From 8c4e09dff83847ac7f07bf1da7751e9328006c4d Mon Sep 17 00:00:00 2001 From: Jack Jamison Date: Thu, 30 Jul 2026 20:09:00 -0400 Subject: actual final changes and get rid of junk in lisp dir actually works fine --- .config/emacs/early-init.el | 50 + .config/emacs/init.el | 5 +- .../emacs/lisp/dired-hacks/dired-hacks-utils.el | 275 - .config/emacs/lisp/dired-hacks/dired-subtree.el | 785 -- .config/emacs/lisp/doom-themes/LICENSE | 24 - .config/emacs/lisp/doom-themes/doom-themes-base.el | 1635 --- .config/emacs/lisp/doom-themes/doom-themes.el | 465 - .../lisp/doom-themes/themes/doom-one-theme.el | 184 - .config/emacs/lisp/dumb-jump.el | 5706 ----------- .../.github/PULL_REQUEST_TEMPLATE.md | 21 - .../evil-collection/.github/workflows/build.yaml | 51 - .config/emacs/lisp/evil-collection/.gitignore | 4 - .config/emacs/lisp/evil-collection/Cask | 12 - .config/emacs/lisp/evil-collection/Eask | 47 - .config/emacs/lisp/evil-collection/LICENSE | 674 -- .config/emacs/lisp/evil-collection/Makefile | 22 - .config/emacs/lisp/evil-collection/README.org | 821 -- .../emacs/lisp/evil-collection/evil-collection.el | 1129 --- .config/emacs/lisp/evil-collection/modes/.nosearch | 0 .../modes/2048-game/evil-collection-2048-game.el | 54 - .../emacs/lisp/evil-collection/modes/ag/README.org | 22 - .../evil-collection/modes/ag/evil-collection-ag.el | 63 - .../evil-collection/modes/agent-shell/README.org | 137 - .../agent-shell/evil-collection-agent-shell.el | 254 - .../modes/alchemist/evil-collection-alchemist.el | 114 - .../anaconda-mode/evil-collection-anaconda-mode.el | 66 - .../lisp/evil-collection/modes/apropos/README.org | 15 - .../modes/apropos/evil-collection-apropos.el | 52 - .../lisp/evil-collection/modes/arc-mode/README.org | 30 - .../modes/arc-mode/evil-collection-arc-mode.el | 78 - .../atomic-chrome/evil-collection-atomic-chrome.el | 42 - .../evil-collection-auto-package-update.el | 44 - .../modes/beginend/evil-collection-beginend.el | 125 - .../modes/bluetooth/evil-collection-bluetooth.el | 59 - .../evil-collection/modes/bm/evil-collection-bm.el | 54 - .../lisp/evil-collection/modes/bookmark/README.org | 36 - .../modes/bookmark/evil-collection-bookmark.el | 78 - .../evil-collection/modes/buff-menu/README.org | 35 - .../modes/buff-menu/evil-collection-buff-menu.el | 78 - .../modes/bufler/evil-collection-bufler.el | 57 - .../lisp/evil-collection/modes/calc/README.org | 52 - .../modes/calc/evil-collection-calc.el | 172 - .../lisp/evil-collection/modes/calendar/README.org | 63 - .../modes/calendar/evil-collection-calendar.el | 146 - .../lisp/evil-collection/modes/cider/README.org | 164 - .../modes/cider/evil-collection-cider.el | 253 - .../modes/citre/evil-collection-citre.el | 47 - .../evil-collection/modes/cmake-mode/README.org | 13 - .../modes/cmake-mode/evil-collection-cmake-mode.el | 44 - .../modes/color-rg/evil-collection-color-rg.el | 71 - .../lisp/evil-collection/modes/comint/README.org | 29 - .../modes/comint/evil-collection-comint.el | 74 - .../lisp/evil-collection/modes/company/README.org | 51 - .../modes/company/evil-collection-company.el | 138 - .../lisp/evil-collection/modes/compile/README.org | 18 - .../modes/compile/evil-collection-compile.el | 67 - .../lisp/evil-collection/modes/consult/README.org | 26 - .../modes/consult/evil-collection-consult.el | 123 - .../lisp/evil-collection/modes/corfu/README.org | 54 - .../modes/corfu/evil-collection-corfu.el | 180 - .../modes/crdt/evil-collection-crdt.el | 57 - .../modes/csv/evil-collection-csv.el | 43 - .../evil-collection/modes/cus-theme/README.org | 30 - .../modes/cus-theme/evil-collection-cus-theme.el | 65 - .../lisp/evil-collection/modes/custom/README.org | 16 - .../modes/custom/evil-collection-custom.el | 68 - .../modes/daemons/evil-collection-daemons.el | 68 - .../lisp/evil-collection/modes/dape/README.org | 29 - .../modes/dape/evil-collection-dape.el | 74 - .../modes/dashboard/evil-collection-dashboard.el | 91 - .../lisp/evil-collection/modes/deadgrep/README.org | 24 - .../modes/deadgrep/evil-collection-deadgrep.el | 64 - .../modes/debbugs/evil-collection-debbugs.el | 81 - .../lisp/evil-collection/modes/debug/README.org | 26 - .../modes/debug/evil-collection-debug.el | 79 - .../modes/devdocs/evil-collection-devdocs.el | 66 - .../modes/dictionary/evil-collection-dictionary.el | 51 - .../lisp/evil-collection/modes/diff-hl/README.org | 29 - .../modes/diff-hl/evil-collection-diff-hl.el | 75 - .../evil-collection/modes/diff-mode/README.org | 66 - .../modes/diff-mode/evil-collection-diff-mode.el | 222 - .../evil-collection/modes/difftastic/README.org | 20 - .../modes/difftastic/evil-collection-difftastic.el | 57 - .../dired-sidebar/evil-collection-dired-sidebar.el | 52 - .../lisp/evil-collection/modes/dired/README.org | 40 - .../modes/dired/evil-collection-dired.el | 224 - .../modes/disk-usage/evil-collection-disk-usage.el | 89 - .../modes/distel/evil-collection-distel.el | 81 - .../lisp/evil-collection/modes/doc-view/README.org | 42 - .../modes/doc-view/evil-collection-doc-view.el | 89 - .../modes/docker/evil-collection-docker.el | 89 - .../lisp/evil-collection/modes/eat/README.org | 37 - .../modes/eat/evil-collection-eat.el | 124 - .../modes/ebib/evil-collection-ebib.el | 77 - .../modes/ebuku/evil-collection-ebuku.el | 63 - .../modes/eca/evil-collection-eca.el | 56 - .../modes/edbi/evil-collection-edbi.el | 108 - .../lisp/evil-collection/modes/edebug/README.org | 53 - .../modes/edebug/evil-collection-edebug.el | 126 - .../lisp/evil-collection/modes/ediff/README.org | 21 - .../modes/ediff/evil-collection-ediff.el | 205 - .../lisp/evil-collection/modes/eglot/README.org | 19 - .../modes/eglot/evil-collection-eglot.el | 50 - .../lisp/evil-collection/modes/eldoc/README.org | 19 - .../modes/eldoc/evil-collection-eldoc.el | 67 - .../lisp/evil-collection/modes/elfeed/README.org | 64 - .../modes/elfeed/evil-collection-elfeed.el | 139 - .../evil-collection/modes/elisp-mode/README.org | 23 - .../modes/elisp-mode/evil-collection-elisp-mode.el | 99 - .../evil-collection/modes/elisp-refs/README.org | 12 - .../modes/elisp-refs/evil-collection-elisp-refs.el | 52 - .../modes/elisp-slime-nav/README.org | 11 - .../evil-collection-elisp-slime-nav.el | 44 - .../modes/elpaca/evil-collection-elpaca.el | 118 - .../lisp/evil-collection/modes/embark/README.org | 19 - .../modes/embark/evil-collection-embark.el | 52 - .../modes/ement/evil-collection-ement.el | 138 - .../lisp/evil-collection/modes/emms/README.org | 131 - .../modes/emms/evil-collection-emms.el | 266 - .../lisp/evil-collection/modes/emoji/README.org | 13 - .../modes/emoji/evil-collection-emoji.el | 44 - .../lisp/evil-collection/modes/epa/README.org | 34 - .../modes/epa/evil-collection-epa.el | 71 - .../lisp/evil-collection/modes/ert/README.org | 24 - .../modes/ert/evil-collection-ert.el | 71 - .../lisp/evil-collection/modes/eshell/README.org | 36 - .../modes/eshell/evil-collection-eshell.el | 168 - .../evil-collection/modes/eval-sexp-fu/README.org | 16 - .../eval-sexp-fu/evil-collection-eval-sexp-fu.el | 61 - .../lisp/evil-collection/modes/evil-mc/README.org | 49 - .../modes/evil-mc/evil-collection-evil-mc.el | 79 - .../lisp/evil-collection/modes/eww/README.org | 61 - .../modes/eww/evil-collection-eww.el | 128 - .../evil-collection-explain-pause-mode.el | 50 - .../modes/fanyi/evil-collection-fanyi.el | 47 - .../lisp/evil-collection/modes/finder/README.org | 13 - .../modes/finder/evil-collection-finder.el | 49 - .../lisp/evil-collection/modes/flycheck/README.org | 18 - .../modes/flycheck/evil-collection-flycheck.el | 56 - .../lisp/evil-collection/modes/flymake/README.org | 15 - .../modes/flymake/evil-collection-flymake.el | 52 - .../lisp/evil-collection/modes/forge/README.org | 44 - .../modes/forge/evil-collection-forge.el | 113 - .../modes/free-keys/evil-collection-free-keys.el | 53 - .../lisp/evil-collection/modes/fzfa/README.org | 19 - .../modes/fzfa/evil-collection-fzfa.el | 111 - .../lisp/evil-collection/modes/geiser/README.org | 62 - .../modes/geiser/evil-collection-geiser.el | 115 - .../modes/ggtags/evil-collection-ggtags.el | 104 - .../modes/git-timemachine/README.org | 20 - .../evil-collection-git-timemachine.el | 49 - .../modes/gited/evil-collection-gited.el | 157 - .../lisp/evil-collection/modes/gnus/README.org | 274 - .../modes/gnus/evil-collection-gnus.el | 491 - .../lisp/evil-collection/modes/go-mode/README.org | 19 - .../modes/go-mode/evil-collection-go-mode.el | 47 - .../lisp/evil-collection/modes/gptel/README.org | 47 - .../modes/gptel/evil-collection-gptel.el | 82 - .../lisp/evil-collection/modes/grep/README.org | 15 - .../modes/grep/evil-collection-grep.el | 49 - .../modes/guix/evil-collection-guix.el | 217 - .../modes/hackernews/evil-collection-hackernews.el | 63 - .../lisp/evil-collection/modes/helm/README.org | 107 - .../modes/helm/evil-collection-helm.el | 238 - .../lisp/evil-collection/modes/help/README.org | 23 - .../modes/help/evil-collection-help.el | 80 - .../lisp/evil-collection/modes/helpful/README.org | 19 - .../modes/helpful/evil-collection-helpful.el | 54 - .../hg-histedit/evil-collection-hg-histedit.el | 49 - .../lisp/evil-collection/modes/hideshow/README.org | 11 - .../modes/hideshow/evil-collection-hideshow.el | 45 - .../hungry-delete/evil-collection-hungry-delete.el | 60 - .../modes/hyrolo/evil-collection-hyrolo.el | 32 - .../lisp/evil-collection/modes/ibuffer/README.org | 60 - .../modes/ibuffer/evil-collection-ibuffer.el | 197 - .../lisp/evil-collection/modes/ielm/README.org | 22 - .../modes/ielm/evil-collection-ielm.el | 60 - .../modes/image+/evil-collection-image+.el | 54 - .../evil-collection/modes/image-dired/README.org | 31 - .../image-dired/evil-collection-image-dired.el | 74 - .../lisp/evil-collection/modes/image/README.org | 36 - .../modes/image/evil-collection-image.el | 93 - .../modes/imenu-list/evil-collection-imenu-list.el | 47 - .../lisp/evil-collection/modes/imenu/README.org | 11 - .../modes/imenu/evil-collection-imenu.el | 39 - .../lisp/evil-collection/modes/indent/README.org | 15 - .../modes/indent/evil-collection-indent.el | 48 - .../modes/indium/evil-collection-indium.el | 110 - .../lisp/evil-collection/modes/info/README.org | 40 - .../modes/info/evil-collection-info.el | 110 - .../lisp/evil-collection/modes/ivy/README.org | 51 - .../modes/ivy/evil-collection-ivy.el | 111 - .../lisp/evil-collection/modes/js2-mode/README.org | 12 - .../modes/js2-mode/evil-collection-js2-mode.el | 46 - .../lisp/evil-collection/modes/kmacro/README.org | 22 - .../modes/kmacro/evil-collection-kmacro.el | 58 - .../kotlin-mode/evil-collection-kotlin-mode.el | 42 - .../modes/leetcode/evil-collection-leetcode.el | 46 - .../lisp/evil-collection/modes/lispy/README.org | 140 - .../modes/lispy/evil-collection-lispy.el | 659 -- .../modes/lms/evil-collection-lms.el | 404 - .../lisp/evil-collection/modes/log-edit/README.org | 17 - .../modes/log-edit/evil-collection-log-edit.el | 57 - .../lisp/evil-collection/modes/log-view/README.org | 20 - .../modes/log-view/evil-collection-log-view.el | 63 - .../lsp-ui-imenu/evil-collection-lsp-ui-imenu.el | 47 - .../lisp/evil-collection/modes/lua-mode/README.org | 18 - .../modes/lua-mode/evil-collection-lua-mode.el | 50 - .../evil-collection/modes/macrostep/README.org | 13 - .../modes/macrostep/evil-collection-macrostep.el | 52 - .../evil-collection/modes/magit-repos/README.org | 17 - .../magit-repos/evil-collection-magit-repos.el | 49 - .../evil-collection/modes/magit-section/README.org | 47 - .../magit-section/evil-collection-magit-section.el | 91 - .../evil-collection/modes/magit-todos/README.org | 32 - .../magit-todos/evil-collection-magit-todos.el | 62 - .../lisp/evil-collection/modes/magit/README.org | 212 - .../modes/magit/evil-collection-magit.el | 747 -- .../lisp/evil-collection/modes/man/README.org | 22 - .../modes/man/evil-collection-man.el | 68 - .../evil-collection/modes/markdown-mode/README.org | 14 - .../markdown-mode/evil-collection-markdown-mode.el | 50 - .../lisp/evil-collection/modes/message/README.org | 18 - .../modes/message/evil-collection-message.el | 46 - .../minesweeper/evil-collection-minesweeper.el | 53 - .../evil-collection/modes/minibuffer/README.org | 47 - .../modes/minibuffer/evil-collection-minibuffer.el | 85 - .../modes/monky/evil-collection-monky.el | 129 - .../lisp/evil-collection/modes/mpc/README.org | 44 - .../modes/mpc/evil-collection-mpc.el | 80 - .../modes/mpdel/evil-collection-mpdel.el | 96 - .../modes/mpdired/evil-collection-mpdired.el | 85 - .../evil-collection-mu4e-conversation.el | 75 - .../modes/mu4e/evil-collection-mu4e-1.8.el | 435 - .../modes/mu4e/evil-collection-mu4e.el | 344 - .../modes/neotree/evil-collection-neotree.el | 101 - .../evil-collection/modes/newsticker/README.org | 56 - .../modes/newsticker/evil-collection-newsticker.el | 116 - .../lisp/evil-collection/modes/notmuch/README.org | 142 - .../modes/notmuch/evil-collection-notmuch.el | 256 - .../modes/nov/evil-collection-nov.el | 67 - .../modes/omnisharp/evil-collection-omnisharp.el | 44 - .../modes/org-agenda/evil-collection-org-agenda.el | 147 - .../org-present/evil-collection-org-present.el | 65 - .../modes/org-roam/evil-collection-org-roam.el | 56 - .../lisp/evil-collection/modes/org/README.org | 46 - .../modes/org/evil-collection-org.el | 87 - .../evil-collection-osx-dictionary.el | 47 - .../lisp/evil-collection/modes/outline/README.org | 39 - .../modes/outline/evil-collection-outline.el | 116 - .../modes/ovpn-mode/evil-collection-ovpn-mode.el | 56 - .../modes/p-search/evil-collection-p-search.el | 85 - .../evil-collection/modes/p4/evil-collection-p4.el | 123 - .../evil-collection/modes/package-menu/README.org | 22 - .../package-menu/evil-collection-package-menu.el | 60 - .../modes/pass/evil-collection-pass.el | 102 - .../modes/pdf/evil-collection-pdf.el | 320 - .../lisp/evil-collection/modes/popup/README.org | 12 - .../modes/popup/evil-collection-popup.el | 44 - .../lisp/evil-collection/modes/proced/README.org | 33 - .../modes/proced/evil-collection-proced.el | 88 - .../evil-collection/modes/process-menu/README.org | 18 - .../process-menu/evil-collection-process-menu.el | 54 - .../modes/prodigy/evil-collection-prodigy.el | 86 - .../lisp/evil-collection/modes/profiler/README.org | 25 - .../modes/profiler/evil-collection-profiler.el | 71 - .../lisp/evil-collection/modes/python/README.org | 17 - .../modes/python/evil-collection-python.el | 52 - .../modes/quickrun/evil-collection-quickrun.el | 42 - .../modes/racer/evil-collection-racer.el | 48 - .../evil-collection-racket-describe.el | 45 - .../modes/reader/evil-collection-reader.el | 162 - .../modes/realgud/evil-collection-realgud.el | 103 - .../lisp/evil-collection/modes/reftex/README.org | 75 - .../modes/reftex/evil-collection-reftex.el | 174 - .../lisp/evil-collection/modes/replace/README.org | 34 - .../modes/replace/evil-collection-replace.el | 79 - .../modes/restclient/evil-collection-restclient.el | 66 - .../emacs/lisp/evil-collection/modes/rg/README.org | 47 - .../evil-collection/modes/rg/evil-collection-rg.el | 91 - .../lisp/evil-collection/modes/ripgrep/README.org | 14 - .../modes/ripgrep/evil-collection-ripgrep.el | 48 - .../modes/rjsx-mode/evil-collection-rjsx-mode.el | 47 - .../modes/robe/evil-collection-robe.el | 45 - .../modes/rtags/evil-collection-rtags.el | 141 - .../evil-collection/modes/ruby-mode/README.org | 9 - .../modes/ruby-mode/evil-collection-ruby-mode.el | 45 - .../lisp/evil-collection/modes/scheme/README.org | 17 - .../modes/scheme/evil-collection-scheme.el | 47 - .../evil-collection/modes/scroll-lock/README.org | 24 - .../scroll-lock/evil-collection-scroll-lock.el | 87 - .../evil-collection/modes/selectrum/README.org | 43 - .../modes/selectrum/evil-collection-selectrum.el | 72 - .../evil-collection/modes/sh-script/README.org | 15 - .../modes/sh-script/evil-collection-sh-script.el | 48 - .../shell-maker/evil-collection-shell-maker.el | 65 - .../lisp/evil-collection/modes/shortdoc/README.org | 20 - .../modes/shortdoc/evil-collection-shortdoc.el | 49 - .../modes/simple-mpc/evil-collection-simple-mpc.el | 122 - .../lisp/evil-collection/modes/simple/README.org | 23 - .../modes/simple/evil-collection-simple.el | 49 - .../modes/slime/evil-collection-slime.el | 222 - .../modes/sly/evil-collection-sly.el | 276 - .../evil-collection/modes/smerge-mode/README.org | 16 - .../smerge-mode/evil-collection-smerge-mode.el | 54 - .../lisp/evil-collection/modes/snake/README.org | 16 - .../modes/snake/evil-collection-snake.el | 50 - .../lisp/evil-collection/modes/so-long/README.org | 22 - .../modes/so-long/evil-collection-so-long.el | 51 - .../lisp/evil-collection/modes/speedbar/README.org | 61 - .../modes/speedbar/evil-collection-speedbar.el | 110 - .../lisp/evil-collection/modes/tab-bar/README.org | 15 - .../modes/tab-bar/evil-collection-tab-bar.el | 59 - .../modes/tablist/evil-collection-tablist.el | 64 - .../modes/tabulated-list/README.org | 20 - .../evil-collection-tabulated-list.el | 54 - .../lisp/evil-collection/modes/tar-mode/README.org | 27 - .../modes/tar-mode/evil-collection-tar-mode.el | 81 - .../modes/telega/evil-collection-telega.el | 218 - .../lisp/evil-collection/modes/term/README.org | 55 - .../modes/term/evil-collection-term.el | 170 - .../lisp/evil-collection/modes/tetris/README.org | 18 - .../modes/tetris/evil-collection-tetris.el | 55 - .../lisp/evil-collection/modes/thread/README.org | 14 - .../modes/thread/evil-collection-thread.el | 45 - .../modes/tide/evil-collection-tide.el | 64 - .../evil-collection/modes/timer-list/README.org | 12 - .../modes/timer-list/evil-collection-timer-list.el | 43 - .../transmission/evil-collection-transmission.el | 163 - .../modes/trashed/evil-collection-trashed.el | 87 - .../lisp/evil-collection/modes/tuareg/README.org | 9 - .../modes/tuareg/evil-collection-tuareg.el | 44 - .../modes/typescript-mode/README.org | 13 - .../evil-collection-typescript-mode.el | 46 - .../ultra-scroll/evil-collection-ultra-scroll.el | 58 - .../modes/unimpaired/evil-collection-unimpaired.el | 313 - .../evil-collection/modes/vc-annotate/README.org | 23 - .../vc-annotate/evil-collection-vc-annotate.el | 59 - .../lisp/evil-collection/modes/vc-dir/README.org | 47 - .../modes/vc-dir/evil-collection-vc-dir.el | 113 - .../lisp/evil-collection/modes/vc-git/README.org | 16 - .../modes/vc-git/evil-collection-vc-git.el | 48 - .../lisp/evil-collection/modes/vdiff/README.org | 18 - .../modes/vdiff/evil-collection-vdiff.el | 54 - .../lisp/evil-collection/modes/vertico/README.org | 40 - .../modes/vertico/evil-collection-vertico.el | 68 - .../lisp/evil-collection/modes/view/README.org | 14 - .../modes/view/evil-collection-view.el | 49 - .../lisp/evil-collection/modes/vlf/README.org | 46 - .../modes/vlf/evil-collection-vlf.el | 86 - .../lisp/evil-collection/modes/vterm/README.org | 55 - .../modes/vterm/evil-collection-vterm.el | 308 - .../lisp/evil-collection/modes/vundo/README.org | 31 - .../modes/vundo/evil-collection-vundo.el | 93 - .../modes/w3m/evil-collection-w3m.el | 87 - .../lisp/evil-collection/modes/wdired/README.org | 14 - .../modes/wdired/evil-collection-wdired.el | 49 - .../lisp/evil-collection/modes/wgrep/README.org | 19 - .../modes/wgrep/evil-collection-wgrep.el | 49 - .../evil-collection/modes/which-key/README.org | 17 - .../modes/which-key/evil-collection-which-key.el | 52 - .../evil-collection/modes/with-editor/README.org | 17 - .../with-editor/evil-collection-with-editor.el | 45 - .../lisp/evil-collection/modes/woman/README.org | 13 - .../modes/woman/evil-collection-woman.el | 51 - .../lisp/evil-collection/modes/xref/README.org | 26 - .../modes/xref/evil-collection-xref.el | 76 - .../lisp/evil-collection/modes/xwidget/README.org | 43 - .../modes/xwidget/evil-collection-xwidget.el | 184 - .../evil-collection/modes/yaml-mode/README.org | 15 - .../modes/yaml-mode/evil-collection-yaml-mode.el | 42 - .../modes/youtube-dl/evil-collection-youtube-dl.el | 67 - .../modes/zmusic/evil-collection-zmusic.el | 49 - .../modes/ztree/evil-collection-ztree.el | 68 - .../test/evil-collection-magit-tests.el | 112 - .../evil-collection/test/evil-collection-test.el | 41 - .../emacs/lisp/evil-collection/test/test-helper.el | 9 - .../lisp/evil-collection/yasnippet_evil-collection | 45 - .../evil-nerd-commenter-operator.el | 402 - .../evil-nerd-commenter/evil-nerd-commenter-sdk.el | 127 - .../evil-nerd-commenter/evil-nerd-commenter.el | 1013 -- .config/emacs/lisp/evil-paste-indent.el | 166 - .config/emacs/lisp/evil/.dir-locals.el | 3 - .config/emacs/lisp/evil/.gitattributes | 1 - .config/emacs/lisp/evil/.github/ISSUE_TEMPLATE.md | 29 - .config/emacs/lisp/evil/.github/workflows/test.yml | 58 - .config/emacs/lisp/evil/.gitignore | 27 - .config/emacs/lisp/evil/.readthedocs.yaml | 17 - .config/emacs/lisp/evil/CHANGES.org | 56 - .config/emacs/lisp/evil/CONTRIBUTING.md | 56 - .config/emacs/lisp/evil/COPYING | 674 -- .config/emacs/lisp/evil/Eask | 57 - .config/emacs/lisp/evil/Makefile | 80 - .config/emacs/lisp/evil/README.md | 83 - .config/emacs/lisp/evil/doc/Makefile | 20 - .config/emacs/lisp/evil/doc/front.png | Bin 3258 -> 0 bytes .config/emacs/lisp/evil/doc/logo.png | Bin 2147 -> 0 bytes .config/emacs/lisp/evil/doc/logo.svg | 110 - .config/emacs/lisp/evil/doc/make.bat | 35 - .config/emacs/lisp/evil/doc/requirements.txt | 2 - .config/emacs/lisp/evil/doc/source/_ext/elisp.py | 289 - .config/emacs/lisp/evil/doc/source/conf.py | 85 - .config/emacs/lisp/evil/doc/source/extension.rst | 146 - .config/emacs/lisp/evil/doc/source/faq.rst | 118 - .config/emacs/lisp/evil/doc/source/hooks.rst | 16 - .config/emacs/lisp/evil/doc/source/index.rst | 21 - .config/emacs/lisp/evil/doc/source/indices.rst | 6 - .config/emacs/lisp/evil/doc/source/internals.rst | 36 - .config/emacs/lisp/evil/doc/source/keymaps.rst | 145 - .config/emacs/lisp/evil/doc/source/license.rst | 447 - .config/emacs/lisp/evil/doc/source/overview.rst | 117 - .config/emacs/lisp/evil/doc/source/settings.rst | 199 - .config/emacs/lisp/evil/evil-command-window.el | 191 - .config/emacs/lisp/evil/evil-commands.el | 5288 ---------- .config/emacs/lisp/evil/evil-common.el | 3843 ------- .config/emacs/lisp/evil/evil-core.el | 1322 --- .config/emacs/lisp/evil/evil-development.el | 50 - .config/emacs/lisp/evil/evil-digraphs.el | 1735 ---- .config/emacs/lisp/evil/evil-ex.el | 940 -- .config/emacs/lisp/evil/evil-integration.el | 468 - .config/emacs/lisp/evil/evil-jumps.el | 358 - .config/emacs/lisp/evil/evil-keybindings.el | 124 - .config/emacs/lisp/evil/evil-macros.el | 772 -- .config/emacs/lisp/evil/evil-maps.el | 686 -- .config/emacs/lisp/evil/evil-repeat.el | 641 -- .config/emacs/lisp/evil/evil-search.el | 1249 --- .config/emacs/lisp/evil/evil-states.el | 930 -- .config/emacs/lisp/evil/evil-test-helpers.el | 416 - .config/emacs/lisp/evil/evil-tests.el | 10130 ------------------- .config/emacs/lisp/evil/evil-types.el | 465 - .config/emacs/lisp/evil/evil-vars.el | 2121 ---- .config/emacs/lisp/evil/evil.el | 158 - .../lisp/evil/scripts/evil-extract-docstrings | 41 - .../emacs/lisp/evil/scripts/evil-release-stable | 52 - .config/emacs/lisp/evil/scripts/evilupdate | 177 - .../emacs/lisp/expand-region/cc-mode-expansions.el | 186 - .../lisp/expand-region/er-basic-expansions.el | 267 - .../emacs/lisp/expand-region/expand-region-core.el | 322 - .../lisp/expand-region/expand-region-custom.el | 115 - .config/emacs/lisp/expand-region/expand-region.el | 198 - .config/emacs/lisp/helpful.el | 3111 ------ .config/emacs/lisp/jai-mode.el | 331 - .config/emacs/lisp/libs/compat-31.el | 416 - .config/emacs/lisp/libs/compat-macs.el | 272 - .config/emacs/lisp/libs/compat.el | 93 - .config/emacs/lisp/libs/cond-let.el | 567 -- .config/emacs/lisp/libs/cond-let.elc | Bin 17761 -> 0 bytes .config/emacs/lisp/libs/dash.el | 4176 -------- .config/emacs/lisp/libs/dash.elc | Bin 160135 -> 0 bytes .config/emacs/lisp/libs/elisp-refs.el | 913 -- .config/emacs/lisp/libs/elisp-refs.elc | Bin 25991 -> 0 bytes .config/emacs/lisp/libs/f.el | 799 -- .config/emacs/lisp/libs/f.elc | Bin 24744 -> 0 bytes .config/emacs/lisp/libs/ht.el | 354 - .config/emacs/lisp/libs/ht.elc | Bin 14059 -> 0 bytes .config/emacs/lisp/libs/llama.el | 572 -- .config/emacs/lisp/libs/llama.elc | Bin 17102 -> 0 bytes .config/emacs/lisp/libs/s.el | 792 -- .config/emacs/lisp/libs/s.elc | Bin 28793 -> 0 bytes .config/emacs/lisp/libs/transient.el | 5497 ---------- .config/emacs/lisp/libs/transient.elc | Bin 224549 -> 0 bytes .config/emacs/lisp/libs/with-editor.el | 998 -- .config/emacs/lisp/libs/with-editor.elc | Bin 36589 -> 0 bytes .config/emacs/lisp/magit/.dir-locals.el | 16 - .config/emacs/lisp/magit/.elpaignore | 10 - .config/emacs/lisp/magit/.github/CONTRIBUTING.md | 15 - .../magit/.github/ISSUE_TEMPLATE/bug_report.md | 51 - .../lisp/magit/.github/ISSUE_TEMPLATE/config.yml | 20 - .../emacs/lisp/magit/.github/PULL_REQUEST_TEMPLATE | 31 - .../emacs/lisp/magit/.github/workflows/compile.yml | 6 - .../emacs/lisp/magit/.github/workflows/manual.yml | 11 - .../emacs/lisp/magit/.github/workflows/stats.yml | 12 - .../emacs/lisp/magit/.github/workflows/test.yml | 6 - .config/emacs/lisp/magit/.gitignore | 25 - .config/emacs/lisp/magit/.mailmap | 84 - .config/emacs/lisp/magit/CHANGELOG | 617 -- .config/emacs/lisp/magit/LICENSE | 674 -- .config/emacs/lisp/magit/Makefile | 195 - .config/emacs/lisp/magit/README.md | 145 - .config/emacs/lisp/magit/default.mk | 249 - .config/emacs/lisp/magit/docs/.orgconfig | 18 - .config/emacs/lisp/magit/docs/AUTHORS.md | 428 - .config/emacs/lisp/magit/docs/BACKERS.md | 1402 --- .config/emacs/lisp/magit/docs/Makefile | 208 - .config/emacs/lisp/magit/docs/RelNotes/0.5.1.txt | 11 - .config/emacs/lisp/magit/docs/RelNotes/0.6.1.txt | 24 - .config/emacs/lisp/magit/docs/RelNotes/0.7.0.txt | 70 - .config/emacs/lisp/magit/docs/RelNotes/0.8.0.txt | 55 - .config/emacs/lisp/magit/docs/RelNotes/0.8.1.txt | 28 - .config/emacs/lisp/magit/docs/RelNotes/0.8.2.txt | 27 - .config/emacs/lisp/magit/docs/RelNotes/1.0.0.txt | 84 - .config/emacs/lisp/magit/docs/RelNotes/1.1.0.txt | 112 - .config/emacs/lisp/magit/docs/RelNotes/1.1.1.txt | 25 - .config/emacs/lisp/magit/docs/RelNotes/1.1.2.txt | 33 - .config/emacs/lisp/magit/docs/RelNotes/1.2.0.txt | 73 - .config/emacs/lisp/magit/docs/RelNotes/1.2.1.txt | 15 - .config/emacs/lisp/magit/docs/RelNotes/1.2.2.txt | 17 - .config/emacs/lisp/magit/docs/RelNotes/1.4.0.txt | 231 - .config/emacs/lisp/magit/docs/RelNotes/1.4.1.txt | 31 - .config/emacs/lisp/magit/docs/RelNotes/1.4.2.txt | 23 - .config/emacs/lisp/magit/docs/RelNotes/2.1.0.txt | 433 - .config/emacs/lisp/magit/docs/RelNotes/2.10.0.txt | 85 - .config/emacs/lisp/magit/docs/RelNotes/2.10.1.txt | 57 - .config/emacs/lisp/magit/docs/RelNotes/2.10.2.txt | 47 - .config/emacs/lisp/magit/docs/RelNotes/2.10.3.txt | 41 - .config/emacs/lisp/magit/docs/RelNotes/2.11.0.txt | 210 - .config/emacs/lisp/magit/docs/RelNotes/2.12.0.txt | 645 -- .config/emacs/lisp/magit/docs/RelNotes/2.12.1.txt | 16 - .config/emacs/lisp/magit/docs/RelNotes/2.13.0.txt | 122 - .config/emacs/lisp/magit/docs/RelNotes/2.13.1.txt | 34 - .config/emacs/lisp/magit/docs/RelNotes/2.2.0.txt | 219 - .config/emacs/lisp/magit/docs/RelNotes/2.2.1.txt | 45 - .config/emacs/lisp/magit/docs/RelNotes/2.2.2.txt | 45 - .config/emacs/lisp/magit/docs/RelNotes/2.3.0.txt | 251 - .config/emacs/lisp/magit/docs/RelNotes/2.3.1.txt | 31 - .config/emacs/lisp/magit/docs/RelNotes/2.4.0.txt | 147 - .config/emacs/lisp/magit/docs/RelNotes/2.4.1.txt | 31 - .config/emacs/lisp/magit/docs/RelNotes/2.5.0.txt | 122 - .config/emacs/lisp/magit/docs/RelNotes/2.6.0.txt | 134 - .config/emacs/lisp/magit/docs/RelNotes/2.6.1.txt | 40 - .config/emacs/lisp/magit/docs/RelNotes/2.6.2.txt | 52 - .config/emacs/lisp/magit/docs/RelNotes/2.7.0.txt | 81 - .config/emacs/lisp/magit/docs/RelNotes/2.8.0.txt | 128 - .config/emacs/lisp/magit/docs/RelNotes/2.9.0.txt | 437 - .config/emacs/lisp/magit/docs/RelNotes/2.90.0.org | 423 - .config/emacs/lisp/magit/docs/RelNotes/2.90.1.org | 39 - .config/emacs/lisp/magit/docs/RelNotes/3.0.0.org | 686 -- .config/emacs/lisp/magit/docs/RelNotes/3.1.0.org | 58 - .config/emacs/lisp/magit/docs/RelNotes/3.2.0.org | 85 - .config/emacs/lisp/magit/docs/RelNotes/3.2.1.org | 12 - .config/emacs/lisp/magit/docs/RelNotes/3.3.0.org | 137 - .config/emacs/lisp/magit/docs/RelNotes/4.0.0.org | 532 - .config/emacs/lisp/magit/docs/htmlxref.cnf | 42 - .config/emacs/lisp/magit/docs/magit-section.org | 309 - .config/emacs/lisp/magit/docs/magit.org | 9641 ------------------ .config/emacs/lisp/magit/git-hooks/applypatch-msg | 1 - .config/emacs/lisp/magit/git-hooks/commit-msg | 1 - .config/emacs/lisp/magit/git-hooks/fallthrough | 8 - .../emacs/lisp/magit/git-hooks/fsmonitor-watchman | 1 - .config/emacs/lisp/magit/git-hooks/p4-changelist | 1 - .../emacs/lisp/magit/git-hooks/p4-post-changelist | 1 - .config/emacs/lisp/magit/git-hooks/p4-pre-submit | 1 - .../lisp/magit/git-hooks/p4-prepare-changelist | 1 - .config/emacs/lisp/magit/git-hooks/post-applypatch | 1 - .config/emacs/lisp/magit/git-hooks/post-checkout | 1 - .config/emacs/lisp/magit/git-hooks/post-commit | 13 - .../emacs/lisp/magit/git-hooks/post-index-change | 1 - .config/emacs/lisp/magit/git-hooks/post-merge | 13 - .config/emacs/lisp/magit/git-hooks/post-receive | 1 - .config/emacs/lisp/magit/git-hooks/post-rewrite | 13 - .config/emacs/lisp/magit/git-hooks/post-update | 1 - .config/emacs/lisp/magit/git-hooks/pre-applypatch | 1 - .config/emacs/lisp/magit/git-hooks/pre-auto-gc | 1 - .config/emacs/lisp/magit/git-hooks/pre-commit | 1 - .../emacs/lisp/magit/git-hooks/pre-merge-commit | 1 - .config/emacs/lisp/magit/git-hooks/pre-push | 1 - .config/emacs/lisp/magit/git-hooks/pre-rebase | 1 - .config/emacs/lisp/magit/git-hooks/pre-receive | 1 - .../emacs/lisp/magit/git-hooks/prepare-commit-msg | 1 - .config/emacs/lisp/magit/git-hooks/proc-receive | 1 - .../emacs/lisp/magit/git-hooks/push-to-checkout | 1 - .../lisp/magit/git-hooks/reference-transaction | 1 - .../emacs/lisp/magit/git-hooks/sendemail-validate | 1 - .config/emacs/lisp/magit/git-hooks/update | 1 - .config/emacs/lisp/magit/lisp/Makefile | 133 - .config/emacs/lisp/magit/lisp/git-commit.el | 1240 --- .config/emacs/lisp/magit/lisp/git-rebase.el | 956 -- .config/emacs/lisp/magit/lisp/magit-apply.el | 830 -- .config/emacs/lisp/magit/lisp/magit-autorevert.el | 277 - .config/emacs/lisp/magit/lisp/magit-base.el | 1203 --- .config/emacs/lisp/magit/lisp/magit-bisect.el | 329 - .config/emacs/lisp/magit/lisp/magit-blame.el | 1014 -- .config/emacs/lisp/magit/lisp/magit-bookmark.el | 170 - .config/emacs/lisp/magit/lisp/magit-branch.el | 985 -- .config/emacs/lisp/magit/lisp/magit-bundle.el | 150 - .config/emacs/lisp/magit/lisp/magit-clone.el | 362 - .config/emacs/lisp/magit/lisp/magit-commit.el | 866 -- .config/emacs/lisp/magit/lisp/magit-core.el | 134 - .config/emacs/lisp/magit/lisp/magit-diff.el | 3699 ------- .config/emacs/lisp/magit/lisp/magit-dired.el | 124 - .config/emacs/lisp/magit/lisp/magit-ediff.el | 615 -- .config/emacs/lisp/magit/lisp/magit-extras.el | 841 -- .config/emacs/lisp/magit/lisp/magit-fetch.el | 196 - .config/emacs/lisp/magit/lisp/magit-files.el | 639 -- .config/emacs/lisp/magit/lisp/magit-git.el | 3008 ------ .config/emacs/lisp/magit/lisp/magit-gitignore.el | 206 - .config/emacs/lisp/magit/lisp/magit-log.el | 2122 ---- .config/emacs/lisp/magit/lisp/magit-margin.el | 271 - .config/emacs/lisp/magit/lisp/magit-merge.el | 325 - .config/emacs/lisp/magit/lisp/magit-mode.el | 1623 --- .config/emacs/lisp/magit/lisp/magit-notes.el | 212 - .config/emacs/lisp/magit/lisp/magit-patch.el | 341 - .config/emacs/lisp/magit/lisp/magit-process.el | 1366 --- .config/emacs/lisp/magit/lisp/magit-pull.el | 174 - .config/emacs/lisp/magit/lisp/magit-push.el | 382 - .config/emacs/lisp/magit/lisp/magit-reflog.el | 219 - .config/emacs/lisp/magit/lisp/magit-refs.el | 822 -- .config/emacs/lisp/magit/lisp/magit-remote.el | 407 - .config/emacs/lisp/magit/lisp/magit-repos.el | 565 -- .config/emacs/lisp/magit/lisp/magit-reset.el | 148 - .config/emacs/lisp/magit/lisp/magit-section.el | 2685 ----- .config/emacs/lisp/magit/lisp/magit-sequence.el | 1152 --- .../emacs/lisp/magit/lisp/magit-sparse-checkout.el | 161 - .config/emacs/lisp/magit/lisp/magit-stash.el | 695 -- .config/emacs/lisp/magit/lisp/magit-status.el | 834 -- .config/emacs/lisp/magit/lisp/magit-submodule.el | 728 -- .config/emacs/lisp/magit/lisp/magit-subtree.el | 198 - .config/emacs/lisp/magit/lisp/magit-tag.el | 257 - .config/emacs/lisp/magit/lisp/magit-transient.el | 244 - .config/emacs/lisp/magit/lisp/magit-wip.el | 391 - .config/emacs/lisp/magit/lisp/magit-worktree.el | 308 - .config/emacs/lisp/magit/lisp/magit.el | 812 -- .config/emacs/lisp/magit/test/Makefile | 21 - .config/emacs/lisp/magit/test/magit-tests.el | 545 - .config/emacs/lisp/magit/test/magit-tests.elc | Bin 89547 -> 0 bytes .config/emacs/lisp/minadstack/cape.el | 1359 --- .config/emacs/lisp/minadstack/consult.el | 5739 ----------- .config/emacs/lisp/minadstack/corfu-history.el | 114 - .config/emacs/lisp/minadstack/corfu.el | 1444 --- .config/emacs/lisp/minadstack/marginalia.el | 1461 --- .config/emacs/lisp/minadstack/orderless.el | 672 -- .config/emacs/lisp/minadstack/vertico-directory.el | 136 - .config/emacs/lisp/minadstack/vertico.el | 736 -- .config/emacs/lisp/mwim.el | 472 - .config/emacs/lisp/no-littering.el | 6 +- .config/emacs/lisp/proj | 2 +- .config/emacs/lisp/sideline-flymake.el | 158 - .config/emacs/lisp/sideline.el | 908 -- .config/emacs/lisp/toggle-window/toggle-window.el | 27 - .config/emacs/lisp/yasnippet-snippets.el | 77 - .config/emacs/lisp/yasnippet.el | 5272 ---------- .config/emacs/minibuffer.el | 6 +- .config/emacs/misc.el | 2 +- .config/emacs/windows.el | 1 + 634 files changed, 62 insertions(+), 170930 deletions(-) create mode 100644 .config/emacs/early-init.el delete mode 100644 .config/emacs/lisp/dired-hacks/dired-hacks-utils.el delete mode 100644 .config/emacs/lisp/dired-hacks/dired-subtree.el delete mode 100644 .config/emacs/lisp/doom-themes/LICENSE delete mode 100644 .config/emacs/lisp/doom-themes/doom-themes-base.el delete mode 100644 .config/emacs/lisp/doom-themes/doom-themes.el delete mode 100644 .config/emacs/lisp/doom-themes/themes/doom-one-theme.el delete mode 100644 .config/emacs/lisp/dumb-jump.el delete mode 100644 .config/emacs/lisp/evil-collection/.github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .config/emacs/lisp/evil-collection/.github/workflows/build.yaml delete mode 100644 .config/emacs/lisp/evil-collection/.gitignore delete mode 100644 .config/emacs/lisp/evil-collection/Cask delete mode 100644 .config/emacs/lisp/evil-collection/Eask delete mode 100644 .config/emacs/lisp/evil-collection/LICENSE delete mode 100755 .config/emacs/lisp/evil-collection/Makefile delete mode 100644 .config/emacs/lisp/evil-collection/README.org delete mode 100644 .config/emacs/lisp/evil-collection/evil-collection.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/.nosearch delete mode 100644 .config/emacs/lisp/evil-collection/modes/2048-game/evil-collection-2048-game.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/ag/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/ag/evil-collection-ag.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/agent-shell/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/agent-shell/evil-collection-agent-shell.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/alchemist/evil-collection-alchemist.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/anaconda-mode/evil-collection-anaconda-mode.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/apropos/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/apropos/evil-collection-apropos.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/arc-mode/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/arc-mode/evil-collection-arc-mode.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/atomic-chrome/evil-collection-atomic-chrome.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/auto-package-update/evil-collection-auto-package-update.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/beginend/evil-collection-beginend.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/bluetooth/evil-collection-bluetooth.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/bm/evil-collection-bm.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/bookmark/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/bookmark/evil-collection-bookmark.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/buff-menu/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/buff-menu/evil-collection-buff-menu.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/bufler/evil-collection-bufler.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/calc/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/calc/evil-collection-calc.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/calendar/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/calendar/evil-collection-calendar.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/cider/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/cider/evil-collection-cider.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/citre/evil-collection-citre.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/cmake-mode/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/cmake-mode/evil-collection-cmake-mode.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/color-rg/evil-collection-color-rg.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/comint/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/comint/evil-collection-comint.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/company/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/company/evil-collection-company.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/compile/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/compile/evil-collection-compile.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/consult/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/consult/evil-collection-consult.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/corfu/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/corfu/evil-collection-corfu.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/crdt/evil-collection-crdt.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/csv/evil-collection-csv.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/cus-theme/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/cus-theme/evil-collection-cus-theme.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/custom/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/custom/evil-collection-custom.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/daemons/evil-collection-daemons.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/dape/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/dape/evil-collection-dape.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/dashboard/evil-collection-dashboard.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/deadgrep/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/deadgrep/evil-collection-deadgrep.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/debbugs/evil-collection-debbugs.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/debug/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/debug/evil-collection-debug.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/devdocs/evil-collection-devdocs.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/dictionary/evil-collection-dictionary.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/diff-hl/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/diff-hl/evil-collection-diff-hl.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/diff-mode/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/diff-mode/evil-collection-diff-mode.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/difftastic/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/difftastic/evil-collection-difftastic.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/dired-sidebar/evil-collection-dired-sidebar.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/dired/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/dired/evil-collection-dired.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/disk-usage/evil-collection-disk-usage.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/distel/evil-collection-distel.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/doc-view/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/doc-view/evil-collection-doc-view.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/docker/evil-collection-docker.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/eat/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/eat/evil-collection-eat.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/ebib/evil-collection-ebib.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/ebuku/evil-collection-ebuku.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/eca/evil-collection-eca.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/edbi/evil-collection-edbi.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/edebug/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/edebug/evil-collection-edebug.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/ediff/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/ediff/evil-collection-ediff.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/eglot/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/eglot/evil-collection-eglot.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/eldoc/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/eldoc/evil-collection-eldoc.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/elfeed/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/elfeed/evil-collection-elfeed.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/elisp-mode/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/elisp-mode/evil-collection-elisp-mode.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/elisp-refs/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/elisp-refs/evil-collection-elisp-refs.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/elisp-slime-nav/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/elisp-slime-nav/evil-collection-elisp-slime-nav.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/elpaca/evil-collection-elpaca.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/embark/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/embark/evil-collection-embark.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/ement/evil-collection-ement.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/emms/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/emms/evil-collection-emms.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/emoji/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/emoji/evil-collection-emoji.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/epa/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/epa/evil-collection-epa.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/ert/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/ert/evil-collection-ert.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/eshell/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/eshell/evil-collection-eshell.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/eval-sexp-fu/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/eval-sexp-fu/evil-collection-eval-sexp-fu.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/evil-mc/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/evil-mc/evil-collection-evil-mc.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/eww/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/eww/evil-collection-eww.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/explain-pause-mode/evil-collection-explain-pause-mode.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/fanyi/evil-collection-fanyi.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/finder/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/finder/evil-collection-finder.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/flycheck/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/flycheck/evil-collection-flycheck.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/flymake/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/flymake/evil-collection-flymake.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/forge/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/forge/evil-collection-forge.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/free-keys/evil-collection-free-keys.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/fzfa/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/fzfa/evil-collection-fzfa.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/geiser/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/geiser/evil-collection-geiser.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/ggtags/evil-collection-ggtags.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/git-timemachine/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/git-timemachine/evil-collection-git-timemachine.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/gited/evil-collection-gited.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/gnus/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/gnus/evil-collection-gnus.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/go-mode/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/go-mode/evil-collection-go-mode.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/gptel/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/gptel/evil-collection-gptel.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/grep/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/grep/evil-collection-grep.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/guix/evil-collection-guix.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/hackernews/evil-collection-hackernews.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/helm/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/helm/evil-collection-helm.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/help/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/help/evil-collection-help.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/helpful/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/helpful/evil-collection-helpful.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/hg-histedit/evil-collection-hg-histedit.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/hideshow/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/hideshow/evil-collection-hideshow.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/hungry-delete/evil-collection-hungry-delete.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/hyrolo/evil-collection-hyrolo.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/ibuffer/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/ibuffer/evil-collection-ibuffer.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/ielm/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/ielm/evil-collection-ielm.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/image+/evil-collection-image+.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/image-dired/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/image-dired/evil-collection-image-dired.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/image/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/image/evil-collection-image.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/imenu-list/evil-collection-imenu-list.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/imenu/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/imenu/evil-collection-imenu.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/indent/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/indent/evil-collection-indent.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/indium/evil-collection-indium.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/info/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/info/evil-collection-info.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/ivy/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/ivy/evil-collection-ivy.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/js2-mode/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/js2-mode/evil-collection-js2-mode.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/kmacro/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/kmacro/evil-collection-kmacro.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/kotlin-mode/evil-collection-kotlin-mode.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/leetcode/evil-collection-leetcode.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/lispy/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/lispy/evil-collection-lispy.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/lms/evil-collection-lms.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/log-edit/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/log-edit/evil-collection-log-edit.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/log-view/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/log-view/evil-collection-log-view.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/lsp-ui-imenu/evil-collection-lsp-ui-imenu.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/lua-mode/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/lua-mode/evil-collection-lua-mode.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/macrostep/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/macrostep/evil-collection-macrostep.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/magit-repos/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/magit-repos/evil-collection-magit-repos.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/magit-section/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/magit-section/evil-collection-magit-section.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/magit-todos/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/magit-todos/evil-collection-magit-todos.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/magit/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/magit/evil-collection-magit.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/man/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/man/evil-collection-man.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/markdown-mode/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/markdown-mode/evil-collection-markdown-mode.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/message/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/message/evil-collection-message.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/minesweeper/evil-collection-minesweeper.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/minibuffer/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/minibuffer/evil-collection-minibuffer.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/monky/evil-collection-monky.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/mpc/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/mpc/evil-collection-mpc.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/mpdel/evil-collection-mpdel.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/mpdired/evil-collection-mpdired.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/mu4e-conversation/evil-collection-mu4e-conversation.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/mu4e/evil-collection-mu4e-1.8.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/mu4e/evil-collection-mu4e.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/neotree/evil-collection-neotree.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/newsticker/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/newsticker/evil-collection-newsticker.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/notmuch/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/notmuch/evil-collection-notmuch.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/nov/evil-collection-nov.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/omnisharp/evil-collection-omnisharp.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/org-agenda/evil-collection-org-agenda.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/org-present/evil-collection-org-present.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/org-roam/evil-collection-org-roam.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/org/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/org/evil-collection-org.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/osx-dictionary/evil-collection-osx-dictionary.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/outline/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/outline/evil-collection-outline.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/ovpn-mode/evil-collection-ovpn-mode.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/p-search/evil-collection-p-search.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/p4/evil-collection-p4.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/package-menu/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/package-menu/evil-collection-package-menu.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/pass/evil-collection-pass.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/pdf/evil-collection-pdf.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/popup/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/popup/evil-collection-popup.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/proced/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/proced/evil-collection-proced.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/process-menu/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/process-menu/evil-collection-process-menu.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/prodigy/evil-collection-prodigy.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/profiler/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/profiler/evil-collection-profiler.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/python/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/python/evil-collection-python.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/quickrun/evil-collection-quickrun.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/racer/evil-collection-racer.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/racket-describe/evil-collection-racket-describe.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/reader/evil-collection-reader.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/realgud/evil-collection-realgud.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/reftex/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/reftex/evil-collection-reftex.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/replace/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/replace/evil-collection-replace.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/restclient/evil-collection-restclient.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/rg/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/rg/evil-collection-rg.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/ripgrep/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/ripgrep/evil-collection-ripgrep.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/rjsx-mode/evil-collection-rjsx-mode.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/robe/evil-collection-robe.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/rtags/evil-collection-rtags.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/ruby-mode/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/ruby-mode/evil-collection-ruby-mode.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/scheme/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/scheme/evil-collection-scheme.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/scroll-lock/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/scroll-lock/evil-collection-scroll-lock.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/selectrum/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/selectrum/evil-collection-selectrum.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/sh-script/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/sh-script/evil-collection-sh-script.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/shell-maker/evil-collection-shell-maker.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/shortdoc/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/shortdoc/evil-collection-shortdoc.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/simple-mpc/evil-collection-simple-mpc.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/simple/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/simple/evil-collection-simple.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/slime/evil-collection-slime.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/sly/evil-collection-sly.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/smerge-mode/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/smerge-mode/evil-collection-smerge-mode.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/snake/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/snake/evil-collection-snake.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/so-long/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/so-long/evil-collection-so-long.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/speedbar/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/speedbar/evil-collection-speedbar.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/tab-bar/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/tab-bar/evil-collection-tab-bar.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/tablist/evil-collection-tablist.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/tabulated-list/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/tabulated-list/evil-collection-tabulated-list.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/tar-mode/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/tar-mode/evil-collection-tar-mode.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/telega/evil-collection-telega.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/term/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/term/evil-collection-term.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/tetris/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/tetris/evil-collection-tetris.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/thread/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/thread/evil-collection-thread.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/tide/evil-collection-tide.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/timer-list/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/timer-list/evil-collection-timer-list.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/transmission/evil-collection-transmission.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/trashed/evil-collection-trashed.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/tuareg/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/tuareg/evil-collection-tuareg.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/typescript-mode/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/typescript-mode/evil-collection-typescript-mode.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/ultra-scroll/evil-collection-ultra-scroll.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/unimpaired/evil-collection-unimpaired.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/vc-annotate/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/vc-annotate/evil-collection-vc-annotate.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/vc-dir/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/vc-dir/evil-collection-vc-dir.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/vc-git/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/vc-git/evil-collection-vc-git.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/vdiff/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/vdiff/evil-collection-vdiff.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/vertico/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/vertico/evil-collection-vertico.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/view/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/view/evil-collection-view.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/vlf/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/vlf/evil-collection-vlf.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/vterm/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/vterm/evil-collection-vterm.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/vundo/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/vundo/evil-collection-vundo.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/w3m/evil-collection-w3m.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/wdired/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/wdired/evil-collection-wdired.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/wgrep/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/wgrep/evil-collection-wgrep.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/which-key/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/which-key/evil-collection-which-key.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/with-editor/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/with-editor/evil-collection-with-editor.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/woman/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/woman/evil-collection-woman.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/xref/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/xref/evil-collection-xref.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/xwidget/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/xwidget/evil-collection-xwidget.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/yaml-mode/README.org delete mode 100644 .config/emacs/lisp/evil-collection/modes/yaml-mode/evil-collection-yaml-mode.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/youtube-dl/evil-collection-youtube-dl.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/zmusic/evil-collection-zmusic.el delete mode 100644 .config/emacs/lisp/evil-collection/modes/ztree/evil-collection-ztree.el delete mode 100644 .config/emacs/lisp/evil-collection/test/evil-collection-magit-tests.el delete mode 100644 .config/emacs/lisp/evil-collection/test/evil-collection-test.el delete mode 100644 .config/emacs/lisp/evil-collection/test/test-helper.el delete mode 100644 .config/emacs/lisp/evil-collection/yasnippet_evil-collection delete mode 100644 .config/emacs/lisp/evil-nerd-commenter/evil-nerd-commenter-operator.el delete mode 100644 .config/emacs/lisp/evil-nerd-commenter/evil-nerd-commenter-sdk.el delete mode 100644 .config/emacs/lisp/evil-nerd-commenter/evil-nerd-commenter.el delete mode 100644 .config/emacs/lisp/evil-paste-indent.el delete mode 100644 .config/emacs/lisp/evil/.dir-locals.el delete mode 100644 .config/emacs/lisp/evil/.gitattributes delete mode 100644 .config/emacs/lisp/evil/.github/ISSUE_TEMPLATE.md delete mode 100644 .config/emacs/lisp/evil/.github/workflows/test.yml delete mode 100644 .config/emacs/lisp/evil/.gitignore delete mode 100644 .config/emacs/lisp/evil/.readthedocs.yaml delete mode 100644 .config/emacs/lisp/evil/CHANGES.org delete mode 100644 .config/emacs/lisp/evil/CONTRIBUTING.md delete mode 100644 .config/emacs/lisp/evil/COPYING delete mode 100644 .config/emacs/lisp/evil/Eask delete mode 100644 .config/emacs/lisp/evil/Makefile delete mode 100644 .config/emacs/lisp/evil/README.md delete mode 100644 .config/emacs/lisp/evil/doc/Makefile delete mode 100644 .config/emacs/lisp/evil/doc/front.png delete mode 100644 .config/emacs/lisp/evil/doc/logo.png delete mode 100644 .config/emacs/lisp/evil/doc/logo.svg delete mode 100644 .config/emacs/lisp/evil/doc/make.bat delete mode 100644 .config/emacs/lisp/evil/doc/requirements.txt delete mode 100644 .config/emacs/lisp/evil/doc/source/_ext/elisp.py delete mode 100644 .config/emacs/lisp/evil/doc/source/conf.py delete mode 100644 .config/emacs/lisp/evil/doc/source/extension.rst delete mode 100644 .config/emacs/lisp/evil/doc/source/faq.rst delete mode 100644 .config/emacs/lisp/evil/doc/source/hooks.rst delete mode 100644 .config/emacs/lisp/evil/doc/source/index.rst delete mode 100644 .config/emacs/lisp/evil/doc/source/indices.rst delete mode 100644 .config/emacs/lisp/evil/doc/source/internals.rst delete mode 100644 .config/emacs/lisp/evil/doc/source/keymaps.rst delete mode 100644 .config/emacs/lisp/evil/doc/source/license.rst delete mode 100644 .config/emacs/lisp/evil/doc/source/overview.rst delete mode 100644 .config/emacs/lisp/evil/doc/source/settings.rst delete mode 100644 .config/emacs/lisp/evil/evil-command-window.el delete mode 100644 .config/emacs/lisp/evil/evil-commands.el delete mode 100644 .config/emacs/lisp/evil/evil-common.el delete mode 100644 .config/emacs/lisp/evil/evil-core.el delete mode 100644 .config/emacs/lisp/evil/evil-development.el delete mode 100644 .config/emacs/lisp/evil/evil-digraphs.el delete mode 100644 .config/emacs/lisp/evil/evil-ex.el delete mode 100644 .config/emacs/lisp/evil/evil-integration.el delete mode 100644 .config/emacs/lisp/evil/evil-jumps.el delete mode 100644 .config/emacs/lisp/evil/evil-keybindings.el delete mode 100644 .config/emacs/lisp/evil/evil-macros.el delete mode 100644 .config/emacs/lisp/evil/evil-maps.el delete mode 100644 .config/emacs/lisp/evil/evil-repeat.el delete mode 100644 .config/emacs/lisp/evil/evil-search.el delete mode 100644 .config/emacs/lisp/evil/evil-states.el delete mode 100644 .config/emacs/lisp/evil/evil-test-helpers.el delete mode 100644 .config/emacs/lisp/evil/evil-tests.el delete mode 100644 .config/emacs/lisp/evil/evil-types.el delete mode 100644 .config/emacs/lisp/evil/evil-vars.el delete mode 100644 .config/emacs/lisp/evil/evil.el delete mode 100755 .config/emacs/lisp/evil/scripts/evil-extract-docstrings delete mode 100755 .config/emacs/lisp/evil/scripts/evil-release-stable delete mode 100755 .config/emacs/lisp/evil/scripts/evilupdate delete mode 100644 .config/emacs/lisp/expand-region/cc-mode-expansions.el delete mode 100644 .config/emacs/lisp/expand-region/er-basic-expansions.el delete mode 100644 .config/emacs/lisp/expand-region/expand-region-core.el delete mode 100644 .config/emacs/lisp/expand-region/expand-region-custom.el delete mode 100644 .config/emacs/lisp/expand-region/expand-region.el delete mode 100644 .config/emacs/lisp/helpful.el delete mode 100644 .config/emacs/lisp/jai-mode.el delete mode 100644 .config/emacs/lisp/libs/compat-31.el delete mode 100644 .config/emacs/lisp/libs/compat-macs.el delete mode 100644 .config/emacs/lisp/libs/compat.el delete mode 100644 .config/emacs/lisp/libs/cond-let.el delete mode 100644 .config/emacs/lisp/libs/cond-let.elc delete mode 100644 .config/emacs/lisp/libs/dash.el delete mode 100644 .config/emacs/lisp/libs/dash.elc delete mode 100644 .config/emacs/lisp/libs/elisp-refs.el delete mode 100644 .config/emacs/lisp/libs/elisp-refs.elc delete mode 100644 .config/emacs/lisp/libs/f.el delete mode 100644 .config/emacs/lisp/libs/f.elc delete mode 100644 .config/emacs/lisp/libs/ht.el delete mode 100644 .config/emacs/lisp/libs/ht.elc delete mode 100644 .config/emacs/lisp/libs/llama.el delete mode 100644 .config/emacs/lisp/libs/llama.elc delete mode 100644 .config/emacs/lisp/libs/s.el delete mode 100644 .config/emacs/lisp/libs/s.elc delete mode 100644 .config/emacs/lisp/libs/transient.el delete mode 100644 .config/emacs/lisp/libs/transient.elc delete mode 100644 .config/emacs/lisp/libs/with-editor.el delete mode 100644 .config/emacs/lisp/libs/with-editor.elc delete mode 100644 .config/emacs/lisp/magit/.dir-locals.el delete mode 100644 .config/emacs/lisp/magit/.elpaignore delete mode 100644 .config/emacs/lisp/magit/.github/CONTRIBUTING.md delete mode 100644 .config/emacs/lisp/magit/.github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .config/emacs/lisp/magit/.github/ISSUE_TEMPLATE/config.yml delete mode 100644 .config/emacs/lisp/magit/.github/PULL_REQUEST_TEMPLATE delete mode 100644 .config/emacs/lisp/magit/.github/workflows/compile.yml delete mode 100644 .config/emacs/lisp/magit/.github/workflows/manual.yml delete mode 100644 .config/emacs/lisp/magit/.github/workflows/stats.yml delete mode 100644 .config/emacs/lisp/magit/.github/workflows/test.yml delete mode 100644 .config/emacs/lisp/magit/.gitignore delete mode 100644 .config/emacs/lisp/magit/.mailmap delete mode 100644 .config/emacs/lisp/magit/CHANGELOG delete mode 100644 .config/emacs/lisp/magit/LICENSE delete mode 100644 .config/emacs/lisp/magit/Makefile delete mode 100644 .config/emacs/lisp/magit/README.md delete mode 100644 .config/emacs/lisp/magit/default.mk delete mode 100644 .config/emacs/lisp/magit/docs/.orgconfig delete mode 100644 .config/emacs/lisp/magit/docs/AUTHORS.md delete mode 100644 .config/emacs/lisp/magit/docs/BACKERS.md delete mode 100644 .config/emacs/lisp/magit/docs/Makefile delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/0.5.1.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/0.6.1.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/0.7.0.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/0.8.0.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/0.8.1.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/0.8.2.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/1.0.0.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/1.1.0.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/1.1.1.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/1.1.2.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/1.2.0.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/1.2.1.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/1.2.2.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/1.4.0.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/1.4.1.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/1.4.2.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.1.0.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.10.0.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.10.1.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.10.2.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.10.3.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.11.0.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.12.0.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.12.1.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.13.0.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.13.1.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.2.0.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.2.1.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.2.2.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.3.0.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.3.1.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.4.0.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.4.1.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.5.0.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.6.0.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.6.1.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.6.2.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.7.0.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.8.0.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.9.0.txt delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.90.0.org delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/2.90.1.org delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/3.0.0.org delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/3.1.0.org delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/3.2.0.org delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/3.2.1.org delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/3.3.0.org delete mode 100644 .config/emacs/lisp/magit/docs/RelNotes/4.0.0.org delete mode 100644 .config/emacs/lisp/magit/docs/htmlxref.cnf delete mode 100644 .config/emacs/lisp/magit/docs/magit-section.org delete mode 100644 .config/emacs/lisp/magit/docs/magit.org delete mode 120000 .config/emacs/lisp/magit/git-hooks/applypatch-msg delete mode 120000 .config/emacs/lisp/magit/git-hooks/commit-msg delete mode 100755 .config/emacs/lisp/magit/git-hooks/fallthrough delete mode 120000 .config/emacs/lisp/magit/git-hooks/fsmonitor-watchman delete mode 120000 .config/emacs/lisp/magit/git-hooks/p4-changelist delete mode 120000 .config/emacs/lisp/magit/git-hooks/p4-post-changelist delete mode 120000 .config/emacs/lisp/magit/git-hooks/p4-pre-submit delete mode 120000 .config/emacs/lisp/magit/git-hooks/p4-prepare-changelist delete mode 120000 .config/emacs/lisp/magit/git-hooks/post-applypatch delete mode 120000 .config/emacs/lisp/magit/git-hooks/post-checkout delete mode 100755 .config/emacs/lisp/magit/git-hooks/post-commit delete mode 120000 .config/emacs/lisp/magit/git-hooks/post-index-change delete mode 100755 .config/emacs/lisp/magit/git-hooks/post-merge delete mode 120000 .config/emacs/lisp/magit/git-hooks/post-receive delete mode 100755 .config/emacs/lisp/magit/git-hooks/post-rewrite delete mode 120000 .config/emacs/lisp/magit/git-hooks/post-update delete mode 120000 .config/emacs/lisp/magit/git-hooks/pre-applypatch delete mode 120000 .config/emacs/lisp/magit/git-hooks/pre-auto-gc delete mode 120000 .config/emacs/lisp/magit/git-hooks/pre-commit delete mode 120000 .config/emacs/lisp/magit/git-hooks/pre-merge-commit delete mode 120000 .config/emacs/lisp/magit/git-hooks/pre-push delete mode 120000 .config/emacs/lisp/magit/git-hooks/pre-rebase delete mode 120000 .config/emacs/lisp/magit/git-hooks/pre-receive delete mode 120000 .config/emacs/lisp/magit/git-hooks/prepare-commit-msg delete mode 120000 .config/emacs/lisp/magit/git-hooks/proc-receive delete mode 120000 .config/emacs/lisp/magit/git-hooks/push-to-checkout delete mode 120000 .config/emacs/lisp/magit/git-hooks/reference-transaction delete mode 120000 .config/emacs/lisp/magit/git-hooks/sendemail-validate delete mode 120000 .config/emacs/lisp/magit/git-hooks/update delete mode 100644 .config/emacs/lisp/magit/lisp/Makefile delete mode 100644 .config/emacs/lisp/magit/lisp/git-commit.el delete mode 100644 .config/emacs/lisp/magit/lisp/git-rebase.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-apply.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-autorevert.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-base.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-bisect.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-blame.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-bookmark.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-branch.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-bundle.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-clone.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-commit.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-core.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-diff.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-dired.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-ediff.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-extras.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-fetch.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-files.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-git.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-gitignore.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-log.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-margin.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-merge.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-mode.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-notes.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-patch.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-process.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-pull.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-push.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-reflog.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-refs.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-remote.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-repos.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-reset.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-section.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-sequence.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-sparse-checkout.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-stash.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-status.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-submodule.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-subtree.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-tag.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-transient.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-wip.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit-worktree.el delete mode 100644 .config/emacs/lisp/magit/lisp/magit.el delete mode 100644 .config/emacs/lisp/magit/test/Makefile delete mode 100644 .config/emacs/lisp/magit/test/magit-tests.el delete mode 100644 .config/emacs/lisp/magit/test/magit-tests.elc delete mode 100644 .config/emacs/lisp/minadstack/cape.el delete mode 100644 .config/emacs/lisp/minadstack/consult.el delete mode 100644 .config/emacs/lisp/minadstack/corfu-history.el delete mode 100644 .config/emacs/lisp/minadstack/corfu.el delete mode 100644 .config/emacs/lisp/minadstack/marginalia.el delete mode 100644 .config/emacs/lisp/minadstack/orderless.el delete mode 100644 .config/emacs/lisp/minadstack/vertico-directory.el delete mode 100644 .config/emacs/lisp/minadstack/vertico.el delete mode 100644 .config/emacs/lisp/mwim.el delete mode 100644 .config/emacs/lisp/sideline-flymake.el delete mode 100644 .config/emacs/lisp/sideline.el delete mode 100644 .config/emacs/lisp/toggle-window/toggle-window.el delete mode 100644 .config/emacs/lisp/yasnippet-snippets.el delete mode 100644 .config/emacs/lisp/yasnippet.el (limited to '.config') diff --git a/.config/emacs/early-init.el b/.config/emacs/early-init.el new file mode 100644 index 0000000..b8c27fb --- /dev/null +++ b/.config/emacs/early-init.el @@ -0,0 +1,50 @@ +;; file handler optimization — skip regex matching on every load +(defvar my--old-file-name-handler-alist file-name-handler-alist) +(setq file-name-handler-alist nil) +(add-hook 'emacs-startup-hook + (lambda () + (setq file-name-handler-alist my--old-file-name-handler-alist))) + +;; configure frame parameters +(push '(menu-bar-lines . 0) default-frame-alist) +(push '(tool-bar-lines . 0) default-frame-alist) +(push '(vertical-scroll-bars) default-frame-alist) +(push '(horizontal-scroll-bars) default-frame-alist) +(setq menu-bar-mode nil + tool-bar-mode nil + scroll-bar-mode nil) + +;; performance +(setq frame-resize-pixelwise t + frame-inhibit-implied-resize t + auto-mode-case-fold nil + read-process-output-max (* 2 1024 1024) + load-prefer-newer t) +(setq redisplay-skip-fontification-on-input t) + +;; bidirectional text +(setq-default bidi-display-reordering 'left-to-right + bidi-paragraph-direction 'left-to-right) +(setq bidi-inhibit-bpa t) + +;; pgtk latency improvement +(when (boundp 'pgtk-wait-for-event-timeout) + (setq pgtk-wait-for-event-timeout 0.001)) + +;; utf-8 +(set-charset-priority 'unicode) +(setq locale-coding-system 'utf-8) +(set-terminal-coding-system 'utf-8) +(set-keyboard-coding-system 'utf-8) +(set-selection-coding-system 'utf-8) +(prefer-coding-system 'utf-8) + +;; fonts +(let ((mono-spaced-font "Monaco Nerd Font Mono") + (proportionately-spaced-font "MonacoLigaturized Nerd Font")) + (set-face-attribute 'default nil :family mono-spaced-font :height 100) + (set-face-attribute 'fixed-pitch nil :family mono-spaced-font :height 1.0) + (set-face-attribute 'variable-pitch nil :family proportionately-spaced-font :height 1.0)) + +;; native comp warnings +(setq native-comp-async-report-warnings-errors 'silent) diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 60537cc..e041356 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -1,8 +1,5 @@ ;; add my lisp directory and its subdirectories to the load path -(defvar my-lisp-dir (file-name-concat user-emacs-directory "lisp")) -(add-to-list 'load-path my-lisp-dir) -(let ((default-directory my-lisp-dir)) - (normal-top-level-add-subdirs-to-load-path)) +(add-to-list 'load-path (locate-user-emacs-file "lisp")) ;; stop garbage files (require 'no-littering) diff --git a/.config/emacs/lisp/dired-hacks/dired-hacks-utils.el b/.config/emacs/lisp/dired-hacks/dired-hacks-utils.el deleted file mode 100644 index b492f76..0000000 --- a/.config/emacs/lisp/dired-hacks/dired-hacks-utils.el +++ /dev/null @@ -1,275 +0,0 @@ -;;; dired-hacks-utils.el --- Utilities and helpers for dired-hacks collection - -;; Copyright (C) 2014-2015 Matúš Goljer - -;; Author: Matúš Goljer -;; Maintainer: Matúš Goljer -;; Keywords: files -;; Version: 0.0.1 -;; Created: 14th February 2014 -;; Package-Requires: ((dash "2.5.0") (emacs "24.3")) -;; URL: https://github.com/Fuco1/dired-hacks - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; Utilities and helpers for `dired-hacks' collection of dired -;; improvements. - -;; This package also provides these interactive functions: -;; * `dired-hacks-next-file' - go to next file, skipping empty and non-file lines -;; * `dired-hacks-previous-file' - go to previous file, skipping empty -;; and non-file lines -;; * `dired-utils-format-information-line-mode' - Format the information -;; (summary) line file sizes to be human readable (e.g. 1GB instead of 1048576). - - -;; See https://github.com/Fuco1/dired-hacks for the entire collection - -;;; Code: - -(require 'dash) -(require 'dired) -(require 'dired-aux) ;; for dired-dwim-target-directory - -(defgroup dired-hacks () - "Collection of useful dired additions." - :group 'dired - :prefix "dired-hacks-") - -(defcustom dired-hacks-file-size-formatter #'file-size-human-readable - "The function used to format file sizes. - -See `dired-utils-format-file-sizes'." - :type 'function - :group 'dired-hacks) - -(defcustom dired-hacks-datetime-regexp - "\\sw\\sw\\sw....\\(?:[0-9][0-9]:[0-9][0-9]\\|.[0-9]\\{4\\}\\)" - "A regexp matching the date/time in the dired listing. - -It is used to determine where the filename starts. It should -*not* match any characters after the last character of the -timestamp. It is assumed that the timestamp is preceded and -followed by at least one space character. You should only use -shy groups (prefixed with ?:) because the first group is used by -the font-lock to determine what portion of the name should be -colored." - :type 'regexp - :group 'dired-hacks) - -(defalias 'dired-utils--string-trim - (if (and (require 'subr-x nil t) - (fboundp 'string-trim)) - #'string-trim - (lambda (string) - (let ((s string)) - (when (string-match "\\`[ \t\n\r]+" s) - (setq s (replace-match "" t t s))) - (when (string-match "[ \t\n\r]+\\'" s) - (setq s (replace-match "" t t s))) - s))) - "Trim STRING of trailing whitespace. - -\(fn STRING)") - -(defun dired-utils-get-filename (&optional localp) - "Like `dired-get-filename' but never signal an error. - -Optional arg LOCALP with value `no-dir' means don't include -directory name in result." - (dired-get-filename localp t)) - -(defun dired-utils-get-all-files (&optional localp) - "Return all files in this dired buffer as a list. - -LOCALP has same semantics as in `dired-get-filename'." - (save-excursion - (goto-char (point-min)) - (let (r) - (while (= 0 (forward-line)) - (--when-let (dired-utils-get-filename localp) - (push it r))) - (nreverse r)))) - -(defconst dired-utils-file-attributes-keywords - '(:isdir :nlinks :uid :gid :atime :mtime :ctime :size :modes :gidchg :inode :devnum) - "List of keywords to map with `file-attributes'.") - -(defconst dired-utils-info-keywords - `(:name :issym :target ,@dired-utils-file-attributes-keywords) - "List of keywords available for `dired-utils-get-info'.") - -(defun dired-utils--get-keyword-info (keyword) - "Get file information about KEYWORD." - (let ((filename (dired-utils-get-filename))) - (cl-case keyword - (:name filename) - (:isdir (file-directory-p filename)) - (:issym (and (file-symlink-p filename) t)) - (:target (file-symlink-p filename)) - (t - (nth (-elem-index keyword dired-utils-file-attributes-keywords) - (file-attributes filename)))))) - -(defun dired-utils-get-info (&rest keywords) - "Query for info about the file at point. - -KEYWORDS is a list of attributes to query. - -When querying for one attribute, its value is returned. When -querying for more than one, a list of results is returned. - -The available keywords are listed in -`dired-utils-info-keywords'." - (let ((attributes (mapcar 'dired-utils--get-keyword-info keywords))) - (if (> (length attributes) 1) - attributes - (car attributes)))) - -(defun dired-utils-goto-line (filename) - "Go to line describing FILENAME in listing. - -Should be absolute file name matched against -`dired-get-filename'." - (goto-char (point-min)) - (let (stop) - (while (and (not stop) - (= (forward-line) 0)) - (when (equal filename (dired-utils-get-filename)) - (setq stop t) - (dired-move-to-filename))) - stop)) - -(defun dired-utils-match-filename-regexp (filename alist) - "Match FILENAME against each car in ALIST and return first matched cons. - -Each car in ALIST is a regular expression. - -The matching is done using `string-match-p'." - (let (match) - (--each-while alist (not match) - (when (string-match-p (car it) filename) - (setq match it))) - match)) - -(defun dired-utils-match-filename-extension (filename alist) - "Match FILENAME against each car in ALIST and return first matched cons. - -Each car in ALIST is a string representing file extension -*without* the delimiting dot." - (let (done) - (--each-while alist (not done) - (when (string-match-p (concat "\\." (regexp-quote (car it)) "\\'") filename) - (setq done it))) - done)) - -(defun dired-utils-format-information-line () - "Format the disk space on the Dired information line." - (save-excursion - (goto-char (point-min)) - (forward-line) - (let ((inhibit-read-only t) - (limit (line-end-position))) - (while (re-search-forward "\\(?:directory\\|available\\) \\(\\<[0-9]+$\\>\\)" nil t) - (replace-match - (save-match-data - (propertize (dired-utils--string-trim - (funcall dired-hacks-file-size-formatter - (* 1024 (string-to-number (match-string 1))) t)) - 'invisible 'dired-hide-details-information)) - t nil nil 1))))) - - -;;; Predicates -(defun dired-utils-is-file-p () - "Return non-nil if the line at point is a file or a directory." - (dired-utils-get-filename 'no-dir)) - -(defun dired-utils-is-dir-p () - "Return non-nil if the line at point is a directory." - (--when-let (dired-utils-get-filename) - (file-directory-p it))) - - -;;; Interactive -;; TODO: add wrap-around option -(defun dired-hacks-next-file (&optional arg) - "Move point to the next file. - -Optional prefix ARG says how many lines to move; default is one -line." - (interactive "p") - (unless arg (setq arg 1)) - (if (< arg 0) - (dired-hacks-previous-file (- arg)) - (--dotimes arg - (forward-line) - (while (and (or (not (dired-utils-is-file-p)) - (get-text-property (point) 'invisible)) - (= (forward-line) 0)))) - (if (not (= (point) (point-max))) - (dired-move-to-filename) - (forward-line -1) - (dired-move-to-filename) - nil))) - -(defun dired-hacks-previous-file (&optional arg) - "Move point to the previous file. - -Optional prefix ARG says how many lines to move; default is one -line." - (interactive "p") - (unless arg (setq arg 1)) - (if (< arg 0) - (dired-hacks-next-file (- arg)) - (--dotimes arg - (forward-line -1) - (while (and (or (not (dired-utils-is-file-p)) - (get-text-property (point) 'invisible)) - (= (forward-line -1) 0)))) - (if (not (= (point) (point-min))) - (dired-move-to-filename) - (dired-hacks-next-file) - nil))) - -(defun dired-hacks-compare-files (file-a file-b) - "Test if two files FILE-A and FILE-B are the (probably) the same." - (interactive (let ((other-dir (dired-dwim-target-directory))) - (list (read-file-name "File A: " default-directory (car (dired-get-marked-files)) t) - (read-file-name "File B: " other-dir (with-current-buffer (cdr (assoc other-dir dired-buffers)) - (car (dired-get-marked-files))) t)))) - (let ((md5-a (with-temp-buffer - (shell-command (format "md5sum %s" file-a) (current-buffer)) - (buffer-string))) - (md5-b (with-temp-buffer - (shell-command (format "md5sum %s" file-b) (current-buffer)) - (buffer-string)))) - (message "%s%sFiles are %s." md5-a md5-b - (if (equal (car (split-string md5-a)) - (car (split-string md5-b))) - "probably the same" "different")))) - -(define-minor-mode dired-utils-format-information-line-mode - "Toggle formatting of disk space in the Dired information line." - :group 'dired-utils - :lighter "" - (if dired-utils-format-information-line-mode - (add-hook 'dired-after-readin-hook #'dired-utils-format-information-line) - (remove-hook 'dired-after-readin-hook #'dired-utils-format-information-line))) - -(provide 'dired-hacks-utils) - -;;; dired-hacks-utils.el ends here diff --git a/.config/emacs/lisp/dired-hacks/dired-subtree.el b/.config/emacs/lisp/dired-hacks/dired-subtree.el deleted file mode 100644 index d50ab96..0000000 --- a/.config/emacs/lisp/dired-hacks/dired-subtree.el +++ /dev/null @@ -1,785 +0,0 @@ -;;; dired-subtree.el --- Insert subdirectories in a tree-like fashion - -;; Copyright (C) 2014-2015 Matúš Goljer - -;; Author: Matúš Goljer -;; Maintainer: Matúš Goljer -;; Keywords: files -;; Version: 0.0.1 -;; Created: 25th February 2014 -;; Package-Requires: ((dash "2.5.0") (dired-hacks-utils "0.0.1") (emacs "24.3")) -;; URL: https://github.com/Fuco1/dired-hacks - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; Introduction -;; ------------ - -;; The basic command to work with subdirectories in dired is `i', -;; which inserts the subdirectory as a separate listing in the active -;; dired buffer. - -;; This package defines function `dired-subtree-insert' which instead -;; inserts the subdirectory directly below its line in the original -;; listing, and indent the listing of subdirectory to resemble a -;; tree-like structure (somewhat similar to tree(1) except the pretty -;; graphics). The tree display is somewhat more intuitive than the -;; default "flat" subdirectory manipulation provided by `i'. - -;; There are several presentation options and faces you can customize -;; to change the way subtrees are displayed. - -;; You can further remove the unwanted lines from the subtree by using -;; `k' command or some of the built-in "focusing" functions, such as -;; `dired-subtree-only-*' (see list below). - -;; If you have the package `dired-filter', you can additionally filter -;; the subtrees with global or local filters. - -;; A demo of basic functionality is available on youtube: -;; https://www.youtube.com/watch?v=z26b8HKFsNE - -;; Interactive functions -;; --------------------- - -;; Here's a list of available interactive functions. You can read -;; more about each one by using the built-in documentation facilities -;; of Emacs. It is adviced to place bindings for these into a -;; convenient prefix key map, for example C-, - -;; * `dired-subtree-insert' -;; * `dired-subtree-remove' -;; * `dired-subtree-toggle' -;; * `dired-subtree-cycle' -;; * `dired-subtree-revert' -;; * `dired-subtree-narrow' -;; * `dired-subtree-up' -;; * `dired-subtree-down' -;; * `dired-subtree-next-sibling' -;; * `dired-subtree-previous-sibling' -;; * `dired-subtree-beginning' -;; * `dired-subtree-end' -;; * `dired-subtree-mark-subtree' -;; * `dired-subtree-unmark-subtree' -;; * `dired-subtree-only-this-file' -;; * `dired-subtree-only-this-directory' - -;; If you have package `dired-filter', additional command -;; `dired-subtree-apply-filter' is available. - -;; See https://github.com/Fuco1/dired-hacks for the entire collection. - -;;; Code: - -(require 'dired-hacks-utils) -(require 'dash) -(require 'cl-lib) - -(defgroup dired-subtree () - "Insert subdirectories in a tree-like fashion." - :group 'dired-hacks - :prefix "dired-subtree-") - -(defcustom dired-subtree-line-prefix " " - "A prefix put into each nested subtree. - -The prefix is repeated \"depth\" times. - -Alternatively, it can be a function taking one argument---the -depth---that creates the prefix." - :type '(choice string function) - :group 'dired-subtree) - -(defcustom dired-subtree-line-prefix-face 'parents - "Specifies how the prefix is fontified." - :type '(radio - (const :tag "No face applied" nil) - (const :tag "Inherit from current subtree" subtree) - (const :tag "Inherit from all parents" parents)) - :group 'dired-subtree) - -(defcustom dired-subtree-use-backgrounds t - "When non-nil, add a background face to a subtree listing." - :type 'boolean - :group 'dired-subtree) - -(defcustom dired-subtree-after-insert-hook () - "Hook run at the end of `dired-subtree-insert'." - :type 'hook - :group 'dired-subtree) - -(defcustom dired-subtree-after-remove-hook () - "Hook run at the end of `dired-subtree-remove'." - :type 'hook - :group 'dired-subtree) - -(defcustom dired-subtree-cycle-depth 3 - "Default depth expanded by `dired-subtree-cycle'." - :type 'natnum - :group 'dired-subtree) - -(defcustom dired-subtree-ignored-regexp - (concat "^" (regexp-opt vc-directory-exclusion-list) "$") - "Matching directories will not be expanded in `dired-subtree-cycle'." - :type 'regexp - :group 'dired-subtree) - -(defgroup dired-subtree-faces () - "Faces used in `dired-subtree'." - :group 'dired-subtree) - -(defface dired-subtree-depth-1-face - '((t (:background "#252e30"))) - "Background for depth 1 subtrees" - :group 'dired-subtree-faces) - -(defface dired-subtree-depth-2-face - '((t (:background "#232a2b"))) - "Background for depth 2 subtrees" - :group 'dired-subtree-faces) - -(defface dired-subtree-depth-3-face - '((t (:background "#212627"))) - "Background for depth 3 subtrees" - :group 'dired-subtree-faces) - -(defface dired-subtree-depth-4-face - '((t (:background "#1e2223"))) - "Background for depth 4 subtrees" - :group 'dired-subtree-faces) - -(defface dired-subtree-depth-5-face - '((t (:background "#1c1d1e"))) - "Background for depth 5 subtrees" - :group 'dired-subtree-faces) - -(defface dired-subtree-depth-6-face - '((t (:background "#1a191a"))) - "Background for depth 6 subtrees" - :group 'dired-subtree-faces) - -(defvar dired-subtree-overlays nil - "Subtree overlays in this buffer.") -(make-variable-buffer-local 'dired-subtree-overlays) - - -;;; Overlay manipulation -;; Maybe we should abstract the overlay-foo into some subtree -;; functions instead!!! - -(defun dired-subtree--remove-overlay (ov) - "Remove dired-subtree overlay OV." - (setq dired-subtree-overlays - (--remove (equal it ov) dired-subtree-overlays)) - (delete-overlay ov)) - -(defun dired-subtree--remove-overlays (ovs) - "Remove dired-subtree overlays OVS." - (mapc 'dired-subtree--remove-overlay ovs)) - -(defun dired-subtree--cleanup-overlays () - "Remove the nil values from `dired-subtree-overlays'." - (setq dired-subtree-overlays - (--remove (not (overlay-buffer it)) dired-subtree-overlays))) - -(defun dired-subtree--get-all-ovs () - "Get all dired-subtree overlays in this buffer." - (--filter (overlay-get it 'dired-subtree-depth) (overlays-in (point-min) (point-max)))) - -(defun dired-subtree--get-all-ovs-at-point (&optional p) - "Get all dired-subtree overlays at point P." - (setq p (or p (point))) - (--filter (overlay-get it 'dired-subtree-depth) (overlays-at (point)))) - -(defun dired-subtree--get-ovs-in (&optional beg end) - "Get all dired-subtree overlays between BEG and END. - -BEG and END default to the region spanned by overlay at point." - (when (not beg) - (let ((ov (dired-subtree--get-ov))) - (setq beg (overlay-start ov)) - (setq end (overlay-end ov)))) - (--filter (and (overlay-get it 'dired-subtree-depth) - (>= (overlay-start it) beg) - (<= (overlay-end it) end)) - (overlays-in (point-min) (point-max)))) - -(defun dired-subtree--get-ov (&optional p) - "Get the parent subtree overlay at point." - (setq p (or p (point))) - (car (--sort (> (overlay-get it 'dired-subtree-depth) - (overlay-get other 'dired-subtree-depth)) - (dired-subtree--get-all-ovs-at-point p)))) - -(defun dired-subtree--get-depth (ov) - "Get subtree depth." - (or (and ov (overlay-get ov 'dired-subtree-depth)) 0)) - - - -;;; helpers -(defvar dired-subtree-preserve-properties '(dired-subtree-filter) - "Properties that should be preserved between read-ins.") - -(defun dired-subtree--after-readin (&optional subtrees) - "Insert the SUBTREES again after dired buffer has been reverted. - -If no SUBTREES are specified, use `dired-subtree-overlays'." - (-when-let (subtrees-to-process (or subtrees dired-subtree-overlays)) - (let* ((ovs-by-depth (--sort (< (car it) (car other)) - (--group-by (overlay-get it 'dired-subtree-depth) - subtrees-to-process))) - (sorted-ovs (--map (cons (car it) - (--map (-cons* it - (overlay-get it 'dired-subtree-name) - (-map (lambda (x) (cons x (overlay-get it x))) - dired-subtree-preserve-properties)) (cdr it))) - ovs-by-depth))) - ;; (depth (path1 ov1 (prop1 . value1) (prop2 . value2)) (path2 ...)) - (--each sorted-ovs - (--each (cdr it) - (when (dired-utils-goto-line (cadr it)) - (dired-subtree--remove-overlay (car it)) - (dired-subtree-insert) - (let ((ov (dired-subtree--get-ov))) - (--each (cddr it) - (overlay-put ov (car it) (cdr it))) - (dired-subtree--filter-subtree ov)))))))) - -(defun dired-subtree--after-insert () - "After inserting the subtree, setup dired-details/dired-hide-details-mode." - (if (fboundp 'dired-insert-set-properties) - (let ((inhibit-read-only t) - (ov (dired-subtree--get-ov))) - (dired-insert-set-properties (overlay-start ov) (overlay-end ov))) - (when (featurep 'dired-details) - (dired-details-delete-overlays) - (dired-details-activate)))) - -(add-hook 'dired-after-readin-hook 'dired-subtree--after-readin) - -(add-hook 'dired-subtree-after-insert-hook 'dired-subtree--after-insert) - -(defun dired-subtree--unmark () - "Unmark a file without moving point." - (save-excursion (dired-unmark 1))) - -(defun dired-subtree--dired-line-is-directory-or-link-p () - "Return non-nil if line under point is a directory or symlink." - ;; We've replaced `file-directory-p' with the regexp test to - ;; speed up filters over TRAMP. So long as dired/ls format - ;; doesn't change, we're good. - ;; 'd' for directories, 'l' for potential symlinks to directories. - (save-excursion (beginning-of-line) (looking-at "..[dl]"))) - -(defun dired-subtree--is-expanded-p () - "Return non-nil if directory under point is expanded." - (save-excursion - (when (dired-utils-get-filename) - (let ((depth (dired-subtree--get-depth (dired-subtree--get-ov)))) - (dired-next-line 1) - (< depth (dired-subtree--get-depth (dired-subtree--get-ov))))))) - -(defmacro dired-subtree-with-subtree (&rest forms) - "Run FORMS on each file in this subtree." - (declare (debug (body))) - `(save-excursion - (dired-subtree-beginning) - ,@forms - (while (dired-subtree-next-sibling) - ,@forms))) - - -;;;; Interactive - -;;;###autoload -(defun dired-subtree-narrow () - "Narrow the buffer to this subtree." - (interactive) - (-when-let (ov (dired-subtree--get-ov)) - (narrow-to-region (overlay-start ov) - (overlay-end ov)))) - -;;; Navigation - -;; make the arguments actually do something -;;;###autoload -(defun dired-subtree-up (&optional arg) - "Jump up one directory." - (interactive "p") - (-when-let (ov (dired-subtree--get-ov)) - (goto-char (overlay-start ov)) - (dired-previous-line 1))) - -;;;###autoload -(defun dired-subtree-down (&optional arg) - "Jump down one directory." - (interactive "p") - (-when-let* ((p (point)) - (ov (car (--sort - (< (overlay-start it) - (overlay-start other)) - (--remove - (< (overlay-start it) p) - (dired-subtree--get-all-ovs)))))) - (goto-char (overlay-start ov)) - (dired-move-to-filename))) - -;;;###autoload -(defun dired-subtree-next-sibling (&optional arg) - "Go to the next sibling." - (interactive "p") - (let ((current-ov (dired-subtree--get-ov))) - (dired-next-line 1) - (let ((new-ov (dired-subtree--get-ov))) - (cond - ((not (dired-utils-is-file-p)) - nil) - ((< (dired-subtree--get-depth current-ov) - (dired-subtree--get-depth new-ov)) - (goto-char (overlay-end new-ov)) - (dired-move-to-filename) - t) - ((> (dired-subtree--get-depth current-ov) - (dired-subtree--get-depth new-ov)) - ;; add option to either go to top or stay at the end - (dired-previous-line 1) - nil) - (t t))))) - -;;;###autoload -(defun dired-subtree-previous-sibling (&optional arg) - "Go to the previous sibling." - (interactive "p") - (let ((current-ov (dired-subtree--get-ov))) - (dired-previous-line 1) - (let ((new-ov (dired-subtree--get-ov))) - (cond - ;; this will need better handlign if we have inserted - ;; subdirectories - ((not (dired-utils-is-file-p)) - nil) - ((< (dired-subtree--get-depth current-ov) - (dired-subtree--get-depth new-ov)) - (goto-char (overlay-start new-ov)) - (dired-previous-line 1) - t) - ((> (dired-subtree--get-depth current-ov) - (dired-subtree--get-depth new-ov)) - ;; add option to either go to top or stay at the end - (dired-next-line 1) - nil) - (t t))))) - -;;;###autoload -(defun dired-subtree-beginning () - "Go to the first file in this subtree." - (interactive) - (let ((ov (dired-subtree--get-ov))) - (if (not ov) - ;; do something when not in subtree - t - (goto-char (overlay-start ov)) - (dired-move-to-filename)))) - -;;;###autoload -(defun dired-subtree-end () - "Go to the first file in this subtree." - (interactive) - (let ((ov (dired-subtree--get-ov))) - (if (not ov) - ;; do something when not in subtree - t - (goto-char (overlay-end ov)) - (dired-previous-line 1)))) - -;;; Marking - -;;;###autoload -(defun dired-subtree-mark-subtree (&optional all) - "Mark all files in this subtree. - -With prefix argument mark all the files in subdirectories -recursively." - (interactive "P") - (save-excursion - (if all - (let ((beg (save-excursion - (dired-subtree-beginning) - (point))) - (end (save-excursion - (dired-subtree-end) - (point)))) - (dired-mark-files-in-region - (progn (goto-char beg) (line-beginning-position)) - (progn (goto-char end) (line-end-position)))) - (dired-subtree-beginning) - (save-excursion (dired-mark 1)) - (while (dired-subtree-next-sibling) - (save-excursion (dired-mark 1)))))) - -;;;###autoload -(defun dired-subtree-unmark-subtree (&optional all) - "Unmark all files in this subtree. - -With prefix argument unmark all the files in subdirectories -recursively." - (interactive) - (let ((dired-marker-char ? )) - (dired-subtree-mark-subtree all))) - -;;; Insertion/deletion -;;;###autoload -(defun dired-subtree-revert () - "Revert the subtree. - -This means reinserting the content of this subtree and all its -children." - (interactive) - (let ((inhibit-read-only t) - (file-name (dired-utils-get-filename))) - (-when-let* ((ov (dired-subtree--get-ov)) - (ovs (dired-subtree--get-ovs-in))) - (dired-subtree-up) - (delete-region (overlay-start ov) (overlay-end ov)) - (dired-subtree--after-readin ovs) - (when file-name - (dired-utils-goto-line file-name))))) - -(defun dired-subtree--readin (dir-name) - "Read in the directory. - -Return a string suitable for insertion in `dired' buffer." - (with-temp-buffer - (insert-directory dir-name dired-listing-switches nil t) - (delete-char -1) - (goto-char (point-min)) - (delete-region - (progn (beginning-of-line) (point)) - (progn (forward-line - (if (save-excursion - (forward-line 1) - (end-of-line) - (looking-back "\\.")) - 3 1)) (point))) - (insert " ") - (while (= (forward-line) 0) - (insert " ")) - (delete-char -2) - (buffer-string))) - -;;;###autoload -(defun dired-subtree-insert () - "Insert subtree under this directory." - (interactive) - (when (and (dired-subtree--dired-line-is-directory-or-link-p) - (not (dired-subtree--is-expanded-p))) - (let* ((dir-name (dired-get-filename nil)) - (listing (dired-subtree--readin (file-name-as-directory dir-name))) - beg end) - (read-only-mode -1) - (move-end-of-line 1) - ;; this is pretty ugly, I'm sure it can be done better - (save-excursion - (insert listing) - (setq end (+ (point) 2))) - (insert "\n") - (setq beg (point)) - (let ((inhibit-read-only t)) - (remove-text-properties (1- beg) beg '(dired-filename))) - (let* ((ov (make-overlay beg end)) - (parent (dired-subtree--get-ov (1- beg))) - (depth (or (and parent (1+ (overlay-get parent 'dired-subtree-depth))) - 1)) - (face (intern (format "dired-subtree-depth-%d-face" depth)))) - (when dired-subtree-use-backgrounds - (overlay-put ov 'face face)) - ;; refactor this to some function - (overlay-put ov 'line-prefix - (if (stringp dired-subtree-line-prefix) - (if (not dired-subtree-use-backgrounds) - (apply 'concat (-repeat depth dired-subtree-line-prefix)) - (cond - ((eq nil dired-subtree-line-prefix-face) - (apply 'concat - (-repeat depth dired-subtree-line-prefix))) - ((eq 'subtree dired-subtree-line-prefix-face) - (concat - dired-subtree-line-prefix - (propertize - (apply 'concat - (-repeat (1- depth) dired-subtree-line-prefix)) - 'face face))) - ((eq 'parents dired-subtree-line-prefix-face) - (concat - dired-subtree-line-prefix - (apply 'concat - (--map - (propertize dired-subtree-line-prefix - 'face - (intern (format "dired-subtree-depth-%d-face" it))) - (number-sequence 1 (1- depth)))))))) - (funcall dired-subtree-line-prefix depth))) - (overlay-put ov 'dired-subtree-name dir-name) - (overlay-put ov 'dired-subtree-parent parent) - (overlay-put ov 'dired-subtree-depth depth) - (overlay-put ov 'evaporate t) - (push ov dired-subtree-overlays)) - (goto-char beg) - (dired-move-to-filename) - (read-only-mode 1) - (when (bound-and-true-p dired-filter-mode) (dired-filter-mode 1)) - (run-hooks 'dired-subtree-after-insert-hook)))) - -;;;###autoload -(defun dired-subtree-remove () - "Remove subtree at point." - (interactive) - (-when-let* ((ov (dired-subtree--get-ov)) - (ovs (dired-subtree--get-ovs-in - (overlay-start ov) - (overlay-end ov)))) - (let ((inhibit-read-only t)) - (dired-subtree-up) - (delete-region (overlay-start ov) - (overlay-end ov)) - (dired-subtree--remove-overlays ovs))) - (run-hooks 'dired-subtree-after-remove-hook)) - -;;;###autoload -(defun dired-subtree-toggle () - "Insert subtree at point or remove it if it was not present." - (interactive) - (if (dired-subtree--is-expanded-p) - (progn - (dired-next-line 1) - (dired-subtree-remove) - ;; #175 fixes the case of the first line in dired when the - ;; cursor jumps to the header in dired rather then to the - ;; first file in buffer - (when (bobp) - (dired-next-line 1))) - (save-excursion (dired-subtree-insert)))) - -(defun dired-subtree--insert-recursive (depth max-depth) - "Insert full subtree at point." - (save-excursion - (let ((name (dired-get-filename nil t))) - (when (and name (file-directory-p name) - (<= depth (or max-depth depth)) - (or (= 1 depth) - (not (string-match-p dired-subtree-ignored-regexp - (file-name-nondirectory name))))) - (if (dired-subtree--is-expanded-p) - (dired-next-line 1) - (dired-subtree-insert)) - (dired-subtree-end) - (dired-subtree--insert-recursive (1+ depth) max-depth) - (while (dired-subtree-previous-sibling) - (dired-subtree--insert-recursive (1+ depth) max-depth)))))) - -(defvar dired-subtree--cycle-previous nil - "Remember previous action for `dired-subtree-cycle'") - -;;;###autoload -(defun dired-subtree-cycle (&optional max-depth) - "Org-mode like cycle visibility: - -1) Show subtree -2) Show subtree recursively (if previous command was cycle) -3) Remove subtree - -Numeric prefix will set max depth" - (interactive "P") - (save-excursion - (cond - ;; prefix - show subtrees up to max-depth - (max-depth - (when (dired-subtree--is-expanded-p) - (dired-next-line 1) - (dired-subtree-remove)) - (dired-subtree--insert-recursive 1 (if (integerp max-depth) max-depth nil)) - (setq dired-subtree--cycle-previous :full)) - ;; if directory is not expanded, expand one level - ((not (dired-subtree--is-expanded-p)) - (dired-subtree-insert) - (setq dired-subtree--cycle-previous :insert)) - ;; hide if previous command was not cycle or tree was fully expanded - ((or (not (eq last-command 'dired-subtree-cycle)) - (eq dired-subtree--cycle-previous :full)) - (dired-next-line 1) - (dired-subtree-remove) - (setq dired-subtree--cycle-previous :remove)) - (t - (dired-subtree--insert-recursive 1 dired-subtree-cycle-depth) - (setq dired-subtree--cycle-previous :full))))) - -(defun dired-subtree--filter-up (keep-dir kill-siblings) - (save-excursion - (let (ov) - (save-excursion - (while (dired-subtree-up)) - (dired-next-line 1) - (dired-subtree-mark-subtree t)) - (if keep-dir - (dired-subtree-unmark-subtree) - (dired-subtree--unmark)) - (while (and (dired-subtree-up) - (> (dired-subtree--get-depth (dired-subtree--get-ov)) 0)) - (if (not kill-siblings) - (dired-subtree--unmark) - (dired-subtree--unmark) - (let ((here (point))) - (dired-subtree-with-subtree - (when (and (dired-subtree--is-expanded-p) - (/= (point) here)) - (dired-subtree--unmark) - (save-excursion - (dired-next-line 1) - (dired-subtree-unmark-subtree t))))))) - (dired-do-kill-lines) - (dired-subtree--cleanup-overlays)))) - -;;;###autoload -(defun dired-subtree-only-this-file (&optional arg) - "Remove all the siblings on the route from this file to the top-most directory. - -With ARG non-nil, do not remove expanded directories in parents." - (interactive "P") - (dired-subtree--filter-up nil arg)) - -;;;###autoload -(defun dired-subtree-only-this-directory (&optional arg) - "Remove all the siblings on the route from this directory to the top-most directory. - -With ARG non-nil, do not remove expanded directories in parents." - (interactive "P") - (dired-subtree--filter-up t arg)) - -;;; filtering -(defun dired-subtree--filter-update-bs (ov) - "Update the local filter list. - -This function assumes that `dired-filter-stack' is dynamically -bound to relevant value." - (let* ((filt (dired-filter--describe-filters)) - (before-str (if (equal filt "") nil (concat " Local filters: " filt "\n")))) - (overlay-put ov 'before-string before-str))) - -(defun dired-subtree--filter-subtree (ov) - "Run the filter for this subtree. - -It is only safe to call this from readin. - -This depends on `dired-filter' package." - (when (featurep 'dired-filter) - (let ((dired-filter-stack (overlay-get ov 'dired-subtree-filter))) - (save-restriction - (widen) - (dired-subtree-narrow) - (dired-filter--expunge) - (dired-subtree--filter-update-bs ov))))) - -;;;###autoload -(defun dired-subtree-apply-filter () - "Push a local filter for this subtree. - -This depends on `dired-filter' package. - -It works exactly the same as global dired filters, only -restricted to a subtree. The global filter is also applied to -the subtree. The filter action is read from `dired-filter-map'." - (interactive) - (when (featurep 'dired-filter) - (-when-let (ov (dired-subtree--get-ov)) - (let ((dired-filter-stack (overlay-get ov 'dired-subtree-filter)) - (glob (current-global-map)) - (loc (current-local-map)) - cmd) - (cl-flet ((dired-filter--update - () - (save-restriction - (overlay-put ov 'dired-subtree-filter dired-filter-stack) - (widen) - (dired-subtree-revert) - (dired-subtree--filter-update-bs ov)))) - (unwind-protect - (progn - (use-global-map dired-filter-map) - (use-local-map nil) - (setq cmd (key-binding (read-key-sequence "Choose filter action: ")))) - (use-global-map glob) - (use-local-map loc)) - (let ((p (point)) - (beg (overlay-start ov)) - (current-file (dired-utils-get-filename))) - (unwind-protect - (call-interactively cmd) - (unless (dired-utils-goto-line current-file) - (goto-char beg) - (forward-line) - (goto-char (min p (1- (overlay-end (dired-subtree--get-ov))))) - (dired-move-to-filename))))))))) - - -;;; Here we redefine a couple of functions from dired.el to make them -;;; subtree-aware - -;; If the point is in a subtree, we need to provide a proper -;; directory, not the one that would come from `dired-subdir-alist'. -(defun dired-current-directory (&optional localp) - "Return the name of the subdirectory to which this line belongs. -This returns a string with trailing slash, like `default-directory'. -Optional argument means return a file name relative to `default-directory'." - (let ((here (point)) - (alist (or dired-subdir-alist - ;; probably because called in a non-dired buffer - (error "No subdir-alist in %s" (current-buffer)))) - elt dir) - (while alist - (setq elt (car alist) - dir (car elt) - ;; use `<=' (not `<') as subdir line is part of subdir - alist (if (<= (dired-get-subdir-min elt) here) - nil ; found - (cdr alist)))) - ;; dired-subdir: modify dir here if we are in a "subtree" view - (-when-let (parent (dired-subtree--get-ov)) - (setq dir (concat (overlay-get parent 'dired-subtree-name) "/"))) - ;; end - (if localp - (dired-make-relative dir default-directory) - dir))) - -;; Since the tree-inserted directory is not in the dired-subdir-alist, -;; we need to guard against nil. -(defun dired-get-subdir () - "Return the subdir name on this line, or nil if not on a headerline." - ;; Look up in the alist whether this is a headerline. - (save-excursion - (let ((cur-dir (dired-current-directory))) - (beginning-of-line) ; alist stores b-o-l positions - (and (zerop (- (point) - (or (dired-get-subdir-min - (assoc cur-dir - dired-subdir-alist)) - 0))) ;; dired-subtree: return zero if current - ;; dir is not in `dired-subdir-alist'. - cur-dir)))) - -(provide 'dired-subtree) - -;;; dired-subtree.el ends here diff --git a/.config/emacs/lisp/doom-themes/LICENSE b/.config/emacs/lisp/doom-themes/LICENSE deleted file mode 100644 index 9faaf05..0000000 --- a/.config/emacs/lisp/doom-themes/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -# Doom Themes 53645a905dfb3055db52f5d418d5ef612027e062 - -The MIT License (MIT) - -Copyright (c) 2016-2024 Henrik Lissner. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/.config/emacs/lisp/doom-themes/doom-themes-base.el b/.config/emacs/lisp/doom-themes/doom-themes-base.el deleted file mode 100644 index f73fa3f..0000000 --- a/.config/emacs/lisp/doom-themes/doom-themes-base.el +++ /dev/null @@ -1,1635 +0,0 @@ -;;; doom-themes-base.el --- base faces for all doom themes -*- lexical-binding: t; -*- -;;; Commentary: -;;; Code: - -;; These are used as a basis for every Doom theme defined with `def-doom-theme', -;; as a set of reasonble defaults. They are intended to be overidden where it -;; makes sense to. -(defvar doom-themes-base-faces - '((bold :weight 'bold :foreground (if bold 'unspecified base8)) - (bold-italic :inherit '(bold italic)) - (italic :slant 'italic) - (escape-glyph :foreground cyan) - (default :background bg :foreground fg) - (fringe :inherit 'default :foreground base4) - (region :background region :distant-foreground (doom-darken fg 0.2) :extend t) - (highlight :background highlight :foreground base0 :distant-foreground base8) - (cursor :background highlight) - (shadow :foreground base5) - (minibuffer-prompt :foreground highlight) - (tooltip :background bg-alt :foreground fg) - (secondary-selection :background grey :extend t) - (lazy-highlight - (&dark :background (doom-darken highlight 0.3) :foreground base8 :distant-foreground base0 :weight 'bold) - (&light :background (doom-blend bg highlight 0.7) :foreground base0 :distant-foreground base8)) - (match :foreground green :background base0 :weight 'bold) - (trailing-whitespace :background red) - (nobreak-space :inherit 'escape-glyph :underline t) - (vertical-border :background vertical-bar :foreground vertical-bar) - (link :foreground highlight :underline t :weight 'bold) - (error :foreground error) - (warning :foreground warning) - (success :foreground success) - ;;;; font-lock-* faces - (font-lock-builtin-face :foreground builtin) - (font-lock-bracket-face :inherit 'font-lock-punctuation-face) - (font-lock-comment-delimiter-face :inherit 'font-lock-comment-face) - (font-lock-comment-face :foreground comments) - (font-lock-constant-face :foreground constants) - (font-lock-doc-face :inherit 'font-lock-comment-face :foreground doc-comments) - (font-lock-delimiter-face :inherit 'font-lock-punctuation-face) - (font-lock-escape-face :inherit 'font-lock-regexp-grouping-backslash) - (font-lock-function-name-face :foreground functions) - (font-lock-function-call-face :inherit 'font-lock-function-name-face :slant 'italic :foreground (doom-blend 'functions 'fg 0.7)) - (font-lock-keyword-face :foreground keywords) - (font-lock-misc-punctuation-face :inherit 'font-lock-punctuation-face) - (font-lock-negation-char-face :inherit 'bold :foreground operators) - (font-lock-number-face :foreground numbers) - (font-lock-operator-face :foreground operators) - (font-lock-punctuation-face :foreground (doom-blend 'operators 'fg 0.25)) - (font-lock-property-name-face :foreground (doom-blend 'keywords 'fg 0.6) :weight 'bold) - (font-lock-property-use-face :inherit 'font-lock-property-name-face :weight 'regular) - (font-lock-preprocessor-char-face :inherit 'bold :foreground operators) - (font-lock-preprocessor-face :inherit 'bold :foreground operators) - (font-lock-regexp-grouping-backslash :inherit 'bold :foreground operators) - (font-lock-regexp-grouping-construct :inherit 'bold :foreground operators) - (font-lock-string-face :foreground strings) - (font-lock-type-face :foreground type) - (font-lock-variable-name-face :foreground variables) - (font-lock-variable-use-face :inherit 'font-lock-variable-name-face :foreground (doom-blend 'variables 'fg 0.5)) - (font-lock-warning-face :inherit 'warning) - ;;;; mode-line / header-line - (mode-line :background bg :foreground fg :distant-foreground bg) - (mode-line-active :inherit 'mode-line) - (mode-line-inactive :background bg-alt :foreground fg-alt :distant-foreground bg-alt) - (mode-line-emphasis :foreground highlight :distant-foreground bg) - (mode-line-highlight :inherit 'highlight :distant-foreground bg) - (mode-line-buffer-id :weight 'bold) - (header-line :inherit 'mode-line) - (header-line-highlight :inherit 'mode-line-highlight) - ;;;; tab-line/tab-bar (Emacs 27+) - (tab-line :background bg-alt :foreground bg-alt) - (tab-line-tab :background bg :foreground fg) - (tab-line-tab-inactive :background bg-alt :foreground fg-alt) - ((tab-line-tab-inactive-alternate &inherit tab-line-tab-inactive)) - (tab-line-tab-current :background bg :foreground fg) - ;; (tab-line-special ) - (tab-line-highlight :inherit 'tab-line-tab) - (tab-line-close-highlight :foreground highlight) - ((tab-bar &inherit tab-line)) - ((tab-bar-tab &inherit tab-line-tab)) - ((tab-bar-tab-inactive &inherit tab-line-tab-inactive)) - ;;;; Line numbers - ;; 1. Line number faces must explicitly disable its text style attributes - ;; because nearby faces may "bleed" into the line numbers otherwise. - ;; 2. All other line number plugin faces should &inherit from these. - (line-number - :inherit 'default - :foreground base5 :distant-foreground 'unspecified - :weight 'normal :slant 'unspecified - :underline 'unspecified :strike-through 'unspecified) - (line-number-current-line - :inherit '(hl-line default) - :foreground fg :distant-foreground 'unspecified - :weight 'normal :slant 'unspecified - :underline 'unspecified :strike-through 'unspecified) - - ;;;; --- Package faces ---------------------- - ;; What follows are faces for all the packages doom-themes explicitly - ;; supports. Headings are formatted as such: - ;; - ;; PACKAGE [] [] - ;; - ;; The purpose of this is to make it easy to jump to via `imenu', or search - ;; for with isearch, swiper, etc. - ;;;; agda-mode - (agda2-highlight-keyword-face :inherit 'font-lock-keyword-face) - (agda2-highlight-string-face :inherit 'font-lock-string-face) - (agda2-highlight-number-face :inherit 'font-lock-string-face) - (agda2-highlight-symbol-face :inherit 'font-lock-variable-name-face) - (agda2-highlight-primitive-type-face :inherit 'font-lock-type-face) - (agda2-highlight-bound-variable-face :inherit 'font-lock-variable-name-face) - (agda2-highlight-inductive-constructor-face :inherit 'font-lock-type-face) - (agda2-highlight-coinductive-constructor-face :inherit 'font-lock-type-face) - (agda2-highlight-datatype-face :inherit 'font-lock-type-face) - (agda2-highlight-field-face :inherit 'font-lock-type-face) - (agda2-highlight-function-face :inherit 'font-lock-function-name-face) - (agda2-highlight-module-face :inherit 'font-lock-variable-name-face) - (agda2-highlight-postulate-face :inherit 'font-lock-type-face) - (agda2-highlight-primitive-face :inherit 'font-lock-type-face) - (agda2-highlight-macro-face :inherit 'font-lock-function-name-face) - (agda2-highlight-record-face :inherit 'font-lock-type-face) - (agda2-highlight-error-face :inherit 'font-lock-warning-face) - (agda2-highlight-dotted-face :inherit 'font-lock-variable-name-face) - (agda2-highlight-unsolved-meta-face :inherit 'font-lock-warning-face) - (agda2-highlight-unsolved-constraint-face :inherit 'font-lock-warning-face) - (agda2-highlight-termination-problem-face :inherit 'font-lock-warning-face) - (agda2-highlight-positivity-problem-face :inherit 'font-lock-warning-face) - (agda2-highlight-incomplete-pattern-face :inherit 'font-lock-warning-face) - (agda2-highlight-typechecks-face :inherit 'font-lock-warning-face) - ;;;; auctex - (font-latex-bold-face :inherit 'bold) - (font-latex-italic-face :inherit 'italic) - (font-latex-underline-face :inherit 'underline) - (font-latex-math-face :foreground blue) - (font-latex-sedate-face :inherit 'font-lock-keyword-face) - (font-latex-sectioning-0-face :foreground blue :weight 'ultra-bold) - (font-latex-sectioning-1-face :foreground magenta :weight 'semi-bold) - (font-latex-sectioning-2-face :foreground violet :weight 'semi-bold) - (font-latex-sectioning-3-face :foreground (doom-lighten blue 0.3) :weight 'semi-bold) - (font-latex-sectioning-4-face :foreground (doom-lighten magenta 0.3) :weight 'semi-bold) - (font-latex-sectioning-5-face :foreground (doom-lighten violet 0.3) :weight 'semi-bold) - (font-latex-script-char-face :foreground dark-blue) - (font-latex-string-face :inherit 'font-lock-string-face) - (font-latex-warning-face :inherit 'font-lock-warning-face) - (font-latex-verbatim-face :inherit 'fixed-pitch :foreground violet :slant 'italic) - (TeX-error-description-error :inherit 'error :weight 'bold) - (TeX-error-description-warning :inherit 'warning :weight 'bold) - (TeX-error-description-tex-said :inherit 'success :weight 'bold) - ;;;; alert - (alert-high-face :inherit bold :foreground warning) - (alert-low-face :foreground grey) - (alert-moderate-face :inherit bold :foreground fg-alt) - (alert-trivial-face :foreground doc-comments) - (alert-urgent-face :inherit bold :foreground error) - ;;;; all-the-icons - (all-the-icons-blue :foreground blue) - (all-the-icons-blue-alt :foreground teal) - (all-the-icons-cyan :foreground cyan) - (all-the-icons-cyan-alt :foreground cyan) - (all-the-icons-dblue :foreground dark-blue) - (all-the-icons-dcyan :foreground dark-cyan) - (all-the-icons-dgreen :foreground (doom-darken green 0.3)) - (all-the-icons-dmaroon :foreground (doom-darken magenta 0.3)) - (all-the-icons-dorange :foreground (doom-darken orange 0.3)) - (all-the-icons-dpink :foreground (doom-lighten red 0.15)) - (all-the-icons-dpurple :foreground (doom-darken violet 0.3)) - (all-the-icons-dred :foreground (doom-darken red 0.3)) - (all-the-icons-dsilver :foreground (doom-lighten grey 0.1)) - (all-the-icons-dyellow :foreground (doom-darken yellow 0.3)) - (all-the-icons-green :foreground green) - (all-the-icons-lblue :foreground (doom-lighten blue 0.3)) - (all-the-icons-lcyan :foreground (doom-lighten cyan 0.3)) - (all-the-icons-lgreen :foreground (doom-lighten green 0.3)) - (all-the-icons-lmaroon :foreground (doom-lighten magenta 0.3)) - (all-the-icons-lorange :foreground (doom-lighten orange 0.3)) - (all-the-icons-lpink :foreground (doom-lighten red 0.55)) - (all-the-icons-lpurple :foreground (doom-lighten violet 0.3)) - (all-the-icons-lred :foreground (doom-lighten red 0.3)) - (all-the-icons-lsilver :foreground (doom-lighten grey 0.7)) - (all-the-icons-lyellow :foreground (doom-lighten yellow 0.3)) - (all-the-icons-maroon :foreground magenta) - (all-the-icons-orange :foreground orange) - (all-the-icons-pink :foreground (doom-lighten red 0.35)) - (all-the-icons-purple :foreground violet) - (all-the-icons-purple-alt :foreground (doom-blend violet grey 0.15)) - (all-the-icons-red :foreground red) - (all-the-icons-red-alt :foreground (doom-blend red grey 0.15)) - (all-the-icons-silver :foreground (doom-lighten grey 0.45)) - (all-the-icons-yellow :foreground yellow) - ;;;; all-the-icons-dired - (all-the-icons-dired-dir-face :foreground doc-comments) - ;;;; annotate - (annotate-annotation :background (doom-blend highlight bg 0.1) :foreground doc-comments) - (annotate-annotation-secondary :background (doom-blend green bg 0.1) :foreground doc-comments) - (annotate-highlight :background (doom-blend highlight bg 0.1) :underline highlight) - (annotate-highlight-secondary :background (doom-blend green bg 0.1) :underline green) - ;;;; ansi-color - (ansi-color-black :foreground bg :background bg) - (ansi-color-red :foreground red :background red) - (ansi-color-green :foreground green :background green) - (ansi-color-yellow :foreground yellow :background yellow) - (ansi-color-blue :foreground blue :background blue) - (ansi-color-magenta :foreground magenta :background magenta) - (ansi-color-cyan :foreground cyan :background cyan) - (ansi-color-white :foreground fg :background fg) - ;; This color is used effectively as grayed out foreground text. - ;; base5 and up have too much contrast in light themes; - ;; base5 and lower have too little contrast in dark themes. - (ansi-color-bright-black - (&light :foreground base4 :background base4) - (&dark :foreground base6 :background base6)) - (ansi-color-bright-red :foreground (doom-lighten red 0.15) :background (doom-lighten red 0.15)) - (ansi-color-bright-green :foreground (doom-lighten green 0.15) :background (doom-lighten green 0.15)) - (ansi-color-bright-yellow :foreground (doom-lighten yellow 0.15) :background (doom-lighten yellow 0.15)) - (ansi-color-bright-blue :foreground (doom-lighten blue 0.15) :background (doom-lighten blue 0.15)) - (ansi-color-bright-magenta :foreground (doom-lighten magenta 0.15) :background (doom-lighten magenta 0.15)) - (ansi-color-bright-cyan :foreground (doom-lighten cyan 0.15) :background (doom-lighten cyan 0.15)) - (ansi-color-bright-white :foreground base8 :background base8) - ;;;; anzu - (anzu-replace-highlight :background base0 :foreground red :weight 'bold :strike-through t) - (anzu-replace-to :background base0 :foreground green :weight 'bold) - ;;;; avy - (avy-background-face :foreground comments) - (avy-lead-face :background highlight :foreground bg :distant-foreground fg :weight 'bold) - (avy-lead-face-0 - (&all :inherit 'avy-lead-face) - (&dark :background (doom-lighten highlight 0.3)) - (&light :background (doom-darken highlight 0.3))) - (avy-lead-face-1 - (&all :inherit 'avy-lead-face) - (&dark :background (doom-lighten highlight 0.6)) - (&light :background (doom-darken highlight 0.6))) - (avy-lead-face-2 - (&all :inherit 'avy-lead-face) - (&dark :background (doom-lighten highlight 0.9)) - (&light :background (doom-darken highlight 0.9))) - ;;;; bookmark - (bookmark-face :background (doom-blend highlight bg 0.1) :extend t) - ;;;; bookmark+ - (bmkp-*-mark :foreground bg :background yellow) - (bmkp->-mark :foreground yellow) - (bmkp-D-mark :foreground bg :background red) - (bmkp-X-mark :foreground red) - (bmkp-a-mark :background red) - (bmkp-bad-bookmark :foreground bg :background yellow) - (bmkp-bookmark-file :foreground violet :background bg-alt) - (bmkp-bookmark-list :background bg-alt) - (bmkp-buffer :foreground blue) - (bmkp-desktop :foreground bg :background violet) - (bmkp-file-handler :background red) - (bmkp-function :foreground green) - (bmkp-gnus :foreground orange) - (bmkp-heading :foreground yellow) - (bmkp-info :foreground cyan) - (bmkp-light-autonamed :foreground bg-alt :background cyan) - (bmkp-light-autonamed-region :foreground bg-alt :background red) - (bmkp-light-fringe-autonamed :foreground bg-alt :background violet) - (bmkp-light-fringe-non-autonamed :foreground bg-alt :background green) - (bmkp-light-mark :foreground bg :background cyan) - (bmkp-light-non-autonamed :foreground bg :background violet) - (bmkp-light-non-autonamed-region :foreground bg :background red) - (bmkp-local-directory :foreground bg :background violet) - (bmkp-local-file-with-region :foreground yellow) - (bmkp-local-file-without-region :foreground comments) - (bmkp-man :foreground violet) - (bmkp-no-jump :foreground comments) - (bmkp-no-local :foreground yellow) - (bmkp-non-file :foreground green) - (bmkp-remote-file :foreground orange) - (bmkp-sequence :foreground blue) - (bmkp-su-or-sudo :foreground red) - (bmkp-t-mark :foreground violet) - (bmkp-url :foreground blue :underline t) - (bmkp-variable-list :foreground green) - ;;;; calfw - (calfw-annotation-face :foreground violet) - (calfw-day-title-face :foreground fg :weight 'bold) - (calfw-default-content-face :foreground fg) - (calfw-default-day-face :weight 'bold) - (calfw-disable-face :foreground grey) - (calfw-grid-face :foreground vertical-bar) - (calfw-header-face :foreground (doom-blend blue bg 0.8) :weight 'bold) - (calfw-holiday-face :background bg-alt :weight 'bold) - (calfw-periods-face :foreground yellow) - (calfw-saturday-face :foreground (doom-blend red bg 0.8) :weight 'bold) - (calfw-sunday-face :foreground (doom-blend red bg 0.8) :weight 'bold) - (calfw-title-face :foreground blue :weight 'bold :height 2.0 :inherit 'variable-pitch) - (calfw-today-face :weight 'bold) - (calfw-today-title-face :foreground bg :background blue :weight 'bold) - (calfw-toolbar-button-off-face :foreground base6 :weight 'bold :inherit 'variable-pitch) - (calfw-toolbar-button-on-face :foreground blue :weight 'bold :inherit 'variable-pitch) - (calfw-toolbar-face) - ;;;; centaur-tabs - ((centaur-tabs-default &inherit tab-bar) :box nil) - ((centaur-tabs-selected &inherit tab-bar-tab) :box nil) - ((centaur-tabs-unselected &inherit tab-bar-tab-inactive) :box nil) - (centaur-tabs-selected-modified :background bg :foreground teal) - (centaur-tabs-unselected-modified :background bg-alt :foreground teal) - (centaur-tabs-active-bar-face :background (if (bound-and-true-p -modeline-bright) modeline-bg highlight)) - (centaur-tabs-modified-marker-selected - :foreground (if (bound-and-true-p -modeline-bright) modeline-bg highlight) - :inherit 'centaur-tabs-selected) - (centaur-tabs-modified-marker-unselected - :foreground (if (bound-and-true-p -modeline-bright) modeline-bg highlight) - :inherit 'centaur-tabs-unselected) - ;;;; company - (company-tooltip :inherit 'tooltip) - (company-tooltip-common :foreground highlight :distant-foreground base0 :weight 'bold) - (company-tooltip-search :background highlight :foreground bg :distant-foreground fg :weight 'bold) - (company-tooltip-search-selection :background (doom-darken selection 0.25)) - (company-tooltip-selection :background selection :weight 'bold) - (company-tooltip-mouse :background magenta :foreground bg :distant-foreground fg) - (company-tooltip-annotation :foreground violet :distant-foreground bg) - (company-scrollbar-bg :inherit 'tooltip) - (company-scrollbar-fg :background highlight) - (company-preview :foreground comments) - (company-preview-common :background base3 :foreground highlight) - (company-preview-search :inherit 'company-tooltip-search) - (company-template-field :inherit 'match) - ;;;; company-box - (company-box-candidate :foreground fg) - ;;;; corfu - (corfu-default :inherit 'tooltip) - (corfu-current :background bg :foreground fg) - ;;;; circe - (circe-fool :foreground doc-comments) - (circe-highlight-nick-face :weight 'bold :foreground constants) - (circe-prompt-face :weight 'bold :foreground highlight) - (circe-server-face :foreground comments) - (circe-my-message-face :weight 'bold) - ;;;; cperl - (cperl-array-face :weight 'bold :inherit 'font-lock-variable-name-face) - (cperl-hash-face :weight 'bold :slant 'italic :inherit 'font-lock-variable-name-face) - (cperl-nonoverridable-face :inherit 'font-lock-builtin-face) - ;;;; compilation - (compilation-column-number :inherit 'font-lock-comment-face) - (compilation-line-number :foreground highlight) - (compilation-error :inherit 'error :weight 'bold) - (compilation-warning :inherit 'warning :slant 'italic) - (compilation-info :inherit 'success) - (compilation-mode-line-exit :inherit 'compilation-info) - (compilation-mode-line-fail :inherit 'compilation-error) - ;;;; custom - (custom-button :foreground blue :background bg :box '(:line-width 1 :style nil)) - (custom-button-unraised :foreground violet :background bg :box '(:line-width 1 :style nil)) - (custom-button-pressed-unraised :foreground bg :background violet :box '(:line-width 1 :style nil)) - (custom-button-pressed :foreground bg :background blue :box '(:line-width 1 :style nil)) - (custom-button-mouse :foreground bg :background blue :box '(:line-width 1 :style nil)) - (custom-variable-button :foreground green :underline t) - (custom-saved :foreground green :background (doom-blend green bg 0.2) :bold bold) - (custom-comment :foreground fg :background region) - (custom-comment-tag :foreground grey) - (custom-modified :foreground blue :background (doom-blend blue bg 0.2)) - (custom-variable-tag :foreground magenta) - (custom-visibility :foreground blue) - (custom-group-subtitle :foreground red) - (custom-group-tag :foreground violet) - (custom-group-tag-1 :foreground blue) - (custom-set :foreground yellow :background bg) - (custom-themed :foreground yellow :background bg) - (custom-invalid :foreground red :background (doom-blend red bg 0.2)) - (custom-variable-obsolete :foreground grey :background bg) - (custom-state :foreground green :background (doom-blend green bg 0.2)) - (custom-changed :foreground blue :background bg) - ;;;; cider - ;; (cider-stacktrace-error-class-face :inherit 'font-lock-warning-face) - ;; (cider-stacktrace-error-message-face :inherit 'font-lock-doc-face) - ;; (cider-stacktrace-filter-active-face :inherit 'button :underline t :weight 'normal) - ;; (cider-stacktrace-filter-inactive-face :inherit 'cider-stacktrace-filter-active-face :underline nil) - ;; (cider-stacktrace-face :inherit 'default) - ;; (cider-stacktrace-ns-face :inherit 'font-lock-comment-face) - ;; (cider-stacktrace-fn-face :inherit 'default :weight 'bold) - ;; (cider-docview-emphasis-face :inherit 'default :underline t) - ;; (cider-docview-strong-face :inherit 'default :underline t :weight 'bold) - ;; (cider-docview-literal-face :inherit 'font-lock-string-face) - ;; (cider-docview-table-border-face :inherit 'shadow) - (cider-debug-code-overlay-face :background base3) - ;; (cider-debug-prompt-face :inherit font-lock-builtin-face :underline t) - (cider-enlightened-face - :inherit 'cider-result-overlay-face :box `(:color ,orange :line-width -1)) - (cider-enlightened-local-face :foreground orange :weight 'bold) - ;; (cider-repl-prompt-face :inherit 'font-lock-keyword-face) - ;; (cider-repl-stdout-face :inherit 'font-lock-string-face) - ;; (cider-repl-stderr-face :inherit 'font-lock-warning-face) - ;; (cider-repl-input-face :weight 'bold) - ;; (cider-repl-result-face ) - (cider-result-overlay-face :background base3 :box `(:line-width -1 :color ,base5)) - (cider-fringe-good-face :foreground green) - (cider-deprecated-face :background (doom-blend bg yellow 0.8)) - (cider-instrumented-face :background (doom-blend bg red 0.8)) - (cider-traced-face :background (doom-blend bg cyan 0.8)) - ;; (cider-reader-conditional-face :inherit 'font-lock-comment-face) - (cider-error-highlight-face - `((((supports :underline (:style wave))) - (:inherit unspecified :underline (:style wave :color ,(car error)))) - (t (:inherit font-lock-warning-face :underline t)))) - (cider-warning-highlight-face - `((((supports :underline (:style wave))) - (:underline (:style wave :color ,(car warning)) :inherit unspecified)) - (t (:inherit font-lock-warning-face :underline (:color ,(car warning)))))) - (cider-test-failure-face :background (doom-blend bg error 0.7)) - (cider-test-error-face :background orange) - (cider-test-success-face - (&light :foreground base0 :background green) - (&dark :foreground green :background base0)) - ;;;; diff-hl - (diff-hl-change :foreground vc-modified :background vc-modified) - (diff-hl-delete :foreground vc-deleted :background vc-deleted) - (diff-hl-insert :foreground vc-added :background vc-added) - ;;;; diff-mode - (diff-added :inherit 'hl-line :foreground green) - (diff-changed :foreground violet) - (diff-context - (&dark :foreground (doom-darken fg 0.12)) - (&light :foreground (doom-lighten fg 0.12))) - (diff-removed :foreground red :background base3) - (diff-header :foreground cyan) - (diff-file-header :foreground blue) - (diff-hunk-header :foreground violet) - (diff-indicator-added :foreground vc-added) - (diff-indicator-changed :foreground vc-modified) - (diff-indicator-removed :foreground vc-deleted) - (diff-refine-added :inherit 'diff-added :inverse-video t) - (diff-refine-changed :inherit 'diff-changed :inverse-video t) - (diff-refine-removed :inherit 'diff-removed :inverse-video t) - ;;;; dired - (dired-directory :foreground builtin) - (dired-ignored :foreground comments) - (dired-flagged :foreground red) - (dired-header :foreground blue :weight 'bold) - (dired-mark :foreground orange :weight 'bold) - (dired-marked :foreground magenta :weight 'bold :inverse-video t) - (dired-perm-write :foreground fg :underline t) - (dired-symlink :foreground cyan :weight 'bold) - (dired-warning :foreground warning) - ;;;; dired+ - (diredp-file-name :foreground base8) - (diredp-dir-name :foreground base8 :weight 'bold) - (diredp-ignored-file-name :foreground base5) - (diredp-compressed-file-suffix :foreground base5) - (diredp-symlink :foreground violet) - (diredp-dir-heading :foreground blue :weight 'bold) - (diredp-file-suffix :foreground violet) - (diredp-read-priv :foreground magenta) - (diredp-write-priv :foreground green) - (diredp-exec-priv :foreground yellow) - (diredp-rare-priv :foreground red :weight 'bold) - (diredp-dir-priv :foreground blue :weight 'bold) - (diredp-no-priv :foreground base5) - (diredp-number :foreground magenta) - (diredp-date-time :foreground blue) - ;;;; dired-k - (dired-k-modified :foreground vc-modified :weight 'bold) - (dired-k-commited :foreground green :weight 'bold) - (dired-k-added :foreground vc-added :weight 'bold) - (dired-k-untracked :foreground teal :weight 'bold) - (dired-k-ignored :foreground base5 :weight 'bold) - (dired-k-directory :foreground blue :weight 'bold) - ;;;; dired-subtree - (dired-subtree-depth-1-face :background (doom-darken bg-alt 0.02)) - (dired-subtree-depth-2-face :background (doom-darken bg-alt 0.04)) - (dired-subtree-depth-3-face :background (doom-darken bg-alt 0.06)) - (dired-subtree-depth-4-face :background (doom-darken bg-alt 0.08)) - (dired-subtree-depth-5-face :background (doom-darken bg-alt 0.10)) - (dired-subtree-depth-6-face :background (doom-darken bg-alt 0.12)) - ;;;; diredfl - (diredfl-autofile-name :foreground base4) - (diredfl-compressed-file-name :foreground yellow) - (diredfl-compressed-file-suffix :foreground (doom-blend orange bg 0.6)) - (diredfl-date-time :foreground cyan :weight 'light) - (diredfl-deletion :foreground red :background (doom-blend red bg 0.2) :weight 'bold) - (diredfl-deletion-file-name :foreground red :background (doom-blend red bg 0.2)) - (diredfl-dir-heading :foreground blue :weight 'bold) - (diredfl-dir-name :foreground blue) - (diredfl-dir-priv :foreground blue) - (diredfl-exec-priv :foreground green) - (diredfl-executable-tag :foreground green) - (diredfl-file-name :foreground fg) - (diredfl-file-suffix :foreground (doom-blend fg bg 0.6)) - (diredfl-flag-mark :foreground yellow :background (doom-blend yellow bg 0.2) :weight 'bold) - (diredfl-flag-mark-line :background (doom-blend yellow bg 0.1)) - (diredfl-ignored-file-name :foreground comments) - (diredfl-link-priv :foreground violet) - (diredfl-no-priv :inherit 'shadow) - (diredfl-number :foreground orange) - (diredfl-other-priv :foreground magenta) - (diredfl-rare-priv :foreground fg) - (diredfl-read-priv :foreground yellow) - (diredfl-symlink :foreground violet) - (diredfl-tagged-autofile-name :foreground base5) - (diredfl-write-priv :foreground red) - ;;;; disk-usage - (disk-usage-children :foreground yellow) - (disk-usage-percent :foreground violet) - (disk-usage-size :foreground blue) - (disk-usage-symlink :foreground cyan :weight 'bold) - ;;;; doom-modeline - (doom-modeline-eldoc-bar :background green) - (doom-modeline-bar-inactive) ; transparent - ;;;; doom-themes - (doom-themes-visual-bell :background error) - ;;;; ediff - (ediff-fine-diff-A :inherit 'diff-refine-removed) - (ediff-fine-diff-B :inherit 'diff-refine-added) - (ediff-fine-diff-C :inherit 'ediff-fine-diff-A) - (ediff-current-diff-A :foreground vc-deleted :background (doom-blend vc-deleted base3 0.2) :extend t) - (ediff-current-diff-B :foreground vc-added :background (doom-blend vc-added bg 0.2) :extend t) - (ediff-current-diff-C :inherit 'ediff-current-diff-A) - (ediff-even-diff-A :inherit 'hl-line) - (ediff-even-diff-B :inherit 'ediff-even-diff-A) - (ediff-even-diff-C :inherit 'ediff-even-diff-A) - (ediff-odd-diff-A :inherit 'ediff-even-diff-A) - (ediff-odd-diff-B :inherit 'ediff-odd-diff-A) - (ediff-odd-diff-C :inherit 'ediff-odd-diff-A) - ;;;; elfeed - (elfeed-log-debug-level-face :foreground comments) - (elfeed-log-error-level-face :inherit 'error) - (elfeed-log-info-level-face :inherit 'success) - (elfeed-log-warn-level-face :inherit 'warning) - (elfeed-search-date-face :foreground violet) - (elfeed-search-feed-face :foreground blue) - (elfeed-search-tag-face :foreground comments) - (elfeed-search-title-face :foreground comments) - (elfeed-search-filter-face :foreground violet) - (elfeed-search-unread-count-face :foreground yellow) - (elfeed-search-unread-title-face :foreground fg :weight 'bold) - ;;;; elixir-mode - (elixir-atom-face (&light :foreground dark-blue) - (&dark :foreground cyan)) - (elixir-attribute-face :foreground violet) - ;;;; elscreen - (elscreen-tab-background-face :background bg) - (elscreen-tab-control-face :background bg :foreground bg) - (elscreen-tab-current-screen-face :background bg-alt :foreground fg) - (elscreen-tab-other-screen-face :background bg :foreground fg-alt) - ;;;; embark - ((embark-target &inherit vertico-current)) - ;;;; enh-ruby-mode - (enh-ruby-heredoc-delimiter-face :inherit 'font-lock-string-face) - (enh-ruby-op-face :foreground operators) - (enh-ruby-regexp-delimiter-face :inherit 'enh-ruby-regexp-face) - (enh-ruby-regexp-face :foreground constants) - (enh-ruby-string-delimiter-face :inherit 'font-lock-string-face) - (erm-syn-errline :underline `(:style wave :color ,error)) - (erm-syn-warnline :underline `(:style wave :color ,warning)) - ;;;; erc - (erc-button :weight 'bold :underline t) - (erc-default-face :inherit 'default) - (erc-action-face :weight 'bold) - (erc-command-indicator-face :weight 'bold) - (erc-direct-msg-face :foreground magenta) - (erc-error-face :inherit 'error) - (erc-header-line :background (doom-darken bg-alt 0.15) :foreground highlight) - (erc-input-face :foreground green) - (erc-current-nick-face :foreground green :weight 'bold) - (erc-timestamp-face :foreground blue :weight 'bold) - (erc-nick-default-face :weight 'bold) - (erc-nick-msg-face :foreground magenta) - (erc-nick-prefix-face :inherit 'erc-nick-default-face) - (erc-my-nick-face :foreground green :weight 'bold) - (erc-my-nick-prefix-face :inherit 'erc-my-nick-face) - (erc-notice-face :foreground comments) - (erc-prompt-face :foreground highlight :weight 'bold) - ;;;; eshell - (eshell-prompt :foreground highlight :weight 'bold) - (eshell-ls-archive :foreground magenta) - (eshell-ls-backup :foreground yellow) - (eshell-ls-clutter :foreground red) - (eshell-ls-directory :foreground blue) - (eshell-ls-executable :foreground green) - (eshell-ls-missing :foreground red) - (eshell-ls-product :foreground orange) - (eshell-ls-readonly :foreground orange) - (eshell-ls-special :foreground violet) - (eshell-ls-symlink :foreground cyan) - (eshell-ls-unreadable :foreground base5) - ;;;; evil - (evil-ex-info :foreground error :slant 'italic) - (evil-ex-search :background highlight :foreground base0 :weight 'bold) - (evil-ex-substitute-matches :background base0 :foreground red :weight 'bold :strike-through t) - (evil-ex-substitute-replacement :background base0 :foreground green :weight 'bold) - (evil-search-highlight-persist-highlight-face :inherit 'lazy-highlight) - ;;;; evil-mc - (evil-mc-cursor-default-face :background magenta :foreground base0) - (evil-mc-region-face :inherit 'region) - (evil-mc-cursor-bar-face :height 1 :background magenta :foreground base0) - (evil-mc-cursor-hbar-face :underline `(:color ,highlight)) - ;;;; evil-snipe - (evil-snipe-first-match-face :foreground highlight :background dark-blue :weight 'bold) - (evil-snipe-matches-face :foreground highlight :underline t :weight 'bold) - ;;;; evil-googles - (evil-goggles-default-face :inherit 'region :background (doom-blend region bg 0.5)) - ;;;; eww - (eww-form-checkbox :inherit 'eww-form-file) - (eww-form-file :inherit 'eww-form-submit :background bg-alt) - (eww-form-select :inherit 'eww-form-submit :background bg-alt) - (eww-form-submit :inherit 'eww-form-text :box `(:line-width 2 :style released-button) :background base2) - (eww-form-text :box `(:line-width 1 :color ,base3) :background bg :foreground fg :distant-foreground bg) - (eww-form-textarea :inherit 'eww-form-text) - (eww-invalid-certificate :foreground error) - (eww-valid-certificate :foreground highlight) - ;;;; eyebrowse - (eyebrowse-mode-line-active :weight 'bold :foreground highlight) - ;;;; flycheck - (flycheck-error :underline `(:style wave :color ,red)) - (flycheck-warning :underline `(:style wave :color ,yellow)) - (flycheck-info :underline `(:style wave :color ,green)) - (flycheck-fringe-error :inherit 'fringe :foreground error) - (flycheck-fringe-warning :inherit 'fringe :foreground warning) - (flycheck-fringe-info :inherit 'fringe :foreground success) - ;;;; flycheck-posframe - (flycheck-posframe-face :inherit 'default) - (flycheck-posframe-background-face :background bg-alt) - (flycheck-posframe-error-face :inherit 'flycheck-posframe-face :foreground error) - (flycheck-posframe-info-face :inherit 'flycheck-posframe-face :foreground success) - (flycheck-posframe-warning-face :inherit 'flycheck-posframe-face :foreground warning) - ;;;; flymake - (flymake-error :underline `(:style wave :color ,red)) - (flymake-note :underline `(:style wave :color ,green)) - (flymake-warning :underline `(:style wave :color ,orange)) - ;;;; flyspell - (flyspell-incorrect :underline `(:style wave :color ,error)) - (flyspell-duplicate :underline `(:style wave :color ,warning)) - ;;;; flx-ido - (flx-highlight-face :weight 'bold :foreground yellow :underline nil) - ;;;; forge - (forge-dimmed :inherit 'magit-dimmed) - (forge-pullreq-open :inherit 'forge-issue-open) - (forge-pullreq-merged :inherit 'forge-issue-completed) - (forge-pullreq-rejected :inherit 'forge-issue-unplanned) - ;;;; git-commit - (git-commit-summary :foreground strings) - (git-commit-overlong-summary :inherit 'error :background base0 :slant 'italic :weight 'bold) - (git-commit-nonempty-second-line :inherit 'git-commit-overlong-summary) - (git-commit-keyword :foreground cyan :slant 'italic) - (git-commit-pseudo-header :foreground doc-comments :slant 'italic) - (git-commit-known-pseudo-header :foreground doc-comments :weight 'bold :slant 'italic) - (git-commit-comment-branch-local :foreground magenta) - (git-commit-comment-branch-remote :foreground green) - (git-commit-comment-detached :foreground orange) - (git-commit-comment-heading :foreground keywords) - (git-commit-comment-file :foreground violet) - (git-commit-comment-action) - ;;;; git-gutter - (git-gutter:modified :inherit 'fringe :foreground vc-modified) - (git-gutter:added :inherit 'fringe :foreground vc-added) - (git-gutter:deleted :inherit 'fringe :foreground vc-deleted) - ;;;; git-gutter+ - (git-gutter+-modified :inherit 'fringe :foreground vc-modified :background 'unspecified) - (git-gutter+-added :inherit 'fringe :foreground vc-added :background 'unspecified) - (git-gutter+-deleted :inherit 'fringe :foreground vc-deleted :background 'unspecified) - ;;;; git-gutter-fringe - ((git-gutter-fr:modified &inherit git-gutter:modified)) - ((git-gutter-fr:added &inherit git-gutter:added)) - ((git-gutter-fr:deleted &inherit git-gutter:deleted)) - ;;;; gnus (built-in) - (gnus-group-mail-1 :weight 'bold :foreground fg) - (gnus-group-mail-2 :inherit 'gnus-group-mail-1) - (gnus-group-mail-3 :inherit 'gnus-group-mail-1) - (gnus-group-mail-1-empty :foreground base5) - (gnus-group-mail-2-empty :inherit 'gnus-group-mail-1-empty) - (gnus-group-mail-3-empty :inherit 'gnus-group-mail-1-empty) - (gnus-group-news-1 :inherit 'gnus-group-mail-1) - (gnus-group-news-2 :inherit 'gnus-group-news-1) - (gnus-group-news-3 :inherit 'gnus-group-news-1) - (gnus-group-news-4 :inherit 'gnus-group-news-1) - (gnus-group-news-5 :inherit 'gnus-group-news-1) - (gnus-group-news-6 :inherit 'gnus-group-news-1) - (gnus-group-news-1-empty :inherit 'gnus-group-mail-1-empty) - (gnus-group-news-2-empty :inherit 'gnus-group-news-1-empty) - (gnus-group-news-3-empty :inherit 'gnus-group-news-1-empty) - (gnus-group-news-4-empty :inherit 'gnus-group-news-1-empty) - (gnus-group-news-5-empty :inherit 'gnus-group-news-1-empty) - (gnus-group-news-6-empty :inherit 'gnus-group-news-1-empty) - (gnus-group-mail-low :inherit 'gnus-group-mail-1 :weight 'normal) - (gnus-group-mail-low-empty :inherit 'gnus-group-mail-1-empty) - (gnus-group-news-low-empty :inherit 'gnus-group-news-low :weight 'normal) - (gnus-group-news-low :inherit 'gnus-group-mail-1 :foreground base5) - (gnus-header-content :inherit 'message-header-other) - (gnus-header-from :inherit 'message-header-other) - (gnus-header-name :inherit 'message-header-name) - (gnus-header-newsgroups :inherit 'message-header-other) - (gnus-header-subject :inherit 'message-header-subject) - (gnus-summary-cancelled :foreground red :strike-through t) - (gnus-summary-high-ancient :foreground (doom-lighten base5 0.2) :inherit 'italic) - (gnus-summary-high-read :foreground (doom-lighten fg 0.2)) - (gnus-summary-high-ticked :foreground (doom-lighten magenta 0.2)) - (gnus-summary-high-unread :foreground (doom-lighten green 0.2)) - (gnus-summary-low-ancient :foreground (doom-darken base5 0.2) :inherit 'italic) - (gnus-summary-low-read :foreground (doom-darken fg 0.2)) - (gnus-summary-low-ticked :foreground (doom-darken magenta 0.2)) - (gnus-summary-low-unread :foreground (doom-darken green 0.2)) - (gnus-summary-normal-ancient :foreground base5 :inherit 'italic) - (gnus-summary-normal-read :foreground fg) - (gnus-summary-normal-ticked :foreground magenta) - (gnus-summary-normal-unread :foreground green :inherit 'bold) - (gnus-summary-selected :foreground blue :weight 'bold) - (gnus-cite-1 :foreground violet) - (gnus-cite-2 :foreground yellow) - (gnus-cite-3 :foreground magenta) - (gnus-cite-4 :foreground green) - (gnus-cite-5 :foreground green) - (gnus-cite-6 :foreground green) - (gnus-cite-7 :foreground magenta) - (gnus-cite-8 :foreground magenta) - (gnus-cite-9 :foreground magenta) - (gnus-cite-10 :foreground yellow) - (gnus-cite-11 :foreground yellow) - (gnus-signature :foreground yellow) - (gnus-x-face :background base5 :foreground fg) - ;;;; goggles - (goggles-changed :inherit 'region) - (goggles-removed :background (doom-blend red bg-alt 0.25) :extend t) - (goggles-added :background (doom-blend green bg-alt 0.25)) - ;;;; helm - (helm-selection - (&all :inherit 'bold :background selection :extend t) - (&dark :distant-foreground highlight) - (&light :distant-foreground base0)) - (helm-match :inherit 'bold :foreground highlight :distant-foreground base8) - (helm-source-header :background base2 :foreground keywords :weight 'bold) - (helm-visible-mark :inherit '(bold highlight)) - (helm-moccur-buffer :inherit 'link) - (helm-ff-file :foreground fg) - (helm-ff-prefix :foreground keywords) - (helm-ff-dotted-directory :foreground grey) - (helm-ff-directory :foreground variables) - (helm-ff-executable :foreground base8 :inherit 'italic) - (helm-grep-match :foreground highlight :distant-foreground red) - (helm-grep-file :foreground methods) - (helm-grep-lineno :foreground base5) - (helm-grep-finish :foreground green) - ;;;; helm-swoop - (helm-swoop-target-line-face :foreground highlight :inverse-video t) - (helm-swoop-target-line-block-face :foreground yellow) - (helm-swoop-target-word-face :foreground green :inherit 'bold) - (helm-swoop-target-number-face :foreground base5) - ;;;; helm-rg - (helm-rg-active-arg-face :foreground green :weight 'normal) - (helm-rg-base-rg-cmd-face :foreground grey :weight 'normal) - (helm-rg-colon-separator-ripgrep-output-face :foreground base8) - (helm-rg-directory-cmd-face :foreground (doom-darken yellow 0.25) :background base0 :weight 'normal) - (helm-rg-directory-header-face :foreground base8 :background base0 :weight 'bold) - (helm-rg-error-message :foreground red) - (helm-rg-extra-arg-face :foreground yellow :weight 'normal) - (helm-rg-file-match-face :foreground cyan :underline t) - (helm-rg-inactive-arg-face :foreground grey :weight 'normal) - (helm-rg-line-number-match-face :foreground orange :underline t) - (helm-rg-match-text-face :foreground base8 :background violet) - (helm-rg-title-face :foreground violet :background base0 :weight 'bold) - ;;;; helpful - (helpful-heading :weight 'bold :height 1.2) - ;;;; hi-lock - (hi-yellow :background yellow) - (hi-pink :background magenta) - (hi-red-b :foreground red :weight 'bold) - (hi-green :background green) - (hi-green-b :foreground green :weight 'bold) - (hi-blue :background blue) - (hi-blue-b :foreground blue :weight 'bold) - ;; (hi-black-b :weight 'bold) - ;; (hi-black-hb :inherit 'variable-pitch :weight 'bold :height 1.67) - ;;;; hideshow - (+fold-hideshow-folded-face ; this is defined in Doom Emacs, only - :inherit 'font-lock-comment-face - :weight 'light - :background (doom-darken bg 0.15)) - ;;;; highlight-numbers-mode - (highlight-numbers-number :inherit 'bold :foreground numbers) - ;;;; highlight-indentation-mode - (highlight-indentation-face :inherit 'hl-line) - (highlight-indentation-current-column-face :background base1) - (highlight-indentation-guides-odd-face :inherit 'highlight-indentation-face) - (highlight-indentation-guides-even-face :inherit 'highlight-indentation-face) - ;;;; highlight-quoted-mode - (highlight-quoted-symbol :foreground type) - (highlight-quoted-quote :foreground operators) - ;;;; highlight-symbol - (highlight-symbol-face - (&dark :background (doom-lighten region 0.1) :distant-foreground fg-alt) - (&light :background (doom-darken region 0.1) :distant-foreground fg-alt)) - ;;;; highlight-thing - (highlight-thing - (&dark :background (doom-lighten region 0.1) :distant-foreground fg-alt) - (&light :background (doom-darken region 0.1) :distant-foreground fg-alt)) - ;;;; hl-fill-column-face - (hl-fill-column-face :inherit '(hl-line shadow)) - ;;;; hl-line (built-in) - (hl-line :background bg-alt :extend t) - ;;;; hl-todo - (hl-todo :foreground red :weight 'bold) - ;;;; hlinum - (linum-highlight-face :foreground fg :weight 'normal) - ;;;; hydra - (hydra-face-red :foreground red :weight 'bold) - (hydra-face-blue :foreground blue :weight 'bold) - (hydra-face-amaranth :foreground magenta :weight 'bold) - (hydra-face-pink :foreground violet :weight 'bold) - (hydra-face-teal :foreground teal :weight 'bold) - ;;;; iedit - (iedit-occurrence :foreground magenta :weight 'bold :inverse-video t) - (iedit-read-only-occurrence :inherit 'region) - ;;;; ido - (ido-first-match :foreground orange) - (ido-indicator :foreground red :background bg) - (ido-only-match :foreground green) - (ido-subdir :foreground violet) - (ido-virtual :foreground comments) - ;;;; imenu-list - ;; (imenu-list-entry-face) - (imenu-list-entry-face-0 :foreground highlight) - (imenu-list-entry-subalist-face-0 :inherit 'imenu-list-entry-face-0 :weight 'bold) - (imenu-list-entry-face-1 :foreground green) - (imenu-list-entry-subalist-face-1 :inherit 'imenu-list-entry-face-1 :weight 'bold) - (imenu-list-entry-face-2 :foreground yellow) - (imenu-list-entry-subalist-face-2 :inherit 'imenu-list-entry-face-2 :weight 'bold) - ;;;; indent-guide - ((indent-guide-face &inherit highlight-indentation-face)) - ;;;; isearch - (isearch :inherit 'lazy-highlight :weight 'bold) - (isearch-fail :background error :foreground base0 :weight 'bold) - ;;;; ivy - (ivy-current-match :background region :extend t) - (ivy-minibuffer-match-face-1 - :foreground (doom-lighten grey 0.14) - :weight 'light) - (ivy-minibuffer-match-face-2 - :inherit 'ivy-minibuffer-match-face-1 - :foreground magenta :background base1 :weight 'semi-bold) - (ivy-minibuffer-match-face-3 - :inherit 'ivy-minibuffer-match-face-2 - :foreground green :weight 'semi-bold) - (ivy-minibuffer-match-face-4 - :inherit 'ivy-minibuffer-match-face-2 - :foreground yellow :weight 'semi-bold) - (ivy-minibuffer-match-highlight :foreground violet) - (ivy-highlight-face :foreground violet) - (ivy-confirm-face :foreground success) - (ivy-match-required-face :foreground error) - (ivy-virtual :inherit 'italic :foreground doc-comments) - (ivy-modified-buffer :inherit 'bold :foreground warning) - ;;;; ivy-posframe - (ivy-posframe :background (doom-darken bg-alt 0.2)) - (ivy-posframe-border :inherit 'internal-border) - ;;;; selectrum - (selectrum-current-candidate :background region :extend t) - ;;;; vertico - (vertico-current :background region :extend t) - ;;;; vertico-posframe - ;;(vertico-posframe :inherit 'default) - (vertico-posframe-border :background grey) - (vertico-posframe-border-2 :background red) - (vertico-posframe-border-3 :background green) - (vertico-posframe-border-4 :background blue) - (vertico-posframe-border-fallback :background yellow) - ;;;; jabber - (jabber-activity-face :foreground red :weight 'bold) - (jabber-activity-personal-face :foreground blue :weight 'bold) - (jabber-chat-error :foreground red :weight 'bold) - (jabber-chat-prompt-foreign :foreground red :weight 'bold) - (jabber-chat-prompt-local :foreground blue :weight 'bold) - (jabber-chat-prompt-system :foreground green :weight 'bold) - (jabber-chat-text-foreign :foreground fg) - (jabber-chat-text-local :foreground fg) - (jabber-rare-time-face :foreground green) - (jabber-roster-user-away :foreground yellow) - (jabber-roster-user-chatty :foreground green :weight 'bold) - (jabber-roster-user-dnd :foreground red) - (jabber-roster-user-error :foreground red) - (jabber-roster-user-offline :foreground fg) - (jabber-roster-user-online :foreground green :weight 'bold) - (jabber-roster-user-xa :foreground cyan) - ;;;; jdee - (jdee-font-lock-number-face :foreground numbers) - (jdee-font-lock-operator-face :foreground operators) - (jdee-font-lock-constant-face :inherit 'font-lock-constant-face) - (jdee-font-lock-constructor-face :foreground methods) - (jdee-font-lock-public-face :inherit 'font-lock-keyword-face) - (jdee-font-lock-protected-face :inherit 'font-lock-keyword-face) - (jdee-font-lock-private-face :inherit 'font-lock-keyword-face) - (jdee-font-lock-modifier-face :inherit 'font-lock-type-face) - (jdee-font-lock-doc-tag-face :foreground violet) - (jdee-font-lock-italic-face :inherit 'italic) - (jdee-font-lock-bold-face :inherit 'bold) - (jdee-font-lock-link-face :foreground blue :slant nil :underline t) - ;;;; js2-mode - (js2-function-param :foreground variables) - (js2-function-call :foreground functions) - (js2-object-property :foreground violet) - (js2-jsdoc-tag :foreground doc-comments) - (js2-external-variable :foreground operators) - ;;;; keycast - (keycast-command :inherit 'mode-line-emphasis) - (keycast-key :inherit '(bold mode-line-highlight)) - ;;;; ledger-mode - (ledger-font-posting-date-face :foreground blue) - (ledger-font-posting-amount-face :foreground yellow) - (ledger-font-posting-account-face :foreground base8) - (ledger-font-payee-cleared-face :foreground violet :weight 'bold) - (ledger-font-payee-uncleared-face :foreground base5 :weight 'bold) - (ledger-font-xact-highlight-face :background base0) - ;;;; linum - ((linum &inherit line-number)) - ;;;; linum-relative - ((linum-relative-current-face &inherit line-number-current-line)) - ;;;; lui - (lui-time-stamp-face :foreground violet) - (lui-highlight-face :foreground highlight) - (lui-button-face :foreground builtin :underline t) - ;;;; magit - (magit-bisect-bad :foreground red) - (magit-bisect-good :foreground green) - (magit-bisect-skip :foreground orange) - (magit-blame-hash :foreground cyan) - (magit-blame-date :foreground red) - (magit-blame-heading :foreground orange :background base3 :extend t) - (magit-branch-current :foreground blue) - (magit-branch-local :foreground cyan) - (magit-branch-remote :foreground green) - (magit-cherry-equivalent :foreground violet) - (magit-cherry-unmatched :foreground cyan) - (magit-diff-added :foreground (doom-darken vc-added 0.2) :background (doom-blend vc-added bg 0.1) :extend t) - (magit-diff-added-highlight :foreground vc-added :background (doom-blend vc-added bg 0.2) :weight 'bold :extend t) - (magit-diff-base :foreground (doom-darken orange 0.2) :background (doom-blend orange bg 0.1) :extend t) - (magit-diff-base-highlight :foreground orange :background (doom-blend orange bg 0.2) :weight 'bold :extend t) - (magit-diff-context :foreground (doom-darken fg 0.4) :background bg :extend t) - (magit-diff-context-highlight :foreground fg :background bg-alt :extend t) - (magit-diff-file-heading :foreground fg :weight 'bold :extend t) - (magit-diff-file-heading-selection :foreground magenta :background dark-blue :weight 'bold :extend t) - (magit-diff-hunk-heading :foreground bg :background (doom-blend violet bg 0.3) :extend t) - (magit-diff-hunk-heading-highlight :foreground bg :background violet :weight 'bold :extend t) - (magit-diff-lines-heading :foreground yellow :background red :extend t :extend t) - (magit-diff-removed :foreground (doom-darken vc-deleted 0.2) :background (doom-blend vc-deleted base3 0.1) :extend t) - (magit-diff-removed-highlight :foreground vc-deleted :background (doom-blend vc-deleted base3 0.2) :weight 'bold :extend t) - (magit-diffstat-added :foreground vc-added) - (magit-diffstat-removed :foreground vc-deleted) - (magit-dimmed :foreground fg-alt) - (magit-hash :foreground comments) - (magit-header-line :background dark-blue :foreground base8 :weight 'bold - :box `(:line-width 3 :color ,dark-blue)) - (magit-filename :foreground violet) - (magit-log-author :foreground orange) - (magit-log-date :foreground blue) - (magit-log-graph :foreground comments) - (magit-process-ng :inherit 'error) - (magit-process-ok :inherit 'success) - (magit-reflog-amend :foreground magenta) - (magit-reflog-checkout :foreground blue) - (magit-reflog-cherry-pick :foreground green) - (magit-reflog-commit :foreground green) - (magit-reflog-merge :foreground green) - (magit-reflog-other :foreground cyan) - (magit-reflog-rebase :foreground magenta) - (magit-reflog-remote :foreground cyan) - (magit-reflog-reset :inherit 'error) - (magit-refname :foreground comments) - (magit-section-heading :foreground blue :weight 'bold :extend t) - (magit-section-heading-selection :foreground orange :weight 'bold :extend t) - (magit-section-highlight :inherit 'hl-line) - (magit-section-secondary-heading :foreground violet :weight 'bold :extend t) - (magit-sequence-drop :foreground red) - (magit-sequence-head :foreground blue) - (magit-sequence-part :foreground orange) - (magit-sequence-stop :foreground green) - (magit-signature-bad :inherit 'error) - (magit-signature-error :inherit 'error) - (magit-signature-expired :foreground orange) - (magit-signature-good :inherit 'success) - (magit-signature-revoked :foreground magenta) - (magit-signature-untrusted :foreground yellow) - (magit-tag :foreground yellow) - ;;;; make-mode - (makefile-targets :foreground blue) - ;;;; man - (Man-overstrike :inherit 'bold :foreground operators) - (Man-underline :inherit 'underline :foreground keywords) - ;;;; markdown-mode - (markdown-header-face :inherit 'bold :foreground highlight) - (markdown-header-delimiter-face :inherit 'markdown-header-face) - (markdown-metadata-key-face :foreground red) - (markdown-list-face :foreground red) - (markdown-link-face :foreground highlight) - (markdown-url-face :foreground magenta :weight 'normal) - (markdown-italic-face :inherit 'italic :foreground violet) - (markdown-bold-face :inherit 'bold :foreground orange) - (markdown-markup-face :foreground operators) - (markdown-blockquote-face :inherit 'italic :foreground doc-comments) - (markdown-pre-face :foreground strings) - (markdown-code-face :background base3 :extend t) - (markdown-reference-face :foreground doc-comments) - (markdown-inline-code-face :inherit '(markdown-code-face markdown-pre-face) :extend nil) - (markdown-html-attr-name-face :inherit 'font-lock-variable-name-face) - (markdown-html-attr-value-face :inherit 'font-lock-string-face) - (markdown-html-entity-face :inherit 'font-lock-variable-name-face) - (markdown-html-tag-delimiter-face :inherit 'markdown-markup-face) - (markdown-html-tag-name-face :inherit 'font-lock-keyword-face) - ;;;; marginalia - (marginalia-documentation :inherit 'font-lock-doc-face) - (marginalia-file-priv-dir :foreground blue) - (marginalia-file-priv-exec :foreground green) - (marginalia-file-priv-link :foreground violet) - (marginalia-file-priv-other :foreground magenta) - (marginalia-file-priv-rare :foreground fg) - (marginalia-file-priv-read :foreground yellow) - (marginalia-file-priv-write :foreground red) - (marginalia-number :foreground numbers) - (marginalia-size :foreground violet) - (marginalia-lighter :foreground violet) - ;;;; message - (message-header-name :foreground green) - (message-header-subject :foreground highlight :weight 'bold) - (message-header-to :foreground highlight :weight 'bold) - (message-header-cc :inherit 'message-header-to :foreground (doom-darken highlight 0.15)) - (message-header-other :foreground violet) - (message-header-newsgroups :foreground yellow) - (message-header-xheader :foreground doc-comments) - (message-separator :foreground comments) - (message-mml :foreground comments :slant 'italic) - ((message-cited-text &inherit gnus-cite-1)) - ((message-cited-text-1 &inherit gnus-cite-2)) - ((message-cited-text-2 &inherit gnus-cite-3)) - ((message-cited-text-3 &inherit gnus-cite-4)) - ((message-cited-text-4 &inherit gnus-cite-5)) - ;;;; mic-paren - (paren-face-match :foreground red :background base0 :weight 'ultra-bold) - (paren-face-mismatch :foreground base0 :background red :weight 'ultra-bold) - (paren-face-no-match :inherit 'paren-face-mismatch :weight 'ultra-bold) - ;;;; minimap - (minimap-current-line-face :background selection) - (minimap-active-region-background :background vertical-bar) - ;; mm - (mm-uu-extract :background (doom-blend highlight base2 0.07) :foreground (doom-blend highlight fg 0.15)) - ;;;; mmm-mode - (mmm-init-submode-face :background (doom-blend red bg 0.1)) - (mmm-cleanup-submode-face :background (doom-blend yellow bg 0.1)) - (mmm-declaration-submode-face :background (doom-blend cyan bg 0.1)) - (mmm-comment-submode-face :background (doom-blend blue bg 0.1)) - (mmm-output-submode-face :background (doom-blend violet bg 0.1)) - (mmm-special-submode-face :background (doom-blend green bg 0.1)) - (mmm-code-submode-face :background bg-alt) - (mmm-default-submode-face) ; make transparent - ;;;; multiple cursors - (mc/cursor-face :inherit 'cursor) - ;;;; nav-flash - (nav-flash-face :background selection :foreground base8 :weight 'bold) - ;;;; neotree - (neo-root-dir-face :foreground strings :background bg :box `(:line-width 4 :color ,bg)) - (neo-file-link-face :foreground fg) - (neo-dir-link-face :foreground highlight) - (neo-expand-btn-face :foreground highlight) - (neo-vc-edited-face :foreground yellow) - (neo-vc-added-face :foreground green) - (neo-vc-removed-face :foreground red :strike-through t) - (neo-vc-conflict-face :foreground magenta :weight 'bold) - (neo-vc-ignored-face :foreground comments) - (doom-neotree-dir-face :foreground highlight) - (doom-neotree-file-face :foreground base8) - (doom-neotree-hidden-file-face :foreground comments) - (doom-neotree-text-file-face :foreground fg) - (doom-neotree-data-file-face :foreground violet) - (doom-neotree-media-file-face :inherit 'doom-neotree-hidden-file-face) - ;;;; nerd-icons - (nerd-icons-blue :foreground blue) - (nerd-icons-blue-alt :foreground teal) - (nerd-icons-cyan :foreground cyan) - (nerd-icons-cyan-alt :foreground cyan) - (nerd-icons-dblue :foreground dark-blue) - (nerd-icons-dcyan :foreground dark-cyan) - (nerd-icons-dgreen :foreground (doom-darken green 0.3)) - (nerd-icons-dmaroon :foreground (doom-darken magenta 0.3)) - (nerd-icons-dorange :foreground (doom-darken orange 0.3)) - (nerd-icons-dpink :foreground (doom-lighten red 0.15)) - (nerd-icons-dpurple :foreground (doom-darken violet 0.3)) - (nerd-icons-dred :foreground (doom-darken red 0.3)) - (nerd-icons-dsilver :foreground (doom-lighten grey 0.1)) - (nerd-icons-dyellow :foreground (doom-darken yellow 0.3)) - (nerd-icons-green :foreground green) - (nerd-icons-lblue :foreground (doom-lighten blue 0.3)) - (nerd-icons-lcyan :foreground (doom-lighten cyan 0.3)) - (nerd-icons-lgreen :foreground (doom-lighten green 0.3)) - (nerd-icons-lmaroon :foreground (doom-lighten magenta 0.3)) - (nerd-icons-lorange :foreground (doom-lighten orange 0.3)) - (nerd-icons-lpink :foreground (doom-lighten red 0.55)) - (nerd-icons-lpurple :foreground (doom-lighten violet 0.3)) - (nerd-icons-lred :foreground (doom-lighten red 0.3)) - (nerd-icons-lsilver :foreground (doom-lighten grey 0.7)) - (nerd-icons-lyellow :foreground (doom-lighten yellow 0.3)) - (nerd-icons-maroon :foreground magenta) - (nerd-icons-orange :foreground orange) - (nerd-icons-pink :foreground (doom-lighten red 0.35)) - (nerd-icons-purple :foreground violet) - (nerd-icons-purple-alt :foreground (doom-blend violet grey 0.15)) - (nerd-icons-red :foreground red) - (nerd-icons-red-alt :foreground (doom-blend red grey 0.15)) - (nerd-icons-silver :foreground (doom-lighten grey 0.45)) - (nerd-icons-yellow :foreground yellow) - ;;;; nerd-icons-completion - (nerd-icons-completion-dir-face :foreground doc-comments) - ;;;; nerd-icons-dired - (nerd-icons-dired-dir-face :foreground doc-comments) - ;;;; nlinum - ((nlinum-current-line &inherit line-number-current-line)) - ;;;; nlinum-hl - ((nlinum-hl-face &inherit line-number-current-line)) - ;;;; nlinum-relative - ((nlinum-relative-current-face &inherit line-number-current-line)) - ;;;; notmuch - ;; (notmuch-crypto-decryption :foreground blue-l) - ;; (notmuch-crypto-part-header :foreground yellow-l) - ;; (notmuch-crypto-signature-bad :foreground red-l) - ;; (notmuch-crypto-signature-good :foreground base1) - ;; (notmuch-crypto-signature-good-key :foreground aqua-l) - ;; (notmuch-crypto-signature-unknown :foreground yellow) - ;; (notmuch-hello-logo-background :foreground fg) - (notmuch-message-summary-face :foreground grey) - (notmuch-search-count :foreground comments) - (notmuch-search-date :foreground numbers) - (notmuch-search-flagged-face :foreground (doom-blend red base4 0.5)) - (notmuch-search-matching-authors :foreground blue) - (notmuch-search-non-matching-authors :foreground fg) - (notmuch-search-subject :foreground fg) - (notmuch-search-unread-face :weight 'bold) - (notmuch-tag-added :foreground green :weight 'normal) - (notmuch-tag-deleted :foreground red :weight 'normal) - (notmuch-tag-face :foreground yellow :weight 'normal) - (notmuch-tag-flagged :foreground yellow :weight 'normal) - (notmuch-tag-unread :foreground yellow :weight 'normal) - (notmuch-tree-match-author-face :foreground blue :weight 'bold) - (notmuch-tree-match-date-face :foreground numbers :weight 'bold) - (notmuch-tree-match-face :foreground fg) - (notmuch-tree-match-subject-face :foreground fg) - (notmuch-tree-match-tag-face :foreground yellow) - (notmuch-tree-match-tree-face :foreground comments) - (notmuch-tree-no-match-author-face :foreground blue) - (notmuch-tree-no-match-date-face :foreground numbers) - (notmuch-tree-no-match-face :foreground base5) - (notmuch-tree-no-match-subject-face :foreground base5) - (notmuch-tree-no-match-tag-face :foreground yellow) - (notmuch-tree-no-match-tree-face :foreground yellow) - (notmuch-wash-cited-text :foreground base4) - (notmuch-wash-toggle-button :foreground fg) - ;;;; lsp-mode - (lsp-face-highlight-textual - (&all :weight 'bold) - (&light :background base3 :foreground base0 :distant-foreground base8) - (&dark :background (doom-blend highlight bg 0.3) :foreground base8 :distant-foreground base0)) - (lsp-face-highlight-read :inherit 'lsp-face-highlight-textual) - (lsp-face-highlight-write :inherit 'lsp-face-highlight-textual) - (lsp-headerline-breadcrumb-separator-face :inherit 'shadow) - ;;;; lsp-ui - (lsp-ui-doc-background :inherit 'tooltip) - (lsp-ui-peek-filename :inherit 'mode-line-buffer-id) - (lsp-ui-peek-header :foreground fg :background (doom-lighten bg 0.1) :bold bold) - (lsp-ui-peek-selection :foreground bg :background blue :bold bold) - (lsp-ui-peek-list :background (doom-darken bg 0.1)) - (lsp-ui-peek-peek :background (doom-darken bg 0.1)) - (lsp-ui-peek-highlight :inherit 'isearch :box t) - (lsp-ui-peek-line-number :foreground success) - (lsp-ui-sideline-code-action :foreground (doom-blend highlight bg 0.85)) - (lsp-ui-sideline-current-symbol :inherit 'highlight) - (lsp-ui-sideline-symbol-info :foreground (doom-blend comments bg 0.85) - :background bg-alt :extend t) - ;;;; objed - (objed-mode-line :inherit 'warning :weight 'bold) - (objed-hl :inherit 'region :background (doom-blend region bg 0.5)) - ;;;; orderless - (orderless-match-face-0 :weight 'bold :foreground (doom-blend blue fg 0.6) :background (doom-blend blue bg 0.1)) - (orderless-match-face-1 :weight 'bold :foreground (doom-blend magenta fg 0.6) :background (doom-blend magenta bg 0.1)) - (orderless-match-face-2 :weight 'bold :foreground (doom-blend green fg 0.6) :background (doom-blend green bg 0.1)) - (orderless-match-face-3 :weight 'bold :foreground (doom-blend yellow fg 0.6) :background (doom-blend yellow bg 0.1)) - ;;;; org - (org-archived :foreground doc-comments) - (org-block :background base3 :extend t) - (org-block-background :background base3 :extend t) - (org-block-begin-line :inherit 'org-block :foreground comments) - (org-block-end-line :inherit 'org-block-begin-line) - (org-checkbox :inherit 'org-todo) - (org-checkbox-statistics-done :inherit 'org-done) - (org-checkbox-statistics-todo :inherit 'org-todo) - (org-cite :foreground (doom-blend teal fg 0.9)) - (org-cite-key :foreground (doom-blend teal fg 0.6) :underline t) - (org-code :inherit 'org-block :foreground orange) - (org-date :foreground yellow) - (org-default :inherit 'variable-pitch) - (org-document-info :foreground builtin) - (org-document-title :foreground builtin :weight 'bold) - (org-done :inherit 'org-headline-done :strike-through nil :weight 'bold) - (org-drawer :foreground comments) - (org-ellipsis :foreground comments :underline nil) - (org-footnote :foreground orange) - (org-formula :foreground cyan) - (org-headline-done :foreground base5) - (org-hide :foreground bg) - (org-latex-and-related :foreground base8 :weight 'bold) - (org-link :inherit 'link :foreground highlight) - (org-list-dt :foreground highlight) - (org-meta-line :foreground doc-comments) - (org-priority :foreground red) - (org-property-value :foreground doc-comments) - (org-quote :inherit 'org-block :slant 'italic) - (org-special-keyword :foreground doc-comments) - (org-table :foreground violet) - (org-tag :foreground doc-comments :weight 'normal) - (org-todo :foreground green :bold 'inherit) - (org-verbatim :foreground green) - (org-warning :foreground warning) - ;; Omitted because we rely on style they inherit from the outline-N faces - ;;(org-level-1) - ;;(org-level-2) - ;;(org-level-3) - ;;(org-level-4) - ;;(org-level-5) - ;;(org-level-6) - ;;(org-level-7) - ;;(org-level-8) - ;;;; org-agenda - (org-agenda-done :inherit 'org-done) - (org-agenda-dimmed-todo-face :foreground comments) - (org-agenda-date :foreground violet :weight 'ultra-bold) - (org-agenda-date-today :foreground (doom-lighten violet 0.4) :weight 'ultra-bold) - (org-agenda-date-weekend :foreground (doom-darken violet 0.4) :weight 'ultra-bold) - (org-agenda-structure :foreground fg :weight 'ultra-bold) - (org-agenda-clocking :background (doom-blend blue bg 0.2)) - (org-upcoming-deadline :foreground (doom-blend fg bg 0.8)) - (org-upcoming-distant-deadline :foreground (doom-blend fg bg 0.5)) - (org-scheduled :foreground fg) - (org-scheduled-today :foreground base7) - (org-scheduled-previously :foreground base8) - (org-time-grid :foreground comments) - (org-sexp-date :foreground fg) - ;;;; org-habit - (org-habit-clear-face :weight 'bold :background base4) - (org-habit-clear-future-face :weight 'bold :background base3) - (org-habit-ready-face :weight 'bold :background (doom-blend blue bg-alt 0.5)) - (org-habit-ready-future-face :weight 'bold :background (doom-blend blue bg-alt 0.3)) - (org-habit-alert-face :weight 'bold :background (doom-blend yellow bg-alt 0.5)) - (org-habit-alert-future-face :weight 'bold :background (doom-blend yellow bg-alt 0.3)) - (org-habit-overdue-face :weight 'bold :background (doom-blend red bg-alt 0.5)) - (org-habit-overdue-future-face :weight 'bold :background (doom-blend red bg-alt 0.3)) - ;;;; org-journal - (org-journal-highlight :foreground highlight) - (org-journal-calendar-entry-face :foreground magenta :slant 'italic) - (org-journal-calendar-scheduled-face :foreground red :slant 'italic) - ;;;; org-pomodoro - (org-pomodoro-mode-line :foreground red) - (org-pomodoro-mode-line-overtime :foreground warning :weight 'bold) - ;;;; org-ref - (org-ref-acronym-face :foreground violet) - (org-ref-cite-face :foreground yellow :weight 'light :underline t) - (org-ref-glossary-face :foreground magenta) - (org-ref-label-face :foreground blue) - (org-ref-ref-face :inherit 'link :foreground teal) - ;;;; outline - ;; NOTE org-mode's org-level-N faces inherit these outline-N faces. - (outline-1 :foreground blue :weight 'bold :extend t) - (outline-2 :foreground magenta :weight 'bold :extend t) - (outline-3 :foreground violet :weight 'bold :extend t) - (outline-4 :foreground (doom-lighten blue 0.25) :weight 'bold :extend t) - (outline-5 :foreground (doom-lighten magenta 0.25) :weight 'bold :extend t) - (outline-6 :foreground (doom-lighten blue 0.5) :weight 'bold :extend t) - (outline-7 :foreground (doom-lighten magenta 0.5) :weight 'bold :extend t) - (outline-8 :foreground (doom-lighten blue 0.8) :weight 'bold :extend t) - ;;;; parenface - (paren-face :foreground comments) - ;;;; parinfer - (parinfer-pretty-parens:dim-paren-face :foreground base5) - (parinfer-smart-tab:indicator-face :foreground base5) - ;;;; perspective - (persp-selected-face :foreground blue :weight 'bold) - ;;;; persp-mode - (persp-face-lighter-default :foreground highlight :weight 'bold) - (persp-face-lighter-buffer-not-in-persp :foreground doc-comments) - (persp-face-lighter-nil-persp :foreground comments) - ;;;; pkgbuild-mode - (pkgbuild-error-face :underline `(:style wave :color ,red)) - ;;;; popup - (popup-face :inherit 'tooltip) - (popup-tip-face :inherit 'popup-face :foreground violet :background base0) - (popup-selection-face :background selection) - ;;;; power - (powerline-active0 :inherit 'mode-line :background bg) - (powerline-active1 :inherit 'mode-line :background (doom-lighten 'bg 0.025)) - (powerline-active2 :inherit 'mode-line :foreground base8 :background (doom-lighten 'bg 0.08)) - (powerline-inactive0 :inherit 'mode-line-inactive :background base2) - (powerline-inactive1 :inherit 'mode-line-inactive :background (doom-lighten 'base2 0.02)) - (powerline-inactive2 :inherit 'mode-line-inactive :background (doom-lighten 'base2 0.04)) - ;;;; rainbow-delimiters - (rainbow-delimiters-depth-1-face :foreground blue) - (rainbow-delimiters-depth-2-face :foreground magenta) - (rainbow-delimiters-depth-3-face :foreground green) - (rainbow-delimiters-depth-4-face :foreground violet) - (rainbow-delimiters-depth-5-face :foreground teal) - (rainbow-delimiters-depth-6-face :foreground blue) - (rainbow-delimiters-depth-7-face :foreground magenta) - (rainbow-delimiters-depth-8-face :foreground green) - (rainbow-delimiters-depth-9-face :foreground violet) - (rainbow-delimiters-base-error-face :inherit 'rainbow-delimiters-base-face :foreground error) - (rainbow-delimiters-base-face :inherit 'default) - (rainbow-delimiters-unmatched-face :foreground red :weight 'bold :inverse-video t) - (rainbow-delimiters-mismatched-face :inherit 'rainbow-delimiters-unmatched-face) - ;;;; re-builder - (reb-match-0 :foreground orange :inverse-video t) - (reb-match-1 :foreground magenta :inverse-video t) - (reb-match-2 :foreground green :inverse-video t) - (reb-match-3 :foreground yellow :inverse-video t) - ;;;; rjsx-mode - (rjsx-tag :foreground type) - (rjsx-attr :foreground functions) - ;;;; rpm-spec-mode - (rpm-spec-macro-face :foreground yellow) - (rpm-spec-var-face :foreground violet) - (rpm-spec-tag-face :foreground blue) - (rpm-spec-obsolete-tag-face :foreground red) - (rpm-spec-package-face :foreground orange) - (rpm-spec-dir-face :foreground green) - (rpm-spec-doc-face :foreground orange) - (rpm-spec-ghost-face :foreground comments) - (rpm-spec-section-face :foreground magenta) - ;;;; rst - (rst-block :inherit 'font-lock-constant-face) - (rst-level-1 :inherit 'rst-adornment :weight 'bold) - (rst-level-2 :inherit 'rst-adornment :weight 'bold) - (rst-level-3 :inherit 'rst-adornment :weight 'bold) - (rst-level-4 :inherit 'rst-adornment :weight 'bold) - (rst-level-5 :inherit 'rst-adornment :weight 'bold) - (rst-level-6 :inherit 'rst-adornment :weight 'bold) - ;;;; sh-script - (sh-heredoc :inherit 'font-lock-string-face :weight 'normal) - (sh-quoted-exec :inherit 'font-lock-preprocessor-face) - ;;;; show-paren - ((show-paren-match &inherit paren-face-match)) - ((show-paren-mismatch &inherit paren-face-mismatch)) - ;;;; smart-mode-line - (sml/charging :foreground green) - (sml/discharging :foreground yellow :weight 'bold) - (sml/filename :foreground violet :weight 'bold) - (sml/git :foreground blue) - (sml/modified :foreground cyan) - (sml/outside-modified :foreground cyan) - (sml/process :weight 'bold) - (sml/read-only :foreground cyan) - (sml/sudo :foreground orange :weight 'bold) - (sml/vc-edited :foreground green) - ;;;; smartparens - (sp-pair-overlay-face :background region) - ((sp-show-pair-match-face &inherit show-paren-match)) - ((sp-show-pair-mismatch-face &inherit show-paren-mismatch)) - ;;;; smerge-tool - (smerge-lower :background (doom-blend green bg 0.2)) - (smerge-upper :background (doom-blend red base3 0.2)) - (smerge-base :background (doom-blend blue bg 0.2)) - (smerge-markers :background comments :foreground bg :distant-foreground fg :weight 'bold) - (smerge-refined-added :inherit 'diff-added :inverse-video t) - (smerge-refined-removed :inherit 'diff-removed :inverse-video t) - ;; Emacs <25 compatibility - ((smerge-mine &inherit smerge-upper)) - ((smerge-other &inherit smerge-lower)) - ;;;; solaire-mode - (solaire-default-face :inherit 'default :background bg-alt) - (solaire-hl-line-face :inherit 'hl-line :background bg :extend t) - (solaire-org-hide-face :inherit 'org-hide :foreground bg-alt) - ;;;; spaceline - (spaceline-highlight-face :background highlight) - (spaceline-modified :background vc-modified) - (spaceline-unmodified :background constants) - (spaceline-python-venv :foreground magenta :distant-foreground violet) - (spaceline-flycheck-error :inherit 'error :distant-background base0) - (spaceline-flycheck-warning :inherit 'warning :distant-background base0) - (spaceline-flycheck-info :inherit 'success :distant-background base0) - (spaceline-evil-normal :background blue) - (spaceline-evil-insert :background green) - (spaceline-evil-emacs :background cyan) - (spaceline-evil-replace :background orange) - (spaceline-evil-visual :background grey) - (spaceline-evil-motion :background magenta) - ;;;; spell-fu - (spell-fu-incorrect-face - `((((supports :underline (:style wave))) - (:underline (:style wave :color ,(car error)))) - (t (:inherit error :underline t)))) - ;;;; stripe-buffer - (stripe-highlight - (&light :background base5) - (&dark :background base3)) - ;;;; symbol-overlay - (symbol-overlay-default-face - (&dark :background (doom-lighten region 0.1) :distant-foreground fg-alt) - (&light :background (doom-darken region 0.1) :distant-foreground fg-alt)) - (symbol-overlay-face-1 :background (doom-blend blue bg 0.4) :distant-foreground fg-alt) - (symbol-overlay-face-2 :background (doom-blend violet bg 0.4) :distant-foreground fg-alt) - (symbol-overlay-face-3 :background (doom-blend yellow bg 0.3) :distant-foreground fg-alt) - (symbol-overlay-face-4 :background (doom-blend orange bg 0.3) :distant-foreground fg-alt) - (symbol-overlay-face-5 :background (doom-blend red bg 0.3) :distant-foreground fg-alt) - (symbol-overlay-face-6 :background (doom-blend magenta bg 0.3) :distant-foreground fg-alt) - (symbol-overlay-face-7 :background (doom-blend green bg 0.4) :distant-foreground fg-alt) - (symbol-overlay-face-8 :background (doom-blend cyan bg 0.2) :distant-foreground fg-alt) - ;;;; swiper - (swiper-line-face :background blue :foreground base0) - (swiper-match-face-1 :background base0 :foreground base5) - (swiper-match-face-2 :background orange :foreground base0 :weight 'bold) - (swiper-match-face-3 :background magenta :foreground base0 :weight 'bold) - (swiper-match-face-4 :background green :foreground base0 :weight 'bold) - ;;;; tabbar - (tabbar-default :foreground bg :background bg :height 1.0) - (tabbar-highlight :foreground fg :background selection :distant-foreground bg) - (tabbar-button :foreground fg :background bg) - (tabbar-button-highlight :inherit 'tabbar-button :inverse-video t) - (tabbar-modified :inherit 'tabbar-default :foreground red :weight 'bold) - (tabbar-unselected :inherit 'tabbar-default :foreground base5) - (tabbar-unselected-modified :inherit 'tabbar-modified) - (tabbar-selected - :inherit 'tabbar-default :weight 'bold - :foreground fg :background bg-alt) - (tabbar-selected-modified :inherit 'tabbar-selected :foreground green) - ;;;; telephone-line - (telephone-line-accent-active :foreground fg :background base4) - (telephone-line-accent-inactive :foreground fg :background base2) - (telephone-line-projectile :foreground green) - (telephone-line-evil :foreground fg :weight 'bold) - (telephone-line-evil-insert :background (doom-blend green bg 0.5) :weight 'bold) - (telephone-line-evil-normal :background (doom-blend red bg 0.5) :weight 'bold) - (telephone-line-evil-visual :background (doom-blend orange bg 0.5) :weight 'bold) - (telephone-line-evil-replace :background (doom-color bg-alt) :weight 'bold) - (telephone-line-evil-motion :background (doom-blend blue bg 0.5) :weight 'bold) - (telephone-line-evil-operator :background (doom-blend violet bg 0.5) :weight 'bold) - (telephone-line-evil-emacs :background (doom-blend magenta bg 0.5) :weight 'bold) - ;;;; term - (term :foreground fg) - (term-bold :weight 'bold) - (term-color-black :background base0 :foreground base0) - (term-color-red :background red :foreground red) - (term-color-green :background green :foreground green) - (term-color-yellow :background yellow :foreground yellow) - (term-color-blue :background blue :foreground blue) - (term-color-magenta :background magenta :foreground magenta) - (term-color-cyan :background cyan :foreground cyan) - (term-color-white :background base8 :foreground base8) - ;;;; terraform-mode - (terraform--resource-type-face :foreground type) - (terraform--resource-name-face :foreground strings) - ;;;; tldr - (tldr-command-itself :foreground bg :background green :weight 'semi-bold) - (tldr-title :foreground yellow :bold t :height 1.4) - (tldr-description :foreground fg :weight 'semi-bold) - (tldr-introduction :foreground (doom-blend blue bg 0.8) :weight 'semi-bold) - (tldr-code-block :foreground green :background region :weight 'semi-bold) - (tldr-command-argument :foreground fg :background region) - ;;;; typescript-mode - (typescript-jsdoc-tag :foreground doc-comments) - (typescript-jsdoc-type :foreground (doom-darken doc-comments 0.15)) - (typescript-jsdoc-value :foreground (doom-lighten doc-comments 0.15)) - ;;;; treemacs - (treemacs-directory-face :foreground fg) - (treemacs-file-face :foreground fg) - (treemacs-fringe-indicator-face :foreground highlight) - (treemacs-git-added-face :foreground vc-added) - (treemacs-git-conflict-face :foreground red) - (treemacs-git-modified-face :foreground violet) - (treemacs-git-untracked-face :inherit 'font-lock-doc-face) - (treemacs-on-failure-pulse-face :foreground base0 :background error :extend t) - (treemacs-on-success-pulse-face :foreground base0 :background success :extend t) - (treemacs-root-face :inherit 'font-lock-string-face :weight 'bold :height 1.2) - (treemacs-tags-face :foreground highlight) - ;;;; treemacs-nerd-icons - (treemacs-nerd-icons-file-face :foreground doc-comments) - (treemacs-nerd-icons-root-face :inherit 'font-lock-string-face :weight 'bold :height 1.2) - ;;;; ts-fold - (ts-fold-fringe-face) - ((ts-fold-replacement-face &inherit +fold-hideshow-folded-face)) - ((ts-fold-replacement-mouse-face &inherit +fold-hideshow-folded-face) - :box '(:line-width -1 :style released-button)) - ;;;; twittering-mode - (twitter-divider ; custom face in Doom Emacs - (&light :underline `(:color ,(doom-lighten vertical-bar 0.2))) - (&dark :underline `(:color ,(doom-darken vertical-bar 0.2)))) - ;;;; undo-tree - (undo-tree-visualizer-default-face :foreground base5) - (undo-tree-visualizer-current-face :foreground green :weight 'bold) - (undo-tree-visualizer-unmodified-face :foreground base5) - (undo-tree-visualizer-active-branch-face :foreground blue) - (undo-tree-visualizer-register-face :foreground yellow) - ;;;; vimish-fold - (vimish-fold-overlay :inherit 'font-lock-comment-face :background base0 :weight 'light) - (vimish-fold-fringe :foreground magenta) - ;;;; visual-regexp - (vr/group-0 :background blue :foreground bg) - (vr/group-1 :background magenta :foreground bg) - (vr/group-2 :background green :foreground bg) - (vr/match-0 :background (doom-blend green bg 0.2) :foreground fg) - (vr/match-1 :background (doom-blend green bg 0.4) :foreground fg) - (vr/match-separator-face :inherit 'bold :foreground red) - ;;;; volatile-highlights - (vhl/default-face :background grey) - ;;;; vterm - (vterm-color-black :background (doom-lighten base0 0.25) :foreground base0) - (vterm-color-red :background (doom-lighten red 0.25) :foreground red) - (vterm-color-green :background (doom-lighten green 0.25) :foreground green) - (vterm-color-yellow :background (doom-lighten yellow 0.25) :foreground yellow) - (vterm-color-blue :background (doom-lighten blue 0.25) :foreground blue) - (vterm-color-magenta :background (doom-lighten magenta 0.25) :foreground magenta) - (vterm-color-cyan :background (doom-lighten cyan 0.25) :foreground cyan) - (vterm-color-white :background (doom-lighten base8 0.25) :foreground base8) - ;;;; web-mode - (web-mode-block-control-face :foreground builtin) - (web-mode-block-delimiter-face :foreground builtin) - (web-mode-css-property-name-face :foreground type) - (web-mode-doctype-face :foreground comments) - (web-mode-html-tag-face :foreground methods) - (web-mode-html-tag-bracket-face :foreground methods) - (web-mode-html-attr-name-face :foreground type) - (web-mode-html-attr-value-face :foreground strings) - (web-mode-html-entity-face :foreground cyan :inherit 'italic) - (web-mode-block-control-face :foreground orange) - (web-mode-html-tag-bracket-face :foreground operators) - (web-mode-json-key-face :foreground strings) - (web-mode-json-context-face :foreground strings) - (web-mode-keyword-face :foreground keywords) - (web-mode-string-face :foreground strings) - (web-mode-type-face :foreground type) - ;;;; wgrep - (wgrep-face :weight 'bold :foreground green :background base5) - (wgrep-delete-face :foreground base3 :background red) - (wgrep-done-face :foreground blue) - (wgrep-file-face :foreground comments) - (wgrep-reject-face :foreground red :weight 'bold) - ;;;; which-func - (which-func :foreground blue) - ;;;; which-key - (which-key-key-face :foreground green) - (which-key-group-description-face :foreground violet) - (which-key-command-description-face :foreground blue) - (which-key-local-map-description-face :foreground magenta) - ;;;; whitespace - (whitespace-empty :background base3) - (whitespace-space :foreground base4) - (whitespace-newline :foreground base4) - (whitespace-tab - :foreground base4 - :background (if (default-value 'indent-tabs-mode) 'unspecified base3)) - (whitespace-indentation - :foreground base4 - :background (if (default-value 'indent-tabs-mode) base3 'unspecified)) - (whitespace-trailing :inherit 'trailing-whitespace) - (whitespace-line :background base0 :foreground red :weight 'bold) - ;;;; widget - (widget-button-pressed :foreground red) - (widget-documentation :foreground green) - (widget-single-line-field :background base3 :distant-foreground bg) - (widget-field :background base3 :distant-foreground bg - :box `(:line-width -1 :color ,grey) :extend t) - ;;;; window-divider - (window-divider :inherit 'vertical-border) - (window-divider-first-pixel :inherit 'window-divider) - (window-divider-last-pixel :inherit 'window-divider) - ;;;; window-tool-bar - (window-tool-bar-button :background bg :foreground fg) - (window-tool-bar-button-hover :inherit 'highlight :distant-foreground bg) - (window-tool-bar-button-disabled :background bg-alt :foreground fg-alt) - ;;;; winum - (winum-face :inherit 'bold :foreground highlight) - ;;;; woman - (woman-bold :inherit 'Man-overstrike) - (woman-italic :inherit 'Man-underline) - ;;;; xah-elisp-mode - (xah-elisp-at-symbol :inherit 'font-lock-warning-face) - (xah-elisp-cap-variable :inherit 'font-lock-preprocessor-face) - (xah-elisp-command-face :inherit 'font-lock-type-face) - (xah-elisp-dollar-symbol :inherit 'font-lock-variable-name-face) - ;;;; workgroups2 - (wg-current-workgroup-face :foreground base0 :background highlight) - (wg-other-workgroup-face :foreground base5) - (wg-divider-face :foreground grey) - (wg-brace-face :foreground highlight) - ;;;; yasnippet - (yas-field-highlight-face :inherit 'match) - ;;;; xref - ((xref-file-header &inherit compilation-info)) - ((xref-line-number &inherit compilation-line-number)) - ((xref-match &inherit match))) - ;;;; --- END Package faces ------------------ - - "TODO") - -;;;; --- Package variables ------------------ -(defvar doom-themes-base-vars - '( - ;;;; ansi-color DEPRECATED - (ansi-color-names-vector - (vconcat (mapcar #'doom-color '(bg red green yellow blue magenta cyan fg)))) - ;;;; rustic - (rustic-ansi-faces - (vconcat (mapcar #'doom-color '(bg red green yellow blue magenta cyan fg)))) - ;;;; exwm - (exwm-floating-border-color (doom-color 'vertical-bar)) - ;;;; fill-column-indicator - (fci-rule-color (doom-color 'base5)) - ;;;; jdee - (jdee-db-spec-breakpoint-face-colors `(cons ,(doom-color 'base0) ,(doom-color 'grey))) - (jdee-db-requested-breakpoint-face-colors `(cons ,(doom-color 'base0) ,(doom-color 'green))) - (jdee-db-active-breakpoint-face-colors `(cons ,(doom-color 'base0) ,(doom-color 'highlight))) - ;;;; highlight-tail - (highlight-tail-colors - `((,(doom-blend green bg 0.1) . 0) - (,(doom-blend cyan bg 0.1) . 20))) - ;;;; objed - (objed-cursor-color (doom-color 'red)) - ;;;; pdf-tools - (pdf-view-midnight-colors `(cons ,(doom-color 'fg) ,(doom-color 'bg))) - ;;;; vc - (vc-annotate-color-map - `(list (cons 20 ,(doom-color 'green)) - (cons 40 ,(doom-blend 'yellow 'green (/ 1.0 3))) - (cons 60 ,(doom-blend 'yellow 'green (/ 2.0 3))) - (cons 80 ,(doom-color 'yellow)) - (cons 100 ,(doom-blend 'orange 'yellow (/ 1.0 3))) - (cons 120 ,(doom-blend 'orange 'yellow (/ 2.0 3))) - (cons 140 ,(doom-color 'orange)) - (cons 160 ,(doom-blend 'magenta 'orange (/ 1.0 3))) - (cons 180 ,(doom-blend 'magenta 'orange (/ 2.0 3))) - (cons 200 ,(doom-color 'magenta)) - (cons 220 ,(doom-blend 'red 'magenta (/ 1.0 3))) - (cons 240 ,(doom-blend 'red 'magenta (/ 2.0 3))) - (cons 260 ,(doom-color 'red)) - (cons 280 ,(doom-blend 'grey 'red (/ 1.0 4))) - (cons 300 ,(doom-blend 'grey 'red (/ 2.0 4))) - (cons 320 ,(doom-blend 'grey 'red (/ 3.0 4))) - (cons 340 ,(doom-color 'base5)) - (cons 360 ,(doom-color 'base5)))) - (vc-annotate-very-old-color nil) - (vc-annotate-background (doom-color 'bg))) -;;;; --- END Package variables -------------- - "TODO") - -(provide 'doom-themes-base) -;;; doom-themes-base.el ends here diff --git a/.config/emacs/lisp/doom-themes/doom-themes.el b/.config/emacs/lisp/doom-themes/doom-themes.el deleted file mode 100644 index df65280..0000000 --- a/.config/emacs/lisp/doom-themes/doom-themes.el +++ /dev/null @@ -1,465 +0,0 @@ -;;; doom-themes.el --- an opinionated pack of modern color-themes -*- lexical-binding: t; -*- -;; -;; Copyright (C) 2016-2024 Henrik Lissner -;; -;; Author: Henrik Lissner -;; Maintainer: Henrik Lissner -;; Maintainer: Emmanuel Bustos Torres -;; Created: May 22, 2016 -;; Version: 2.3.0 -;; Keywords: themes faces -;; Homepage: https://github.com/doomemacs/themes -;; Package-Requires: ((emacs "25.1") (cl-lib "0.5")) -;; -;; This file is not part of GNU Emacs. -;; -;;; Commentary: -;; -;; doomemacs/themes is an megapack of popular themes, including aesthetic -;; extensions for popular packages. -;; -;; Themes in this pack: -;; - doom-1337 -- ported from VSCode's 1337 theme (ported by @ccmywish) -;; - doom-acario-dark -- an original dark theme (ported by @gagbo) -;; - doom-acario-light -- an original light theme (ported by @gagbo) -;; - doom-ayu-dark -- inspired by Ayu Dark (ported by @ashton) -;; - doom-ayu-light -- inspirted by Ayu Light (ported by @LoveSponge) -;; - doom-ayu-mirage -- inspired by Ayu Mirage (ported by @LoveSponge) -;; - doom-badger -- inspired by cann's Badger colorscheme (ported by @jsoa) -;; - doom-challenger-deep -- inspired by Vim's Challenger Deep theme (ported by @fuxialexander) -;; - doom-city-lights -- inspired by Atom's City Lights theme (ported by @fuxialexander) -;; - doom-dark+ -- ported from equinusocio's VSCode Theme, dark+ (ported by @ema2159) -;; - doom-dracula -- inspired by the popular Dracula theme (ported by @fuxialexander) -;; - doom-earl-grey -- a gentle color scheme, for code (ported by @JuneKelly) -;; - doom-ephemeral -- inspired by the Ephemeral Theme from elenapan's dotfiles (ported by @karetsu) -;; - doom-fairy-floss -- a candy colored theme by sailorhg (ported by @ema2159) -;; - doom-feather-dark -- a purple-tinted theme, inspired by doom-one (by @Plunne) -;; - doom-feather-light -- a light variable of feather-dark, inspired by doom-one (by @Plunne) -;; - doom-flatwhite -- inspired by Atom's Flatwhite Syntax theme (ported by @JuneKelly) -;; - doom-gruvbox -- inspired by morhetz's Gruvbox (ported by @JongW) -;; - doom-gruvbox-light -- inspired by morhetz's Gruvbox (light) (ported by @jsoa) -;; - doom-henna -- based on VSCode's Henna theme (ported by @jsoa) -;; - doom-homage-black -- a minimalistic, colorless theme inspired by eziam, tao, and jbeans (ported by @mskorzhinskiy) -;; - doom-homage-white -- minimal white theme inspired by editors from 2000s (ported by @mskorzhinskiy) -;; - doom-horizon -- ported from VSCode Horizon (ported by @karetsu) -;; - doom-Iosvkem -- ported from the default dark theme for Adobe Brackets (ported by @neutaaaaan) -;; - doom-ir-black -- ported from Vim's ir_black colorscheme (ported by @legendre6891) -;; - doom-lantern -- based on Gitleptune's Lantern theme (ported by @paladhammika) -;; - doom-laserwave -- a clean synthwave/outrun theme inspired by VSCode's Laserwave (ported by @hyakt) -;; - doom-manegarm -- an original autumn-inspired dark theme (ported by @kenranunderscore) -;; - doom-material -- adapted from equinusocio's Material themes (ported by @tam5) -;; - doom-material-dark -- inspired by Material Theme by xrei (ported by @trev-dev) -;; - doom-meltbus -- a dark (mostly) monochromatic theme (ported by @spacefrogg) -;; - doom-miramare -- a port of Franbach's Miramare theme; a variant of Grubox (ported by @sagittaros) -;; - doom-molokai -- inspired by Tomas Restrepo's Molokai (ported by @hlissner) -;; - doom-monokai-classic -- port of Monokai Classic (ported by @ema2159) -;; - doom-monokai-machine -- port of Monokai Classic (ported by @minikN) -;; - doom-monokai-octagon -- port of Monokai Octagon (ported by @minikN) -;; - doom-monokai-pro -- Port of Monokai Pro (ported by @minikN) -;; - doom-monokai-ristretto -- Port of Monokai Ristretto (ported by @minikN) -;; - doom-monokai-spectrum -- port of Monokai Spectrum (ported by @minikN) -;; - doom-moonlight -- inspired by VS code's Moonlight (ported by @Brettm12345) -;; - doom-nord -- dark variant of Nord (ported by @fuxialexander) -;; - doom-nord-aurora -- a light variant of Nord (ported by @MoskitoHero) -;; - doom-nord-light -- light variant of Nord (ported by @fuxialexander) -;; - doom-nova -- inspired by Trevord Miller's Nova (ported by @bigardone) -;; - doom-oceanic-next -- inspired by Oceanic Next (ported by @juanwolf) -;; - doom-oksolar-dark -- an OKLab variant of Solarized dark (ported by @logc) -;; - doom-oksolar-light -- an OKLab variant of Solarized light (ported by @logc) -;; - doom-old-hope -- inspired by An Old Hope, in a galaxy far far away (ported by @teesloane) -;; - doom-one -- inspired by Atom One Dark (ported by @hlissner) -;; - doom-one-light -- inspired by Atom One Light (ported by @ztlevi) -;; - doom-opera -- an original light theme (ported by @jwintz) -;; - doom-opera-light -- an original light theme (ported by @jwintz) -;; - doom-outrun-electric -- a high contrast, neon theme inspired by Outrun Electric on VSCode (ported by @ema2159) -;; - doom-palenight -- adapted from equinusocio's Material themes (ported by @Brettm12345) -;; - doom-peacock -- inspired by daylerees' Peacock (ported by @teesloane) -;; - doom-pine -- a green flavor of doom-gruvbox (by @RomanHargrave) -;; - doom-plain -- inspired by gko's plain theme for VSCode (ported by @das-s) -;; - doom-plain-dark -- inspired by gko's plain theme for VSCode (ported by @das-s) -;; - doom-rouge -- ported from VSCode's Rouge Theme (ported by @das-s) -;; - doom-shades-of-purple -- a port of VSCode's Shades of Purple (ported by @jwbaldwin) -;; - doom-snazzy -- inspired by Hyper Snazzy (ported by @ar1a) -;; - doom-solarized-dark -- a dark variant of Solarized (ported by @ema2159) -;; - doom-solarized-dark-high-contrast -- a high-contrast variant of Solarized Dark (ported by @jmorag) -;; - doom-solarized-light -- a light variant of Solarized (ported by @fuxialexander) -;; - doom-sourcerer -- a port of xero's Sourcerer (ported by @fm0xb) -;; - doom-spacegrey -- I'm sure you've heard of it (ported by @teesloane) -;; - doom-tokyo-night -- inspired by VSCode's Tokyo Night theme (ported by @FosterHangdaan) -;; - doom-tomorrow-day -- a light variant of Tomorrow (ported by @emacswatcher) -;; - doom-tomorrow-night -- One of the dark variants of Tomorrow (ported by @hlissner) -;; - doom-vibrant -- a more vibrant variant of doom-one (ported by @hlissner) -;; - doom-wilmersdorf -- port of Ian Pan's Wilmersdorf (ported by @ema2159) -;; - doom-xcode -- based off of Apple's Xcode Dark Theme (ported by @kadenbarlow) -;; - doom-zenburn -- port of the popular Zenburn theme (ported by @jsoa) -;; -;; ## Install -;; -;; `M-x package-install RET doom-themes` -;; -;; A comprehensive configuration example: -;; -;; (require 'doom-themes) -;; -;; ;; Global settings (defaults) -;; (setq doom-themes-enable-bold t ; if nil, bold is universally disabled -;; doom-themes-enable-italic t) ; if nil, italics is universally disabled -;; -;; ;; Load the theme (doom-one, doom-molokai, etc); keep in mind that each -;; ;; theme may have their own settings. -;; (load-theme 'doom-one t) -;; -;; ;; Enable flashing mode-line on errors -;; (doom-themes-visual-bell-config) -;; -;; ;; Enable custom neotree theme -;; (doom-themes-neotree-config) ; all-the-icons fonts must be installed! -;; -;;; Code: - -(require 'cl-lib) -(require 'doom-themes-base) - -(defgroup doom-themes nil - "Options for doom-themes." - :group 'faces) - -(defcustom doom-themes-padded-modeline nil - "Default value for padded-modeline setting for themes that support it." - :group 'doom-themes - :type '(choice integer boolean)) - -;; -(defcustom doom-themes-enable-bold t - "If nil, bold will be disabled across all faces." - :group 'doom-themes - :type 'boolean) - -(defcustom doom-themes-enable-italic t - "If nil, italics will be disabled across all faces." - :group 'doom-themes - :type 'boolean) - - -;; -;;; API - -(defvar doom-themes--colors nil) -(defvar doom--min-colors '(257 256 16)) -(defvar doom--quoted-p nil) -(defvar doom-themes--faces nil) - -(defun doom-themes--colors-p (item) - (declare (pure t) (side-effect-free t)) - (when item - (cond ((listp item) - (let ((car (car item))) - (cond ((memq car '(quote doom-color)) nil) - - ((memq car '(backquote \`)) - (let ((doom--quoted-p t)) - (doom-themes--colors-p (cdr item)))) - - ((eq car '\,) - (let (doom--quoted-p) - (doom-themes--colors-p (cdr item)))) - - ((or (doom-themes--colors-p car) - (doom-themes--colors-p (cdr-safe item))))))) - - ((and (symbolp item) - (not (keywordp item)) - (not doom--quoted-p) - (not (equal (substring (symbol-name item) 0 1) "-")) - (assq item doom-themes--colors)))))) - -(defun doom-themes--apply-faces (new-faces &optional default-faces) - (declare (pure t) (side-effect-free t)) - (let ((default-faces (or default-faces doom-themes-base-faces)) - (faces (make-hash-table :test #'eq :size (+ (length default-faces) (length new-faces)))) - (directives (make-hash-table :test #'eq))) - (dolist (spec (append (mapcar #'copy-sequence default-faces) new-faces)) - (if (listp (car spec)) - (cl-destructuring-bind (face action &optional arg) (car spec) - (unless (assq face new-faces) - (puthash face (list action arg (cdr spec)) - directives))) - (puthash (car spec) (cdr spec) faces))) - (cl-loop for face being the hash-keys of directives - for (action target spec) = (gethash face directives) - unless (memq action '(&inherit &extend &override)) - do (error "Invalid operation (%s) for '%s' face" action face) - if (eq (car spec) 'quote) - do (error "Can't extend literal face spec (for '%s')" face) - ;; TODO Add &all/&light/&dark extension support - else if (memq (car spec) '(&all &light &dark)) - do (error "Can't extend face with &all, &light or &dark specs (for '%s')" face) - else do - (puthash face - (let ((old-spec (gethash (or target face) faces)) - (plist spec)) - ;; remove duplicates - (while (keywordp (car plist)) - (setq old-spec (plist-put old-spec (car plist) (cadr plist)) - plist (cddr plist))) - old-spec) - faces)) - (let (results) - (maphash (lambda (face plist) - (when (keywordp (car plist)) - ;; TODO Clean up duplicates in &all/&light/&dark blocks - (dolist (prop (append (unless doom-themes-enable-bold '(:weight normal :bold unspecified)) - (unless doom-themes-enable-italic '(:slant normal :italic unspecified)))) - (when (and (plist-member plist prop) - (not (eq (plist-get plist prop) 'inherit))) - (plist-put plist prop - (if (memq prop '(:weight :slant)) - (quote 'normal)))))) - (push (cons face plist) results)) - faces) - (nreverse results)))) - -(defun doom-themes--colorize (item type) - (declare (pure t) (side-effect-free t)) - (when item - (let ((doom--quoted-p doom--quoted-p)) - (cond ((listp item) - (cond ((memq (car item) '(quote doom-color)) - item) - ((eq (car item) 'doom-ref) - (doom-themes--colorize - (apply #'doom-ref (cdr item)) type)) - ((let* ((item (append item nil)) - (car (car item)) - (doom--quoted-p - (cond ((memq car '(backquote \`)) t) - ((eq car '\,) nil) - (t doom--quoted-p)))) - (cons car - (cl-loop - for i in (cdr item) - collect (doom-themes--colorize i type))))))) - - ((and (symbolp item) - (not (keywordp item)) - (not doom--quoted-p) - (not (equal (substring (symbol-name item) 0 1) "-")) - (assq item doom-themes--colors)) - `(doom-color ',item ',type)) - - (item))))) - -(defun doom-themes--build-face (face) - (declare (pure t) (side-effect-free t)) - `(list - ',(car face) - ,(let ((face-body (cdr face))) - (cond ((keywordp (car face-body)) - (let ((real-attrs face-body) - defs) - (if (doom-themes--colors-p real-attrs) - (dolist (cl doom--min-colors `(list ,@(nreverse defs))) - (push `(list '((class color) (min-colors ,cl)) - (list ,@(doom-themes--colorize real-attrs cl))) - defs)) - `(list (list 't (list ,@real-attrs)))))) - - ((memq (car-safe (car face-body)) '(quote backquote \`)) - (car face-body)) - - ((let (all-attrs defs) - (dolist (attrs face-body `(list ,@(nreverse defs))) - (cond ((eq (car attrs) '&all) - (setq all-attrs (append all-attrs (cdr attrs)))) - - ((memq (car attrs) '(&dark &light)) - (let ((bg (if (eq (car attrs) '&dark) 'dark 'light)) - (real-attrs (append all-attrs (cdr attrs) '()))) - (cond ((doom-themes--colors-p real-attrs) - (dolist (cl doom--min-colors) - (push `(list '((class color) (min-colors ,cl) (background ,bg)) - (list ,@(doom-themes--colorize real-attrs cl))) - defs))) - - ((push `(list '((background ,bg)) (list ,@real-attrs)) - defs))))))))))))) - - -;; -;;; Color helper functions - -;; Shamelessly *borrowed* from solarized -;;;###autoload -(defun doom-name-to-rgb (color) - "Retrieves the hexidecimal string repesented the named COLOR (e.g. \"red\") -for FRAME (defaults to the current frame)." - (cl-loop with div = (float (car (tty-color-standard-values "#ffffff"))) - for x in (tty-color-standard-values (downcase color)) - collect (/ x div))) - -;;;###autoload -(defun doom-blend (color1 color2 alpha) - "Blend two colors (hexidecimal strings) together by a coefficient ALPHA (a -float between 0 and 1)" - (when (and color1 color2) - (cond ((and color1 color2 (symbolp color1) (symbolp color2)) - (doom-blend (doom-color color1) (doom-color color2) alpha)) - - ((or (listp color1) (listp color2)) - (cl-loop for x in color1 - when (if (listp color2) (pop color2) color2) - collect (doom-blend x it alpha))) - - ((and (string-prefix-p "#" color1) (string-prefix-p "#" color2)) - (apply (lambda (r g b) (format "#%02x%02x%02x" (* r 255) (* g 255) (* b 255))) - (cl-loop for it in (doom-name-to-rgb color1) - for other in (doom-name-to-rgb color2) - collect (+ (* alpha it) (* other (- 1 alpha)))))) - - (color1)))) - -;;;###autoload -(defun doom-darken (color alpha) - "Darken a COLOR (a hexidecimal string) by a coefficient ALPHA (a float between -0 and 1)." - (cond ((and color (symbolp color)) - (doom-darken (doom-color color) alpha)) - - ((listp color) - (cl-loop for c in color collect (doom-darken c alpha))) - - ((doom-blend color "#000000" (- 1 alpha))))) - -;;;###autoload -(defun doom-lighten (color alpha) - "Brighten a COLOR (a hexidecimal string) by a coefficient ALPHA (a float -between 0 and 1)." - (cond ((and color (symbolp color)) - (doom-lighten (doom-color color) alpha)) - - ((listp color) - (cl-loop for c in color collect (doom-lighten c alpha))) - - ((doom-blend color "#FFFFFF" (- 1 alpha))))) - -;;;###autoload -(defun doom-color (name &optional type) - "Retrieve a specific color named NAME (a symbol) from the current theme." - (let ((colors (if (listp name) - name - (cdr-safe (assq name doom-themes--colors))))) - (and colors - (cond ((listp colors) - (let ((i (or (plist-get '(256 1 16 2 8 3) type) 0))) - (if (> i (1- (length colors))) - (car (last colors)) - (nth i colors)))) - (t colors))))) - -;;;###autoload -(defun doom-ref (face prop &optional class) - "TODO" - (let ((spec (or (cdr (assq face doom-themes--faces)) - (error "Couldn't find the '%s' face" face)))) - (when (memq (car spec) '(quote backquote \`)) - (user-error "Can't fetch the literal spec for '%s'" face)) - (when class - (setq spec (cdr (assq class spec))) - (unless spec - (error "Couldn't find the '%s' class in the '%s' face" - class face))) - (unless (plist-member spec prop) - (error "Couldn't find the '%s' property in the '%s' face%s" - prop face (if class (format "'s '%s' class" class) ""))) - (plist-get spec prop))) - - -;; -;;; Defining themes - -(defun doom-themes--prepare-facelist-1 (specs) - (dolist (spec specs specs) - (when spec - (setcar (cdr spec) - (cl-loop for (classes plist . rest) in (cadr spec) - collect - (cons classes - (cons (cl-loop for (key val) on plist by #'cddr - append (list key (or val 'unspecified))) - rest))))))) - -(defun doom-themes-prepare-facelist (custom-faces) - "Return an alist of face definitions for `custom-theme-set-faces'. - -Faces in EXTRA-FACES override the default faces." - (declare (pure t) (side-effect-free t)) - (setq doom-themes--faces (doom-themes--apply-faces custom-faces)) - (mapcar #'doom-themes--build-face doom-themes--faces)) - -(defun doom-themes-prepare-varlist (vars) - "Return an alist of variable definitions for `custom-theme-set-variables'. - -Variables in EXTRA-VARS override the default ones." - (declare (pure t) (side-effect-free t)) - (cl-loop for (var val) in (append doom-themes-base-vars vars) - collect `(list ',var ,val))) - -;;;###autoload -(defun doom-themes-set-faces (theme &rest faces) - "Customize THEME (a symbol) with FACES. - -If THEME is nil, it applies to all themes you load. FACES is a list of Doom -theme face specs. These is a simplified spec. For example: - - (doom-themes-set-faces \\='user - \\='(default :background red :foreground blue) - \\='(doom-modeline-bar :background (if -modeline-bright modeline-bg highlight)) - \\='(doom-modeline-buffer-file :inherit \\='mode-line-buffer-id :weight \\='bold) - \\='(doom-modeline-buffer-path :inherit \\='mode-line-emphasis :weight \\='bold) - \\='(doom-modeline-buffer-project-root :foreground green :weight \\='bold))" - (declare (indent defun)) - (apply #'custom-theme-set-faces - (or theme 'user) - (doom-themes--prepare-facelist-1 - (eval - `(let* ((bold ,doom-themes-enable-bold) - (italic ,doom-themes-enable-italic) - ,@(cl-loop for (var . val) in doom-themes--colors - collect `(,var ',val))) - (list ,@(mapcar #'doom-themes--build-face faces))))))) - -(defmacro def-doom-theme (name docstring &rest properties) - "Define a DOOM theme, named NAME (a symbol)." - (declare (doc-string 2) - (indent 2)) - (let (plist) - (while (keywordp (car properties)) - (cl-callf plist-put plist (pop properties) (pop properties))) - (cl-destructuring-bind (defs &optional extra-faces extra-vars) properties - (let ((doom-themes--colors defs)) - `(let* ((bold doom-themes-enable-bold) - (italic doom-themes-enable-italic) - ,@defs) - (setq doom-themes--colors - (list ,@(cl-loop for (var val) in defs - collect `(cons ',var ,val)))) - (deftheme ,name ,docstring :kind 'color-scheme ,@plist) - (apply #'custom-theme-set-faces - ',name - (doom-themes--prepare-facelist-1 (list ,@(doom-themes-prepare-facelist extra-faces)))) - (custom-theme-set-variables - ',name ,@(doom-themes-prepare-varlist extra-vars)) - (unless bold (set-face-bold 'bold 'unspecified)) - (unless italic (set-face-italic 'italic 'unspecified)) - (provide-theme ',name)))))) - -;;;###autoload -(when load-file-name - (add-to-list 'custom-theme-load-path - (let* ((base (file-name-directory load-file-name)) - (dir (expand-file-name "themes/" base))) - (or (and (file-directory-p dir) dir) - base)))) - -(provide 'doom-themes) -;;; doom-themes.el ends here diff --git a/.config/emacs/lisp/doom-themes/themes/doom-one-theme.el b/.config/emacs/lisp/doom-themes/themes/doom-one-theme.el deleted file mode 100644 index 1a87bab..0000000 --- a/.config/emacs/lisp/doom-themes/themes/doom-one-theme.el +++ /dev/null @@ -1,184 +0,0 @@ -;;; doom-one-theme.el --- inspired by Atom One Dark -*- lexical-binding: t; no-byte-compile: t; -*- -;; -;; Added: May 23, 2016 (28620647f838) -;; Author: Henrik Lissner -;; Maintainer: Henrik Lissner -;; Source: https://github.com/atom/one-dark-ui -;; -;;; Commentary: -;; -;; This themepack's flagship theme. -;; -;;; Code: - -(require 'doom-themes) - - -;; -;;; Variables - -(defgroup doom-one-theme nil - "Options for the `doom-one' theme." - :group 'doom-themes) - -(defcustom doom-one-brighter-modeline nil - "If non-nil, more vivid colors will be used to style the mode-line." - :group 'doom-one-theme - :type 'boolean) - -(defcustom doom-one-brighter-comments nil - "If non-nil, comments will be highlighted in more vivid colors." - :group 'doom-one-theme - :type 'boolean) - -(defcustom doom-one-comment-bg doom-one-brighter-comments - "If non-nil, comments will have a subtle highlight to enhance their -legibility." - :group 'doom-one-theme - :type 'boolean) - -(defcustom doom-one-padded-modeline doom-themes-padded-modeline - "If non-nil, adds a 4px padding to the mode-line. -Can be an integer to determine the exact padding." - :group 'doom-one-theme - :type '(choice integer boolean)) - - -;; -;;; Theme definition - -(def-doom-theme doom-one - "A dark theme inspired by Atom One Dark." - :family 'doom-one - :background-mode 'dark - - ;; name default 256 16 - ((bg '("#282c34" "black" "black" )) - (fg '("#bbc2cf" "#bfbfbf" "brightwhite" )) - - ;; These are off-color variants of bg/fg, used primarily for `solaire-mode', - ;; but can also be useful as a basis for subtle highlights (e.g. for hl-line - ;; or region), especially when paired with the `doom-darken', `doom-lighten', - ;; and `doom-blend' helper functions. - (bg-alt '("#21242b" "black" "black" )) - (fg-alt '("#5B6268" "#2d2d2d" "white" )) - - ;; These should represent a spectrum from bg to fg, where base0 is a starker - ;; bg and base8 is a starker fg. For example, if bg is light grey and fg is - ;; dark grey, base0 should be white and base8 should be black. - (base0 '("#1B2229" "black" "black" )) - (base1 '("#1c1f24" "#1e1e1e" "brightblack" )) - (base2 '("#202328" "#2e2e2e" "brightblack" )) - (base3 '("#23272e" "#262626" "brightblack" )) - (base4 '("#3f444a" "#3f3f3f" "brightblack" )) - (base5 '("#5B6268" "#525252" "brightblack" )) - (base6 '("#73797e" "#6b6b6b" "brightblack" )) - (base7 '("#9ca0a4" "#979797" "brightblack" )) - (base8 '("#DFDFDF" "#dfdfdf" "white" )) - - (grey base4) - (red '("#ff6c6b" "#ff6655" "red" )) - (orange '("#da8548" "#dd8844" "brightred" )) - (green '("#98be65" "#99bb66" "green" )) - (teal '("#4db5bd" "#44b9b1" "brightgreen" )) - (yellow '("#ECBE7B" "#ECBE7B" "yellow" )) - (blue '("#51afef" "#51afef" "brightblue" )) - (dark-blue '("#2257A0" "#2257A0" "blue" )) - (magenta '("#c678dd" "#c678dd" "brightmagenta")) - (violet '("#a9a1e1" "#a9a1e1" "magenta" )) - (cyan '("#46D9FF" "#46D9FF" "brightcyan" )) - (dark-cyan '("#5699AF" "#5699AF" "cyan" )) - - ;; These are the "universal syntax classes" that doom-themes establishes. - ;; These *must* be included in every doom themes, or your theme will throw an - ;; error, as they are used in the base theme defined in doom-themes-base. - (highlight blue) - (vertical-bar (doom-darken base1 0.1)) - (selection dark-blue) - (builtin magenta) - (comments (if doom-one-brighter-comments dark-cyan base5)) - (doc-comments (doom-lighten (if doom-one-brighter-comments dark-cyan base5) 0.25)) - (constants violet) - (functions magenta) - (keywords blue) - (methods cyan) - (operators blue) - (type yellow) - (strings green) - (variables (doom-lighten magenta 0.4)) - (numbers orange) - (region `(,(doom-lighten (car bg-alt) 0.15) ,@(doom-lighten (cdr base1) 0.35))) - (error red) - (warning yellow) - (success green) - (vc-modified orange) - (vc-added green) - (vc-deleted red) - - ;; These are extra color variables used only in this theme; i.e. they aren't - ;; mandatory for derived themes. - (modeline-fg fg) - (modeline-fg-alt base5) - (modeline-bg (if doom-one-brighter-modeline - (doom-darken blue 0.45) - (doom-darken bg-alt 0.1))) - (modeline-bg-alt (if doom-one-brighter-modeline - (doom-darken blue 0.475) - `(,(doom-darken (car bg-alt) 0.15) ,@(cdr bg)))) - (modeline-bg-inactive `(,(car bg-alt) ,@(cdr base1))) - (modeline-bg-inactive-alt `(,(doom-darken (car bg-alt) 0.1) ,@(cdr bg))) - - (-modeline-pad - (when doom-one-padded-modeline - (if (integerp doom-one-padded-modeline) doom-one-padded-modeline 4)))) - - - ;;;; Base theme face overrides - (((line-number &override) :foreground base4) - ((line-number-current-line &override) :foreground fg) - ((font-lock-comment-face &override) - :background (if doom-one-comment-bg (doom-lighten bg 0.05) 'unspecified)) - (mode-line - :background modeline-bg :foreground modeline-fg - :box (if -modeline-pad `(:line-width ,-modeline-pad :color ,modeline-bg))) - (mode-line-inactive - :background modeline-bg-inactive :foreground modeline-fg-alt - :box (if -modeline-pad `(:line-width ,-modeline-pad :color ,modeline-bg-inactive))) - (mode-line-emphasis :foreground (if doom-one-brighter-modeline base8 highlight)) - - ;;;; css-mode / scss-mode - (css-proprietary-property :foreground orange) - (css-property :foreground green) - (css-selector :foreground blue) - ;;;; doom-modeline - (doom-modeline-bar :background (if doom-one-brighter-modeline modeline-bg highlight)) - (doom-modeline-buffer-file :inherit 'mode-line-buffer-id :weight 'bold) - (doom-modeline-buffer-path :inherit 'mode-line-emphasis :weight 'bold) - (doom-modeline-buffer-project-root :foreground green :weight 'bold) - ;;;; elscreen - (elscreen-tab-other-screen-face :background "#353a42" :foreground "#1e2022") - ;;;; ivy - (ivy-current-match :background dark-blue :distant-foreground base0 :weight 'normal) - ;;;; LaTeX-mode - (font-latex-math-face :foreground green) - ;;;; markdown-mode - (markdown-markup-face :foreground base5) - (markdown-header-face :inherit 'bold :foreground red) - ((markdown-code-face &override) :background (doom-lighten base3 0.05)) - ;;;; rjsx-mode - (rjsx-tag :foreground red) - (rjsx-attr :foreground orange) - ;;;; solaire-mode - (solaire-mode-line-face - :inherit 'mode-line - :background modeline-bg-alt - :box (if -modeline-pad `(:line-width ,-modeline-pad :color ,modeline-bg-alt))) - (solaire-mode-line-inactive-face - :inherit 'mode-line-inactive - :background modeline-bg-inactive-alt - :box (if -modeline-pad `(:line-width ,-modeline-pad :color ,modeline-bg-inactive-alt)))) - - ;;;; Base theme variable overrides- - ()) - -;;; doom-one-theme.el ends here diff --git a/.config/emacs/lisp/dumb-jump.el b/.config/emacs/lisp/dumb-jump.el deleted file mode 100644 index 39e1f63..0000000 --- a/.config/emacs/lisp/dumb-jump.el +++ /dev/null @@ -1,5706 +0,0 @@ -;;; dumb-jump.el --- Jump to definition for 60+ languages without configuration -*- lexical-binding: t; -*- -;; Copyright (C) 2015-2026 jack angers -;; Author: jack angers and contributors -;; Url: https://github.com/jacktasia/dumb-jump -;; Version: 0.5.5 -;; Package-Requires: ((emacs "26.1")) -;; Keywords: programming - -;; Dumb Jump is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. -;; -;; Dumb Jump is distributed in the hope that it will be useful, but WITHOUT -;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -;; License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Dumb Jump. If not, see http://www.gnu.org/licenses. - -;;; Commentary: - -;; Dumb Jump is an Emacs "jump to definition" package with support for 60+ programming languages that favors -;; "just working" over speed or accuracy. This means minimal -- and ideally zero -- configuration with absolutely -;; no stored indexes (TAGS) or persistent background processes. -;; -;; Dumb Jump provides a xref-based interface for jumping to -;; definitions. It is based on tools such as grep, the silver searcher -;; (https://geoff.greer.fm/ag/), ripgrep -;; (https://github.com/BurntSushi/ripgrep) or git-grep -;; (https://git-scm.com/docs/git-grep). -;; -;; To enable Dumb Jump, add the following to your initialisation file: -;; -;; (add-hook 'xref-backend-functions #'dumb-jump-xref-activate) -;; -;; Now pressing M-. on an identifier should open a buffer at the place -;; where it is defined, or a list of candidates if uncertain. This -;; list can be navigated using M-g M-n (next-error) and M-g M-p -;; (previous-error). -;;; Code: -(require 'xref) -(require 'cl-generic) -(require 'cl-lib) -(require 'seq) -(require 'subr-x) -(require 'json) -(require 'project nil 'noerror) - -(defun dumb-jump--chop-prefix (prefix text) - "Remove PREFIX from TEXT when present." - (if (and (stringp prefix) - (stringp text) - (string-prefix-p prefix text)) - (substring text (length prefix)) - text)) - -(defun dumb-jump--contains-p (needle text &optional ignore-case) - "Return non-nil when TEXT contains NEEDLE as a literal substring. -When IGNORE-CASE is non-nil, match without case sensitivity." - (and (stringp needle) - (stringp text) - (save-match-data - (let ((case-fold-search ignore-case)) - (if (string-match-p (regexp-quote needle) text) t nil))))) - -(defun dumb-jump--index-of (needle text) - "Return the index of NEEDLE in TEXT, or nil when not found." - (when (and (stringp needle) (stringp text)) - (save-match-data - (string-match-p (regexp-quote needle) text)))) - -(defun dumb-jump--join (separator strings) - "Join STRINGS using SEPARATOR." - (mapconcat #'identity strings separator)) - -(defun dumb-jump--match (regexp text &optional start) - "Return list of REGEXP matches in TEXT from START, or nil." - (when (and (stringp regexp) - (stringp text)) - (save-match-data - (when (string-match regexp text start) - (let* ((group-count (/ (length (match-data t)) 2)) - (i 0) - matches) - (while (< i group-count) - (push (match-string i text) matches) - (setq i (1+ i))) - (nreverse matches)))))) - -(defun dumb-jump--matched-positions-all (regexp text &optional start) - "Return a list of match ranges for REGEXP in TEXT from START. -Each element is a cons cell of the form (START . END)." - (when (and (stringp regexp) (stringp text)) - (save-match-data - (let ((pos (or start 0)) - matches) - (while (string-match regexp text pos) - (let ((beg (match-beginning 0)) - (end (match-end 0))) - (push (cons beg end) matches) - ;; Avoid infinite loops if REGEXP can match empty strings. - (setq pos (if (= beg end) (1+ end) end)))) - (nreverse matches))))) - -(defun dumb-jump--replace (old new text) - "Replace all OLD literal matches in TEXT with NEW." - (replace-regexp-in-string (regexp-quote old) (or new "") (or text "") t t)) - -(defun dumb-jump--split (regexp text &optional omit-nulls) - "Split TEXT on REGEXP and optionally OMIT-NULLS." - (split-string (or text "") regexp omit-nulls)) - -(defun dumb-jump--trim (text) - "Trim leading and trailing whitespace from TEXT." - (string-trim (or text ""))) - -(defun dumb-jump--select-choice (choices &optional prompt) - "Choose one of CHOICES with `completing-read'. -PROMPT defaults to \"Jump to: \"." - (completing-read (or prompt "Jump to: ") choices nil t)) - -(defun dumb-jump--show-preview (text) - "Display TEXT preview to the user." - (message "%s" text)) - -(defun dumb-jump--find-index (pred list) - "Return index of first element in LIST satisfying PRED, or nil." - (let ((i 0)) - (catch 'found - (dolist (elem list) - (when (funcall pred elem) - (throw 'found i)) - (setq i (1+ i))) - nil))) - -(defun dumb-jump--zip-pair (list1 list2) - "Return list of cons pairs from LIST1 and LIST2." - (cl-mapcar #'cons list1 list2)) - -(defun dumb-jump--splice (pred rep list) - "Replace elements in LIST matching PRED with result of calling REP on them. -REP can return a list to splice in multiple elements." - (apply #'append - (mapcar (lambda (it) - (if (funcall pred it) - (funcall rep it) - (list it))) - list))) - -(defgroup dumb-jump nil - "Easily jump to project function and variable definitions." - :group 'tools - :group 'convenience) - -;;;###autoload -(defvar dumb-jump-mode-map - (let ((map (make-sparse-keymap))) - (define-key map (kbd "C-M-g") 'dumb-jump-go) - (define-key map (kbd "C-M-p") 'dumb-jump-back) - (define-key map (kbd "C-M-q") 'dumb-jump-quick-look) - map)) - -(defvar dumb-jump--search-mode 'definitions - "Current search mode: `definitions' (default) or `references'.") - -(defcustom dumb-jump-window - 'current - "Which window to use when jumping. -Valid options are \\='current (default) or \\='other." - :group 'dumb-jump - :type '(choice (const :tag "Current window" current) - (const :tag "Other window" other))) - -(defcustom dumb-jump-use-visible-window - t - "If true will jump in a visible window that shows the opened file." - :group 'dumb-jump - :type 'boolean) - -(defcustom dumb-jump-selector - 'completing-read - "Which selector to use when there is multiple choices. -The available selectors are: -- helm : https://emacs-helm.github.io/helm/ -- ivy : https://github.com/abo-abo/swiper -- Completing Read: Emacs default `completing-read'. - -When selecting helm or ivy, if the corresponding package is not installed, -the selector falls back to `completing-read'." - :group 'dumb-jump - :type '(choice (const :tag "Helm" helm) - (const :tag "Ivy" ivy) - (const :tag "Completing Read" completing-read))) - -(defcustom dumb-jump-ivy-jump-to-selected-function - #'dumb-jump-ivy-jump-to-selected - "Prompts user for a choice using ivy then dumb-jump to that choice." - :group 'dumb-jump - :type 'function) - -(defcustom dumb-jump-prefer-searcher nil - "The preferred searcher command line tool to use. -The available choices are: -- \\='ag : https://github.com/ggreer/the_silver_searcher -- \\='rg : https://github.com/BurntSushi/ripgrep -- \\='grep : https://en.wikipedia.org/wiki/Grep -- \\='gnu-grep : https://www.gnu.org/software/grep/manual/grep.html -- \\='git-grep : https://git-scm.com/docs/git-grep -- \\='git-grep-plus-ag - -If nil, select the most optimal searcher at runtime, looking for all -tools listed above except for git-grep in the order of that list. -However, the choice is overridden by `dumb-jump-force-searcher' selection -unless that is nil." - :group 'dumb-jump - :type '(choice (const :tag "Best Available" nil) - (const :tag "ag" ag) - (const :tag "rg" rg) - (const :tag "grep" grep) - (const :tag "gnu-grep" gnu-grep) - (const :tag "git grep" git-grep) - (const :tag "git grep + ag" git-grep-plus-ag))) - -(defcustom dumb-jump-force-searcher nil - "Search tool override of `dumb-jump-prefer-searcher' selection. - -By default this is nil to honour the choice made by `dumb-jump-prefer-searcher'. - -However, you may want to override that choice for some projects by identifying -one of two preferred choice overriding methods: -- Override preferred via user-specified function: - Enter the name of a function that takes the current directory and return the - search tool symbol to use for this project or nil if the choice made in - `dumb-jump-prefer-searcher' must be honoured. -- Override preferred for directories needing git-grep: - Specify one or more project directories where the git-grep search tool must - be used. -- Override to a specific tool. That is mostly useful to set the overriding - inside the .dir-locals.el of the directory. - The choices are: \\='ag, \\='rg, \\='grep, \\='gnu-grep, \\='git-grep, or - \\='git-grep-plus-ag." - :group 'dumb-jump - :type '(choice (const - :tag "nil: honour `dumb-jump-prefer-searcher' choice." nil) - (function - :tag "Override preferred via user-specified function") - (repeat - :tag "Override preferred for directories needing git-grep" - (directory :tag "Repo root")) - (const :tag "ag" ag) - (const :tag "rg" rg) - (const :tag "grep" grep) - (const :tag "gnu grep" gnu-grep) - (const :tag "git grep" git-grep) - (const :tag "git grep + ag" git-grep-plus-ag))) - -(defcustom dumb-jump-grep-prefix - "LANG=C" - "Prefix to grep command. Seemingly makes it faster for pure text." - :group 'dumb-jump - :type 'string) - -(defcustom dumb-jump-grep-cmd - "grep" - "The path to grep. By default assumes it is in path." - :group 'dumb-jump - :type 'string) - -(defcustom dumb-jump-ag-cmd - "ag" - "The path to the silver searcher. By default assumes it is in path." - :group 'dumb-jump - :type 'string) - -(defcustom dumb-jump-rg-cmd - "rg" - "The path to ripgrep. By default assumes it is in path." - :group 'dumb-jump - :type 'string) - -(defcustom dumb-jump-git-grep-cmd - "git grep" - "The path to git grep. By default assumes it is in path." - :group 'dumb-jump - :type 'string) - -;; --------------------------------------------------------------------------- -;; Dumb Jump Regular Expressions (see `dumb-jump-find-rules' docstring) - -(defcustom dumb-jump-force-using-space-bracket-exp - (eq system-type 'windows-nt) - "When t the `\\\\s` in regexp code strings is replaced by `[[:space:]]`. -Otherwise it is left in the regular expression. -Defaults to t under Windows because older gnu grep versions have problem -dealing with `\\\\s` to match end of words due to the 2 bytes used to -identify the end of line." - :group 'dumb-jump - :type 'boolean) - -(defun dumb-jump-use-space-bracket-exp-for (variant) - "Return t when `\\\\s` must be replaced by `[[:space]]` for VARIANT. -VARIANT must be a one of the following symbols: ag, rg, grep, gnu-grep, -git-grep or git-grep-plus-ag." - (and dumb-jump-force-using-space-bracket-exp - (memq variant '(grep gnu-grep git-grep git-grep-plus-ag)))) - -;; word-boundary regexps: they replace the "\\j" in dumb-jump regexes. -;; [:todo 2026-01-29, by Pierre Rouleau: Should we not exclude '_' from word boundary?] -(defcustom dumb-jump-ag-word-boundary - "(?![a-zA-Z0-9\\?\\*-])" - "Regexp that replaces `\\j` in dumb-jump regexes for ag search. -`\\b` thinks `-` is a word boundary. -When this matters use `\\j` instead and ag will use this value." - :group 'dumb-jump - :type 'string) - -;; [:todo 2026-01-29, by Pierre Rouleau: Should we not exclude '_' from word boundary?] -(defcustom dumb-jump-rg-word-boundary - "($|[^a-zA-Z0-9\\?\\*-])" - "Regexp that replaces `\\j` in dumb-jump regexes for rg search. -`\\b` thinks `-` is a word boundary. -When this matters use `\\j` instead and rg will use this value." - :group 'dumb-jump - :type 'string) - -;; [:todo 2026-01-29, by Pierre Rouleau: Should we not exclude '_' from word boundary?] -(defcustom dumb-jump-git-grep-word-boundary - "($|[^a-zA-Z0-9\\?\\*-])" - "Regexp that replaces `\\j` in dumb-jump regexes for git-grep search. -`\\b` thinks `-` is a word boundary. -When this matters use `\\j` instead and git grep will use this value." - :group 'dumb-jump - :type 'string) - -;; [:todo 2026-01-29, by Pierre Rouleau: Should we not exclude '_' from word boundary?] -(defcustom dumb-jump-grep-word-boundary - "($|[^a-zA-Z0-9\\?\\*-])" - "Regexp that replaces `\\j` in dumb-jump regexes for grep search. -`\\b` thinks `-` is a word boundary. -When this matters use `\\j` instead and grep will use this value." - :group 'dumb-jump - :type 'string) - -;; [:todo 2026-01-29, by Pierre Rouleau: Should we not exclude '_' from word boundary?] -(defcustom dumb-jump-gnu-grep-word-boundary - "($|[^a-zA-Z0-9\\?\\*-])" - "Regexp that replaces `\\j` in dumb-jump regexes for gnu grep search. -`\\b` thinks `-` is a word boundary. -When this matters use `\\j` instead and grep will use this value." - :group 'dumb-jump - :type 'string) - -;; -- - -(defcustom dumb-jump-fallback-regex - "\\bJJJ\\j" - "When `dumb-jump-fallback-search' is t use this regex. -Defaults to boundary search of symbol under point." - :group 'dumb-jump - :type 'string) - -(defcustom dumb-jump-fallback-search - t - "If nothing is found with normal search fallback searching fallback regex." - :group 'dumb-jump - :type 'boolean) - -(defcustom dumb-jump-zgrep-cmd - "zgrep" - "The path to grep to use for gzipped files. -By default assumes it is in path." - :group 'dumb-jump - :type 'string) - -(defcustom dumb-jump-grep-args "-REn" - "Grep command args [R]ecursive, [E]xtended regexes, and show line [n]umbers." - :group 'dumb-jump - :type 'string) - -(defcustom dumb-jump-gnu-grep-args "-rEn" - "Grep command args [r]ecursive and [E]xtended regexes, and show line [n]umbers." - :group 'dumb-jump - :type 'string) - -(defcustom dumb-jump-max-find-time - 2 - "Number of seconds a grep/find command can take before issuing a warning. -The warning recommend using a faster search tool and config." - :group 'dumb-jump - :type 'integer) - -(defcustom dumb-jump-functions-only - nil - "Should we only jump to functions?" - :group 'dumb-jump - :type 'boolean) - -(defcustom dumb-jump-quiet - nil - "If non-nil Dumb Jump will not log anything to *Messages*. -Note that it prevents printing when `dumb-jump-debug' is non-nil." - :group 'dumb-jump - :type 'boolean) - -(defcustom dumb-jump-ignore-context - nil - "If non-nil Dumb Jump will ignore the context of point when jumping." - :group 'dumb-jump - :type 'boolean) - -(defcustom dumb-jump-git-grep-search-untracked - t - "If non-nil Dumb Jump will also search untracked files when using git-grep." - :group 'dumb-jump - :type 'boolean) - -(defcustom dumb-jump-git-grep-search-args - "" - "Appends the passed arguments to the git-grep search function. -Default: \"\"." - :group 'dumb-jump - :type 'string) - -(defcustom dumb-jump-ag-search-args - "" - "Appends the passed arguments to the ag search function. -Default: \"\"." - :group 'dumb-jump - :type 'string) - -(defcustom dumb-jump-rg-search-args - "--pcre2" - "Appends the passed arguments to the rg search function. -Default: \"--pcre2\"." - :group 'dumb-jump - :type 'string) - -(defcustom dumb-jump-search-type-org-only-org - t - "If non nil restrict type ag/rg to org file. -If nil add also the language type of current src block." - :group 'dumb-jump - :type 'boolean) - -;; [:todo 2026-01-29, by Pierre Rouleau: Why 3 backslashes in front of '('? ] -(defcustom dumb-jump-find-rules - ;;-- elisp - '((:language "elisp" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\((defun|cl-defun|cl-defgeneric|cl-defmethod|cl-defsubst)\\s+JJJ\\j" - :tests ("(defun test (blah)" - "(defun test\n" - "(cl-defun test (blah)" - "(cl-defun test\n") - :not ("(defun test-asdf (blah)" - "(defun test-blah\n" - "(cl-defun test-asdf (blah)" - "(cl-defun test-blah\n" - "(defun tester (blah)" - "(defun test? (blah)" - "(defun test- (blah)")) - - (:language "elisp" :type "function" ; macros - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\((defmacro|cl-defmacro|cl-define-compiler-macro)\\s+JJJ\\j" - :tests ("(defmacro test (blah)" - "(defmacro test\n") - :not ("(defmacro test-asdf (blah)" - "(defmacro test-blah\n" - "(defmacro tester (blah)" - "(defmacro test? (blah)" - "(defmacro test- (blah)")) - - (:language "elisp" :type "function" ; hydras - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\(defhydra\\b\\s*JJJ\\j" - :tests ("(defhydra test " - "(defhydra test\n" - "(defhydra test (blah\n" - "(defhydra test (blah)") - :not ("(defhydra tester" - "(defhydra test?" - "(defhydra test-" - "(defhydra test? (blah\n" - "(defhydra test? (blah)")) - - (:language "elisp" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\(defvar(-local)?\\b\\s*JJJ\\j" - :tests ("(defvar test " - "(defvar test\n" - "(defvar-local test" - "(defvar-local test\n") - :not ("(defvar tester" - "(defvar test?" - "(defvar test-" - "(defvar-local tester" - "(defvar-local test?" - "(defvar-local test-")) - - (:language "elisp" :type "variable" - :supports ("ag" "grep" "rg" "ugrep" "git-grep") - :regex "\\(defconst\\b\\s*JJJ\\j" - :tests ("(defconst test " - "(defconst test\n") - :not ("(defconst tester" - "(defconst test?" - "(defconst test-")) - - (:language "elisp" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\(defcustom\\b\\s*JJJ\\j" - :tests ("(defcustom test " - "(defcustom test\n") - :not ("(defcustom tester" - "(defcustom test?" - "(defcustom test-")) - - (:language "elisp" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\(setq\\b\\s*JJJ\\j" - :tests ("(setq test 123)") - :not ("setq test-blah 123)" - "(setq tester" - "(setq test?" "(setq test-")) - - (:language "elisp" :type "variable" ; let bound variables - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\(JJJ\\s+" - :skip-ref-filter t - :tests ("(let ((test 123)))" - "(let* ((test 123)))") - :not ("(let ((test-2 123)))" - "(let* ((test-2 123)))")) - - (:language "elisp" :type "type" ; cl-lib structured type definitions - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\((cl-defstruct|cl-deftype)\\s+JJJ\\j" - :tests ("(cl-defstruct test " - "(cl-defstruct test\n" - "(cl-deftype test " - "(cl-deftype test\n") - :not ("(cl-defstruct test-asdf (blah)" - "(cl-defstruct test-blah\n" - "(cl-deftype test-asdf (blah)" - "(cl-deftype test-blah\n")) - - (:language "elisp" :type "variable" ;; variable in method signature - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\((defun|cl-defun|cl-defgeneric|cl-defmethod)\\s*.+\\(?\\s*JJJ\\j\\s*\\)?" - :tests ("(defun blah (test)" - "(defun blah (test blah)" - "(defun (blah test)") - :not ("(defun blah (test-1)" - "(defun blah (test-2 blah)" - "(defun (blah test-3)")) - - ;;-- common lisp - (:language "commonlisp" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\(def(un|macro|generic|method|setf)\\s+JJJ\\j" - ;; \\j usage see `dumb-jump-ag-word-boundary` - :tests ("(defun test (blah)" - "(defun test\n" - "(defmacro test (blah)" - "(defmacro test\n" - "(defgeneric test (blah)" - "(defgeneric test\n" - "(defmethod test (blah)" - "(defmethod test\n" - "(defsetf test (blah)" - "(defsetf test\n") - :not ("(defun test-asdf (blah)" - "(defun test-blah\n" - "(defun tester (blah)" - "(defun test? (blah)" - "(defun test- (blah)" - "(defmacro test-asdf (blah)" - "(defmacro test-blah\n" - "(defmacro tester (blah)" - "(defmacro test? (blah)" - "(defmacro test- (blah)" - "(defgeneric test-asdf (blah)" - "(defgeneric test-blah\n" - "(defgeneric tester (blah)" - "(defgeneric test? (blah)" - "(defun test- (blah)" - "(defmethod test-asdf (blah)" - "(defmethod test-blah\n" - "(defmethod tester (blah)" - "(defmethod test? (blah)" - "(defun test- (blah)" - "(defsetf test-asdf (blah)" - "(defsetf test-blah\n" - "(defsetf tester (blah)" - "(defsetf test? (blah)" - "(defun test- (blah)")) - - (:language "commonlisp" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\(define-(modify-macro|compiler-macro|setf-expander)\\s+JJJ\\j" - ;; \\j usage see `dumb-jump-ag-word-boundary` - :tests ("(define-modify-macro test (blah)" - "(define-modify-macro test\n" - "(define-compiler-macro test (blah)" - "(define-compiler-macro test\n") - :not ("(define-modify-macro test-asdf (blah)" - "(define-modify-macro test-blah\n" - "(define-modify-macro tester (blah)" - "(define-modify-macro test? (blah)" - "(define-modify-macro test- (blah)" - "(define-compiler-macro test-asdf (blah)" - "(define-compiler-macro test-blah\n" - "(define-compiler-macro tester (blah)" - "(define-compiler-macro test? (blah)" - "(define-compiler-macro test- (blah)")) - - (:language "commonlisp" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\(def(var|parameter|constant)\\b\\s*JJJ\\j" - :tests ("(defvar test " - "(defvar test\n" - "(defparameter test " - "(defparameter test\n" - "(defconstant test " - "(defconstant test\n") - :not ("(defvar tester" - "(defvar test?" - "(defvar test-" - "(defparameter tester" - "(defparameter test?" - "(defparameter test-" - "(defconstant tester" - "(defconstant test?" - "(defconstant test-")) - - (:language "commonlisp" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\(define-symbol-macro\\b\\s*JJJ\\j" - :tests ("(define-symbol-macro test " - "(define-symbol-macro test\n") - :not ("(define-symbol-macro tester" - "(define-symbol-macro test?" - "(define-symbol-macro test-")) - - (:language "commonlisp" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\(def(class|struct|type)\\b\\s*JJJ\\j" - :tests ("(defclass test " - "(defclass test\n" - "(defstruct test " - "(defstruct test\n" - "(deftype test " - "(deftype test\n") - :not ("(defclass tester" - "(defclass test?" - "(defclass test-" - "(defstruct tester" - "(defstruct test?" - "(defstruct test-" - "(deftype tester" - "(deftype test?" - "(deftype test-")) - - (:language "commonlisp" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\(define-condition\\b\\s*JJJ\\j" - :tests ("(define-condition test " - "(define-condition test\n") - :not ("(define-condition tester" - "(define-condition test?" - "(define-condition test-")) - - ;;-- racket - (:language "racket" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\(define\\s+\\(\\s*JJJ\\j" - :tests ("(define (test blah)" - "(define (test\n") - :not ("(define test blah" - "(define (test-asdf blah)" - "(define test (lambda (blah")) - - (:language "racket" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\(define\\s+JJJ\\s*\\\(\\s*lambda" - :tests ("(define test (lambda (blah" - "(define test (lambda\n") - :not ("(define test blah" - "(define test-asdf (lambda (blah)" - "(define (test)" - "(define (test blah) (lambda (foo")) - - (:language "racket" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\(let\\s+JJJ\\s*(\\\(|\\\[)*" - :tests ("(let test ((blah foo) (bar bas))" - "(let test\n" - "(let test [(foo") - :not ("(let ((test blah")) - - (:language "racket" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\(define\\s+JJJ\\j" - :tests ("(define test " "(define test\n") - :not ("(define (test")) - - (:language "racket" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(\\\(|\\\[)\\s*JJJ\\s+" - :tests ("(let ((test 'foo" - "(let [(test 'foo" - "(let [(test 'foo" - "(let [[test 'foo" - "(let ((blah 'foo) (test 'bar)") - :not ("{test foo")) - - (:language "racket" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\(lambda\\s+\\\(?[^\(\)]*\\s*JJJ\\j\\s*\\\)?" - :tests ("(lambda (test)" - "(lambda (foo test)" - "(lambda test (foo)") - :not ("(lambda () test")) - - (:language "racket" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\(define\\s+\\\([^\(\)]+\\s*JJJ\\j\\s*\\\)?" - :tests ("(define (foo test)" - "(define (foo test bar)") - :not ("(define foo test" - "(define (test foo" - "(define (test)")) - - (:language "racket" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\(struct\\s+JJJ\\j" - :tests ("(struct test (a b)")) - - ;;-- scheme - (:language "scheme" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\(define\\s+\\(\\s*JJJ\\j" - :tests ("(define (test blah)" - "(define (test\n") - :not ("(define test blah" - "(define (test-asdf blah)" - "(define test (lambda (blah")) - - (:language "scheme" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\(define\\s+JJJ\\s*\\\(\\s*lambda" - :tests ("(define test (lambda (blah" - "(define test (lambda\n") - :not ("(define test blah" - "(define test-asdf (lambda (blah)" - "(define (test)" - "(define (test blah) (lambda (foo")) - - (:language "scheme" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\(let\\s+JJJ\\s*(\\\(|\\\[)*" - :tests ("(let test ((blah foo) (bar bas))" - "(let test\n" - "(let test [(foo") - :not ("(let ((test blah")) - - (:language "scheme" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\(define\\s+JJJ\\j" - :tests ("(define test " - "(define test\n") - :not ("(define (test")) - - (:language "scheme" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(\\\(|\\\[)\\s*JJJ\\s+" - :tests ("(let ((test 'foo" - "(let [(test 'foo" - "(let [(test 'foo" - "(let [[test 'foo" - "(let ((blah 'foo) (test 'bar)") - :not ("{test foo")) - - (:language "scheme" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\(lambda\\s+\\\(?[^\(\)]*\\s*JJJ\\j\\s*\\\)?" - :tests ("(lambda (test)" - "(lambda (foo test)" - "(lambda test (foo)") - :not ("(lambda () test")) - - (:language "scheme" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\(define\\s+\\\([^\(\)]+\\s*JJJ\\j\\s*\\\)?" - :tests ("(define (foo test)" - "(define (foo test bar)") - :not ("(define foo test" - "(define (test foo" - "(define (test)")) - - ;;-- janet - (:language "janet" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\(\(de\)?f\\s+JJJ\\j" - :tests ("(def test (foo)")) - - (:language "janet" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\(var\\s+JJJ\\j" - :tests ("(var test (foo)")) - - (:language "janet" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\(\(de\)fn-?\\s+JJJ\\j" - :tests ("(defn test [foo]" - "(defn- test [foo]") - :not ("(defn test? [foo]" - "(defn- test? [foo]")) - - (:language "janet" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\(defmacro\\s+JJJ\\j" - :tests ("(defmacro test [foo]")) - - ;;-- c++ - (:language "c++" :type "function" - :supports ("ag" "rg" "git-grep") - :regex "\\bJJJ(\\s|\\))*\\((\\w|[,&*.<>:]|\\s)*(\\))\\s*(const|->|\\{|$)|typedef\\s+(\\w|[(*]|\\s)+JJJ(\\)|\\s)*\\(" - :tests ("int test(){" - "my_struct (*test)(int a, int b){" - "auto MyClass::test ( Builder::Builder& reference, ) -> decltype( builder.func() ) {" - "int test( int *random_argument) const {" - "test::test() {" - "typedef int (*test)(int);") - :not ("return test();)" - "int test(a, b);" - "if( test() ) {" - "else test();")) - - ;; (:language "c++" :type "variable" - ;; :supports ("grep") - ;; :regex "(\\b\\w+|[,>])([*&]|\\s)+JJJ\\s*(\\[([0-9]|\\s)*\\])*\\s*([=,){;]|:\\s*[0-9])|#define\\s+JJJ\\b" - ;; :tests ("int test=2;" "char *test;" "int x = 1, test = 2" "int test[20];" "#define test" "unsigned int test:2;")) - - (:language "c++" :type "variable" - :supports ("ag" "rg") - :regex "\\b(?!(class\\b|struct\\b|return\\b|else\\b|delete\\b))(\\w+|[,>])([*&]|\\s)+JJJ\\s*(\\[(\\d|\\s)*\\])*\\s*([=,(){;]|:\\s*\\d)|#define\\s+JJJ\\b" - :tests ("int test=2;" - "char *test;" - "int x = 1, test = 2" - "int test[20];" - "#define test" - "typedef int test;" - "unsigned int test:2") - :not ("return test;" - "#define NOT test" - "else test=2;")) - - (:language "c++" :type "type" - :supports ("ag" "rg" "git-grep") - :regex "\\b(class|struct|enum|union)\\b\\s*JJJ\\b\\s*(final\\s*)?(:((\\s*\\w+\\s*::)*\\s*\\w*\\s*?\\s*,*)+)?((\\{|$))|}\\s*JJJ\\b\\s*;" - :tests ("typedef struct test {" - "enum test {" - "} test;" - "union test {" - "class test final: public Parent1, private Parent2{" - "class test : public std::vector {") - :not("union test var;" - "struct test function() {")) - - ;;-- clojure - (:language "clojure" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\(def.*\ JJJ\\j" - :tests ("(def test (foo)" - "(defn test [foo]" - "(defn ^:some-data test [foo]" - "(defn- test [foo]" - "(defmacro test [foo]" - "(deftask test [foo]" - "(deftype test [foo]" - "(defmulti test fn" - "(defmethod test type" - "(definterface test (foo)" - "(defprotocol test (foo)" - "(defrecord test [foo]" - "(deftest test")) - - ;;-- coffeescript - (:language "coffeescript" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^\\s*JJJ\\s*[=:].*[-=]>" - :tests ("test = () =>" - "test= =>" - "test = ->" - "test=()->" - "test : () =>" - "test: =>" - "test : ->" - "test:()->") - :not ("# test = =>" - "test = 1")) - - (:language "coffeescript" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^\\s*JJJ\\s*[:=][^:=-][^>]+$" - :tests ("test = $" - "test : [" - "test = {" - "test = a") - :not ("test::a" - "test: =>" - "test == 1" - "# test = 1")) - - (:language "coffeescript" :type "class" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^\\s*\\bclass\\s+JJJ" - :tests ("class test" - "class test extends") - :not ("# class")) - - ;;-- objc : Objective-C - (:language "objc" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\)\\s*JJJ(:|\\b|\\s)" - :tests ("- (void)test" - "- (void)test:(UIAlertView *)alertView") - :not ("- (void)testnot" - "- (void)testnot:(UIAlertView *)alertView")) - - (:language "objc" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\b\\*?JJJ\\s*=[^=\\n]+" - :tests ("NSString *test = @\"asdf\"") - :not ("NSString *testnot = @\"asdf\"" - "NSString *nottest = @\"asdf\"")) - - (:language "objc" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(@interface|@protocol|@implementation)\\b\\s*JJJ\\b\\s*" - :tests ("@interface test: UIWindow") - :not ("@interface testnon: UIWindow")) - - - (:language "objc" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "typedef\\b\\s+(NS_OPTIONS|NS_ENUM)\\b\\([^,]+?,\\s*JJJ\\b\\s*" - :tests ("typedef NS_ENUM(NSUInteger, test)") - :not ("typedef NS_ENUMD(NSUInteger, test)")) - - ;;-- swift - (:language "swift" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(let|var)\\s*JJJ\\s*(=|:)[^=:\\n]+" - :tests ("let test = 1234" - "var test = 1234" - "private lazy var test: UITapGestureRecognizer") - :not ("if test == 1234:")) - - (:language "swift" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "func\\s+JJJ\\b\\s*(<[^>]*>)?\\s*\\(" - :tests ("func test(asdf)" - "func test()" - "func test()") - :not ("func testnot(asdf)" - "func testnot()")) - - (:language "swift" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(class|struct|protocol|enum)\\s+JJJ\\b\\s*?" - :tests ("struct test" - "struct test: Codable" - "struct test" - "class test:" - "class test: UIWindow" - "class test") - :not ("class testnot:" - "class testnot(object):" - "struct testnot(object)")) - - (:language "swift" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(typealias)\\s+JJJ\\b\\s*?=" - :tests ("typealias test =") - :not ("typealias testnot")) - - ;;-- csharp : C# - (:language "csharp" :type "function" - :supports ("ag" "rg") - :regex "^\\s*(?:[\\w\\[\\]]+\\s+){1,3}JJJ\\s*\\\(" - :tests ("int test()" - "int test(param)" - "static int test()" - "static int test(param)" - "public static MyType test()" - "private virtual SomeType test(param)" - "static int test()") - :not ("test()" - "testnot()" - "blah = new test()")) - - (:language "csharp" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*\\bJJJ\\s*=[^=\\n)]+" - :tests ("int test = 1234") - :not ("if test == 1234:" - "int nottest = 44")) - - (:language "csharp" :type "variable" - :supports ("ag" "rg") - :regex "\\bforeach\\s*\\(\\s*[\\w\\[\\]<>,\\.?]+\\s+JJJ\\s+in\\b" - :tests ("foreach (int test in items)" - "foreach (var test in items)" - "foreach (string test in items)" - "foreach (List test in items)") - :not ("foreach (int nottest in items)" - "test in items")) - - (:type "type" - :supports ("ag" "grep" "rg" "git-grep") - :language "csharp" - :regex "(class|interface)\\s*JJJ\\b" - :tests ("class test:" - "public class test : IReadableChannel, I") - :not ("class testnot:" - "public class testnot : IReadableChannel, I")) - - ;;-- java (literally the same regexes as c#, but different tests) - (:language "java" :type "function" - :supports ("ag" "rg") - :regex "^\\s*(?:[\\w\\[\\]]+\\s+){1,3}JJJ\\s*\\\(" - :tests ("int test()" - "int test(param)" - "static int test()" - "static int test(param)" - "public static MyType test()" - "private virtual SomeType test(param)" - "static int test()" - "private foo[] test()") - :not ("test()" - "testnot()" - "blah = new test()" - "foo bar = test()")) - - (:language "java" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*\\bJJJ\\s*=[^=\\n)]+" - :tests ("int test = 1234") - :not ("if test == 1234:" - "int nottest = 44")) - - (:language "java" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(class|interface)\\s*JJJ\\b" - :tests ("class test:" - "public class test implements Something") - :not ("class testnot:" - "public class testnot implements Something")) - - (:language "java" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\benum\\s+JJJ\\b" - :tests ("enum test {" - "public enum test {") - :not ("enum testnot {")) - - (:language "java" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "@interface\\s+JJJ\\b" - :tests ("@interface test {" - "public @interface test {") - :not ("@interface testnot {")) - - ;; grep/git-grep fallback: requires access modifier because grep lacks - ;; PCRE features (?:...) and {n,m} used by the ag/rg rule above. - (:language "java" :type "function" - :supports ("grep" "git-grep") - :regex "(public|protected|private|static)[^(]+JJJ\\s*\\\(" - :tests ("public int test()" - "private static String test(param)" - "protected List test()") - :not ("test()" - "new test()")) - - ;;-- vala (again just like c#, exactly the same..) - (:language "vala" :type "function" - :supports ("ag" "rg") - :regex "^\\s*(?:[\\w\\[\\]]+\\s+){1,3}JJJ\\s*\\\(" - :tests ("int test()" - "int test(param)" - "static int test()" - "static int test(param)" - "public static MyType test()" - "private virtual SomeType test(param)" - "static int test()") - :not ("test()" - "testnot()" - "blah = new test()")) - - (:language "vala" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*\\bJJJ\\s*=[^=\\n)]+" - :tests ("int test = 1234") - :not ("if test == 1234:" - "int nottest = 44")) - - (:language "vala" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(class|interface)\\s*JJJ\\b" - :tests ("class test:" - "public class test : IReadableChannel, I") - :not ("class testnot:" - "public class testnot : IReadableChannel, I")) - - ;;-- coq (renamed Rocq in March 2025) - (:language "coq" :type "function" - :supports ("ag" "rg" "grep" "git-grep") - :regex "\\s*Variable\\s+JJJ\\b" - :tests ("Variable test") - :not ("Variable testx")) - - (:language "coq" :type "function" - :supports ("ag" "rg" "grep" "git-grep") - :regex "\\s*Inductive\\s+JJJ\\b" - :tests ("Inductive test") - :not ("Inductive testx")) - - (:language "coq" :type "function" - :supports ("ag" "rg" "grep" "git-grep") - :regex "\\s*Lemma\\s+JJJ\\b" - :tests ("Lemma test") - :not ("Lemma testx")) - - (:language "coq" :type "function" - :supports ("ag" "rg" "grep" "git-grep") - :regex "\\s*Definition\\s+JJJ\\b" - :tests ("Definition test") - :not ("Definition testx")) - - (:language "coq" :type "function" - :supports ("ag" "rg" "grep" "git-grep") - :regex "\\s*Hypothesis\\s+JJJ\\b" - :tests ("Hypothesis test") - :not ("Hypothesis testx")) - - (:language "coq" :type "function" - :supports ("ag" "rg" "grep" "git-grep") - :regex "\\s*Theorem\\s+JJJ\\b" - :tests ("Theorem test") - :not ("Theorem testx")) - - (:language "coq" :type "function" - :supports ("ag" "rg" "grep" "git-grep") - :regex "\\s*Fixpoint\\s+JJJ\\b" - :tests ("Fixpoint test") - :not ("Fixpoint testx")) - - (:language "coq" :type "function" - :supports ("ag" "rg" "grep" "git-grep") - :regex "\\s*Module\\s+JJJ\\b" - :tests ("Module test") - :not ("Module testx")) - - (:language "coq" :type "function" - :supports ("ag" "rg" "git-grep") - :regex "\\s*CoInductive\\s+JJJ\\b" - :tests ("CoInductive test") - :not ("CoInductive testx")) - - ;;-- python - (:language "python" :type "variable" - :supports ("ag" "rg") - :regex "\\s*\\bJJJ\\b(\\s*:[^=\\n]+)?\\s*=[^=\\n]+" - :tests ("test = 1234" - "test: int = 1234" - "test: int | None = 1234" - "test: List[Optional[int]] = [1234, None]") - :not ("if test == 1234:" - "_test = 1234" - "if (test := 3):" - "while test:" - "test['key'] = 1234")) - - (:language "python" :type "variable" - :supports ("grep" "git-grep") - :regex "\\s*\\bJJJ\\b(\\s*:[^=]+)?\\s*=[^=]+" - :tests ("test = 1234" - "test: int = 1234" - "test: int | None = 1234" - "test: List[Optional[int]] = [1234, None]") - :not ("if test == 1234:" - "_test = 1234" - "if (test := 3):" - "while test:" - "test['key'] = 1234")) - - (:language "python" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "def\\s*JJJ\\b\\s*\\\(" - :tests ("\tdef test(asdf)" - "def test()") - :not ("\tdef testnot(asdf)" - "def testnot()")) - - (:language "python" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "class\\s*JJJ\\b\\s*\\\(?" - :tests ("class test(object):" - "class test:") - :not ("class testnot:" - "class testnot(object):")) - - (:language "python" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "async\\s+def\\s*JJJ\\b\\s*\\\(" - :tests ("async def test(param)" - "async def test()") - :not ("async def testnot(param)" - "async def testnot()")) - - (:language "python" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^\\s*JJJ\\s*=\\s*lambda\\b" - :tests ("test = lambda x: x" - "test = lambda: None") - :not ("testnot = lambda x: x" - "foo(test=lambda x: x)")) - - ;;-- matlab - (:language "matlab" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^\\s*\\bJJJ\\s*=[^=\\n]+" - :tests ("test = 1234") - :not ("for test = 1:2:" - "_test = 1234")) - - (:language "matlab" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^\\s*function\\s*[^=]+\\s*=\\s*JJJ\\b" - :tests ("\tfunction y = test(asdf)" - "function x = test()" - "function [x, losses] = test(A, y, lambda, method, qtile)") - :not ("\tfunction testnot(asdf)" - "function testnot()")) - - (:language "matlab" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^\\s*classdef\\s*JJJ\\b\\s*" - :tests ("classdef test") - :not ("classdef testnot")) - - ;;-- nim - (:language "nim" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(const|let|var)\\s*JJJ\\*?\\s*(=|:)[^=:\\n]+" - :tests ("let test = 1234" - "var test = 1234" - "var test: Stat" - "const test = 1234" - "const test* = 1234") - :not ("if test == 1234:")) - - (:language "nim" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(proc|func|macro|template)\\s*`?JJJ`?\\b\\*?\\s*\\\(" - :tests ("\tproc test(asdf)" - "proc test()" - "func test()" - "macro test()" - "template test()" - "proc test*()") - :not ("\tproc testnot(asdf)" - "proc testnot()")) - - (:language "nim" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "type\\s*JJJ\\b\\*?\\s*(\\{[^}]+\\})?\\s*=\\s*\\w+" - :tests ("type test = object" - "type test {.pure.} = enum" - "type test* = ref object") - :not ("type testnot = object")) - - ;;-- nix - (:language "nix" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\b\\s*JJJ\\s*=[^=;]+" - :tests ("test = 1234;" - "test = 123;" - "test=123") - :not ("testNot = 1234;" - "Nottest = 1234;" - "AtestNot = 1234;")) - - ;;-- org - ;; org named blocks - (:language "org" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^\\s*#\\+[nN][aA][mM][eE]:\\s*JJJ\\j" - :tests ("#+name: test" - "#+NAME: test" - "#+Name: test" - " #+name: test" - "#+name:test") - :not ("#+name: tester" - "#+name: test-block" - "some #+name: test")) - - ;; org call references (#+call: block-name) - (:language "org" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^\\s*#\\+[cC][aA][lL][lL]:\\s*JJJ\\j" - :tests ("#+call: test" - "#+CALL: test" - "#+Call: test" - " #+call: test" - "#+call: test()" - "#+call: test(x=1)") - :not ("#+call: tester" - "#+call: test-other" - "some #+call: test")) - - ;; org headings (* Heading text) - (:language "org" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^\\*+\\s+JJJ\\j" - :tests ("* test" - "** test" - "*** test" - "**** test" - "* test heading" - "** test with more words") - :not ("* tester" - "** testing" - "* test-other" - "not a * test heading")) - - ;; org custom ID (:CUSTOM_ID: value in property drawers) - (:language "org" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^\\s*:CUSTOM_ID:\\s*JJJ\\j" - :tests (":CUSTOM_ID: test" - ":CUSTOM_ID: test" - " :CUSTOM_ID: test" - ":CUSTOM_ID:test") - :not (":CUSTOM_ID: tester" - ":CUSTOM_ID: test-other" - "inline :CUSTOM_ID: test text")) - - ;;-- ruby - (:language "ruby" :type "variable" - :supports ("ag" "rg" "git-grep") - :regex "^\\s*((\\w+[.])*\\w+,\\s*)*JJJ(,\\s*(\\w+[.])*\\w+)*\\s*=([^=>~]|$)" - :tests ("test = 1234" - "self.foo, test, bar = args") - :not ("if test == 1234" - "foo_test = 1234")) - - (:language "ruby" :type "function" - :supports ("ag" "rg" "git-grep") - :regex "(^|[^\\w.])((private|public|protected)\\s+)?def\\s+(\\w+(::|[.]))*JJJ($|[^\\w|:])" - :tests ("def test(foo)" - "def test()" - "def test foo" - "def test; end" - "def self.test()" - "def MODULE::test()" - "private def test") - :not ("def test_foo")) - - (:language "ruby" :type "function" - :supports ("ag" "rg" "git-grep") - :regex "(^|\\W)define(_singleton|_instance)?_method(\\s|[(])\\s*:JJJ($|[^\\w|:])" - :tests ("define_method(:test, &body)" - "mod.define_instance_method(:test) { body }")) - - (:language "ruby" :type "type" - :supports ("ag" "rg" "git-grep") - :regex "(^|[^\\w.])class\\s+(\\w*::)*JJJ($|[^\\w|:])" - :tests ("class test" - "class Foo::test")) - - (:language "ruby" :type "type" - :supports ("ag" "rg" "git-grep") - :regex "(^|[^\\w.])module\\s+(\\w*::)*JJJ($|[^\\w|:])" - :tests ("module test" - "module Foo::test")) - - (:language "ruby" :type "function" - :supports ("ag" "rg" "git-grep") - :regex "(^|\\W)alias(_method)?\\W+JJJ(\\W|$)" - :tests ("alias test some_method" - "alias_method :test, :some_method" - "alias_method 'test' 'some_method'" - "some_class.send(:alias_method, :test, :some_method)") - :not ("alias some_method test" - "alias_method :some_method, :test" - "alias test_foo test")) - - ;;-- Groovy - (:language "groovy" :type "variable" - :supports ("ag" "rg" "git-grep") - :regex "^\\s*((\\w+[.])*\\w+,\\s*)*JJJ(,\\s*(\\w+[.])*\\w+)*\\s*=([^=>~]|$)" - :tests ("test = 1234" - "self.foo, test, bar = args") - :not ("if test == 1234" - "foo_test = 1234")) - - (:language "groovy" :type "function" - :supports ("ag" "rg" "git-grep") - :regex "(^|[^\\w.])((private|public)\\s+)?def\\s+(\\w+(::|[.]))*JJJ($|[^\\w|:])" - :tests ("def test(foo)" - "def test()" - "def test foo" - "def test; end" - "def self.test()" - "def MODULE::test()" - "private def test") - :not ("def test_foo")) - - (:language "groovy" :type "type" - :supports ("ag" "rg" "git-grep") - :regex "(^|[^\\w.])class\\s+(\\w*::)*JJJ($|[^\\w|:])" - :tests ("class test" - "class Foo::test")) - - ;;-- crystal - (:language "crystal" :type "variable" - :supports ("ag" "rg" "git-grep") - :regex "^\\s*((\\w+[.])*\\w+,\\s*)*JJJ(,\\s*(\\w+[.])*\\w+)*\\s*=([^=>~]|$)" - :tests ("test = 1234" - "self.foo, test, bar = args") - :not ("if test == 1234" - "foo_test = 1234")) - - (:language "crystal" :type "function" - :supports ("ag" "rg" "git-grep") - :regex "(^|[^\\w.])((private|public|protected)\\s+)?def\\s+(\\w+(::|[.]))*JJJ($|[^\\w|:])" - :tests ("def test(foo)" - "def test()" - "def test foo" - "def test; end" - "def self.test()" - "def MODULE::test()" - "private def test") - :not ("def test_foo")) - - (:language "crystal" :type "type" - :supports ("ag" "rg" "git-grep") - :regex "(^|[^\\w.])class\\s+(\\w*::)*JJJ($|[^\\w|:])" - :tests ("class test" - "class Foo::test")) - - (:language "crystal" :type "type" - :supports ("ag" "rg" "git-grep") - :regex "(^|[^\\w.])module\\s+(\\w*::)*JJJ($|[^\\w|:])" - :tests ("module test" - "module Foo::test")) - - (:language "crystal" :type "type" - :supports ("ag" "rg" "git-grep") - :regex "(^|[^\\w.])struct\\s+(\\w*::)*JJJ($|[^\\w|:])" - :tests ("struct test" - "struct Foo::test")) - - (:language "crystal" :type "type" - :supports ("ag" "rg" "git-grep") - :regex "(^|[^\\w.])alias\\s+(\\w*::)*JJJ($|[^\\w|:])" - :tests ("alias test" - "alias Foo::test")) - - ;;-- scad - (:language "scad" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*\\bJJJ\\s*=[^=\\n]+" - :tests ("test = 1234") - :not ("if test == 1234 {")) - - (:language "scad" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "function\\s*JJJ\\s*\\\(" - :tests ("function test()" - "function test ()")) - - (:language "scad" :type "module" - :supports ("ag" "grep" "rg" "git-grep") - :regex "module\\s*JJJ\\s*\\\(" - :tests ("module test()" - "module test ()")) - - ;;-- scala - (:language "scala" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bval\\s*JJJ\\s*=[^=\\n]+" - :tests ("val test = 1234") - :not ("case test => 1234")) - - (:language "scala" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bvar\\s*JJJ\\s*=[^=\\n]+" - :tests ("var test = 1234") - :not ("case test => 1234")) - - (:language "scala" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\btype\\s*JJJ\\s*=[^=\\n]+" - :tests ("type test = 1234") - :not ("case test => 1234")) - - (:language "scala" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bdef\\s*JJJ\\s*\\\(" - :tests ("def test(asdf)" "def test()")) - - (:language "scala" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "class\\s*JJJ\\s*\\\(?" - :tests ("class test(object)")) - - (:language "scala" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "trait\\s*JJJ\\s*\\\(?" - :tests ("trait test(object)")) - - (:language "scala" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "object\\s*JJJ\\s*\\\(?" - :tests ("object test(object)")) - - ;;-- solidity - (:language "solidity" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "function\\s*JJJ\\s*\\\(" - :tests ("function test() internal" - "function test (uint x, address y)" - "function test() external")) - - (:language "solidity" :type "modifier" - :supports ("ag" "grep" "rg" "git-grep") - :regex "modifier\\s*JJJ\\s*\\\(" - :tests ("modifier test()" - "modifier test ()")) - - (:language "solidity" :type "event" - :supports ("ag" "grep" "rg" "git-grep") - :regex "event\\s*JJJ\\s*\\\(" - :tests ("event test();" - "event test (uint indexed x)" - "event test(uint x, address y)")) - - (:language "solidity" :type "error" - :supports ("ag" "grep" "rg" "git-grep") - :regex "error\\s*JJJ\\s*\\\(" - :tests ("error test();" - "error test (uint x)" - "error test(uint x, address y)")) - - (:language "solidity" :type "contract" - :supports ("ag" "grep" "rg" "git-grep") - :regex "contract\\s*JJJ\\s*(is|\\\{)" - :tests ("contract test{" - "contract test {" - "contract test is foo")) - - (:language "solidity" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "struct\\s*JJJ\\s*\\\{" - :tests ("struct test{" - "struct test {")) - - ;;-- R - (:language "r" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*=[^=><]" - :tests ("test = 1234") - :not ("if (test == 1234)")) - - (:language "r" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*<-\\s*function\\b" - :tests ("test <- function" - "test <- function(") - :not ("test <- functionX")) - - ;;-- perl - (:language "perl" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "sub\\s*JJJ\\s*(\\{|\\()" - :tests ("sub test{" - "sub test {" - "sub test(" "sub test (")) - - (:language "perl" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "JJJ\\s*=\\s*" - :tests ("$test = 1234")) - - ;;-- Tcl - (:language "tcl" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "proc\\s+JJJ\\s*\\{" - :tests ("proc test{" "proc test {")) - - (:language "tcl" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "set\\s+JJJ" - :tests ("set test 1234")) - - (:language "tcl" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(variable|global)\\s+JJJ" - :tests ("variable test" "global test")) - - ;;-- shell - (:language "shell" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "function\\s*JJJ\\s*" - :tests ("function test{" - "function test {" - "function test () {") - :not ("function nottest {")) - - (:language "shell" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "JJJ\\\(\\\)\\s*\\{" - :tests ("test() {") - :not ("testx() {")) - - (:language "shell" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*=\\s*" - :tests ("test = 1234") - :not ("blahtest = 1234")) - - ;;-- php - (:language "php" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "function\\s*JJJ\\s*\\\(" - :tests ("function test()" - "function test ()")) - - (:language "php" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\*\\s@method\\s+[^ \t]+\\s+JJJ\\(" - :tests ("/** @method string|false test($a)" - " * @method bool test()")) - - (:language "php" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(\\s|->|\\$|::)JJJ\\s*=\\s*" - :tests ("$test = 1234" - "$foo->test = 1234")) - - (:language "php" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\*\\s@property(-read|-write)?\\s+([^ \t]+\\s+)&?\\$JJJ(\\s+|$)" - :tests ("/** @property string $test" - "/** @property string $test description for $test property" - " * @property-read bool|bool $test" - " * @property-write \\ArrayObject $test")) - - (:language "php" :type "trait" - :supports ("ag" "grep" "rg" "git-grep") - :regex "trait\\s*JJJ\\s*\\\{" - :tests ("trait test{" - "trait test {")) - - (:language "php" :type "interface" - :supports ("ag" "grep" "rg" "git-grep") - :regex "interface\\s*JJJ\\s*(extends|\\\{)" - :tests ("interface test{" - "interface test {") - "interface test extends test2") - - (:language "php" :type "class" - :supports ("ag" "grep" "rg" "git-grep") - :regex "class\\s*JJJ\\s*(extends|implements|\\\{)" - :tests ("class test{" - "class test {" - "class test extends foo" - "class test implements foo")) - - ;; PHP 8.1+ enum definition - (:language "php" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\benum\\s+JJJ\\b\\s*(:\\s*(int|string))?\\s*(implements[^{]+)?\\{" - :tests ("enum test {" - "enum test: int {" - "enum test: string {" - "enum test implements Stringable {" - "enum test: int implements JsonSerializable {") - :not ("// enum test" "$enum = 'test'")) - - ;; PHP 8.1+ enum case - (:language "php" :type "constant" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^\\s*case\\s+JJJ\\s*(;|=)" - :tests (" case test;" - "case test = 1;" - "case test = 'value';") - :not ("case 'test':" "case \"test\":" "default:")) - - ;; PHP abstract class - (:language "php" :type "class" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\babstract\\s+class\\s+JJJ\\s*(extends|implements|\\\{)" - :tests ("abstract class test {" - "abstract class test extends Base {" - "abstract class test implements Foo {") - :not ("// abstract class test")) - - ;; PHP final class (including final readonly) - (:language "php" :type "class" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bfinal\\s+(readonly\\s+)?class\\s+JJJ\\s*(extends|implements|\\\{)" - :tests ("final class test {" - "final readonly class test {" - "final class test extends Base {") - :not ("// final class test")) - - ;; PHP readonly class (including readonly final) - (:language "php" :type "class" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\breadonly\\s+(final\\s+)?class\\s+JJJ\\s*(extends|implements|\\\{)" - :tests ("readonly class test {" - "readonly final class test {" - "readonly class test implements Serializable {") - :not ("// readonly class test")) - - ;; PHP class constant with optional visibility/final - (:language "php" :type "constant" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(final\\s+)?(public|protected|private)?\\s*const\\s+JJJ\\s*=" - :tests ("const test = 'value';" - "public const test = 100;" - "private const test = 'secret';" - "protected const test = [];" - "final public const test = 42;" - "final const test = true;") - :not ("$const = 'test'" "// const test")) - - ;; PHP global const (outside class) - (:language "php" :type "constant" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^const\\s+JJJ\\s*=" - :tests ("const test = 'app_name';" - "const test = 42;" - "const test = [];") - :not (" const test =" "public const test =")) - - ;; PHP define() function - (:language "php" :type "constant" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^\\s*define\\s*\\(\\s*['\"]JJJ['\"]" - :tests ("define('test', 100);" - "define(\"test\", 'value');" - "define('test',") - :not ("// define('test'" "$define = 'test'")) - - ;; PHP typed property declaration - (:language "php" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(public|protected|private)\\s+(static\\s+)?(readonly\\s+)?\\??[A-Za-z_][A-Za-z0-9_\\\\|&]*\\s+\\$JJJ\\s*(;|=|,)" - :tests ("public int $test;" - "private string $test = '';" - "protected ?array $test = null;" - "public readonly string $test;" - "private static int $test = 0;" - "public DateTime $test;") - :not ("public function foo(int $test)" "return $test;")) - - ;; PHP static property (without explicit type) - (:language "php" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(public|protected|private)?\\s*static\\s+\\$JJJ\\s*(;|=)" - :tests ("static $test;" - "public static $test = [];" - "private static $test = null;") - :not ("static function test()" "static::$test")) - - ;; PHP namespace declaration - (:language "php" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bnamespace\\s+([A-Za-z_][A-Za-z0-9_]*\\\\)*JJJ\\s*[;{]" - :tests ("namespace test;" - "namespace App\\test;" - "namespace App\\Services\\test {") - :not ("// namespace test" "use App\\test;")) - - ;; PHP use statement for class imports - (:language "php" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\buse\\s+([A-Za-z_][A-Za-z0-9_]*\\\\)*JJJ\\s*(;|,|\\s+as\\s+)" - :tests ("use test;" - "use App\\test;" - "use App\\Models\\test as TestModel;" - "use App\\test, App\\Other;") - :not ("use function test;" "use const test;")) - - ;;-- dart - (:language "dart" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*\\([^()]*\\)\\s*[{]" - :tests ("test(foo) {" - "test (foo){" - "test(foo){")) - - (:language "dart" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "class\\s*JJJ\\s*[\\\(\\\{]" - :tests ("class test(object) {" - "class test{")) - - ;;-- dlang - (:language "dlang" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^[[:space:]]*([][[:alnum:]_!.*<>]+[[:space:]]+)+JJJ[[:space:]]*\\\([^;{}]*\\\)([[:space:]]+@?[[:alnum:]_]+)*[[:space:]]*[{]" - :tests ("void test() {" - "public static int test(int value) {" - "auto test(T)(T value) {" - "void test() pure {" - "void test() @safe {") - :not ("return test();" - "auto value = test(arg);" - "test();")) - - (:language "dlang" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*\\bJJJ\\s*=[^=\\n)]+" - :tests ("int test = 1234;" - "immutable test = 1;" - "auto test = foo();") - :not ("if (test == 1234)" - "int nottest = 44;")) - - (:language "dlang" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(class|interface|struct|union|enum|alias)\\s+JJJ\\b" - :tests ("class test {" - "struct test {" - "alias test = int;") - :not ("class testnot {" - "alias nottest = test;")) - - ;;-- faust - (:language "faust" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\(\\\(.+\\\)\)*\\s*=" - :tests ("test = osc + 0.5;" - "test(freq) = osc(freq) + 0.5;")) - - ;;-- fennel - (:language "fennel" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\((local|var)\\s+JJJ\\j" - :tests ("(local test (foo)" - "(var test (foo)")) - - (:language "fennel" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\(fn\\s+JJJ\\j" - :tests ("(fn test [foo]") - :not ("(fn test? [foo]")) - - (:language "fennel" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\(macro\\s+JJJ\\j" - :tests ("(macro test [foo]")) - - ;;-- fortran - (:language "fortran" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*\\bJJJ\\s*=[^=\\n]+" - :tests ("test = 1234") - :not ("if (test == 1234)")) - - (:language "fortran" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\b(function|subroutine|FUNCTION|SUBROUTINE)\\s+JJJ\\b\\s*\\\(" - :tests ("function test (foo)" - "integer function test(foo)" - "subroutine test (foo, bar)" - "FUNCTION test (foo)" - "INTEGER FUNCTION test(foo)" - "SUBROUTINE test (foo, bar)") - :not ("end function test" - "end subroutine test" - "END FUNCTION test" - "END SUBROUTINE test")) - - (:language "fortran" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^\\s*(interface|INTERFACE)\\s+JJJ\\b" - :tests ("interface test" - "INTERFACE test") - :not ("interface test2" - "end interface test" - "INTERFACE test2" - "END INTERFACE test")) - - (:language "fortran" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^\\s*(module|MODULE)\\s+JJJ\\s*" - :tests ("module test" - "MODULE test") - :not ("end module test" - "END MODULE test")) - - ;;-- go - (:language "go" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*\\bJJJ\\s*=[^=\\n]+" - :tests ("test = 1234") - :not ("if test == 1234 {")) - - (:language "go" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*\\bJJJ\\s*:=\\s*" - :tests ("test := 1234")) - - (:language "go" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "func\\s+\\\([^\\\)]*\\\)\\s+JJJ\\s*\\\(" - :tests ("func (s *blah) test(filename string) string {")) - - (:language "go" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "func\\s+JJJ\\s*\\\(" - :tests ("func test(url string) (string, error)")) - - (:language "go" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "type\\s+JJJ\\s+struct\\s+\\\{" - :tests ("type test struct {")) - - (:language "go" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "type\\s+JJJ(\\\[[^]]+\\\])?\\s+interface\\s*\\\{" - :tests ("type test interface {" - "type test[T comparable] interface {") - :not ("type testnot interface {")) - - (:language "go" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "type\\s+JJJ(\\\[[^]]+\\\])?\\s+" - :tests ("type test int" - "type test[T any] []byte" - "type test = string" - "type test []byte" - "type test string") - :not ("type testnot int")) - - ;;-- javascript extended - (:language "javascript" :tags ("angular") :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(service|factory)\\\(['\"]JJJ['\"]" - :tests ("module.factory('test', [\"$rootScope\", function($rootScope) {")) - - (:language "javascript" :tags ("es6") :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*[=:]\\s*\\\([^\\\)]*\\\)\\s+=>" - :tests ("const test = (foo) => " "test: (foo) => {" " test: (foo) => {")) - - (:language "javascript" :tags ("es6") :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*\\([^()]*\\)\\s*[{]" - :tests ("test(foo) {" "test (foo){" "test(foo){") - :not ("test = blah.then(function(){")) - - (:language "javascript" :tags ("es6") :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "class\\s*JJJ\\s*[\\\(\\\{]" - :tests ("class test(object) {" "class test{")) - - (:language "javascript" :tags ("es6") :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "class\\s*JJJ\\s+extends" - :tests ("class test extends Component{")) - - ;;-- javascript - (:language "javascript" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*\\bJJJ\\s*=[^=\\n]+" - :tests ("test = 1234" - "const test = props =>") - :not ("if (test === 1234)")) - - (:language "javascript" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bfunction\\b[^\\(]*\\\(\\s*[^\\)]*\\bJJJ\\b\\s*,?\\s*\\\)?" - :tests ("function (test)" - "function (test, blah)" - "function somefunc(test, blah) {" - "function(blah, test)") - :not ("function (testLen)" - "function (test1, blah)" - "function somefunc(testFirst, blah) {" - "function(blah, testLast)" - "function (Lentest)" - "function (blahtest, blah)" - "function somefunc(Firsttest, blah) {" - "function(blah, Lasttest)")) - - (:language "javascript" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "function\\s*JJJ\\s*\\\(" - :tests ("function test()" - "function test ()")) - - (:language "javascript" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*:\\s*function\\s*\\\(" - :tests ("test: function()")) - - (:language "javascript" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*=\\s*function\\s*\\\(" - :tests ("test = function()")) - - ;;-- hcl terraform - (:language "hcl" :type "block" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(variable|output|module)\\s*\"JJJ\"\\s*\\\{" - :tests ("variable \"test\" {" - "output \"test\" {" - "module \"test\" {")) - - (:language "hcl" :type "block" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(data|resource)\\s*\"\\w+\"\\s*\"JJJ\"\\s*\\\{" - :tests ("data \"openstack_images_image_v2\" \"test\" {" - "resource \"google_compute_instance\" \"test\" {")) - - ;;-- typescript - (:language "typescript" :tags ("angular") :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(service|factory)\\\(['\"]JJJ['\"]" - :tests ("module.factory('test', [\"$rootScope\", function($rootScope) {")) - - (:language "typescript" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*[=:]\\s*\\\([^\\\)]*\\\)\\s+=>" - :tests ("const test = (foo) => " - "test: (foo) => {" - " test: (foo) => {")) - - (:language "typescript" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*\\([^()]*\\)\\s*[{]" - :tests ("test(foo) {" - "test (foo){" - "test(foo){") - :not ("test = blah.then(function(){")) - - (:language "typescript" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "class\\s*JJJ(\\s*<[^>]*>)?\\s*[\\\(\\\{]" - :tests ("class test{" - "class test{")) - - (:language "typescript" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "class\\s*JJJ(\\s*<[^>]*>)?\\s+extends" - :tests ("class test extends Component{" - "class test extends Component{")) - - (:language "typescript" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "class\\s*JJJ(\\s*<[^>]*>)?\\s*[\\\(\\\{]" - :tests ("class test{" - "class test{")) - - (:language "typescript" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "class\\s*JJJ(\\s*<[^>]*>)?\\s+extends" - :tests ("class test extends Component{" - "class test extends Component{")) - - (:language "typescript" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(export\\s+)?interface\\s+JJJ\\b" - :tests ("interface test{" - "interface test extends Thing{" - "export interface test{") - :not ("interface testnot{")) - - (:language "typescript" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(export\\s+)?type\\s+JJJ\\b" - :tests ("type test = number" - "type test = T" - "export type test = number") - :not ("type testnot = number")) - - (:language "typescript" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(export\\s+)?enum\\s+JJJ\\b" - :tests ("enum test{" - "export enum test{") - :not ("enum testnot{")) - - (:language "typescript" :type "module" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(declare\\s+)?namespace\\s+JJJ\\b" - :tests ("declare namespace test" - "namespace test") - :not ("declare testnot")) - - (:language "typescript" :type "module" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(export\\s+)?module\\s+JJJ\\b" - :tests ("export module test" - "module test") - :not ("module testnot")) - - (:language "typescript" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "function\\s*JJJ\\s*\\\(" - :tests ("function test()" - "function test ()")) - - (:language "typescript" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*:\\s*function\\s*\\\(" - :tests ("test: function()")) - - (:language "typescript" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*=\\s*function\\s*\\\(" - :tests ("test = function()")) - - (:language "typescript" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*\\bJJJ\\s*=[^=\\n]+" - :tests ("test = 1234" "const test = props =>") - :not ("if (test === 1234)")) - - (:language "typescript" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bfunction\\b[^\\(]*\\\(\\s*[^\\)]*\\bJJJ\\b\\s*,?\\s*\\\)?" - :tests ("function (test)" - "function (test, blah)" - "function somefunc(test, blah) {" - "function(blah, test)") - :not ("function (testLen)" - "function (test1, blah)" - "function somefunc(testFirst, blah) {" - "function(blah, testLast)" - "function (Lentest)" - "function (blahtest, blah)" - "function somefunc(Firsttest, blah) {" - "function(blah, Lasttest)")) - - ;;-- julia - (:language "julia" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(@noinline|@inline)?\\s*function\\s*JJJ(\\{[^\\}]*\\})?\\(" - :tests ("function test()" - "@inline function test()" - "function test{T}(h)")) - - (:language "julia" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(@noinline|@inline)?JJJ(\\{[^\\}]*\\})?\\([^\\)]*\\)\s*=" - :tests ("test(a)=1" - "test(a,b)=1*8" - "@noinline test()=1" - "test{T}(x)=x")) - - (:language "julia" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "macro\\s*JJJ\\(" - :tests ("macro test(a)=1" - " macro test(a,b)=1*8")) - - (:language "julia" :type "variable" - :supports ("ag" "rg") - :regex "const\\s+JJJ\\b" - :tests ("const test = ")) - - (:language "julia" :type "type" - :supports ("ag" "rg") - :regex "(mutable)?\\s*struct\\s*JJJ" - :tests ("struct test")) - - (:language "julia" :type "type" - :supports ("ag" "rg") - :regex "(type|immutable|abstract)\\s*JJJ" - :tests ("type test" - "immutable test" - "abstract test <:Testable" )) - - ;;-- haskell - (:language "haskell" :type "module" - :supports ("ag" "rg" "grep" "git-grep") - :regex "^module\\s+JJJ\\s+" - :tests ("module test (exportA, exportB) where") - :not ("-- module test" "import test")) - - ; TODO Doesn't support any '=' in arguments. E.g. 'foo A{a = b,..} = bar'. - (:language "haskell" :type "top level function" - :supports ("ag" "rg") - :regex "^\\bJJJ(?!(\\s+::))\\s+((.|\\s)*?)=\\s+" - :tests ("test n = n * 2" - "test X{..} (Y a b c) \n bcd \n =\n x * y" - "test ab cd e@Datatype {..} (Another thing, inTheRow) = \n undefined" - "test = runRealBasedMode @ext @ctx identity identity" - "test unwrap wrap nr@Naoeu {..} (Action action, specSpecs) = \n undefined") - :not ("nottest n = n * 2" - "let testnot x y = x * y" - "test $ y z" - "let test a o = mda" - "test :: Sometype -> AnotherType aoeu kek = undefined")) - - (:language "haskell" :type "type-like" - :supports ("ag" "rg" "grep" "git-grep") - :regex "^\\s*((data(\\s+family)?)|(newtype)|(type(\\s+family)?))\\s+JJJ\\s+" - :tests ("newtype test a = Something { b :: Kek }" - "data test a b = Somecase a | Othercase b" - "type family test (x :: *) (xs :: [*]) :: Nat where" - "data family test " - "type test = TestAlias") - :not ("newtype nottest a = nottest (Not a)" - "data testnot b = Aoeu")) - - ; datatype contstuctor that doesn't match type definition. - (:language "haskell" :type "(data)type constructor 1" - :supports ("ag" "rg") - :regex "(data|newtype)\\s{1,3}(?!JJJ\\s+)([^=]{1,40})=((\\s{0,3}JJJ\\s+)|([^=]{0,500}?((?\\s*)?JJJ\\s+" - :tests ( - "class (Constr1 m, Constr 2) => test (Kek a) where" - "class test (Veryovka a) where ") - :not ("class test2 (Kek a) where" - "class maketest (AoeuTest x y z) where")) - - ;;-- ocaml - (:language "ocaml" :type "type" - :supports ("ag" "rg" "grep" "git-grep") - :regex "^\\s*(and|type)\\s+.*\\bJJJ\\b" - :tests ("type test =" - "and test =" - "type 'a test =" - "type ('a, _, 'c) test")) - - (:language "ocaml" :type "variable" - :supports ("ag" "rg" "grep" "git-grep") - :regex "let\\s+JJJ\\b" - :tests ("let test =" - "let test x y =")) - - (:language "ocaml" :type "variable" - :supports ("ag" "rg" "grep" "git-grep") - :regex "let\\s+rec\\s+JJJ\\b" - :tests ("let rec test =" - "let rec test x y =")) - - (:language "ocaml" :type "variable" - :supports ("ag" "rg" "grep" "git-grep") - :regex "\\s*val\\s*\\bJJJ\\b\\s*" - :tests ("val test")) - - (:language "ocaml" :type "module" - :supports ("ag" "rg" "grep" "git-grep") - :regex "^\\s*module\\s*\\bJJJ\\b" - :tests ("module test =")) - - (:language "ocaml" :type "module" - :supports ("ag" "rg" "grep" "git-grep") - :regex "^\\s*module\\s*type\\s*\\bJJJ\\b" - :tests ("module type test =")) - - ;;-- purescript - (:language "purescript" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^\\s*\\bJJJ\\b\\s+(::|[^=]*\\s=[^=])" - :tests ("test :: Int -> String" - "test :: Number -> Number -> Number" - " test :: Int -> String" - "test x y = x + y" - "test (Just x) = x" - "test { x } = x") - :not ("nottest :: Int -> String" - "testing x = 1" - "test x == y" - "test >>= bar")) - - (:language "purescript" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^\\s*\\bJJJ\\s*=[^=]" - :tests ("test = 42" - "test = \\x -> x + 1" - " test = compute x") - :not ("test == 42" - "-- test = 42")) - - (:language "purescript" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\blet\\s+JJJ\\s*(\\::|=[^=])" - :tests ("let test = 42" - "let test :: Int") - :not ("let testing = 42" - "let test == 42")) - - (:language "purescript" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^\\s*(type|newtype|data)\\s+JJJ\\b" - :tests ("type test = Int" - "newtype test = test Int" - "data test = test Int | Other String") - :not ("type testOther = Int" - "data testOther = testOther Int")) - - ;; lua - (:language "lua" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*\\bJJJ\\s*=[^=\\n]+" - :tests ("test = 1234") - :not ("if test === 1234")) - - (:language "lua" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bfunction\\b[^\\(]*\\\(\\s*[^\\)]*\\bJJJ\\b\\s*,?\\s*\\\)?" - :tests ("function (test)" - "function (test, blah)" - "function somefunc(test, blah)" - "function(blah, test)") - :not ("function (testLen)" - "function (test1, blah)" - "function somefunc(testFirst, blah)" - "function(blah, testLast)" - "function (Lentest)" - "function (blahtest, blah)" - "function somefunc(Firsttest, blah)" - "function(blah, Lasttest)")) - - (:language "lua" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "function\\s*JJJ\\s*\\\(" - :tests ("function test()" "function test ()")) - - (:language "lua" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "function\\s*.+[.:]JJJ\\s*\\\(" - :tests ("function MyClass.test()" - "function MyClass.test ()" - "function MyClass:test()" - "function MyClass:test ()")) - - (:language "lua" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*=\\s*function\\s*\\\(" - :tests ("test = function()")) - - (:language "lua" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\b.+\\.JJJ\\s*=\\s*function\\s*\\\(" - :tests ("MyClass.test = function()")) - - ;;-- rust - (:language "rust" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\blet\\s+(\\\([^=\\n]*)?(mut\s+)?JJJ([^=\\n]*\\\))?(:\\s*[^=\\n]+)?\\s*=\\s*[^=\\n]+" - :tests ("let test = 1234;" - "let test: u32 = 1234;" - "let test: Vec = Vec::new();" - "let mut test = 1234;" - "let mut test: Vec = Vec::new();" - "let (a, test, b) = (1, 2, 3);" - "let (a, mut test, mut b) = (1, 2, 3);" - "let (mut a, mut test): (u32, usize) = (1, 2);")) - - (:language "rust" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bconst\\s+JJJ:\\s*[^=\\n]+\\s*=[^=\\n]+" - :tests ("const test: u32 = 1234;")) - - (:language "rust" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bstatic\\s+(mut\\s+)?JJJ:\\s*[^=\\n]+\\s*=[^=\\n]+" - :tests ("static test: u32 = 1234;" - "static mut test: u32 = 1234;")) - - ;; variable in method signature - (:language "rust" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bfn\\s+.+\\s*\\\((.+,\\s+)?JJJ:\\s*[^=\\n]+\\s*(,\\s*.+)*\\\)" - :tests ("fn abc(test: u32) -> u32 {" - "fn abc(x: u32, y: u32, test: Vec, z: Vec)" - "fn abc(x: u32, y: u32, test: &mut Vec, z: Vec)")) - - ;; "if let" and "while let" desugaring - (:language "rust" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(if|while)\\s+let\\s+([^=\\n]+)?(mut\\s+)?JJJ([^=\\n\\\(]+)?\\s*=\\s*[^=\\n]+" - :tests ("if let Some(test) = abc() {" - "if let Some(mut test) = abc() {" - "if let Ok(test) = abc() {" - "if let Ok(mut test) = abc() {" - "if let Foo(mut test) = foo {" - "if let test = abc() {" - "if let Some(test) = abc()" - "if let Some((a, test, b)) = abc()" - "while let Some(test) = abc() {" - "while let Some(mut test) = abc() {" - "while let Ok(test) = abc() {" - "while let Ok(mut test) = abc() {") - :not ("while let test(foo) = abc() {")) - - ;; structure fields - (:language "rust" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "struct\\s+[^\\n{]+[{][^}]*(\\s*JJJ\\s*:\\s*[^\\n},]+)[^}]*}" - :tests ("struct Foo { abc: u32, test: Vec, b: PathBuf }" - "struct Foo{test:Vec}" - "struct FooBar<'a> { test: Vec }") - :not ("struct Foo { abc: u32, b: Vec }" - "/// ... construct the equivalent ...\nfn abc() {\n")) - - ;; enum variants - (:language "rust" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "enum\\s+[^\\n{]+\\s*[{][^}]*\\bJJJ\\b[^}]*}" - :tests ("enum Foo { VariantA, test, VariantB(u32) }" - "enum Foo { test(T) }" - "enum BadStyle{test}" - "enum Foo32 { Bar, testing, test(u8) }") - :not ("enum Foo { testing }")) - - (:language "rust" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bfn\\s+JJJ\\s*\\\(" - :tests ("fn test(asdf: u32)" - "fn test()" - "pub fn test()")) - - (:language "rust" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bmacro_rules!\\s+JJJ" - :tests ("macro_rules! test")) - - (:language "rust" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "struct\\s+JJJ\\s*[{\\\(]?" - :tests ("struct test(u32, u32)" - "struct test;" - "struct test { abc: u32, def: Vec }")) - - (:language "rust" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "trait\\s+JJJ\\s*[{]?" - :tests ("trait test;" "trait test { fn abc() -> u32; }")) - - (:language "rust" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\btype\\s+JJJ([^=\\n]+)?\\s*=[^=\\n]+;" - :tests ("type test = Rc>;" - "type test = Arc>>;")) - - (:language "rust" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "impl\\s+((\\w+::)*\\w+\\s+for\\s+)?(\\w+::)*JJJ\\s+[{]?" - :tests ("impl test {" - "impl abc::test {" - "impl std::io::Read for test {" - "impl std::io::Read for abc::test {")) - - (:language "rust" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "mod\\s+JJJ\\s*[{]?" - :tests ("mod test;" "pub mod test {")) - - ;; enum definitions - (:language "rust" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\benum\\s+JJJ\\b\\s*[{]?" - :tests ("enum test { A, B, C }" - "enum test {" - "pub enum test {" - "pub enum test { A, B }" - "pub enum test {" - "enum test { Variant1, Variant2(Type) }" - "pub(crate) enum test { Variant }") - :not ("enum testing { A, B }" - "enum Foo { test, Bar }")) - - ;;-- elixir - (:language "elixir" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bdef(p)?\\s+JJJ\\s*[ ,\\\(]" - :tests ("def test do" - "def test, do:" - "def test() do" - "def test(), do:" - "def test(foo, bar) do" - "def test(foo, bar), do:" - "defp test do" - "defp test(), do:")) - - (:language "elixir" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*JJJ\\s*=[^=\\n]+" - :tests ("test = 1234") - :not ("if test == 1234")) - - (:language "elixir" :type "module" - :supports ("ag" "grep" "rg" "git-grep") - :regex "defmodule\\s+(\\w+\\.)*JJJ\\s+" - :tests ("defmodule test do" - "defmodule Foo.Bar.test do")) - - (:language "elixir" :type "module" - :supports ("ag" "grep" "rg" "git-grep") - :regex "defprotocol\\s+(\\w+\\.)*JJJ\\s+" - :tests ("defprotocol test do" - "defprotocol Foo.Bar.test do")) - - ;;-- erlang - (:language "erlang" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^JJJ\\b\\s*\\\(" - :tests ("test() ->" - "test()->" - "test(Foo) ->" - "test (Foo,Bar) ->" - "test(Foo, Bar)->")) - - (:language "erlang" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*JJJ\\s*=[^:=\\n]+" - :tests ("test = 1234") - :not ("if test =:= 1234" - "if test == 1234")) - - (:language "erlang" :type "module" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^-module\\\(JJJ\\\)" - :tests ("-module(test).")) - - ;;-- scss - (:language "scss" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "@mixin\\sJJJ\\b\\s*\\\(" - :tests ("@mixin test()")) - - (:language "scss" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "@function\\sJJJ\\b\\s*\\\(" - :tests ("@function test()")) - - (:language "scss" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "JJJ\\s*:\\s*" - :tests ("test :")) - - ;;-- sml - (:language "sml" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*(data)?type\\s+.*\\bJJJ\\b" - :tests ("datatype test =" - "datatype test=" - "datatype 'a test =" - "type test =" - "type 'a test =" - "type 'a test" - "type test") - :not ("datatypetest =")) - - (:language "sml" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*val\\s+\\bJJJ\\b" - :tests ("val test =" - "val test=" - "val test : bool")) - - (:language "sml" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*fun\\s+\\bJJJ\\b.*\\s*=" - :tests ("fun test list =" - "fun test (STRING_NIL, a) =" - "fun test ((s1,s2): 'a queue) : 'a * 'a queue =" - "fun test (var : q) : int =" - "fun test f e xs =")) - - (:language "sml" :type "module" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*(structure|signature|functor)\\s+\\bJJJ\\b" - :tests ("structure test =" - "structure test : MYTEST =" - "signature test =" - "functor test (T:TEST) =" - "functor test(T:TEST) =")) - - ;;-- sql - (:language "sql" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(CREATE|create)\\s+(.+?\\s+)?(FUNCTION|function|PROCEDURE|procedure)\\s+JJJ\\s*\\\(" - :tests ("CREATE FUNCTION test(i INT) RETURNS INT" - "create or replace function test (int)" - "CREATE PROCEDURE test (OUT p INT)" - "create definer = 'test'@'localhost' procedure test()")) - - (:language "sql" :type "table" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(CREATE|create)\\s+(.+?\\s+)?(TABLE|table)(\\s+(IF NOT EXISTS|if not exists))?\\s+JJJ\\b" - :tests ("CREATE TABLE test (" - "create temporary table if not exists test" - "CREATE TABLE IF NOT EXISTS test (" - "create global temporary table test")) - - (:language "sql" :type "view" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(CREATE|create)\\s+(.+?\\s+)?(VIEW|view)\\s+JJJ\\b" - :tests ("CREATE VIEW test (" - "create sql security definer view test" - "CREATE OR REPLACE VIEW test AS foo")) - - (:language "sql" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(CREATE|create)\\s+(.+?\\s+)?(TYPE|type)\\s+JJJ\\b" - :tests ("CREATE TYPE test" - "CREATE OR REPLACE TYPE test AS foo (" - "create type test as (")) - - ;;-- systemverilog - (:language "systemverilog" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*class\\s+\\bJJJ\\b" - :tests ("virtual class test;" - "class test;" - "class test extends some_class") - :not ("virtual class testing;" - "class test2;" - "class some_test" - "class some_class extends test")) - - (:language "systemverilog" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*task\\s+\\bJJJ\\b" - :tests ("task test (" - "task test(") - :not ("task testing (" - "task test2(")) - - (:language "systemverilog" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*\\bJJJ\\b\\s*=" - :tests ("assign test =" - "assign test=" - "int test =" - "int test=") - :not ("assign testing =" - "assign test2=")) - - (:language "systemverilog" :type "function" : - supports ("ag" "rg" "git-grep") - :regex "function\\s[^\\s]+\\s*\\bJJJ\\b" - :tests ("function Matrix test ;" - "function Matrix test;") - :not ("function test blah")) - - ;; matches SV class handle declarations - (:language "systemverilog" :type "function" - :supports ("ag" "rg" "git-grep") - :regex "^\\s*[^\\s]*\\s*[^\\s]+\\s+\\bJJJ\\b" - :tests ("some_class_name test" - " another_class_name test ;" - "some_class test[];" - "some_class #(1) test") - :not ("test some_class_name" - "class some_class extends test")) - - ;;-- vhdl - (:language "vhdl" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*type\\s+\\bJJJ\\b" - :tests ("type test is" - "type test is") - :not ("type testing is" - "type test2 is")) - - (:language "vhdl" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*constant\\s+\\bJJJ\\b" - :tests ("constant test :" - "constant test:") - :not ("constant testing " - "constant test2:")) - - (:language "vhdl" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "function\\s*\"?JJJ\"?\\s*\\\(" - :tests ("function test(signal)" - "function test (signal)" - "function \"test\" (signal)") - :not ("function testing(signal")) - - ;;-- latex - (:language "tex" :type "command" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\\.*newcommand\\\*?\\s*\\\{\\s*(\\\\)JJJ\\s*}" - :tests ("\\newcommand{\\test}" - "\\renewcommand{\\test}" - "\\renewcommand*{\\test}" - "\\newcommand*{\\test}" - "\\renewcommand{ \\test }") - :not("\\test" "test")) - - (:language "tex" :type "command" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\\.*newcommand\\\*?\\s*(\\\\)JJJ\\j" - :tests ("\\newcommand\\test {}" - "\\renewcommand\\test{}" - "\\newcommand \\test") - :not("\\test" - "test")) - - (:language "tex" :type "length" : - supports ("ag" "grep" "rg" "git-grep") - :regex "\\\\(s)etlength\\s*\\\{\\s*(\\\\)JJJ\\s*}" - :tests ("\\setlength { \\test}" - "\\setlength{\\test}" - "\\setlength{\\test}{morecommands}" ) - :not("\\test" - "test")) - - (:language "tex" :type "counter" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\\newcounter\\\{\\s*JJJ\\s*}" - :tests ("\\newcounter{test}" ) - :not("\\test" - "test")) - - (:language "tex" :type "environment" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\\\.*newenvironment\\s*\\\{\\s*JJJ\\s*}" - :tests ("\\newenvironment{test}" - "\\newenvironment {test}{morecommands}" - "\\lstnewenvironment{test}" - "\\newenvironment {test}" ) - :not("\\test" - "test" )) - - ;;-- pascal (todo: var, type, const) - (:language "pascal" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bfunction\\s+JJJ\\b" - :tests (" function test : ")) - - (:language "pascal" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bprocedure\\s+JJJ\\b" - :tests (" procedure test ; ")) - - ;;-- f# - (:language "fsharp" :type "variable" - :supports ("ag" "rg" "grep" "git-grep") - :regex "let\\s+JJJ\\b.*\\\=" - :tests ("let test = 1234" - "let test() = 1234" - "let test abc def = 1234") - :not ("let testnot = 1234" - "let testnot() = 1234" - "let testnot abc def = 1234")) - - (:language "fsharp" :type "interface" - :supports ("ag" "rg" "grep" "git-grep") - :regex "member(\\b.+\\.|\\s+)JJJ\\b.*\\\=" - :tests ("member test = 1234" - "member this.test = 1234") - :not ("member testnot = 1234" - "member this.testnot = 1234")) - - (:language "fsharp" :type "type" - :supports ("ag" "rg" "grep" "git-grep") - :regex "type\\s+JJJ\\b.*\\\=" - :tests ("type test = 1234") - :not ("type testnot = 1234")) - - ;;-- kotlin - (:language "kotlin" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "fun\\s*(<[^>]*>)?\\s*JJJ\\s*\\(" - :tests ("fun test()" "fun test()")) - - (:language "kotlin" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(val|var)\\s*JJJ\\b" - :not ("val testval" - "var testvar") - :tests ("val test " - "var test")) - - (:language "kotlin" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(class|interface)\\s*JJJ\\b" - :tests ("class test" - "class test : SomeInterface" - "interface test")) - - ;;-- zig - (:language "zig" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "fn\\s+JJJ\\b" - :tests ("fn test() void {" - "fn test(a: i32) i32 {" - "pub fn test(a: i32) i32 {" - "export fn test(a: i32) i32 {" - "extern \"c\" fn test(a: i32) i32 {" - "inline fn test(a: i32) i32 {")) - - (:language "zig" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(var|const)\\s+JJJ\\b" - :tests ("const test: i32 = 3;" - "var test: i32 = 3;" - "pub const test: i32 = 3;")) - - ;;-- protobuf - (:language "protobuf" :type "message" - :supports ("ag" "grep" "rg" "git-grep") - :regex "message\\s+JJJ\\s*\\\{" - :tests ("message test{" "message test {")) - - (:language "protobuf" :type "enum" - :supports ("ag" "grep" "rg" "git-grep") - :regex "enum\\s+JJJ\\s*\\\{" - :tests ("enum test{" "enum test {")) - - ;;-- apex (literally the same regexes as java) - (:language "apex" :type "function" - :supports ("ag" "rg") - :regex "^\\s*(?:[\\w\\[\\]]+\\s+){1,3}JJJ\\s*\\\(" - :tests ("int test()" - "int test(param)" - "static int test()" - "static int test(param)" - "public static MyType test()" - "private virtual SomeType test(param)" - "static int test()" - "private foo[] test()") - :not ("test()" "testnot()" - "blah = new test()" - "foo bar = test()")) - - (:language "apex" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*\\bJJJ\\s*=[^=\\n)]+" :tests ("int test = 1234") - :not ("if test == 1234:" "int nottest = 44")) - - (:language "apex" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "(class|interface)\\s*JJJ\\b" - :tests ("class test:" - "public class test implements Something") - :not ("class testnot:" - "public class testnot implements Something")) - - ;;-- jai - (:language "jai" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*::" - :tests ("test ::")) - (:language "jai" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*(:|:\\s*=|::)" - :tests ("test: Type" "test : Type = Val" "test :: Val")) - (:language "jai" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*::" - :tests ("test ::")) - - ;;-- odin - (:language "odin" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\s*\\bJJJ\\s*:\\s*([^=\\n]+\\s*:|:|[^=\\n]+\\s*=|=)" - :tests ("test :: struct" - "test ::enum" - "test:: union" - "test: : custom_type" - "test :: [2]f32" - "test : f32 : 20" - "test: i32 : 10" - "test := 20" - "test : f32 = 20" - "test: i32 = 10" - "test: i32= 10" - "test :i32= 10" - "test :: proc()" - "test ::proc() {" - "test:: proc(a: i32) -> i32 {" - "test::proc{}" - "test: :proc \"contextless\" {}")) - - (:language "odin" :type "function" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*:\\s*:\\s*proc\\s*[({]" - :tests ("test :: proc(a: int)" - "test ::proc()" - "test:: proc(a: i32) -> i32 {" - "test::proc{}") - :not ("testnot :: proc()" - "test: proc()")) - - (:language "odin" :type "type" - :supports ("ag" "grep" "rg" "git-grep") - :regex "\\bJJJ\\s*:\\s*:\\s*(struct|enum|union|bit_set|bit_field)\\b" - :tests ("test :: struct {" - "test :: enum {" - "test :: union {" - "test :: bit_set {" - "test :: bit_field {") - :not ("testnot :: struct {" - "test :: structure_builder")) - - ;;-- cobol - (:language "cobol" :type "variable" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^(.{6}[^*/])?\\s*([frs]d|[[:digit:]]{1,2})\\s+JJJ([\\. ]|$)" - :tests (" 01 test." - "000350 10 test pic x." - " 88 test value '10'." - "fd test." - " sd test.") - :not (" *01 test" - " 05 test-01" - " 05 testing")) - - (:language "cobol" :type "section" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^(.{6}[^*/])?JJJ(\\s+section)?\\." - :tests (" test." - " test section." - "test." - "test section.") - :not (" test." - " *test section.")) - - (:language "cobol" :type "submodule" - :supports ("ag" "grep" "rg" "git-grep") - :regex "^(.{6}[^*/])?program-id\\.\\s*[\"']?JJJ[\"']?.*\\." - :tests (" program-id. test." - " program-id. 'test'." - "program-id. \"test\".") - :not (" test."))) - - "List of search regex pattern templates organized by language and type. -Used for generating the grep tool search commands. - -For a given language, a regular expression is only used by Dumb Jump when -the currently used search tool is identified in the :supports value. - -The regex string is a template filled by `dumb-jump-populate-regex' and -should contain the \"JJJ\" string, a marker for the searched identifier. - -It may also contain the following: - -- \"\\\\j\" : a marker for word-boundary regular-expression to use instead - of \"\\\\b\" when word boundary concept must support Lisp language - family and must not include the characters '-', '?' and '*'. - In the Lisp family of programming languages a large number of - characters are allowed in identifiers, including '-', '?' and - '*'. - This marker is replaced by value of the search tool specific - dumb-jump-TOOL-word-boundary, like `dumb-jump-ag-word-boundary' for - ag. - -- \"\\\\s\" : for a single white space character. - Replaced by \"[[:space:]]\" for some search tools as identified by - `dumb-jump-use-space-bracket-exp-for' returning t for a tool variant. - -The language types supported are listed in the linked page below: -- Ag: - URL \ `https://github.com/ggreer/the_silver_searcher/blob/master/tests/list_file_types.t' -- rg: - URL \ `https://github.com/BurntSushi/ripgrep/blob/master/crates/ignore/src/default_types.rs#L12' - -More information using the search tool command line help." - :group 'dumb-jump - :type - '(repeat - (plist :options ((:language string) - (:type string) - (:supports string) - (:regex string) - (:tests (repeat string)) - (:not (repeat string)))))) - -(defcustom dumb-jump-language-file-exts - ;; dumb-jump language file extension ag type rg type - '((:language "elisp" :ext "el" :agtype "elisp" :rgtype "elisp") - (:language "elisp" :ext "el.gz" :agtype "elisp" :rgtype "elisp") - (:language "commonlisp" :ext "lisp" :agtype "lisp" :rgtype "lisp") - (:language "commonlisp" :ext "lsp" :agtype "lisp" :rgtype "lisp") - (:language "c++" :ext "c" :agtype "cc" :rgtype "c") - (:language "c++" :ext "h" :agtype "cc" :rgtype "c") - (:language "c++" :ext "C" :agtype "cpp" :rgtype "cpp") - (:language "c++" :ext "H" :agtype "cpp" :rgtype "cpp") - (:language "c++" :ext "tpp" :agtype "cpp" :rgtype nil) - (:language "c++" :ext "cpp" :agtype "cpp" :rgtype "cpp") - (:language "c++" :ext "hpp" :agtype "cpp" :rgtype "cpp") - (:language "c++" :ext "cxx" :agtype "cpp" :rgtype "cpp") - (:language "c++" :ext "hxx" :agtype "cpp" :rgtype nil) - (:language "c++" :ext "cc" :agtype "cpp" :rgtype "cpp") - (:language "c++" :ext "hh" :agtype "cpp" :rgtype "cpp") - (:language "c++" :ext "c++" :agtype nil :rgtype nil) - (:language "c++" :ext "h++" :agtype nil :rgtype nil) - (:language "c++" :ext "ino" :agtype "cpp" :rgtype nil) - (:language "coq" :ext "v" :agtype nil :rgtype nil) - (:language "ocaml" :ext "ml" :agtype "ocaml" :rgtype "ocaml") - (:language "ocaml" :ext "mli" :agtype "ocaml" :rgtype "ocaml") - (:language "ocaml" :ext "mll" :agtype "ocaml" :rgtype "ocaml") - (:language "ocaml" :ext "mly" :agtype "ocaml" :rgtype "ocaml") - ;; groovy is nil type because jenkinsfile is not in searcher type lists - (:language "groovy" :ext "gradle" :agtype nil :rgtype nil) - (:language "groovy" :ext "groovy" :agtype nil :rgtype nil) - (:language "groovy" :ext "jenkinsfile" :agtype nil :rgtype nil) - (:language "haskell" :ext "hs" :agtype "haskell" :rgtype "haskell") - (:language "haskell" :ext "lhs" :agtype "haskell" :rgtype "haskell") - (:language "objc" :ext "m" :agtype "objc" :rgtype "objc") - (:language "csharp" :ext "cs" :agtype "csharp" :rgtype "csharp") - (:language "java" :ext "java" :agtype "java" :rgtype "java") - (:language "vala" :ext "vala" :agtype "vala" :rgtype "vala") - (:language "vala" :ext "vapi" :agtype "vala" :rgtype "vala") - (:language "julia" :ext "jl" :agtype "julia" :rgtype "julia") - (:language "clojure" :ext "clj" :agtype "clojure" :rgtype "clojure") - (:language "clojure" :ext "cljc" :agtype "clojure" :rgtype "clojure") - (:language "clojure" :ext "cljs" :agtype "clojure" :rgtype "clojure") - (:language "clojure" :ext "cljx" :agtype "clojure" :rgtype "clojure") - (:language "coffeescript" :ext "coffee" :agtype "coffee" :rgtype "coffeescript") - (:language "faust" :ext "dsp" :agtype nil :rgtype nil) - (:language "faust" :ext "lib" :agtype nil :rgtype nil) - (:language "fennel" :ext "fnl" :agtype nil :rgtype nil) - (:language "fortran" :ext "F" :agtype "fortran" :rgtype "fortran") - (:language "fortran" :ext "f" :agtype "fortran" :rgtype "fortran") - (:language "fortran" :ext "f77" :agtype "fortran" :rgtype "fortran") - (:language "fortran" :ext "f90" :agtype "fortran" :rgtype "fortran") - (:language "fortran" :ext "f95" :agtype "fortran" :rgtype "fortran") - (:language "fortran" :ext "F77" :agtype "fortran" :rgtype "fortran") - (:language "fortran" :ext "F90" :agtype "fortran" :rgtype "fortran") - (:language "fortran" :ext "F95" :agtype "fortran" :rgtype "fortran") - (:language "fortran" :ext "f03" :agtype "fortran" :rgtype "fortran") - (:language "fortran" :ext "for" :agtype "fortran" :rgtype "fortran") - (:language "fortran" :ext "ftn" :agtype "fortran" :rgtype "fortran") - (:language "fortran" :ext "fpp" :agtype "fortran" :rgtype "fortran") - (:language "go" :ext "go" :agtype "go" :rgtype "go") - (:language "javascript" :ext "js" :agtype "js" :rgtype "js") - (:language "javascript" :ext "jsx" :agtype "js" :rgtype "js") - (:language "javascript" :ext "vue" :agtype "js" :rgtype "js") - (:language "javascript" :ext "html" :agtype "html" :rgtype "html") - (:language "javascript" :ext "css" :agtype "css" :rgtype "css") - (:language "typescript" :ext "ts" :agtype "ts" :rgtype "ts") - (:language "typescript" :ext "tsx" :agtype "ts" :rgtype "ts") - (:language "typescript" :ext "vue" :agtype "ts" :rgtype "ts") - (:language "dart" :ext "dart" :agtype nil :rgtype "dart") - (:language "dlang" :ext "d" :agtype "dlang" :rgtype "d") - (:language "dlang" :ext "di" :agtype "dlang" :rgtype "d") - (:language "lua" :ext "lua" :agtype "lua" :rgtype "lua") - ;; the extension "m" is also used by obj-c so must use matlab-mode - ;; since obj-c will win by file extension, but here for searcher types - (:language "matlab" :ext "m" :agtype "matlab" :rgtype "matlab") - (:language "nim" :ext "nim" :agtype "nim" :rgtype "nim") - (:language "nix" :ext "nix" :agtype "nix" :rgtype "nix") - (:language "org" :ext "org" :agtype nil :rgtype "org") - (:language "perl" :ext "pl" :agtype "perl" :rgtype "perl") - (:language "perl" :ext "pm" :agtype "perl" :rgtype "perl") - (:language "perl" :ext "pm6" :agtype "perl" :rgtype nil) - (:language "perl" :ext "perl" :agtype nil :rgtype "perl") - (:language "perl" :ext "plh" :agtype nil :rgtype "perl") - (:language "perl" :ext "plx" :agtype nil :rgtype "perl") - (:language "perl" :ext "pod" :agtype "perl" :rgtype "pod") - (:language "perl" :ext "t" :agtype "perl" :rgtype nil) - (:language "php" :ext "php" :agtype "php" :rgtype "php") - (:language "php" :ext "php3" :agtype "php" :rgtype "php") - (:language "php" :ext "php4" :agtype "php" :rgtype "php") - (:language "php" :ext "php5" :agtype "php" :rgtype "php") - (:language "php" :ext "phtml" :agtype "php" :rgtype "php") - (:language "php" :ext "inc" :agtype "php" :rgtype nil) - (:language "purescript" :ext "purs" :agtype nil :rgtype nil) - (:language "python" :ext "py" :agtype "python" :rgtype "py") - (:language "r" :ext "R" :agtype "r" :rgtype "r") - (:language "r" :ext "r" :agtype "r" :rgtype "r") - (:language "r" :ext "Rmd" :agtype "r" :rgtype "r") - (:language "r" :ext "Rnw" :agtype "r" :rgtype "r") - (:language "r" :ext "Rtex" :agtype "r" :rgtype nil) - (:language "r" :ext "Rrst" :agtype "r" :rgtype nil) - (:language "racket" :ext "rkt" :agtype "racket" :rgtype "lisp") - (:language "crystal" :ext "cr" :agtype "crystal" :rgtype "crystal") - (:language "crystal" :ext "ecr" :agtype "crystal" :rgtype nil) - (:language "ruby" :ext "rb" :agtype "ruby" :rgtype "ruby") - (:language "ruby" :ext "erb" :agtype "ruby" :rgtype nil) - (:language "ruby" :ext "haml" :agtype "ruby" :rgtype nil) - (:language "ruby" :ext "rake" :agtype "ruby" :rgtype nil) - (:language "ruby" :ext "slim" :agtype "ruby" :rgtype nil) - (:language "rust" :ext "rs" :agtype "rust" :rgtype "rust") - (:language "zig" :ext "zig" :agtype nil :rgtype "zig") - (:language "scad" :ext "scad" :agtype nil :rgtype nil) - (:language "scala" :ext "scala" :agtype "scala" :rgtype "scala") - (:language "scheme" :ext "scm" :agtype "scheme" :rgtype "lisp") - (:language "scheme" :ext "ss" :agtype "scheme" :rgtype "lisp") - (:language "scheme" :ext "sld" :agtype "scheme" :rgtype "lisp") - (:language "janet" :ext "janet" :agtype "janet" :rgtype "lisp") - (:language "shell" :ext "sh" :agtype nil :rgtype nil) - (:language "shell" :ext "bash" :agtype nil :rgtype nil) - (:language "shell" :ext "csh" :agtype nil :rgtype nil) - (:language "shell" :ext "ksh" :agtype nil :rgtype nil) - (:language "shell" :ext "tcsh" :agtype nil :rgtype nil) - (:language "sml" :ext "sml" :agtype "sml" :rgtype "sml") - (:language "solidity" :ext "sol" :agtype nil :rgtype nil) - (:language "sql" :ext "sql" :agtype "sql" :rgtype "sql") - (:language "swift" :ext "swift" :agtype nil :rgtype "swift") - (:language "tex" :ext "tex" :agtype "tex" :rgtype "tex") - (:language "elixir" :ext "ex" :agtype "elixir" :rgtype "elixir") - (:language "elixir" :ext "exs" :agtype "elixir" :rgtype "elixir") - (:language "elixir" :ext "eex" :agtype "elixir" :rgtype "elixir") - (:language "erlang" :ext "erl" :agtype "erlang" :rgtype "erlang") - (:language "systemverilog" :ext "sv" :agtype "verilog" :rgtype "verilog") - (:language "systemverilog" :ext "svh" :agtype "verilog" :rgtype "verilog") - (:language "vhdl" :ext "vhd" :agtype "vhdl" :rgtype "vhdl") - (:language "vhdl" :ext "vhdl" :agtype "vhdl" :rgtype "vhdl") - (:language "scss" :ext "scss" :agtype "css" :rgtype "css") - (:language "pascal" :ext "pas" :agtype "delphi" :rgtype nil) - (:language "pascal" :ext "dpr" :agtype "delphi" :rgtype nil) - (:language "pascal" :ext "int" :agtype "delphi" :rgtype nil) - (:language "pascal" :ext "dfm" :agtype "delphi" :rgtype nil) - (:language "fsharp" :ext "fs" :agtype "fsharp" :rgtype nil) - (:language "fsharp" :ext "fsi" :agtype "fsharp" :rgtype nil) - (:language "fsharp" :ext "fsx" :agtype "fsharp" :rgtype nil) - (:language "kotlin" :ext "kt" :agtype "kotlin" :rgtype "kotlin") - (:language "kotlin" :ext "kts" :agtype "kotlin" :rgtype "kotlin") - (:language "protobuf" :ext "proto" :agtype "proto" :rgtype "protobuf") - (:language "hcl" :ext "tf" :agtype "terraform" :rgtype "tf") - (:language "hcl" :ext "tfvars" :agtype "terraform" :rgtype nil) - (:language "apex" :ext "cls" :agtype nil :rgtype nil) - (:language "apex" :ext "trigger" :agtype nil :rgtype nil) - (:language "jai" :ext "jai" :agtype nil :rgtype nil) - (:language "odin" :ext "odin" :agtype nil :rgtype nil) - (:language "cobol" :ext "cbl" :agtype nil :rgtype nil) - (:language "cobol" :ext "cob" :agtype nil :rgtype nil) - (:language "cobol" :ext "cpy" :agtype nil :rgtype nil)) - - "Map programming language to file extensions support by search tool. -The value of :agytpe, :rgtype is nil when the search tool file type does -not search for that file extension, otherwise it is the name of the file -type for that tool." - :group 'dumb-jump - :type - '(repeat - (plist - :options ((:language (string :tag "Language")) - (:ext (string :tag "Extension")) - (:agtype (string :tag "Ag type")) - (:rgtype (string :tag "Ripgrep type")))))) - -(defcustom dumb-jump-language-contexts - '((:language "javascript" :type "function" :left nil :right "^(" ) - (:language "javascript" :type "variable" :left "($" :right nil ) - (:language "javascript" :type "variable" :left "($" :right "^)" ) - (:language "javascript" :type "variable" :left nil :right "^\\." ) - (:language "javascript" :type "variable" :left nil :right "^;" ) - (:language "typescript" :type "function" :left nil :right "^(" ) - (:language "typescript" :type "type" :left "\\(?:[:<>,|&]\\|\\_<\\(?:as\\|extends\\|implements\\)\\_>\\)\\s-*$" :right nil) - (:language "typescript" :type "type" :left "\\_<\\(?:type\\|interface\\|enum\\|class\\)\\_>\\s-+$" :right nil) - (:language "perl" :type "function" :left nil :right "^(" ) - (:language "tcl" :type "function" :left "\\[$" :right nil) - (:language "tcl" :type "function" :left "^\\s*$" :right nil) - (:language "tcl" :type "variable" :left "\\$$" :right nil) - (:language "php" :type "function" :left nil :right "^(" ) - (:language "php" :type "class" :left "new\\s+" :right nil ) - (:language "elisp" :type "function" :left "($" :right nil ) - (:language "elisp" :type "variable" :left nil :right "^)" ) - (:language "scheme" :type "function" :left "($" :right nil ) - (:language "scheme" :type "variable" :left nil :right "^)" ) - (:language "jai" :type "function" :left nil :right "\\s*(" ) - (:language "jai" :type "type" :left "\\s*:\\s*" :right nil) - (:language "cobol" :type "submodule" :left "call\\s+" :right nil ) - (:language "cobol" :type "section" :left "perform\\s+" :right nil ) - (:language "cobol" :type "section" :left "go to\\s+" :right nil )) - "List of under points contexts for each language. -This helps limit the number of regular expressions we use -if we know that if there's a ( immediately to the right of -a symbol then it's probably a function call." - :group 'dumb-jump - :type - '(repeat - (plist - :options ((:language (string :tag "Language")) - (:type (choice (const "function") - (const "variable"))) - (:left (choice (const :tag "Anything" nil) - (string :tag "Regular expression"))) - (:right (choice (const :tag "Anything" nil) - (string :tag "Regular expression"))))))) - -(defcustom dumb-jump-project-denoters - '(".dumbjump" - ".projectile" - ".git" - ".hg" - ".fslckout" - ".bzr" - "_darcs" - ".svn" - "Makefile" - "PkgInfo" - "-pkg.el" - "_FOSSIL_" - "Cargo.toml") - "Files and directories that signify a directory is a project root. -If any of these denoting files are present in project sub-directories -(like Makefile) then you can either remove the culprit denoter from the -list or create a .dumbjumpignore file in the project sub-directory." - :group 'dumb-jump - :type '(repeat (string :tag "Name"))) - -(defcustom dumb-jump-default-project "~" - "Directory of default project to search within if a project root is not found." - :group 'dumb-jump - :type 'string) - -(defcustom dumb-jump-project nil - "Directory of project to search within if normal denoters will not work. -This should only be needed in the rarest of cases." - :group 'dumb-jump - :type 'string) - -(defcustom dumb-jump-rust-search-dependencies nil - "When non-nil, automatically include Rust dependency source paths. -Uses `cargo metadata' to discover crate source directories. -Requires `cargo' to be installed and a Cargo.toml in the project." - :group 'dumb-jump - :type 'boolean) - -(with-no-warnings ; don't warn about long example line - (defcustom dumb-jump-extra-search-paths-function nil - "Function to compute extra search paths for jump-to-definition lookups. -When non-nil, this function is called with two arguments: LANG (a -string naming the programming language, or nil if undetected) and -PROJ-ROOT (the project root directory). It should return a list of -directory path strings to include in the search, or nil. - -Returned paths may be absolute or relative to PROJ-ROOT (relative -entries are expanded via `expand-file-name'). Non-existent -directories and non-string entries are silently ignored. - -This is useful for dynamically adding paths such as virtualenv -site-packages, installed library sources, or SDK directories. - -Example: - - (setq dumb-jump-extra-search-paths-function - (lambda (lang proj-root) - (when (string= lang \"python\") - (let* ((default-directory proj-root) - (path (string-trim - (shell-command-to-string - \"poetry run python -c \\\"import site; print(site.getsitepackages()[0])\\\"\")))) - (when (file-directory-p path) - (list path))))))" - :group 'dumb-jump - :type '(choice (const :tag "None" nil) - function))) - -(defcustom dumb-jump-before-jump-hook nil - "Hooks called before jumping." - :group 'dumb-jump - :type 'hook) - -(defcustom dumb-jump-after-jump-hook nil - "Hooks called after jumping." - :group 'dumb-jump - :type 'hook) - -(defcustom dumb-jump-aggressive - nil - "If `t` jump aggressively with the possibility of a false positive. -If `nil` always show list of more than 1 match." - :group 'dumb-jump - :type 'boolean) - -(defcustom dumb-jump-debug - nil - "If `t` will print helpful debug information. -Also ensure that `dumb-jump-quiet' is nil for debugging!" - :group 'dumb-jump - :type 'boolean) - -(defcustom dumb-jump-confirm-jump-to-modified-file - t - "Confirm before jumping to a modified file? -If t, confirm before jumping to a modified file (which may lead to an -inaccurate jump). -If nil, jump without confirmation but print a warning." - :group 'dumb-jump - :type 'boolean) - -(defcustom dumb-jump-disable-obsolete-warnings nil - "If non-nil, don't warn about using the legacy interface." - :group 'dumb-jump - :type 'boolean) - -;; --------------------------------------------------------------------------- -;; Debugging Utilities -;; ------------------- - -(defun dumb-jump-message-prin1 (format-str &rest args) - "Helper debugging function: generate a FORMAT-STR message with all ARGS." - ;; Fist transform each of ARGS to string with `prin1-to-string' then - ;; pass them as arguments to message by making a list used the third - ;; parameter to apply. - (apply 'message format-str (mapcar #'prin1-to-string args))) - -;; --------------------------------------------------------------------------- -;; Search tool presence checkers -;; ----------------------------- -(defvar dumb-jump--detected-env-problems nil - "List of detected environment problems. -Last detected problem is first in the list.") - -(defun dumb-jump-env-problem (problem) - "Add PROBLEM string to `dumb-jump--detected-env-problems' list." - (unless (member problem dumb-jump--detected-env-problems) - (push problem dumb-jump--detected-env-problems))) - -;;;###autoload -(defun dumb-jump-show-detected-problems (keep) - "Print all problems detected by dumb-jump environment in *Message*. -Erase the accumulated list unless the command is issued with any prefix -key (such as `\\[universal-argument]')." - (interactive "P") - (if dumb-jump--detected-env-problems - (progn - (message "-- Dumb-Jump Detected Environment Problems:") - (dolist (problem (reverse dumb-jump--detected-env-problems)) - (message problem)) - (unless keep - (setq dumb-jump--detected-env-problems nil))) - (message "No problem recorded yet."))) - -;; -- - -(defvar dumb-jump--ag-installed? 'unset) -(defun dumb-jump-ag-installed? () - "Return t if ag is installed." - (if (eq dumb-jump--ag-installed? 'unset) - (setq dumb-jump--ag-installed? - (dumb-jump--contains-p "ag version" - (shell-command-to-string - (concat dumb-jump-ag-cmd " --version")))) - dumb-jump--ag-installed?)) - -(defvar dumb-jump--git-grep-plus-ag-installed? 'unset) -(defun dumb-jump-git-grep-plus-ag-installed? () - "Return t if git grep and ag is installed." - (if (eq dumb-jump--git-grep-plus-ag-installed? 'unset) - (setq dumb-jump--git-grep-plus-ag-installed? - (and (dumb-jump-git-grep-installed?) - (dumb-jump-ag-installed?))) - dumb-jump--git-grep-plus-ag-installed?)) - -(defvar dumb-jump--rg-installed? 'unset) -(defun dumb-jump-rg-installed? () - "Return t if rg 0.10 or later with PCRE2 support is installed. -Return nil otherwise. In that case store diagnostics information in the -variable `dumb-jump--detected-env-problems'." - (if (eq dumb-jump--rg-installed? 'unset) - (setq - dumb-jump--rg-installed? - (catch 'rg-problem - (unless (executable-find dumb-jump-rg-cmd) - (dumb-jump-env-problem - (format "Ripgrep not found as specified in `dumb-jump-rg-cmd': %s" - dumb-jump-rg-cmd)) - (throw 'rg-problem nil)) - (let* ((stdout (shell-command-to-string - (concat dumb-jump-rg-cmd " --version"))) - (has-version (string-match "ripgrep \\([0-9]+\\.[0-9]+\\).*" - stdout))) - (unless has-version - (dumb-jump-env-problem "Can't detect Ripgrep version.") - (throw 'rg-problem nil)) - (unless (version<= "0.10" (match-string-no-properties 1 stdout)) - (dumb-jump-env-problem "Ripgrep >= 0.10 is not available.") - (throw 'rg-problem nil)) - (unless (string-match "features:.*pcre2" stdout) - (dumb-jump-env-problem "Ripgrep does not support PCRE2.") - (throw 'rg-problem nil)) - t))) - dumb-jump--rg-installed?)) - -(defvar dumb-jump--git-grep-installed? 'unset) -(defun dumb-jump-git-grep-installed? () - "Return t if git-grep is installed." - (if (eq dumb-jump--git-grep-installed? 'unset) - (setq dumb-jump--git-grep-installed? - (dumb-jump--contains-p "fatal: no pattern given" - (shell-command-to-string - (concat dumb-jump-git-grep-cmd)))) - dumb-jump--git-grep-installed?)) - -(defvar dumb-jump--grep-installed? 'unset) -(defun dumb-jump-grep-installed? () - "Return non-nil if a grep is installed, nil otherwise. -Return \\='gnu if GNU grep is installed, \\='bsd if BSD grep is installed." - (if (eq dumb-jump--grep-installed? 'unset) - (let* ((version (shell-command-to-string - (concat dumb-jump-grep-cmd " --version"))) - (variant (cond ((dumb-jump--match "GNU grep" version) 'gnu) - ((dumb-jump--match "[0-9]+\\.[0-9]+" version) 'bsd) - (t nil)))) - (setq dumb-jump--grep-installed? variant)) - dumb-jump--grep-installed?)) - -;; --------------------------------------------------------------------------- -;; Dumb-Jump Tests -;; --------------- - -(defun dumb-jump-run-test (test cmd) - "Use TEST as the standard input for the CMD." - (with-temp-buffer - (insert test) - (shell-command-on-region (point-min) (point-max) cmd nil t) - (buffer-substring-no-properties (point-min) (point-max)))) - -(defun dumb-jump-run-test-temp-file (test thefile realcmd) - "Write TEST string to temporary file THEFILE, run shell REALCMD on it. -Return resulting string." - (with-temp-buffer - (insert test) - (write-file thefile nil) - (delete-region (point-min) (point-max)) - (shell-command realcmd t) - (set-buffer-modified-p nil) ; prevent prompt on file deletion during test - (delete-file thefile) - (buffer-substring-no-properties (point-min) (point-max)))) - -(defun dumb-jump-run-git-grep-test (test git-grep-cmd) - "Execute GIT-GREP-CMD on input TEST string written in temporary file. -Necessary because git grep must be given a file as input, not just a string." - (let ((thefile ".git.grep.test")) - (dumb-jump-run-test-temp-file test - thefile - (concat git-grep-cmd " " thefile)))) - -(defun dumb-jump-run-ag-test (test ag-cmd) - "Execute AG-CMD on input TEST written in temporary file. -The difference is that ag ignores multiline matches when passed -input from stdin, which is a crucial feature." - (let ((thefile ".ag.test")) - (dumb-jump-run-test-temp-file test - thefile - (concat ag-cmd " " thefile)))) - -;; --------------------------------------------------------------------------- -;; Test dumb-jump search rules -;; --------------------------- - -(defun dumb-jump--search-failure-msg (tool test run-not-tests resp cmd rule) - "Return search failure string adjusted to the arguments. -TOOL: search tool name. -TEST: the test string. -RUN-NO-TESTS: t to see a list of all failed rules. -RESP: response. -CMD: the search command used. -RULE: the complete `dumb-jump-find-rules' rule used for this test." - (format "%s FAILURE '%s' %s in response '%s' | CMD: '%s' | rule: '%s'" - tool - test - (if run-not-tests "IS unexpectedly" "NOT") - resp - cmd - rule)) - -(defun dumb-jump-test-grep-rules (&optional run-not-tests) - "Test all the grep rules and return count of those that fail. -Optionally pass t for RUN-NOT-TESTS to see a list of all failed rules." - (let ((variant (if (eq (dumb-jump-grep-installed?) 'gnu) 'gnu-grep 'grep))) - (mapcan - (lambda (rule) - (mapcan - (lambda (test) - (let* ((cmd (concat "grep -En -e " - (shell-quote-argument - (dumb-jump-populate-regex - (plist-get rule :regex) "test" variant)))) - (resp (dumb-jump-run-test test cmd))) - (when (or - (and (not run-not-tests) (not (dumb-jump--contains-p test resp))) - (and run-not-tests (> (length resp) 0))) - (list (dumb-jump--search-failure-msg "grep" - test - run-not-tests - resp - cmd - (plist-get rule :regex)))))) - (plist-get rule (if run-not-tests :not :tests)))) - (seq-filter (lambda (it) (member "grep" (plist-get it :supports))) dumb-jump-find-rules)))) - -(defun dumb-jump-test-ag-rules (&optional run-not-tests) - "Test all the ag rules and return count of those that fail. -Optionally pass t for RUN-NOT-TESTS to see a list of all failed rules." - (mapcan - (lambda (rule) - (mapcan - (lambda (test) - (let* ((cmd (concat "ag --nocolor --nogroup --nonumber " - (shell-quote-argument - (dumb-jump-populate-regex - (plist-get rule :regex) "test" 'ag)))) - (resp (dumb-jump-run-ag-test test cmd))) - (when (or - (and (not run-not-tests) (not (dumb-jump--contains-p test resp))) - (and run-not-tests (> (length resp) 0))) - (list (dumb-jump--search-failure-msg "ag" - test - run-not-tests - resp - cmd - rule))))) - (plist-get rule (if run-not-tests :not :tests)))) - (seq-filter (lambda (it) (member "ag" (plist-get it :supports))) dumb-jump-find-rules))) - -(defun dumb-jump-test-rg-rules (&optional run-not-tests) - "Test all the rg rules and return count of those that fail. -Optionally pass t for RUN-NOT-TESTS to see a list of all failed rules." - (mapcan - (lambda (rule) - (mapcan - (lambda (test) - (let* ((cmd (concat "rg --color never --no-heading -U --pcre2 " - (shell-quote-argument - (dumb-jump-populate-regex - (plist-get rule :regex) "test" 'rg)))) - (resp (dumb-jump-run-test test cmd))) - (when (or - (and (not run-not-tests) (not (dumb-jump--contains-p test resp))) - (and run-not-tests (> (length resp) 0))) - (list (dumb-jump--search-failure-msg "rg" - test - run-not-tests - resp - cmd - rule))))) - (plist-get rule (if run-not-tests :not :tests)))) - (seq-filter (lambda (it) (member "rg" (plist-get it :supports))) dumb-jump-find-rules))) - -(defun dumb-jump-test-git-grep-rules (&optional run-not-tests) - "Test all the git grep rules and return count of those that fail. -Optionally pass t for RUN-NOT-TESTS to see a list of all failed rules. - -Note: Tests rules that support \"grep\" since git-grep uses the same -ERE syntax. Testing actual git-grep would require temp git repos." - (mapcan - (lambda (rule) - (mapcan - (lambda (test) - (let* ((cmd (concat "git grep --color=never -h --untracked -E " - (shell-quote-argument - (dumb-jump-populate-regex - (plist-get rule :regex) "test" 'git-grep)))) - (resp (dumb-jump-run-git-grep-test test cmd))) - (when (or - (and (not run-not-tests) (not (dumb-jump--contains-p test resp))) - (and run-not-tests (> (length resp) 0))) - (list (dumb-jump--search-failure-msg "git-grep" - test - run-not-tests - resp - cmd - rule))))) - (plist-get rule (if run-not-tests :not :tests)))) - (seq-filter (lambda (it) (member "grep" (plist-get it :supports))) dumb-jump-find-rules))) - -;; --------------------------------------------------------------------------- - -(defun dumb-jump-message (str &rest args) - "Log message STR with ARGS to *Messages* if not using `dumb-jump-quiet'." - (unless dumb-jump-quiet - (apply 'message str args)) - nil) - -(defmacro dumb-jump-debug-message (&rest exprs) - "Generate a debug message to print all expressions EXPRS." - (declare (indent defun)) - (let ((i 5) frames frame) - ;; based on https://emacs.stackexchange.com/a/2312 - (while (setq frame (backtrace-frame i)) - (push frame frames) - (cl-incf i)) - ;; this is a macro-expanded version of the code in the stackexchange - ;; code from above. This version should work on emacs-24.3, since it - ;; doesn't depend on thread-last. - (let* ((frame (cl-find-if - (lambda (frame) - (ignore-errors - (and (car frame) - (eq (caaddr frame) - 'defalias)))) - (reverse frames))) - (func (cl-cadadr (cl-caddr frame))) - (defun-name (symbol-name func))) - (with-temp-buffer - (insert "DUMB JUMP DEBUG `") - (insert defun-name) - (insert "` START\n----\n\n") - (dolist (expr exprs) - (insert (prin1-to-string expr) ":\n\t%s\n\n")) - (insert "\n-----\nDUMB JUMP DEBUG `") - (insert defun-name) - (insert "` END\n-----") - `(when dumb-jump-debug - (dumb-jump-message - ,(buffer-string) - ,@exprs)))))) - -(defun dumb-jump-get-point-context (line func cur-pos) - "Get the LINE context to the left and right of FUNC using CUR-POS as hint." - (let ((loc (or (cl-search func line :start2 cur-pos) 0))) - (list :left (substring line 0 loc) - :right (substring line (+ loc (length func)))))) - -(defun dumb-jump-to-selected (results choices selected) - "With RESULTS use CHOICES to find the SELECTED choice from multiple options." - (let* ((result-index (dumb-jump--find-index (lambda (it) (string= selected it)) choices)) - (result (when result-index - (nth result-index results)))) - (when result - (dumb-jump-result-follow result)))) - -(defun dumb-jump-helm-persist-action (candidate) - "Preview CANDIDATE in temporary buffer displaying the file at matched line. -\\ -This is the persistent action (\\[helm-execute-persistent-action]) for helm." - (let* ((file (plist-get candidate :path)) - (line (plist-get candidate :line)) - (default-directory-old default-directory)) - (switch-to-buffer (get-buffer-create " *helm dumb jump persistent*")) - (setq default-directory default-directory-old) - (fundamental-mode) - (erase-buffer) - (insert-file-contents file) - (let ((buffer-file-name file)) - (set-auto-mode) - (font-lock-fontify-region (point-min) (point-max)) - (goto-char (point-min)) - (forward-line (1- line))))) - -(defun dumb-jump--format-result (proj-root result) - "Return file:line:target formatted RESULT as a string stripped of PROJ-ROOT." - (format "%s:%s: %s" - (dumb-jump--replace proj-root "" (plist-get result :path)) - (plist-get result :line) - (dumb-jump--trim (plist-get result :context)))) - -(defun dumb-jump-ivy-jump-to-selected (results choices _proj) - "Offer CHOICES as candidates through `ivy-read'. -Then execute dumb-jump-result-follow' on the selected choice RESULTS. -Ignore _PROJ." - (if (fboundp 'ivy-read) - (ivy-read "Jump to: " (dumb-jump--zip-pair choices results) - :action (lambda (cand) - (dumb-jump-result-follow (cdr cand))) - :caller 'dumb-jump-ivy-jump-to-selected) - (error "ivy-read is unknown. Is it loaded?"))) - -(defun dumb-jump-prompt-user-for-choice (proj-root results) - "Prompt user to select one of the identified RESULTS in PROJ-ROOT. -Strip the PROJ-ROOT (project root path) from the file name shown in each entry. -Prompt with the mechanism selected by `dumb-jump-selector' user-option if -available otherwise default to `completing-read'." - (let ((choices (mapcar (lambda (it) (dumb-jump--format-result proj-root it)) results))) - (cond - ((eq dumb-jump-selector 'completing-read) - (dumb-jump-to-selected results choices - (dumb-jump--select-choice choices "Jump to: "))) - ;; - ((and (eq dumb-jump-selector 'ivy) - (fboundp 'ivy-read)) - (funcall dumb-jump-ivy-jump-to-selected-function - results choices proj-root)) - ;; - ((and (eq dumb-jump-selector 'helm) - (fboundp 'helm)) - (helm :sources - (with-no-warnings - (helm-make-source "Jump to: " 'helm-source-sync - :action '(("Jump to match" . dumb-jump-result-follow)) - :candidates (dumb-jump--zip-pair choices results) - :persistent-action 'dumb-jump-helm-persist-action)) - :buffer "*helm dumb jump choices*")) - ;; fallback for unsupported selector values - (t (dumb-jump-to-selected results choices - (dumb-jump--select-choice choices "Jump to: ")))))) - -(defun dumb-jump-get-project-root (filepath) - "Return project root holding FILEPATH. -Keep looking at the parent dir of FILEPATH until a denoter file/dir is found. -Fall back to `project.el' when available and no denoter is found. -Return a directory name without the trailing slash." - (let* ((path (expand-file-name filepath)) - (dir (if (file-directory-p path) - (file-name-as-directory path) - (file-name-directory path))) - (project-el-root - (when (and (null dumb-jump-project) - dir - (fboundp 'project-current)) - (let ((default-directory dir)) - (let ((proj (ignore-errors (project-current nil)))) - (when proj - (if (fboundp 'project-root) - (project-root proj) - (with-no-warnings - ;; On Emacs 26.1 use now obsolete `project-roots' - (car (project-roots proj)))))))))) - (directory-file-name - (expand-file-name - (or dumb-jump-project - (locate-dominating-file path #'dumb-jump-get-config) - project-el-root - dumb-jump-default-project))))) - -(defvar dumb-jump--rust-deps-cache (make-hash-table :test 'equal) - "Cache of Rust dependency paths keyed by project root.") - -(defun dumb-jump-get-rust-dependency-paths (proj-root) - "Return list of source directories for Rust dependencies in PROJ-ROOT. -Uses `cargo metadata' to discover dependency crate source paths. -Results are cached per project root." - (let ((cached (gethash proj-root dumb-jump--rust-deps-cache 'dumb-jump--no-cache))) - (if (not (eq cached 'dumb-jump--no-cache)) - cached - (let ((dep-paths - (when (file-exists-p (expand-file-name "Cargo.toml" proj-root)) - (let* ((default-directory proj-root) - (json-output (with-temp-buffer - (let ((exit-code (call-process "cargo" nil t nil - "metadata" "--format-version=1"))) - (when (eq exit-code 0) - (buffer-string))))) - (json-data (ignore-errors (when json-output (json-read-from-string json-output)))) - (packages (when json-data (cdr (assoc 'packages json-data)))) - (paths (when packages - (seq-uniq - (seq-filter - #'file-directory-p - (mapcar (lambda (pkg) - (file-name-directory - (cdr (assoc 'manifest_path pkg)))) - packages)))))) - (seq-remove - (lambda (p) (string= (directory-file-name p) - (directory-file-name proj-root))) - paths))))) - (puthash proj-root dep-paths dumb-jump--rust-deps-cache) - dep-paths)))) - -(defun dumb-jump-get-config (dir) - "If a project denoter is in DIR then return it, otherwise nil. -However, if DIR contains a `.dumbjumpignore' it returns nil to keep -looking for another root." - (if (file-exists-p (expand-file-name ".dumbjumpignore" dir)) - nil - (car (seq-filter - (lambda (it) (file-exists-p (expand-file-name it dir))) - dumb-jump-project-denoters)))) - -(defun dumb-jump-get-language (file) - "Get language from FILE extension. Fallback to using `major-mode' name." - (let* ((language (or (dumb-jump-get-language-from-mode) - (dumb-jump-get-language-by-filename file) - (dumb-jump-get-mode-base-name)))) - ; src edit buffer ? org-edit-src-exit - (if (and (fboundp 'org-src-edit-buffer-p) - (org-src-edit-buffer-p)) - (progn - (setq language "org") - (with-no-warnings - (org-edit-src-exit)) - (if (and (boundp 'org-version) - (version< org-version "9")) - (save-buffer)))) - (if (string= language "org") - (setq language (dumb-jump-get-language-in-org))) - (if (member language (seq-uniq - (mapcar (lambda (it) (plist-get it :language)) - dumb-jump-find-rules))) - language - (format ".%s file" (or (file-name-extension file) ""))))) - -(defun dumb-jump-get-language-in-org () - "Return associated language in org mode src block or \"org\" if outside src. -This assumes point is inside an org mode buffer." - (let ((lang (nth 0 (with-no-warnings (org-babel-get-src-block-info))))) - ;; if lang exists then create a composite language - (if lang - (dumb-jump-make-composite-language - "org" - (if (dumb-jump-get-language-from-aliases lang) - (dumb-jump-get-language-from-aliases lang) - lang) - "org" - "org" - "org") - "org"))) - -(defun dumb-jump-add-language-to-proplist (newlang proplist lang) - "Return nil if NEWLANG is already in PROPLIST or (if not) -return a new proplist. The new proplis is PROPLIS -where a NEWLANG plist(s) is (are) added to PROPLIST. -The plist(s) value of NEWLANG is (are) copied from -those of LANG and LANG is replaced by NEWLANG." - (unless (seq-filter (lambda (it) (string= newlang (plist-get it :language))) - proplist) - (dumb-jump--splice - (lambda (it) (string= lang (plist-get it :language))) - (lambda (it) (list it (plist-put (copy-tree it) :language newlang))) - proplist))) - -(defun dumb-jump-make-composite-language (mode lang extension agtype rgtype) - "Concat one MODE (usually the string org) with a LANG (c or python or etc) -to make a composite language of the form cPLUSorg or pythonPLUSorg or etc. -Modify `dumb-jump-find-rules' and `dumb-jump-language-file-exts' accordingly -\(using EXTENSION AGTYPE RGTYPE)" - (let* ((complang (concat lang "PLUS" mode)) - (alreadyextension (seq-filter (lambda (it) - (and - (string= complang (plist-get it :language)) - (string= extension (plist-get it :ext)) - (string= agtype (plist-get it :agtype)) - (string= rgtype (plist-get it :rgtype)))) - dumb-jump-language-file-exts)) - (newfindrule (dumb-jump-add-language-to-proplist complang dumb-jump-find-rules lang)) - (newfileexts (dumb-jump-add-language-to-proplist complang dumb-jump-language-file-exts lang))) - (when newfindrule - (set-default 'dumb-jump-find-rules newfindrule)) - (unless dumb-jump-search-type-org-only-org - (when newfileexts - (set-default 'dumb-jump-language-file-exts newfileexts))) - (unless alreadyextension - (set-default 'dumb-jump-language-file-exts - (cons `(:language ,complang - :ext ,extension - :agtype ,agtype - :rgtype ,rgtype) - dumb-jump-language-file-exts))) - complang)) - -(defcustom dumb-jump-language-aliases-alist - '(("sh" . "shell") - ("d" . "dlang") - ("cperl" . "perl") - ("octave" . "matlab") - ("emacs-lisp" . "elisp") - ("R" . "r") - ("arduino" . "c++")) - "An alist of language alias to language name. -Aliases are major mode base name sometimes used for some files. -For example: \"cperl\" for the \"perl\" language." - :group 'dumb-jump - :type '(repeat (cons - (string :tag "alias ") - (string :tag "language")))) - -(defun dumb-jump-get-language-from-aliases (lang) - "Return the dumb-jump language name for a possible alias if there is one. -Return nil if LANG is not one of the supported aliases." - (assoc-default lang dumb-jump-language-aliases-alist)) - -(defun dumb-jump-get-mode-base-name () - "Get the base name of the mode." - (dumb-jump--replace "-mode" "" (symbol-name major-mode))) - -(defun dumb-jump-get-language-from-mode () - "Extract the language from the `major-mode' name. -Currently just everything before \"-mode\"." - (dumb-jump-get-language-from-aliases (dumb-jump-get-mode-base-name))) - -(defun dumb-jump-get-language-by-filename (file) - "Get the programming language name from the specified FILE extension." - ;; Search in `dumb-jump-language-file-exts' for an entry that has the :ext - ;; attribute equal to the file extension and return the corresponding - ;; :language value. - (let* ((filename (if (string-suffix-p ".gz" file) - (file-name-sans-extension file) - file)) - (result (seq-filter - (lambda (it) (string-suffix-p (concat "." (plist-get it :ext)) filename)) - dumb-jump-language-file-exts))) - (when (and result (eq (length result) 1)) - (plist-get (car result) :language)))) - -;; -- - -(defun dumb-jump-issue-result (issue) - "Return a result property list with the ISSUE set as :issue property symbol." - `(:results nil - :lang nil - :symbol nil - :ctx-type nil - :file nil - :root nil - :issue ,(intern issue))) - -(defun dumb-jump-get-results (&optional entered-name) - "Perform the dumb-jump search for text at point, region or ENTERED-NAME. - -Runs `dumb-jump-fetch-results' under conditions adjusted to the current -context. - -Perform the search if searcher is installed, buffer is saved, and -there's a symbol under point or an item to search is specified by the -ENTERED-NAME string. - -Return the dumb-jump alist result: -- :results -- :lang : string: language name -- :symbol : string: symbol being searched -- :ctx-type: string: -- :file : string: file name -- :root : string: project root -- :issue : symbol: problem description symbol: nogrep or nosymbol." - ;; Prevent a empty string entered-name from being interpreted as user entry - ;; because `read-from-minibuffer' may return "". - (when (and entered-name (string-blank-p entered-name)) - (setq entered-name nil)) - (cond - ;; When no search tool is available just return an empty result identifying - ;; a nogrep issue. - ((not (or (dumb-jump-ag-installed?) - (dumb-jump-rg-installed?) - (dumb-jump-git-grep-installed?) - (dumb-jump-grep-installed?))) - (dumb-jump-issue-result "nogrep")) - ;; Inside a shell or eshell buffer, - ((derived-mode-p 'shell-mode 'eshell-mode) - (dumb-jump-fetch-shell-results entered-name)) - ;; When inside a normal buffer but no string specified by ENTERED-NAME, - ;; point or region does not identify something to search, - ;; just return an empty result identifying a nosymbol issue. - ((and (not entered-name) - (not (region-active-p)) - (not (thing-at-point 'symbol))) - (dumb-jump-issue-result "nosymbol")) - ;; Otherwise, perform the search for the text identified by string specified - ;; by ENTERED-NAME, point or region. - (t - (dumb-jump-fetch-file-results entered-name)))) - -(defun dumb-jump-fetch-shell-results (&optional entered-name) - "Perform search from shell buffer for text at point, region or ENTERED-NAME. -Return the dumb-jump alist result: -- :results -- :lang : string: language name -- :symbol : string: symbol being searched -- :ctx-type: string: -- :file : string: file name -- :root : string: project root." - (let* ((cur-file (buffer-name)) - (proj-root (dumb-jump-get-project-root default-directory)) - (proj-config (dumb-jump-get-config proj-root)) - (config (when (string-suffix-p ".dumbjump" proj-config) - (dumb-jump-read-config proj-root proj-config))) - (lang (or (plist-get config :language) - (car (dumb-jump-get-lang-by-shell-contents (buffer-name)))))) - (dumb-jump-fetch-results cur-file proj-root lang config entered-name))) - -(defun dumb-jump-fetch-file-results (&optional entered-name) - "Perform a file search for text at point, region or ENTERED-NAME string. -Return the dumb-jump alist result: -- :results -- :lang : string: language name -- :symbol : string: symbol being searched -- :ctx-type: string: -- :file : string: file name -- :root : string: project root." - (let* ((cur-file (or (buffer-file-name) "")) - (proj-root (dumb-jump-get-project-root cur-file)) - (proj-config (dumb-jump-get-config proj-root)) - (config (when (string-suffix-p ".dumbjump" proj-config) - (dumb-jump-read-config proj-root proj-config))) - (lang (or (plist-get config :language) - (dumb-jump-get-language cur-file)))) - (dumb-jump-fetch-results cur-file proj-root lang config entered-name))) - -;; -- -(defun dumb-jump-process-symbol-by-lang (lang look-for) - "Process and potentially transform LANG's LOOK-FOR. -For instance, remove clojure namespace prefix." - (cond - ((and (string= lang "commonlisp") - (dumb-jump--contains-p ":" look-for) - (not (string-prefix-p ":" look-for))) - (nth 1 (dumb-jump--split ":" look-for 'omit-nulls))) - ((and (string= lang "clojure") - (dumb-jump--contains-p "/" look-for)) - (nth 1 (dumb-jump--split "/" look-for))) - ((and (string= lang "fennel") - (dumb-jump--contains-p "." look-for)) - (car (last (dumb-jump--split "\\." look-for)))) - ((and (string= lang "ruby") - (dumb-jump--contains-p "::" look-for)) - (car (last (dumb-jump--split "::" look-for)))) - ((and (or (string= lang "ruby") - (string= lang "crystal")) - (string-prefix-p ":" look-for)) - (dumb-jump--chop-prefix ":" look-for)) - ((and (string= lang "systemverilog") - (string-prefix-p "`" look-for)) - (dumb-jump--chop-prefix "`" look-for)) - (t - look-for))) - -(defun dumb-jump-get-point-line () - "Get line at point." - (thing-at-point 'line t)) - -(defun dumb-jump-get-point-symbol () - "Get symbol at point." - (if (region-active-p) - (buffer-substring-no-properties (region-beginning) (region-end)) - (thing-at-point 'symbol t))) - -(defun dumb-jump--get-symbol-start () - "Get the start of symbol at point." - (- (if (region-active-p) - (region-beginning) - (car (bounds-of-thing-at-point 'symbol))) - (line-beginning-position))) - -(defun dumb-jump-get-lang-by-shell-contents (buffer) - "Return languages in BUFFER by checking if file extension is mentioned." - (let* ((buffer-contents (with-current-buffer buffer - (buffer-string))) - (found (seq-filter (lambda (it) - (dumb-jump--match (concat "\\." (regexp-quote (plist-get it :ext)) "\\b") - buffer-contents)) - dumb-jump-language-file-exts))) - (mapcar (lambda (it) (plist-get it :language)) found))) - -(defun dumb-jump-fetch-results (cur-file proj-root lang config - &optional entered-name) - "Search for symbol in ENTERED-NAME or symbol at point. - -Return a list of results based on current file context and calling the -currently selected searcher tool (grep, ag, rg, ...). - -CUR-FILE is the path of the current buffer. -PROJ-ROOT is that file's root project directory. -LANG is a string programming language with CONFIG a property list -of project configuration. -ENTERED-NAME is an optional string identifying item to search. -The returned property list has the following members: -- :results: -- :lang : string: language name -- :symbol : string: symbol being searched -- :ctx-type: string: -- :file : string: file name -- :root : string: project root." - (let* ((cur-line-num (line-number-at-pos)) - (found-symbol (or entered-name (dumb-jump-get-point-symbol))) - (look-for (dumb-jump-process-symbol-by-lang lang found-symbol)) - (pt-ctx (if entered-name - (get-text-property 0 :dumb-jump-ctx entered-name) - (dumb-jump-get-point-context - (dumb-jump-get-point-line) - look-for - (dumb-jump--get-symbol-start)))) - (ctx-type - (unless (eq dumb-jump--search-mode 'references) - (dumb-jump-get-ctx-type-by-language lang pt-ctx))) - - (gen-funcs (dumb-jump-pick-grep-variant proj-root)) - (parse-fn (plist-get gen-funcs :parse)) ; dumb-jump-parse-TOOL-response - (generate-fn (plist-get gen-funcs :generate)) - (searcher (plist-get gen-funcs :searcher)) - - (regexes (if (eq dumb-jump--search-mode 'references) - ;; Broad symbol search with a left boundary that also - ;; works for Lisp-family identifiers like *foo*. - (list "(^|[^a-zA-Z0-9\\?\\*-])JJJ\\j") - (dumb-jump-get-contextual-regexes lang ctx-type searcher))) - - ;; If selected searcher has no rules for this language, try alternatives. - ;; Only block fallback when dumb-jump-force-searcher is a direct - ;; searcher symbol. When it's a function or directory list that - ;; didn't match this project, the auto-selected searcher should - ;; still be eligible for fallback. - (_alt-searcher - (when (and (null regexes) - (not (eq dumb-jump--search-mode 'references)) - (not (memq dumb-jump-force-searcher - '(ag rg grep gnu-grep git-grep - git-grep-plus-ag)))) - (let ((alt (seq-find - (lambda (s) - (and (not (eq s searcher)) - (if (eq s 'gnu-grep) - (eq (dumb-jump-grep-installed?) 'gnu) - (funcall (plist-get - (dumb-jump-generators-by-searcher s) - :installed))) - (dumb-jump-get-rules-by-language lang s))) - '(ag rg git-grep gnu-grep grep)))) - (when alt - (setq gen-funcs (dumb-jump-generators-by-searcher alt)) - (setq parse-fn (plist-get gen-funcs :parse)) - (setq generate-fn (plist-get gen-funcs :generate)) - (setq searcher (plist-get gen-funcs :searcher)) - (setq regexes (dumb-jump-get-contextual-regexes - lang ctx-type searcher)))))) - - (exclude-paths (when config (plist-get config :exclude))) - (include-paths (when config (plist-get config :include))) - (rust-dep-paths (when (and (string= lang "rust") - dumb-jump-rust-search-dependencies) - (dumb-jump-get-rust-dependency-paths proj-root))) - (extra-paths - (when dumb-jump-extra-search-paths-function - (let* ((hook-lang (if (and (stringp lang) - (string-match "\\`\\(.+\\)PLUS" lang)) - (match-string 1 lang) - lang)) - (paths (funcall dumb-jump-extra-search-paths-function - hook-lang proj-root))) - (when (listp paths) - (mapcan - (lambda (p) - (when (stringp p) - (let ((expanded (expand-file-name p proj-root))) - (if (file-directory-p expanded) - (list expanded) - (when dumb-jump-debug - (dumb-jump-message - "Dumb Jump: extra-search-paths dropping %S (not a directory)" - expanded)) - nil)))) - paths))))) - ;; we will search proj root and all include paths - (search-paths (seq-uniq (append (list proj-root) - include-paths - (or rust-dep-paths '()) - (or extra-paths '())))) - (_search-paths-debug - (when dumb-jump-debug - (dumb-jump-message "Dumb Jump: search-paths = %S" search-paths))) - (raw-results (mapcan - (lambda (it) - (dumb-jump-run-command look-for it - regexes lang - exclude-paths cur-file - cur-line-num parse-fn - generate-fn)) - search-paths)) - - (results - (let ((deduped (delete-dups - (mapcar (lambda (it) (plist-put it :target look-for)) - raw-results)))) - (if (eq dumb-jump--search-mode 'references) - (dumb-jump-filter-definition-results deduped lang look-for searcher) - deduped)))) - - `(:results ,results - :lang ,(if (null lang) "" lang) - :symbol ,look-for - :ctx-type ,(if (null ctx-type) "" ctx-type) - :file ,cur-file - :root ,proj-root))) - -;;;###autoload -(defun dumb-jump-back () - "Jump back to where the last jump was done." - ;; Note: made obsolete by Emacs `xref-pop-marker-stack'. - (interactive) - (with-demoted-errors "Error running `dumb-jump-before-jump-hook': %S" - (run-hooks 'dumb-jump-before-jump-hook)) - (pop-tag-mark) - (with-demoted-errors "Error running `dumb-jump-after-jump-hook': %S" - (run-hooks 'dumb-jump-after-jump-hook))) - -;;;###autoload -(defun dumb-jump-quick-look () - "Run `dumb-jump-go' in quick look mode. -That is, show a tooltip of where it would jump instead." - ;; Note: independent of the Emacs xref interface. - (interactive) - (with-no-warnings - (dumb-jump-go t))) - -;;;###autoload -(defun dumb-jump-go-other-window () - "Like dumb-jump-go' but use `find-file-other-window' instead of `find-file'." - ;; Note: independent of the Emacs xref interface. - (interactive) - (let ((dumb-jump-window 'other)) - (with-no-warnings - (dumb-jump-go)))) - -;;;###autoload -(defun dumb-jump-go-current-window () - "Like `dumb-jump-go' but always use `find-file'." - ;; Note: independent of the Emacs xref interface. - (interactive) - (let ((dumb-jump-window 'current)) - (with-no-warnings - (dumb-jump-go)))) - -;;;###autoload -(defun dumb-jump-go-prefer-external () - "Like `dumb-jump-go' but prefer external matches from the current file." - ;; Note: independent of the Emacs xref interface. - (interactive) - (with-no-warnings - (dumb-jump-go nil t))) - -;;;###autoload -(defun dumb-jump-find-references () - "Find references/usages of the symbol at point. -This is the inverse of `dumb-jump-go' -- it finds where a symbol -is used rather than where it is defined." - ;; Note: independent of the Emacs xref interface. - (interactive) - (let ((dumb-jump--search-mode 'references) - (dumb-jump-aggressive nil)) - (with-no-warnings - (dumb-jump-go)))) - -;;;###autoload -(defun dumb-jump-go-prompt () - "Like `dumb-jump-go' but prompt for function instead of using under point." - ;; Note: independent of the Emacs xref interface. - (interactive) - (with-no-warnings - (dumb-jump-go nil nil (read-from-minibuffer "Jump to: ")))) - -;;;###autoload -(defun dumb-jump-go-prefer-external-other-window () - "Like `dumb-jump-go-prefer-external' but create another window. -It uses `find-file-other-window' instead of `find-file'." - ;; Note: independent of the Emacs xref interface. - (interactive) - (let ((dumb-jump-window 'other)) - (with-no-warnings - (dumb-jump-go-prefer-external)))) - -;;;###autoload -(defun dumb-jump-go (&optional use-tooltip prefer-external entered-name) - "Go to the function/variable declaration for thing at point. -When USE-TOOLTIP is t a tooltip jump preview will show instead. -When PREFER-EXTERNAL is t it will sort external matches before -current file. -The optional ENTERED-NAME string is the name of the item to jump to -manually selected by user as response to a prompt." - ;; Note: independent of the Emacs xref interface. - (interactive "P") - (let* ((start-time (float-time)) - (info (dumb-jump-get-results entered-name)) - (end-time (float-time)) - (fetch-time (- end-time start-time)) - (results (plist-get info :results)) - (look-for (or entered-name (plist-get info :symbol))) - (proj-root (plist-get info :root)) - (issue (plist-get info :issue)) - (lang (plist-get info :lang)) - (result-count (length results))) - (when (> fetch-time dumb-jump-max-find-time) - (dumb-jump-message - "Took over %ss to find '%s'. \ -Please install ag or rg, or add a .dumbjump file to '%s' with path exclusions" - (number-to-string dumb-jump-max-find-time) look-for proj-root)) - (cond - ((eq issue 'nogrep) - (dumb-jump-message "Please install ag, rg, git grep or grep!")) - ((eq issue 'nosymbol) - (dumb-jump-message "No symbol under point.")) - ((string-suffix-p " file" lang) - (dumb-jump-message "Could not find rules for '%s'." lang)) - ((= result-count 1) - (dumb-jump-result-follow (car results) use-tooltip proj-root)) - ((> result-count 1) - ;; multiple results so let the user pick from a list - ;; unless the match is in the current file - (dumb-jump-handle-results results - (plist-get info :file) - proj-root - (plist-get info :ctx-type) - look-for use-tooltip prefer-external lang)) - ((= result-count 0) - (dumb-jump-message "'%s' %s %s %s not found." - look-for - (if (string-blank-p (or lang "")) - "with unknown language so" - lang) - (plist-get info :ctx-type) - (if (eq dumb-jump--search-mode 'references) - "references" - "declaration")))))) - -(defcustom dumb-jump-language-comments - '((:comment "//" :language "c++") - (:comment "/*" :language "c++") - (:comment ";" :language "elisp") - (:comment ";" :language "commonlisp") - (:comment "//" :language "javascript") - (:comment "//" :language "typescript") - (:comment "//" :language "dart") - (:comment "//" :language "dlang") - (:comment "/*" :language "dlang") - (:comment "/+" :language "dlang") - (:comment "--" :language "haskell") - (:comment "--" :language "lua") - (:comment "//" :language "rust") - (:comment "#" :language "julia") - (:comment "//" :language "objc") - (:comment "//" :language "csharp") - (:comment "//" :language "java") - (:comment ";" :language "clojure") - (:comment "#" :language "coffeescript") - (:comment "//" :language "faust") - (:comment ";" :language "fennel") - (:comment "!" :language "fortran") - (:comment "//" :language "go") - (:comment "//" :language "zig") - (:comment "#" :language "perl") - (:comment "#" :language "tcl") - (:comment "//" :language "php") - (:comment "#" :language "php") - (:comment "--" :language "purescript") - (:comment "#" :language "python") - (:comment "%" :language "matlab") - (:comment "#" :language "r") - (:comment ";" :language "racket") - (:comment "#" :language "ruby") - (:comment "#" :language "crystal") - (:comment "#" :language "nim") - (:comment "#" :language "nix") - (:comment "//" :language "scala") - (:comment ";" :language "scheme") - (:comment "#" :language "janet") - (:comment "#" :language "shell") - (:comment "//" :language "solidity") - (:comment "//" :language "swift") - (:comment "#" :language "elixir") - (:comment "%" :language "erlang") - (:comment "%" :language "tex") - (:comment "//" :language "systemverilog") - (:comment "--" :language "vhdl") - (:comment "//" :language "scss") - (:comment "//" :language "pascal") - (:comment "//" :language "protobuf") - (:comment "#" :language "hcl") - (:comment "//" :language "apex") - (:comment "//" :language "odin") - (:comment "/*" :language "odin") - (:comment "*>" :language "cobol")) - "List of one-line comments organized by language. -A language may have more than 1 comment string." - :group 'dumb-jump - :type - '(repeat - (plist - :options ((:comment string) - (:language string))))) - -(defun dumb-jump-get-comment-by-language (lang) - "Return a list of the one-line comment or comments for the given LANG." - (let* ((entries (seq-uniq - (seq-filter (lambda (it) (string= (plist-get it :language) lang)) - dumb-jump-language-comments)))) - (if (> (length entries) 0) - (mapcar (lambda (pl) (plist-get pl :comment)) entries) - nil))) - -(defun dumb-jump--context-startswith-comment (context-string comments) - "Return t when CONTEXT-STRING starts with any COMMENTS string." - (let ((startswith-comment nil) - ;; trim leading white-space from context-string - (context-str (replace-regexp-in-string "^\\s-+" "" context-string))) - (catch 'found-one - (dolist (comment comments) - (when (string-prefix-p comment context-str) - (setq startswith-comment t) - (throw 'found-one nil)))) - startswith-comment)) - -(defun dumb-jump-filter-no-start-comments (results lang) - "Filter out RESULTS with a :context starting with a LANG comment in file." - (let ((comments (dumb-jump-get-comment-by-language lang))) - (if comments - (seq-filter (lambda (it) - (not (dumb-jump--context-startswith-comment - (plist-get it :context) - comments))) - results) - results))) - -(defun dumb-jump-handle-results (results cur-file proj-root - ctx-type look-for - use-tooltip prefer-external - &optional language) - "Handle the searchers results. -RESULTS is a list of property lists with the searcher's results. -CUR-FILE is the current file within PROJ-ROOT. -CTX-TYPE is a string of the current context. -LOOK-FOR is the symbol we're jumping for. -USE-TOOLTIP shows a preview instead of jumping. -PREFER-EXTERNAL will sort current file last. -LANGUAGE is an optional language to pass to `dumb-jump-process-results'." - (let* ((processed (dumb-jump-process-results results cur-file proj-root - ctx-type look-for use-tooltip - prefer-external language)) - (results (plist-get processed :results)) - (do-var-jump (plist-get processed :do-var-jump)) - (var-to-jump (plist-get processed :var-to-jump)) - (match-cur-file-front (plist-get processed :match-cur-file-front))) - (dumb-jump-debug-message - look-for - ctx-type - var-to-jump - (pp-to-string match-cur-file-front) - (pp-to-string results) - prefer-external - proj-root - cur-file) - (cond - (use-tooltip ;; quick-look mode - (let* ((choices (mapcar (lambda (it) (dumb-jump--format-result proj-root it)) results)) - (selected-choice (dumb-jump--select-choice choices "Matches: ")) - (selected-result (cdr (assoc selected-choice - (dumb-jump--zip-pair choices results))))) - (when selected-result - (dumb-jump--show-preview - (dumb-jump--format-result proj-root selected-result))))) - (do-var-jump - (dumb-jump-result-follow var-to-jump use-tooltip proj-root)) - (t - (dumb-jump-prompt-user-for-choice proj-root match-cur-file-front))))) - -(defun dumb-jump--candidate-x (plist-get it :diff) 0) - (or (string= (plist-get it :path) cur-file) - (string= (plist-get it :path) rel-cur-file)))) - match-no-comments) - (seq-filter (lambda (it) - (and (<= (plist-get it :diff) 0) - (or (string= (plist-get it :path) cur-file) - (string= (plist-get it :path) rel-cur-file)))) - match-no-comments) - (seq-sort #'dumb-jump--candidate-x (length line-num-raw) 1) - (nth 1 line-num-raw)))) - - (cond - ;; fixes rare bug where context is blank but file is defined "/somepath/file.txt:14:" - ;; OR: (and (= (length parts) 1) (file-name-exists (nth 0 parts))) - ((dumb-jump--match ":[0-9]+:$" resp-line) - nil) - ((and parts line-num) - (if (= (length parts) 2) - (list (let ((path (expand-file-name (nth 0 parts)))) - (if (file-name-absolute-p (nth 0 parts)) - path - (file-relative-name path))) - line-num (nth 1 parts)) - ; this case is when they are searching a particular file... - (list (let ((path (expand-file-name cur-file))) - (if (file-name-absolute-p cur-file) - path - (file-relative-name path))) - line-num (nth 0 parts))))))) - -;; -- -;; Parse Search Tool Results: indirectly called by `dumb-jump-run-command' -;; ----------------------------------------------------------------------- -;; - `dumb-jump-parse-grep-response' -;; - `dumb-jump-parse-ag-response' -;; - `dumb-jump-parse-rg-response' -;; - `dumb-jump-parse-git-grep-response' -;; - `dumb-jump-parse-response-lines' - -(defun dumb-jump-parse-response-lines (parsed cur-file cur-line-num) - "Turn PARSED response lines into a list of property lists. -Using CUR-FILE and CUR-LINE-NUM to exclude jump origin." - (let* ((records (mapcan - (lambda (it) - (when it - (let* ((line-num (string-to-number (nth 1 it))) - (diff (- cur-line-num line-num))) - (list `(:path ,(nth 0 it) - :line ,line-num - :context ,(nth 2 it) - :diff ,diff))))) - parsed)) - (results (delq nil records))) - (seq-filter - (lambda (it) - (not (and - (string= (plist-get it :path) cur-file) - (= (plist-get it :line) cur-line-num)))) - results))) - -(defun dumb-jump-parse-grep-response (resp cur-file cur-line-num) - "Parse raw grep search response RESP into a list of plists. -- CUR-FILE: current file. -- CUR-LINE-NUM: current line number." - (let* ((resp-no-warnings - (seq-filter (lambda (it) - (and (not (string-prefix-p "grep:" it)) - (not (dumb-jump--contains-p "No such file or" it)))) - (dumb-jump--split "\n" (dumb-jump--trim resp)))) - (parsed (mapcar (lambda (it) (dumb-jump-parse-response-line it cur-file)) - resp-no-warnings))) - (dumb-jump-parse-response-lines parsed cur-file cur-line-num))) - -(defun dumb-jump--clean-wsl-response (resp) - "Clean up RESP for Windows WSL/UNC path issues. -Filters CMD.exe UNC path warnings and fixes /wsl$/ to //wsl$/." - (let* ((cleaned (replace-regexp-in-string - "CMD\\.EXE was started with the above path as the current directory\\.\nUNC paths are not supported\\..*?\n" - "" resp)) - (fixed (replace-regexp-in-string "^/wsl\\$/" "//wsl$/" cleaned))) - (replace-regexp-in-string "\n/wsl\\$/" "\n//wsl$/" fixed))) - -(defun dumb-jump-parse-ag-response (resp cur-file cur-line-num) - "Parse raw ag search response RESP into a list of plists. -- CUR-FILE: current file. -- CUR-LINE-NUM: current line number." - (let* ((cleaned (dumb-jump--clean-wsl-response resp)) - (resp-lines (dumb-jump--split "\n" (dumb-jump--trim cleaned))) - (parsed (mapcar (lambda (it) (dumb-jump-parse-response-line it cur-file)) - resp-lines))) - (dumb-jump-parse-response-lines parsed cur-file cur-line-num))) - -(defun dumb-jump-parse-rg-response (resp cur-file cur-line-num) - "Parse raw rg search response RESP into a list of plists. -- CUR-FILE: current file. -- CUR-LINE-NUM: current line number." - (let* ((resp-lines (dumb-jump--split "\n" (dumb-jump--trim resp))) - (parsed (mapcar (lambda (it) (dumb-jump-parse-response-line it cur-file)) - resp-lines))) - (dumb-jump-parse-response-lines parsed cur-file cur-line-num))) - -(defun dumb-jump-parse-git-grep-response (resp cur-file cur-line-num) - "Parse raw git grep response RESP into a list of plists. -- CUR-FILE: current file. -- CUR-LINE-NUM: current line number." - (let* ((resp-lines (dumb-jump--split "\n" (dumb-jump--trim resp))) - (parsed (mapcar (lambda (it) (dumb-jump-parse-response-line it cur-file)) - resp-lines))) - (dumb-jump-parse-response-lines parsed cur-file cur-line-num))) - -;; -- - -(defun dumb-jump-re-match (re s) - "Does regular expression RE match string S. If RE is nil return nil." - (when (and re s) - (dumb-jump--match re s))) - -(defun dumb-jump-get-ctx-type-by-language (lang pt-ctx) - "Detect the type of context by the language LANG and its context PT-CTX. -PT-CTX is assumed to be a property list with the :left and :right attributes -that are both strings." - (let* ((contexts (seq-filter (lambda (it) - (string= (plist-get it ':language) lang)) - dumb-jump-language-contexts)) - (usable-ctxs - (when (> (length contexts) 0) - (seq-filter (lambda (it) - (and (or (null (plist-get it :left)) - (dumb-jump-re-match (plist-get it :left) - (plist-get pt-ctx :left))) - (or (null (plist-get it :right)) - (dumb-jump-re-match (plist-get it :right) - (plist-get pt-ctx :right))))) - contexts))) - (use-ctx (= (length (seq-filter - (lambda (it) - (string= (plist-get it ':type) - (and usable-ctxs (plist-get (car usable-ctxs) :type)))) - usable-ctxs)) - (length usable-ctxs)))) - - (when (and usable-ctxs use-ctx) - (plist-get (car usable-ctxs) :type)))) - -(defun dumb-jump-get-ext-includes (language) - "Return the --include grep argument of file extensions for LANGUAGE." - (let ((exts (dumb-jump-get-file-exts-by-language language))) - (dumb-jump-arg-joiner - "--include" - (mapcar (lambda (it) (format "\\*.%s" it)) exts)))) - -(defun dumb-jump-arg-joiner (prefix values) - "Helper to generate command arg with its PREFIX for each value in VALUES." - (let* ((normalized-values (mapcar (lambda (it) (dumb-jump--trim (or it ""))) values)) - (non-empty-values (seq-filter (lambda (it) (> (length it) 0)) normalized-values)) - (args (dumb-jump--join (format " %s " prefix) non-empty-values))) - (if non-empty-values - (format " %s %s " prefix args) - ""))) - -(defun dumb-jump-get-contextual-regexes (lang ctx-type searcher) - "Get list of search regular expressions by LANG and CTX-TYPE. -The arguments are: -- LANG: string: the language. -- CTX-TYPE: variable, function, etc. -- SEARCHER: symbol: the name of the search tool. - One of: git-grep, ag, git-grep-plus-ag, rg, gnu-grep, grep." - (let* ((raw-rules (dumb-jump-get-rules-by-language lang searcher)) - (ctx-type (unless dumb-jump-ignore-context ctx-type)) - (ctx-rules - (if ctx-type - (seq-filter (lambda (it) (string= (plist-get it :type) ctx-type)) raw-rules) - raw-rules)) - (rules (or ctx-rules raw-rules)) - (regexes (mapcar (lambda (it) (plist-get it :regex)) rules))) - regexes)) - -(defun dumb-jump-populate-regex (it look-for variant) - "Populate IT regex template with LOOK-FOR for the specific search VARIANT. -Replace the dumb-jump generic regular expression meta concepts with the -one required for the search variant tool. -The arguments are: -- IT : string: the dumb-jump generic regular expression. -- LOOK-FOR: string: the searched item. -- VARIANT : symbol: the search tool variant, - one of: ag, rg, grep, gnu-grep, git-grep-plus-ag, git-grep." - (let ((boundary - (cond ((eq variant 'rg) dumb-jump-rg-word-boundary) - ((eq variant 'ag) dumb-jump-ag-word-boundary) - ((eq variant 'git-grep-plus-ag) dumb-jump-ag-word-boundary) - ((eq variant 'git-grep) dumb-jump-git-grep-word-boundary) - (t dumb-jump-grep-word-boundary)))) - (let ((text it)) - (setq text (dumb-jump--replace "\\j" boundary text)) - (when (dumb-jump-use-space-bracket-exp-for variant) - (setq text (dumb-jump--replace "\\s" "[[:space:]]" text))) - (setq text (dumb-jump--replace "JJJ" (regexp-quote look-for) text)) - text))) - -(defun dumb-jump-populate-regexes (look-for regexes variant) - "Return list of VARIANT specific regexes from the dumb-jump generic REGEXES. -Update the generic regexes, populate the target identified in LOOK-FOR. -The arguments are: -- LOOK-FOR: string: the searched item. -- REGEXES: list of strings: each string is a dumb-jump generic regular - expression. -- VARIANT: symbol: the search tool variant, - one of: ag, rg, git-grep-plus-ag, git-grep." - (mapcar - (lambda (it) - (dumb-jump-populate-regex it look-for variant)) - regexes)) - -(defun dumb-jump-pcre-to-emacs (regex) - "Convert a PCRE-style REGEX string to Emacs regex syntax. -In PCRE and Emacs, +, ?, *, ., ^, $, [ are special without escaping. -But (, ), |, {, } differ: special unescaped in PCRE, special escaped in Emacs. -This function swaps the literal/special meaning of (, ), |, {, and }." - (let ((i 0) - (len (length regex)) - (out (list))) - (while (< i len) - (let ((ch (aref regex i))) - (cond - ;; Backslash sequence - ((and (= ch ?\\) (< (1+ i) len)) - (let ((next (aref regex (1+ i)))) - (cond - ((memq next '(?\( ?\) ?| ?{ ?})) - ;; \X (literal in PCRE) → X (literal in Emacs) - (push (char-to-string next) out) - (setq i (+ i 2))) - (t - ;; Other backslash sequences (\b, \w, \+, \?, etc.) pass through - (push (substring regex i (+ i 2)) out) - (setq i (+ i 2)))))) - ;; (? prefixed groups: (?:, (?!, (?=, (?<=, (? (length it) 0)) normalized-parts))) - (dumb-jump--join " " non-empty-parts))) - -(defun dumb-jump-get-file-exts-by-language (language) - "Return list of file extensions for a LANGUAGE." - (mapcar (lambda (it) (plist-get it :ext)) - (seq-filter (lambda (it) (string= (plist-get it :language) language)) - dumb-jump-language-file-exts))) - -(defun dumb-jump-get-ag-type-by-language (language) - "Return list of ag type argument for a LANGUAGE." - (seq-uniq (mapcar (lambda (it) (plist-get it :agtype)) - (seq-filter (lambda (it) - (and - (plist-get it :agtype) - (string= (plist-get it :language) language))) - dumb-jump-language-file-exts)))) - -(defun dumb-jump-get-rg-type-by-language (language) - "Return list of rg type argument for a LANGUAGE." - (seq-uniq (mapcar (lambda (it) (plist-get it :rgtype)) - (seq-filter (lambda (it) - (and - (plist-get it :rgtype) - (string= (plist-get it :language) language))) - dumb-jump-language-file-exts)))) - -(defun dumb-jump-get-rg-nontype-exts-by-language (language) - "Return list of file extensions for a LANGUAGE that have no rgtype. -These extensions need to be explicitly added as glob patterns since -they are not covered by ripgrep's built-in type definitions." - (seq-uniq (mapcar (lambda (it) (plist-get it :ext)) - (seq-filter (lambda (it) - (and - (plist-get it :ext) - (null (plist-get it :rgtype)) - (string= (plist-get it :language) language))) - dumb-jump-language-file-exts)))) - -(defun dumb-jump-get-git-grep-type-by-language (language) - "Return list of git grep type argument for a LANGUAGE." - (seq-uniq (mapcar (lambda (it) (plist-get it :ext)) - (seq-filter (lambda (it) - (and - (plist-get it :ext) - (string= (plist-get it :language) language))) - dumb-jump-language-file-exts)))) - -(defun dumb-jump-get-rules-by-language (language searcher) - "Return a list of rules for the LANGUAGE by SEARCHER." - (let* ((searcher-str (cond ((eq 'git-grep searcher) "git-grep") - ((eq 'rg searcher) "rg") - ((eq 'ag searcher) "ag") - ((eq 'git-grep-plus-ag searcher) "ag") - (t "grep"))) - (results (seq-filter (lambda (it) - (and - (string= (plist-get it ':language) language) - (member searcher-str (plist-get it ':supports)))) - dumb-jump-find-rules))) - (if dumb-jump-functions-only - (seq-filter (lambda (it) (string= (plist-get it ':type) "function")) results) - results))) - -;;;###autoload -(define-minor-mode dumb-jump-local-mode - "Buffer-local minor mode for jumping to variable and function definitions. -Use this to selectively enable dumb-jump in specific major modes, e.g.: - (add-hook \\='python-mode-hook #\\='dumb-jump-local-mode) -For enabling globally, use `dumb-jump-mode' instead." - :global nil - :keymap dumb-jump-mode-map) - -;;;###autoload -(define-minor-mode dumb-jump-mode - "Minor mode for jumping to variable and function definitions." - ;; Note: independent of the Emacs xref interface. - :global t - :keymap dumb-jump-mode-map) - - -;; ----------------------------------------------------------------------------- -;;; Xref Backend - -(unless dumb-jump-disable-obsolete-warnings - (dolist (obsolete - '(dumb-jump-mode - dumb-jump-go - dumb-jump-go-prefer-external-other-window - dumb-jump-go-prompt - dumb-jump-quick-look - dumb-jump-go-other-window - dumb-jump-go-current-window - dumb-jump-go-prefer-external)) - (make-obsolete - obsolete - (format "`%s' has been obsoleted by the xref interface." - obsolete) - "2020-06-26")) - (make-obsolete 'dumb-jump-back - "`dumb-jump-back' has been obsoleted by `xref-pop-marker-stack'." - "2020-06-26")) - -(cl-defmethod xref-backend-identifier-at-point ((_backend (eql dumb-jump))) - (let ((bounds (bounds-of-thing-at-point 'symbol))) - (and bounds (let* ((ident (dumb-jump-get-point-symbol)) - (start (car bounds)) - (col (- start (line-beginning-position))) - (line (dumb-jump-get-point-line)) - (ctx (dumb-jump-get-point-context line ident col))) - (propertize ident :dumb-jump-ctx ctx))))) - -(cl-defmethod xref-backend-definitions ((_backend (eql dumb-jump)) - entered-name) - (let* ((info (dumb-jump-get-results entered-name)) - (results (plist-get info :results)) - (look-for (or entered-name (plist-get info :symbol))) - (proj-root (plist-get info :root)) - (issue (plist-get info :issue)) - (lang (plist-get info :lang)) - (processed (dumb-jump-process-results - results - (plist-get info :file) - proj-root - (plist-get info :ctx-type) - look-for - nil - nil - lang)) - (results (plist-get processed :results)) - (do-var-jump (plist-get processed :do-var-jump)) - (var-to-jump (plist-get processed :var-to-jump)) - (match-cur-file-front (plist-get processed :match-cur-file-front))) - - (dumb-jump-debug-message - look-for - (plist-get info :ctx-type) - var-to-jump - (pp-to-string match-cur-file-front) - (pp-to-string results) - match-cur-file-front - proj-root - (plist-get info :file)) - (cond ((eq issue 'nogrep) - (dumb-jump-message "Please install ag, rg, git grep or grep!")) - ((eq issue 'nosymbol) - (dumb-jump-message "No symbol under point.")) - ((string-suffix-p " file" lang) - (dumb-jump-message "Could not find rules for '%s'." lang)) - ((= (length results) 0) - (dumb-jump-message "'%s' %s %s declaration not found." - look-for - (if (string-blank-p (or lang "")) - "with unknown language so" - lang) - (plist-get info :ctx-type))) - (t (mapcar (lambda (res) - (with-no-warnings - (xref-make - (plist-get res :context) - (xref-make-file-location - (let* ((path (plist-get res :path)) - (remote-prefix (file-remote-p default-directory))) - (if remote-prefix - (if (file-name-absolute-p path) - (concat remote-prefix path) - (concat default-directory path)) - (expand-file-name path))) - (plist-get res :line) - 0)))) - (if do-var-jump - (list var-to-jump) - match-cur-file-front)))))) - -(cl-defmethod xref-backend-references ((_backend (eql dumb-jump)) - entered-name) - (let* ((dumb-jump--search-mode 'references) - (info (dumb-jump-get-results entered-name)) - (results (plist-get info :results)) - (look-for (or entered-name (plist-get info :symbol))) - (proj-root (plist-get info :root)) - (issue (plist-get info :issue)) - (lang (plist-get info :lang)) - (processed (dumb-jump-process-results - results - (plist-get info :file) - proj-root - (plist-get info :ctx-type) - look-for - nil - nil - lang)) - (results (plist-get processed :results)) - (match-cur-file-front (plist-get processed :match-cur-file-front))) - - (cond ((eq issue 'nogrep) - (dumb-jump-message "Please install ag, rg, git grep or grep!")) - ((eq issue 'nosymbol) - (dumb-jump-message "No symbol under point.")) - ((string-suffix-p " file" lang) - (dumb-jump-message "Could not find rules for '%s'." lang)) - ((= (length results) 0) - (dumb-jump-message "'%s' %s references not found." - look-for - (if (string-blank-p (or lang "")) - "with unknown language so" - lang))) - (t (mapcar (lambda (res) - (with-no-warnings - (xref-make - (plist-get res :context) - (xref-make-file-location - (let* ((path (plist-get res :path)) - (remote-prefix (file-remote-p default-directory))) - (if remote-prefix - (if (file-name-absolute-p path) - (concat remote-prefix path) - (concat default-directory path)) - (expand-file-name path))) - (plist-get res :line) - 0)))) - match-cur-file-front))))) - -(cl-defmethod xref-backend-apropos ((_backend (eql dumb-jump)) pattern) - (xref-backend-definitions 'dumb-jump pattern)) - -(cl-defmethod xref-backend-identifier-completion-table - ((_backend (eql dumb-jump))) - nil) - -;;;###autoload -(defun dumb-jump-xref-activate () - "Function to activate xref backend. -Add this function to `xref-backend-functions' to dumb jump to be -activated, whenever it finds a project. It is recommended to add -it to the end, so that it only gets activated when no better -option is found." - (and (dumb-jump-get-project-root default-directory) - 'dumb-jump)) - -(provide 'dumb-jump) -;;; dumb-jump.el ends here diff --git a/.config/emacs/lisp/evil-collection/.github/PULL_REQUEST_TEMPLATE.md b/.config/emacs/lisp/evil-collection/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 748fcae..0000000 --- a/.config/emacs/lisp/evil-collection/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,21 +0,0 @@ -### Brief summary of what the package does - -[Please write a quick summary of the package.] - -### Direct link to the package repository - -https://github.com/your/awesome_package - -### Checklist - - - -Assume you're working on `mpc` mode: - -- [ ] byte-compiles cleanly -- [ ] `M-x checkdoc` is happy. Don't manually write `(provide 'evil-collection-mpc)`, `M-x checkdoc` can do it automatically for you -- [ ] define `evil-collection-mpc-setup` with `defun` -- [ ] define `evil-collection-mpc-mode-maps` with `defconst` -- [ ] All functions should start with `evil-collection-mpc-` - - diff --git a/.config/emacs/lisp/evil-collection/.github/workflows/build.yaml b/.config/emacs/lisp/evil-collection/.github/workflows/build.yaml deleted file mode 100644 index 37d6e78..0000000 --- a/.config/emacs/lisp/evil-collection/.github/workflows/build.yaml +++ /dev/null @@ -1,51 +0,0 @@ -name: evil-collection builds - -on: - workflow_dispatch: - pull_request: - push: - branches: - - master - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - check: - runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.experimental }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - emacs-version: - - 28.2 - - 29.4 - - 30.1 - experimental: [false] - include: - - os: ubuntu-latest - emacs-version: snapshot - experimental: true - - os: macos-latest - emacs-version: snapshot - experimental: true - steps: - - uses: jcs090218/setup-emacs@master - with: - version: ${{ matrix.emacs-version }} - - - uses: actions/checkout@v4 - - - name: Print emacs version - run: emacs --version - - - uses: emacs-eask/setup-eask@master - with: - version: snapshot - - - run: make install - - run: make compile - - run: make lint - - run: make test diff --git a/.config/emacs/lisp/evil-collection/.gitignore b/.config/emacs/lisp/evil-collection/.gitignore deleted file mode 100644 index 5824339..0000000 --- a/.config/emacs/lisp/evil-collection/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/.cask -/.eask -/dist -*.elc diff --git a/.config/emacs/lisp/evil-collection/Cask b/.config/emacs/lisp/evil-collection/Cask deleted file mode 100644 index c9db627..0000000 --- a/.config/emacs/lisp/evil-collection/Cask +++ /dev/null @@ -1,12 +0,0 @@ -(source gnu) -(source melpa) - -(package-file "evil-collection.el") - -(development - (depends-on "evil") - (depends-on "f") - (depends-on "ert-runner") - (depends-on "package-lint") - (depends-on "annalist") - (depends-on "magit")) diff --git a/.config/emacs/lisp/evil-collection/Eask b/.config/emacs/lisp/evil-collection/Eask deleted file mode 100644 index 8f4de82..0000000 --- a/.config/emacs/lisp/evil-collection/Eask +++ /dev/null @@ -1,47 +0,0 @@ -;; -*- mode: eask; lexical-binding: t -*- - -(package "evil-collection" - "0.0.2" - "A set of keybindings for Evil mode") - -(website-url "https://github.com/emacs-evil/evil-collection") -(keywords "evil" "tools") - -(package-file "evil-collection.el") -(files "modes/*/*.el" '(:exclude "modes/magit/*.el" "modes/magit-repos/*.el")) - -(script "test" "echo \"Error: no test specified\" && exit 1") - -(source 'gnu) -(source 'melpa) - -(depends-on "emacs" "27.2") -(depends-on "evil") - -(development - (depends-on "f") - (depends-on "ert-runner") - (depends-on "package-lint") - (depends-on "annalist") - (depends-on "magit")) - -(setq network-security-level 'low) ; see https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-932956432 - -;; Workaround for https://github.com/magit/magit/issues/5489 -(setq magit-credential-cache-daemon-socket nil) - -(add-hook 'eask-before-compile-hook - (lambda (&rest _) - (setq evil-want-integration nil) - (setq evil-want-keybinding nil) - (setq byte-compile-docstring-max-column 200) - (setq byte-compile-error-on-warn t))) - -(add-hook 'eask-before-lint/package-hook - (lambda (&rest _) - (advice-add 'package-lint--error-at-bol :around 'ignore) ; ignore headers - (advice-add 'package-lint--check-eval-after-load :around 'ignore) - (advice-add 'package-lint--check-version-regexp-list :around 'ignore) - (advice-add 'package-lint--check-symbol-separators :around 'ignore) - (advice-add 'package-lint--check-defs-prefix :around 'ignore) - (advice-add 'package-lint--check-provide-form :around 'ignore))) diff --git a/.config/emacs/lisp/evil-collection/LICENSE b/.config/emacs/lisp/evil-collection/LICENSE deleted file mode 100644 index f288702..0000000 --- a/.config/emacs/lisp/evil-collection/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/.config/emacs/lisp/evil-collection/Makefile b/.config/emacs/lisp/evil-collection/Makefile deleted file mode 100755 index 46a80d6..0000000 --- a/.config/emacs/lisp/evil-collection/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -EASK ?= eask - -compile: - $(EASK) compile - -install: - $(EASK) install-deps --dev - -lint: - $(EASK) lint package - -test: install - $(EASK) test ert ./test/evil-collection-test.el - -magit-test: install - $(EASK) test ert ./test/evil-collection-magit-tests.el - -.PHONY: compile lint test - -# Local Variables: -# tab-width: 8 -# End: diff --git a/.config/emacs/lisp/evil-collection/README.org b/.config/emacs/lisp/evil-collection/README.org deleted file mode 100644 index a2b5aca..0000000 --- a/.config/emacs/lisp/evil-collection/README.org +++ /dev/null @@ -1,821 +0,0 @@ -#+TITLE: Evil Collection -#+STARTUP: noindent - -[[https://github.com/emacs-evil/evil-collection/actions][file:https://github.com/emacs-evil/evil-collection/actions/workflows/build.yaml/badge.svg?branch=master]] -[[https://melpa.org/#/evil-collection][file:https://melpa.org/packages/evil-collection-badge.svg]] -[[https://stable.melpa.org/#/evil-collection][file:https://stable.melpa.org/packages/evil-collection-badge.svg]] - -This is a collection of [[https://github.com/emacs-evil/evil][Evil]] bindings for /the parts of Emacs/ that Evil does -not cover properly by default, such as ~help-mode~, ~M-x calendar~, Eshell and -more. - -*Warning:* Expect some default bindings to change in the future. - -** Preliminaries - -1. ~evil-overriding-maps~ is assumed as ~nil~ to reduce redundant ~w/W/l/f/t~ - etc evil bindings. See [[https://github.com/emacs-evil/evil-collection/pull/501][Fixup Info-mode]] for example. - -** Goals - -1. Reduce context switching: As soon as "moving around" gets hardwired - to ~~, it becomes frustratingly inefficient not to have it everywhere. - -2. Community work: setting up bindings is tremendous work and joining force can - only save hours for all of Evil users out there. While not everyone may agree - on the chosen bindings, it helps to have something to start with rather than - nothing at all. In the end, users are free to override a subset of the proposed - bindings to best fit their needs. - -3. Consistency: Having all bindings defined in one place allows for enforcing - consistency across special modes and coordinating the community work to define a - reference implementation. - -** Installation - -- Get the package, either from MELPA: - - : M-x package-install RET evil-collection RET - - Or clone / download this repository and modify your ~load-path~: - - : (add-to-list 'load-path (expand-file-name "/path/to/evil-collection/" user-emacs-directory)) - -- Register the bindings, either all at once with - - : (evil-collection-init) - - or mode-by-mode, for instance: - - : (with-eval-after-load 'calendar (evil-collection-calendar-setup)) - - or by providing an argument to ~evil-collection-init~: - - : (evil-collection-init 'calendar) - - a list can also be provided to ~evil-collection-init~: - - : (evil-collection-init '(calendar dired calc ediff)) - - The list of supported modes is configured by ~evil-collection-mode-list~. - -~evil-collection~ assumes ~evil-want-keybinding~ is set to ~nil~ and -~evil-want-integration~ is set to ~t~ before loading ~evil~ and -~evil-collection~. Note some other packages may load evil (e.g. evil-leader) so -bear that in mind when determining when to set the variables. - -See https://github.com/emacs-evil/evil-collection/issues/60 and https://github.com/emacs-evil/evil/pull/1087 -for more details. - -For example: - -#+begin_src emacs-lisp :tangle yes -(setq evil-want-integration t) ;; This is optional since it's already set to t by default. -(setq evil-want-keybinding nil) -(require 'evil) -(when (require 'evil-collection nil t) - (evil-collection-init)) -#+end_src - -Here's another full TLDR ~use-package~ example. - -#+begin_src emacs-lisp :tangle yes -(use-package evil - :ensure t - :init - (setq evil-want-integration t) ;; This is optional since it's already set to t by default. - (setq evil-want-keybinding nil) - :config - (evil-mode 1)) - -(use-package evil-collection - :after evil - :ensure t - :config - (evil-collection-init)) -#+end_src - -NOTE: If you don't like surprises but still want to use ~evil-collection-init~, setting ~evil-collection-mode-list~ to nil -and adding each mode manually might be a better option. - -** Configuration -Modify ~evil-collection-mode-list~ to disable or add any modes that should be -evilified by ~evil-collection~. - -| Variable | Default | Description | -|--------------------------------------------+---------+-------------------------------------------------------------------| -| evil-collection-calendar-want-org-bindings | nil | Set up Org functions in calendar keymap. | -| evil-collection-outline-bind-tab-p | nil | Enable -based bindings in Outline mode. | -| evil-collection-term-sync-state-and-mode-p | t | Synchronize insert/normal state with char/line-mode in term-mode. | -| evil-collection-setup-minibuffer | nil | Set up Vim style bindings in the minibuffer. | -| evil-collection-setup-debugger-keys | t | Set up debugger keys for certain modes. | -| evil-collection-want-unimpaired-p | t | Set up unimpaired bindings globally. | -| evil-collection-want-find-usages-bindings | t | Bind -find references-, etc to various modes. | -| evil-collection-config | * | List of mode specific configurations. | -| evil-collection-key-whitelist | nil | List of keys Evil Collection is allowed to bind to. | -| evil-collection-key-blacklist | nil | List of keys Evil Collection is not allowed to bind to. | -| evil-collection-state-passlist | nil | List of Evil States Evil Collection is allowed to bind to. | -| evil-collection-state-denylist | nil | List of Evil States Evil Collection is not allowed to bind to. | - -For example, if you want to enable Evil in the minibuffer, you'll have to turn -it on explicitly by customizing ~evil-collection-setup-minibuffer~ to ~t~. Some -minibuffer-related packages such as Helm rely on this option. - -~use-package~ example: - -#+begin_src emacs-lisp :tangle yes -(use-package evil-collection - :custom (evil-collection-setup-minibuffer t) - :init (evil-collection-init)) -#+end_src - -~evil-collection-config~ can also be modified to configure specific modes. -At the moment, it can be used to defer binding keys to those specific modes -in order to improve startup time. - -** Guidelines - -The following rules serve as guiding principles to define the set of standard -Evil bindings for various modes. Since special modes are by definition -structurally incomparable, those rules cannot be expected to be applied -universally. - -The rules are more-or-less sorted by priority. - -1. Don't bind anything to ~:~ nor ~~. - -2. Keep the movement keys when possible and sensible. - - - ~h~, ~j~, ~k~, ~l~ - - ~w~, ~W~, ~b~, ~B~, ~e~, ~E~, ~ge~, ~gE~ - - ~f~, ~F~, ~t~, ~T~, ~;~, =,= - - ~gg~, ~G~ - - ~|~ - - ~(~, ~)~ - - ~{~, ~}~ - - ~%~ - - ~+~, ~-~, ~0~, ~^~, ~$~ - - ~C-i~, ~C-o~ - -3. Keep the yanking and register keys when possible and sensible. - - - ~y~, ~Y~ - - ="= - -4. Keep the search keys when possible and sensible. - - - ~/~, ~?~ - - ~#~, ~*~ - -5. Keep the mark keys when possible and sensible. - - - ~m~ - - ='=, =~= - -6. Keep the windowing keys when possible and sensible. - - - ~H~, ~L~, ~M~ - - ~C-e~, ~C-y~ - - ~C-f~, ~C-b~ - - ~C-d~, ~C-u~ - - ~C-w~-prefixed bindings. - - Some ~z~-prefixed bindings (see below). - -7. The following keys are free when insert state does not make sense in the - current mode: - - - ~a~, ~A~, ~i~, ~I~ - - ~c~, ~C~, ~r~, ~R~, ~s~, ~S~ - - ~d~, ~D~, ~x~, ~X~ - - ~o~, ~O~ - - ~p~, ~P~ - - ~=~, ~<~, ~>~ - - ~J~ - - =~= - - Any of those keys can be set to be a prefix key. - -8. Prefix keys: ~g~ and ~z~ are the ubiquitous prefix keys. - - - ~g~ generally stands for "go" and is best used for movements. - - ~z~ is used for scrolling, folding, spell-checking and more. - -9. Macro and action keys - - - ~@~, ~q~ - - ~.~ - -10. Ensure terminal compatibility without sacrificing GUI key bindings. - - Tab key - - Tab key is recognized as ~~ in GUI and ~TAB~ in terminal. - ~TAB~ equals ~C-i~. - - ~C-i~ is bound to jumping forward for vim compatibility. - If Shift+Tab is not relevant, just bind ~g TAB~ to the function - that Tab is bound to. If Shift+Tab is relevant, bind ~g]~ and - ~g TAB~ to the function that Tab is bound to, and bind ~g[~ to - the function that Shift+Tab is bound to for terminal compatibility. - - Enter key - - Enter key is recognized as ~~ in GUI and ~RET~ in terminal. - ~RET~ equals ~Ctrl+m~. - - Bind only ~RET~ and ~M-RET~. Or, bind ~RET~ and ~M-RET~ to the same - functions ~~ and ~~ are bound to. - - ~S-RET~ is impossible on terminal. Bind ~~ and a vacant key - to the same function for terminal compatibility. - -** Rationale - -Many special modes share the same set of similar actions. Those actions should -share the same bindings across all modes whenever feasible. - -*** Motion (~[~, ~]~, ~{~, ~}~, ~(~, ~)~, ~gj~, ~gk~, ~C-j~, ~C-k~) - -- ~[~ and ~]~: Use ~[-~ and ~]-~ prefixed keys for navigation between sections. - - If the mode makes no difference between the end of a section and the beginning - of the next, use ~[~ and ~]~. - -- ~gj~ and ~gk~: synonym for ~[~ and ~]~. That's what [[evilmagit][evil-magit]] does. - - *Question:* Should ~gj~ / ~gk~ rather be synonyms for ~C-j~ / ~C-k~? They cannot - emulate the behaviour of ~[]~ or ~][~. - - - ~C-j~, ~C-k~: If there is granularity, i.e. subsections, use ~C-j~ and ~C-k~ - to browse them. This reflects [[evilmagit][evil-magit]] and [[evilmu4e][evil-mu4e]] default - bindings. - - - ~{~, ~}~: If there is no paragraph structure, ~{~ and ~}~ can be used for sub-sectioning. - - - ~(~, ~)~: If there is no sentence structure, ~(~ and ~)~ can be used for sub-sectioning. - - - ~HJKL~: ~hjkl~ can be used for atomic movements, but ~HJKL~ can usually not be used - because ~H~, ~K~ and ~L~ are all universal (~J~ is ~evil-join~ and usually - does not make sense in special modes). - - - ~C-h~ should not be remapped: Since we have ~C-j~ and ~C-k~ for vertical motion, it would - make sense to use ~C-h~ and ~C-l~ for horizontal motion. There are some - shortcomings though: - - - In Vim, ~C-h~ works as backspace, but Evil does not follow that behaviour. - - - In Emacs, it is a prefix key for all help-related commands, and so is ~~. - - - Most importantly, ~C-h~ is too widespread and ubiquitous to be replaced. - So we don't. - - - ~C-l~: As a consequence of the former point, ~C-l~ is available. - - - ~M-~: Those keys are usually free in Evil but still bound to their Emacs - default (e.g. ~M-l~ is ~downcase-word~). Besides, if ~C-j~ and ~C-k~ are - already used, having ~M-j~ and ~M-k~ might add up to the confusion. - -*** Quitting (~q~, ~ZQ~, ~ZZ~) - -In Vim, ~q~ is for recording macros. Vim quits with ~ZZ~ or ~ZQ~. In most -Emacs special modes, it stands for quitting while macros are recorded/played -with ~~ and ~~. - -A good rule of thumb would be: - -- Always bind ~q~, ~ZZ~ and ~ZQ~ to the mode specific quitting functions. If there is none, -- Bind ~q~ and ~ZZ~ to ~quit-window~ -- Bind ~ZQ~ to ~evil-quit~ -- If macros don't make sense in current mode, then ~@~ is available. - -*** Refreshing / Reverting (~gr~) - -- ~gr~ is used for refreshing in [[evilmagit][evil-magit]], [[evilmu4e][evil-mu4e]], and some Spacemacs - configurations (org-agenda and neotree among others). - -- ~C-l~ is traditionally used to refresh the terminal screen. Since there does - not seem to be any existing use of it, we leave the binding free for other - uses. - -*** Marking - -~m~ defaults to ~evil-set-marker~ which might not be very useful in special -modes. -='= can still be used as it can jump to other buffers. - -- ~m~: Mark or toggle mark, depending on what the mode offers. In visual mode, - always mark. With a numeric argument, toggle mark on that many following - lines. - -- ~u~: Unmark current selection. - -- ~U~: Unmark all. - -- =~=: Toggle all marks. This mirrors the "invert-char" Vim command bound to =~= - by default. - -- ~M~: Mark all, if available. Otherwise use =U~=. - -- ~*~: Mark-prefix or mark all if current mode has no prefix. ~*~ is traditionally a wildcard. - -- ~%~: Mark regexp. - -- ~x~: Execute action on marks. This mirrors Dired's binding of ~x~. - -If ~*~ is used for marking, then ~#~ is free. - -Also note that Emacs inconsistently uses ~u~ and ~U~ to unmark. - -*** Selecting / Filtering / Narrowing / Searching - -- ~s~ and ~S~ seem to be used in some places like [[mu4e][mu4e]]. - - - ~s~: [s]elect/[s]earch/filter candidates according to a pattern. - - ~S~: Remove filter and select all. - -- ~=~ is usually free and its significance is obvious. It's taken for zooming though. - -- ~|~ is not free but the pipe symbolic is very tantalizing. - -*** Sorting - -- ~o~: Change the sort [o]rder. -- ~O~: Sort in reverse order. - - There is no real consensus around which key to bind to sorting. What others - do by default: - - - ~package-menu~ uses ~S~. - - - ~M-x proced~ and Dired use ~s~. - - - ~profiler~ uses ~A~ and ~D~. - - - [[mu4e][mu4e]] uses ~O~. - - - [[http://www.nongnu.org/ranger/][ranger]] uses ~o~, inspired from [[http://mutt.org][Mutt]]. - -*** Go to definition (~gd~, ~gD~) - -- ~gd~: [g]o to [d]efinition. This is mostly for programming modes. - If there's a corresponding 'pop' action, use ~C-t~. - -*** Go to references, etc (~gr~, ~gA~) -When ~evil-collection-want-find-usages-bindings~ is set to t: - -- ~gr~: [g] to [r]eferences. This binding is also used for refresh/reverting - modes in non programming modes but is usually empty for programming modes. - -- ~gA~: [g]o to [A]ssignments. - -- Additional bindings: - There may be additional binds under this category. Please file a Pull Request if so. - -*** Go to current entity - -- ~.~: go to current entity (day for calendar, playing track for [[EMMS][EMMS]]). - Bind only if more relevant than ~evil-repeat~. - -*** Open thing at point (~RET~, ~S-RET~, ~M-RET~, ~go~, ~gO~) - -- ~RET~, ~S-RET~, ~M-RET~: Open thing at point in current window, open in other - window and display in other window respectively. The latter is like the - former with the focus remaining on the current window. - -- ~go~, ~gO~: When available, same as ~S-RET~ and ~M-RET~ respectively. This is - useful in terminals where ~S-RET~ and ~M-RET~ might not work. - -*** Emacs-style jumping (~J~) - -- ~J~: [[mu4e][mu4e]] has ~j~ and [[evil-mu4e][evil-mu4e]] uses ~J~, so we use ~J~ too. - - Some special modes like [[mu4e][mu4e]] and ibuffer offer to "jump" to a - different buffer. This sometimes depends on the thing at point. - - This is not related to Evil jumps like ~C-i~ and ~C-o~, nor to "go to - definition". - -*** Browse URL (~gx~) - -~gx~: go to URL. This is a default Vim binding. - -*** Help (~?~) - -- ~g?~ : is the standard key for help related commands. -- ~?~ in places where backward search is not very useful. - -*** History browsing (~C-n~, ~C-p~) - -~C-n~ and ~C-p~ are standard bindings to browse the history elements. - -*** Bookmarking - -? - -*** REPL (~gz~) - -If the mode has a Go To REPL-type command, set it to ~gz~. - -*** Zooming (~+~, ~-~, ~=~, ~0~) - -- ~+~ and ~-~ have obvious meanings. -- ~0~ has a somewhat intuitive meaning, plus it is next to ~+~ and ~-~ on QWERTY. -- ~=~ is useful as a synonym for ~+~ because it is the unshifted key of ~+~ on QWERTY. - -*** Debugging - -When debugging is on, debugger keys takes the most precedence. - -These keys will be set when there's an available command for them. - -- ~n~ : Step Over -- ~i~ : Step Into -- ~o~ : Step Out -- ~c~ : Continue/Resume Execution -- ~L~ : Locals -- ~t~ : Tracing -- ~q~ : Quit Debugging -- ~H~ : Continue until Point -- ~e~ : Evaluate Expression -- ~b~ : Set Breakpoint -- ~u~ : Unset Breakpoint -- ~>~ : Navigate to Next Frame -- ~<~ : Navigate to Previous Frame -- ~g?~ : Help -- ~J~ : Jump to debugger location -- ~R~ : Restart - -For debugging outside of debugger being on (e.g. setting initial breakpoints), -we use similar keys to [[https://github.com/realgud/realgud][realgud]]. - -- ~f5~ Start/Continue/Resume Execution -- ~S-f5~ Continue Execution -- ~Mouse-1~ Toggle Breakpoint -- ~f9~ Toggle Breakpoint -- ~f10~ Step Over -- ~f11~ Step Into -- ~S-f11~ Step Out - -*** Editable Buffers - -For buffers where insert-state doesn't make sense but buffer can be edited, -(e.g. wdired or wgrep), pressing ~i~ will change into editable state. - -When this editable state is turned on, - -~ZQ~ will abort and clear any changes. -~ZZ~ will finish and save any changes. -~ESC~ will exit editable state. - -*** :q/:wq/etc - -Modes with commands that can be bound to :q/:wq/etc will have those keys remapped. - -** Key Translation - -~evil-collection-translate-key~ allows binding a key to the definition of -another key in the same keymap (comparable to how Vim's keybindings work). Its -arguments are the ~states~ and ~keymaps~ to bind/look up the key(s) in followed -optionally by keyword arguments (currently only ~:destructive~) and -key/replacement pairs. ~states~ should be nil for non-evil keymaps, and both -~states~ and ~keymaps~ can be a single symbol or a list of symbols. - -This function can be useful for making key swaps/cycles en masse. For example, -someone who uses an alternate keyboard layout may want to retain the ~hjkl~ -positions for directional movement in dired, the calendar, etc. - -Here's an example for Colemak of making swaps in a single keymap: - -#+begin_src emacs-lisp -(evil-collection-translate-key nil 'evil-motion-state-map - ;; colemak hnei is qwerty hjkl - "n" "j" - "e" "k" - "i" "l" - ;; add back nei - "j" "e" - "k" "n" - "l" "i") -#+end_src - -Here's an example of using ~evil-collection-setup-hook~ to cycle the keys for -all modes in ~evil-collection-mode-list~: - -#+begin_src emacs-lisp -(defun my-hjkl-rotation (_mode mode-keymaps &rest _rest) - (evil-collection-translate-key 'normal mode-keymaps - "n" "j" - "e" "k" - "i" "l" - "j" "e" - "k" "n" - "l" "i")) - -;; called after evil-collection makes its keybindings -(add-hook 'evil-collection-setup-hook #'my-hjkl-rotation) - -(evil-collection-init) -#+end_src - -A more common use case of ~evil-collection-translate-key~ would be for keeping -the functionality of some keys that users may bind globally. For example, ~SPC~, -~[~, and ~]~ are bound in some modes. If you use these keys as global prefix -keys that you never want to be overridden, you'll want to give them higher -priority than other evil keybindings (e.g. those made by ~(evil-define-key -'normal some-map ...)~). To do this, you can create an "intercept" map and bind -your prefix keys in it instead of in ~evil-normal-state-map~: - -#+begin_src emacs-lisp -(defvar my-intercept-mode-map (make-sparse-keymap) - "High precedence keymap.") - -(define-minor-mode my-intercept-mode - "Global minor mode for higher precedence evil keybindings." - :global t) - -(my-intercept-mode) - -(dolist (state '(normal visual insert)) - (evil-make-intercept-map - ;; NOTE: This requires an evil version from 2018-03-20 or later - (evil-get-auxiliary-keymap my-intercept-mode-map state t t) - state)) - -(evil-define-key 'normal my-intercept-mode-map - (kbd "SPC f") 'find-file) -;; ... -#+end_src - -You can then define replacement keys: - -#+begin_src emacs-lisp -(defun my-prefix-translations (_mode mode-keymaps &rest _rest) - (evil-collection-translate-key 'normal mode-keymaps - "C-SPC" "SPC" - ;; these need to be unbound first; this needs to be in same statement - "[" nil - "]" nil - "[[" "[" - "]]" "]")) - -(add-hook 'evil-collection-setup-hook #'my-prefix-translations) - -(evil-collection-init) -#+end_src - -By default, the first invocation of ~evil-collection-translate-key~ will make a -backup of the keymap. Each subsequent invocation will look up keys in the backup -instead of the original. This means that a call to -~evil-collection-translate-key~ will always have the same behavior even if -evaluated multiple times. When ~:destructive t~ is specified, keys are looked up -in the keymap as it is currently. This means that a call to -~evil-collection-translate-key~ that swapped two keys would continue to -swap/unswap them with each call. Therefore when ~:destructive t~ is used, all -cycles/swaps must be done within a single call to -~evil-collection-translate-key~. To make a comparison to Vim keybindings, -~:destructive t~ is comparable to Vim's ~map~, and ~:destructive nil~ is -comparable to Vim's ~noremap~ (where the "original" keybindings are those that -existed in the keymap when ~evil-collection-translate-key~ was first called). -You'll almost always want to use the default behavior (especially in your init -file). The limitation of ~:destructive nil~ is that you can't translate a key to -another key that was defined after the first ~evil-collection-translate-key~, so -~:destructive t~ may be useful for interactive experimentation. - -~evil-collection-swap-key~ is also provided as a wrapper around -~evil-collection-translate-key~ that allows swapping keys: - -#+begin_src emacs-lisp -(evil-collection-swap-key nil 'evil-motion-state-map - ";" ":") -;; is equivalent to -(evil-collection-translate-key nil 'evil-motion-state-map - ";" ":" - ":" ";") -#+end_src - -In some cases, keys are bound through `evil-define-minor-mode-key` and may -need to be translated using ~evil-collection-translate-minor-mode-key~ and/or -~evil-collection-swap-minor-mode-key~. - -#+begin_src emacs-lisp -(evil-collection-swap-minor-mode-key '(normal motion) - '(evil-snipe-local-mode evil-snipe-override-local-mode) - "k" "s" - ;; Set this to t to make this swap the keys everytime - ;; this expression is evaluated. - :destructive nil) - -(evil-collection-translate-minor-mode-key - '(normal motion) - '(evil-snipe-local-mode evil-snipe-override-local-mode) - "k" "s" - "s" "k" - ;; Set this to t to make this swap the keys everytime - ;; this expression is evaluated. - :destructive nil) -#+end_src - -** Third-party packages - -Third-party packages are provided by several parties: - -| Major mode | Evil bindings | -|------------+--------------------------| -| ledger | [[https://github.com/atheriel/evil-ledger][evil-ledger]] | -| lispy | [[https://github.com/noctuid/lispyville][lispyville]] or [[https://github.com/sp3ctum/evil-lispy][evil-lispy]] | -| org | [[https://github.com/GuiltyDolphin/org-evil][org-evil]] or [[https://github.com/Somelauw/evil-org-mode][evil-org]] | -| markdown | [[https://github.com/Somelauw/evil-markdown][evil-markdown]] | - -Also ~evil-collection~ has minimal support (~TAB~, ~S-TAB~ and -sentence/paragraph forwarding) for ~markdown~ and ~org~ if you prefer less -packages installed. - -Should you know any suitable package not mentioned in this list, let us know and -file an issue. - -Other references: - -- [[https://github.com/syl20bnr/spacemacs/blob/master/doc/CONVENTIONS.org#key-bindings-conventions][Spacemacs]] -- [[https://github.com/doomemacs/doomemacs/tree/master/modules/editor/evil][Doom Emacs]] - -** FAQ - -*** Making SPC work similarly to [[https://github.com/syl20bnr/spacemacs][spacemacs]]. - -~evil-collection~ binds over SPC in many packages. To use SPC as a leader key -with the [[https://github.com/noctuid/general.el][general]] library: - -#+begin_src emacs-lisp :tangle yes -(use-package general - :ensure t - :init - (setq general-override-states '(insert - emacs - hybrid - normal - visual - motion - operator - replace)) - :config - (general-define-key - :states '(normal visual motion) - :keymaps 'override - "SPC" 'hydra-space/body)) -;; Replace 'hydra-space/body with your leader function. -#+end_src - -See [[https://github.com/noctuid/evil-guide][noctuid's evil guide]] for other approaches. - -- Unintialized mode maps in ~evil-collection-setup-hook~. - ~evil-collection-setup-hook~ is ran with a list of keymaps passed into it. - Some misconfigured modes may not have yet initialized their keymap at this - time so the value of the variable may be nil. In that case, an alternative is - to use a mode-hook to do any custom settings. - -#+begin_src emacs-lisp :tangle yes -(add-hook 'evil-collection-setup-hook - (lambda (_mode keymaps) - (add-hook 'ediff-mode-hook - (lambda () - (... keymaps ...))))) -#+end_src - -View [[https://github.com/emacs-evil/evil-collection/issues/196][196]] for more info. -*** Don't allow Evil-Collection to bind some keys. -Look into ~evil-collection-key-whitelist~ and ~evil-collection-key-blacklist~. - -For example: - -#+begin_src emacs-lisp :tangle yes -;; Don't allow Evil Collection to bind to gfu and gfp. -(setq evil-collection-key-blacklist '("gfu" "gfp")) -#+end_src -*** Modes left behind - -Some modes might still remain unsupported by this package. Should you be missing -your ~~, please feel free to do a pull request. - -*** Writing a new binding - -This [[template][yasnippet template]] can be used to bootstrap a new binding. - -For example, if we were to want to add ~evil-collection~ support to ~eldoc~. -(e.g.) There is a package that contains: - -#+begin_src emacs-lisp :tangle yes -(provide 'eldoc) -#+end_src - -Create a directory named eldoc under [[modes-directory][modes/]]. Create a file -named evil-collection-eldoc.el under the newly created eldoc directory. Then use -the above template as an example or, using [[yasnippet][yasnippet]], -~yas-expand~ the above template which will result in something like below: - -#+begin_src emacs-lisp :tangle yes -;;; evil-collection-eldoc.el --- Bindings for `eldoc' -*- lexical-binding: t -*- - -;; Copyright (C) 2022 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.2 -;; Package-Requires: ((emacs "27.1")) -;; Keywords: evil, emacs, convenience, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for eldoc. - -;;; Code: -(require 'evil-collection) -(require 'eldoc nil t) - -(defvar eldoc-mode-map) -(defconst evil-collection-eldoc-maps '(eldoc-mode-map)) - -(defun evil-collection-eldoc-setup () - "Set up `evil' bindings for eldoc." - (evil-collection-define-key 'normal 'eldoc-mode-map - )) - -(provide 'evil-collection-eldoc) -;;; evil-collection-eldoc.el ends here -#+end_src - -Finally, add ~eldoc~ to ~evil-collection--supported-modes~. - -#+begin_src emacs-lisp :tangle yes -(defvar evil-collection--supported-modes - `( - ;; ... - eldoc - ;; ... - ) - "List of modes supported by evil-collection. Elements are -either target mode symbols or lists which `car' is the mode -symbol and `cdr' the packages to register.") -#+end_src -** Submitting Issues - -When reproducing issues, you can use this emacs -Q recipe. - -#+begin_src emacs-lisp :tangle yes -(setq user-emacs-directory "~/.emacs.1.d") -(setq package-user-dir - (format "%s/elpa/%s/" user-emacs-directory emacs-major-version)) - -(setq package-enable-at-startup nil - package-archives - '(("melpa" . "https://melpa.org/packages/") - ("gnu" . "http://elpa.gnu.org/packages/"))) - -(require 'package) -(package-initialize) -(unless (package-installed-p 'use-package) - (package-refresh-contents) - (package-install 'use-package)) -(require 'use-package) -(setq use-package-always-ensure t) - -(use-package evil - :ensure t - :init - (setq evil-want-keybinding nil) - :config - (evil-mode 1)) - -(use-package evil-collection - :after evil - :ensure t - :config - (evil-collection-init)) -#+end_src - -** Contributing -We welcome any additional modes that are not already supported. - -All bindings in ~evil-collection~ are open to change so if there's a better or -more consistent binding, please -[[https://github.com/emacs-evil/evil-collection/issues][open an issue]] or -[[https://github.com/emacs-evil/evil-collection/pulls][submit a pull request]]. - -Follow [[https://github.com/bbatsov/emacs-lisp-style-guide/][The Emacs Lisp -Style Guide]] for coding conventions. - -[[https://github.com/erlang/otp/wiki/writing-good-commit-messages][Erlang/OTP]] -has a good read for helpful commit messages. - -#+LINK: EMMS https://www.gnu.org/software/emms/ -#+LINK: evilmagit https://github.com/emacs-evil/evil-magit -#+LINK: evilmu4e https://github.com/JorisE/evil-mu4e -#+LINK: mu4e https://www.djcbsoftware.nl/code/mu/mu4e.html -#+LINK: yasnippet https://github.com/joaotavora/yasnippet -#+LINK: template https://github.com/emacs-evil/evil-collection/blob/master/yasnippet_evil-collection -#+LINK: modes-directory https://github.com/emacs-evil/evil-collection/tree/master/modes diff --git a/.config/emacs/lisp/evil-collection/evil-collection.el b/.config/emacs/lisp/evil-collection/evil-collection.el deleted file mode 100644 index a7e149a..0000000 --- a/.config/emacs/lisp/evil-collection/evil-collection.el +++ /dev/null @@ -1,1129 +0,0 @@ -;;; evil-collection.el --- A set of keybindings for Evil mode -*- lexical-binding: t -*- - -;; Copyright (C) 2017, 2023 James Nguyen - -;; Author: James Nguyen -;; Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.2 -;; Package-Requires: ((emacs "26.3") (evil "1.2.13")) -;; Keywords: evil, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; A set of keybindings for Evil mode. -;; -;; If you want to use Evil in the minibuffer, you'll have to enable it by -;; setting `evil-collection-setup-minibuffer' to t before loading this package. -;; This is so because many users find it confusing. -;; Some minibuffer-related packages such as Helm rely on this option. - -;;; Code: - -;; `evil' requires `seq-into'? -;; This require on `seq' before loading `evil 'prevents `evil' from erroring -;; out with the below message on Emacs 29. -;; Symbol's function definition is void: seq-into -;; Looks like this error can be traced through evil -> -;; Look at the commit that moved this line above `evil' to see the error message. -;; evil -> evil-vars -> read-kbd-macro -> seq-into -> error. -;; https://github.com/emacs-evil/evil/issues/1627 -(require 'seq) -(require 'cl-lib) -(require 'evil) -;; `annalist' is optional; only used to record and describe bindings via -;; `evil-collection-describe-bindings'. Install it to enable that feature. -(require 'annalist nil t) - -(declare-function annalist-record "annalist") -(declare-function annalist-describe "annalist") -(declare-function annalist-define-view "annalist") -(declare-function annalist-string-< "annalist") - -(defvar evil-collection-base-dir (file-name-directory load-file-name) - "Store the directory evil-collection.el was loaded from.") - -(defvar evil-want-integration) -(defvar evil-want-keybinding) - -(defvar evil-collection--startup-warning-flag nil) - -(defun evil-collection-maybe-display-startup-warning () - "Warn if `evil-want-keybinding' was not set before loading Evil. -Runs at most once." - (unless evil-collection--startup-warning-flag - (setq evil-collection--startup-warning-flag t) - (when (featurep 'evil-keybindings) - (if evil-want-keybinding - (display-warning - '(evil-collection) - "Make sure to set `evil-want-keybinding' to nil before loading evil \ -or evil-collection.\ -\n -See https://github.com/emacs-evil/evil-collection/issues/60 for more details.") - (display-warning - '(evil-collection) - "`evil-want-keybinding' was set to nil but not before loading evil.\ -\n -Make sure to set `evil-want-keybinding' to nil before loading evil \ -or evil-collection.\ -\n -See https://github.com/emacs-evil/evil-collection/issues/60 for more details."))))) - -(unless (featurep 'evil-integration) - (message "Requiring evil-integration. Set evil-want-integration to t to\ - remove this message.\ -\n -See https://github.com/emacs-evil/evil-collection/issues/60 for more details.") - (require 'evil-integration)) - -(defgroup evil-collection nil - "A set of keybindings for Evil mode." - :group 'evil) - -(defcustom evil-collection-setup-minibuffer nil - "Whether to setup Evil bindings in the minibuffer." - :type 'boolean - :group 'evil-collection) - -(defcustom evil-collection-calendar-want-org-bindings nil - "Whether to bind Org functions in calendar keymap." - :type 'boolean - :group 'evil-collection) - -(defcustom evil-collection-setup-debugger-keys t - "Whether to bind debugger keys when debugger is active. - -Debugger in this case is dependent on mode. - -This is only relevant for debug modes that are part of another mode, - -e.g. `indium'. Modes like `edebug' or `realgud' needs to be explicitly disabled - -through removing their entry from `evil-collection-mode-list'." - :type 'boolean - :group 'evil-collection) - -(defcustom evil-collection-want-unimpaired-p t - "Whether to enable unimpaired style bindings globally." - :type 'boolean - :group 'evil-collection) - -(defcustom evil-collection-want-find-usages-bindings t - "Whether to bind `xref-find-references'-like bindings. - -This will bind additional find-* type commands, e.g. usages, assignments, etc.." - :type 'boolean - :group 'evil-collection) - -(defcustom evil-collection-want-g-bindings t - "Whether to bind g* bindings." - :type 'boolean - :group 'evil-collection) - -(defvar evil-collection--modes-with-delayed-setup - `(emms - eshell) - "List of modes whose keybinds aren't completely set up after the mode is -loaded. This can be a problem for cases where we're doing key translations -using `evil-collection-setup-hook' which would result in an empty keymap. - -Normally we run `evil-collection-setup-hook' right away after the mode -is loaded in `with-eval-after-load' (see `evil-collection-init') but for these -modes, we skip running that hook and let the corresponding `evil-collection' -package handle running `evil-collection-setup-hook'. - -Elements in this list either match a target mode symbol or the car of a list in -`evil-collection--supported-modes'. - -If `evil-collection-always-run-setup-hook-after-load' is t, this list isn't -read and `evil-collection-setup-hook' will be ran in the -`with-eval-after-load' block in `evil-collection-init'.") - -(defcustom evil-collection-always-run-setup-hook-after-load nil - "Whether to always run `evil-collection-setup-hook' after mode is loaded. - -See `evil-collection-init' and `evil-collection--modes-with-delayed-setup'." - :type 'boolean - :group 'evil-collection) - -(defcustom evil-collection-defer-delay 3 - "Default idle delay in seconds used when deferring mode initialization. - -Used as a fallback when no explicit delay is specified for a mode in -`evil-collection-defer'." - :type 'number - :group 'evil-collection) - -(defvar evil-collection--supported-modes - `(2048-game - ag - agent-shell - alchemist - anaconda-mode - apropos - arc-mode - atomic-chrome - auto-package-update - beginend - bluetooth - bm - bookmark - (buff-menu "buff-menu") - bufler - calc - calendar - cider - citre - cmake-mode - color-rg - comint - company - compile - consult - corfu - crdt - (csv "csv-mode") - (custom cus-edit) - cus-theme - dape - dashboard - daemons - deadgrep - debbugs - debug - devdocs - dictionary - diff-hl - diff-mode - difftastic - dired - dired-sidebar - disk-usage - distel - doc-view - docker - eat - ebib - ebuku - eca - edbi - edebug - ediff - eglot - elpaca - ement - explain-pause-mode - eldoc - elfeed - elisp-mode - elisp-refs - elisp-slime-nav - embark - emms - ,@(when (>= emacs-major-version 29) '(emoji)) - epa - ert - eshell - eval-sexp-fu - evil-mc - eww - fanyi - finder - flycheck - flymake - forge - free-keys - fzfa - geiser - ggtags - git-timemachine - gited - gnus - go-mode - gptel - grep - guix - hackernews - helm - help - helpful - hg-histedit - hideshow - hungry-delete - hyrolo - ibuffer - ielm - (image image-mode) - image-dired - image+ - imenu - imenu-list - (indent "indent") - indium - info - ivy - js2-mode - ,@(when (>= emacs-major-version 30) '(kmacro)) - leetcode - lispy - lms - log-edit - log-view - lsp-ui-imenu - lua-mode - kotlin-mode - macrostep - man - (magit magit-submodule) ;; See https://github.com/emacs-evil/evil-collection/issues/637 - magit-repos - magit-section - magit-todos - markdown-mode - message - minesweeper - ,@(when evil-collection-setup-minibuffer '(minibuffer)) - monky - mpc - mpdel - mpdired - mu4e - mu4e-conversation - neotree - newsticker - notmuch - nov - omnisharp - org - org-agenda - org-present - org-roam - osx-dictionary - outline - ovpn-mode - p4 - (package-menu package) - pass - (pdf pdf-view) - popup - proced - (process-menu simple) - prodigy - profiler - p-search - python - quickrun - racer - racket-describe - reader - realgud - reftex - replace ;; For `occur'. - restclient - rg - ripgrep - rjsx-mode - robe - rtags - ruby-mode - scheme - scroll-lock - selectrum - sh-script - shell-maker - ,@(when (>= emacs-major-version 28) '(shortdoc)) - simple - simple-mpc - slime - sly - smerge-mode - snake - so-long - speedbar - ,@(when (>= emacs-major-version 27) '(tab-bar)) - tablist - tabulated-list - tar-mode - telega - (term term ansi-term multi-term) - tetris - ,@(when (>= emacs-major-version 27) '(thread)) - tide - timer-list - transmission - trashed - tuareg - typescript-mode - ultra-scroll - vc-annotate - vc-dir - vc-git - vdiff - vertico - view - vlf - vterm - vundo - w3m - wdired - wgrep - which-key - with-editor - woman - xref - xwidget - yaml-mode - youtube-dl - zmusic - (ztree ztree-diff ztree-dir)) - "List of modes supported by evil-collection. Elements are -either target mode symbols or lists which `car' is the mode -symbol and `cdr' the packages to register.") - -(dolist (mode evil-collection--supported-modes) - (let ((ec-mode-name (if (listp mode) (car mode) mode))) - (autoload - (intern (format "evil-collection-%s-setup" ec-mode-name)) - (expand-file-name - (format "modes/%s/evil-collection-%s" ec-mode-name ec-mode-name) - evil-collection-base-dir)))) - -(defcustom evil-collection-mode-list evil-collection--supported-modes - "The list of modes which will be evilified by `evil-collection-init'. -Elements are either target mode symbols or lists which `car' is the -mode symbol and `cdr' the packages to register. - -By default, `minibuffer' is not included because many users find -this confusing. It will be included if -`evil-collection-setup-minibuffer' is set to t." - :type '(repeat (choice symbol sexp)) - :group 'evil-collection) - -(defcustom evil-collection-config - '((buff-menu :defer t) - (calc :defer t) - (comint :defer t) - (debug :defer t) - (diff-mode :defer t) - (dired :hook dired-mode) - (edebug :defer t) - (eldoc :defer t) - (help :defer t) - (image :defer t) - (indent :defer t) - (info :defer t) - (replace :defer t) - (outline :defer t) - (package-menu :defer t) - (process-menu :defer t) - (simple :defer t) - (tab-bar :defer t) - (tabulated-list :defer t) - (xref :defer t)) - "The list of modes with special configuration. - -These modes should match entries within `evil-collection-mode-list'. - -This variable is consumed only by `evil-collection-setup'. - - -NOTE: The API of this variable may change drastically. - -Currently supported keys: - -:defer t or TIME in seconds to defer loading mode. - -:hook HOOK-NAME to initialize the mode when a hook fires. The hook -name does not need the \"-hook\" suffix; it will be appended -automatically. When :hook is present, :defer is ignored." - :type '(repeat (choice symbol sexp)) - :group 'evil-collection) - -(defcustom evil-collection-key-whitelist '() - "List of keys that may be used by Evil Collection. -This is a list of strings that are suitable for input to -`kbd'. If there are no keys in the list, the whitelist will be ignored." - :type '(repeat string) - :group 'evil-collection) - -(defcustom evil-collection-key-blacklist '() - "List of keys that may not be used by Evil Collection. -This is a list of strings that are suitable for input to `kbd'." - :type '(repeat string) - :group 'evil-collection) - -(defcustom evil-collection-state-passlist '() - "List of evil states that may be used by Evil Collection. -This is a list of symbols that are suitable for input to - `evil-define-key'. Ignore when there are no states in the list." - :type '(repeat symbol) - :group 'evil-collection) - -(defcustom evil-collection-state-denylist - (if (bound-and-true-p evil-disable-insert-state-bindings) - '(insert) - '()) - "List of evil states that may not be used by Evil Collection. -This is a list of symbols that are suitable for input to - `evil-define-key'." - :type '(repeat symbol) - :group 'evil-collection) - -(defcustom evil-collection-repl-submit-state 'normal - "Evil state in which RET submits the prompt in REPL-like buffers. - -The other state gets RET bound to `newline'. S-RET always inserts a -newline regardless of state." - :type '(choice (const :tag "Submit in normal state" normal) - (const :tag "Submit in insert state" insert)) - :group 'evil-collection) - -(defvar evil-collection-setup-hook nil - "Hook run by `evil-collection-init' for each mode that is evilified. -This hook runs after all setup (including keybindings) for a mode has already -taken place. The arguments passed to functions for this hook are the name of the -mode and a list of keymap names (i.e. symbols, not actual keymaps) customized by -Evil Collection for that mode. More arguments may be added in the future, so -functions added to this hook should include a \"&rest _rest\" for forward -compatibility.") - -(defun evil-collection-define-operator-key (operator map-sym &rest bindings) - "Define a key on a specific OPERATOR e.g. yank or delete. - -This function is useful for adding specific binds to operator maps -\(e.g. `evil-yank' or `evil-delete') without erasing the original bind. - -For example, say one wants to bind \"yf\" to something but also wants to keep -\"yy\". - -This function takes care of checking the whitelist/blacklist against the full -binding. - -For example: -\(evil-collection-define-operator-key \='yank - \='pass-mode-map \"f\" \='pass-copy-field) - -This will check \"yf\" against a user's white/blacklist and also record the -binding in `annalist' as so." - (declare (indent defun)) - (let* ((prefix (if (eq operator 'yank) "y" "d")) - (operators (if (eq operator 'yank) - 'evil-collection-yank-operators - 'evil-collection-delete-operators)) - (remap (if (eq operator 'yank) [remap evil-yank] [remap evil-delete])) - (whitelist (mapcar 'kbd evil-collection-key-whitelist)) - (blacklist (mapcar 'kbd evil-collection-key-blacklist)) - filtered-bindings) - (while bindings - (let* ((key (pop bindings)) - (key-with-prefix (concat prefix key)) - (def (pop bindings)) - (def-with-menu-item - `(menu-item - "" - nil - :filter - (lambda (&optional _) - (when (or - (eq evil-this-operator (key-binding ,remap)) - (memq evil-this-operator ,operators)) - (setq evil-inhibit-operator t) - ',def))))) - (when (or (and whitelist (member key-with-prefix whitelist)) - (not (member key-with-prefix blacklist))) - (when (featurep 'annalist) - (annalist-record 'evil-collection 'keybindings - ;; Record the binding as if it was in 'normal mode - ;; instead of 'operator mode as the user would be - ;; in normal mode when triggering the operator. - (list map-sym 'normal key-with-prefix def) - :local (or (eq map-sym 'local) - (local-variable-p map-sym)))) - ;; Use the original key declared when actually setting the binding. - (push key filtered-bindings) - ;; Use the definition attached to the menu-item when setting the - ;; binding. - (push def-with-menu-item filtered-bindings)))) - (setq filtered-bindings (nreverse filtered-bindings)) - (evil-collection--define-key 'operator map-sym filtered-bindings))) - -(defun evil-collection--filter-states (state) - "Return a list states after filtering STATE (a single symbol or list of symbols). -The return value adheres to `evil-collection-state-passlist' and -`evil-collection-state-denylist'. When the STATE is nil, which -means all states for `evil-define-key', return nil." - (let ((states (if (listp state) state (list state)))) - (seq-difference - (if evil-collection-state-passlist - (seq-intersection states evil-collection-state-passlist) - states) - evil-collection-state-denylist))) - -(defun evil-collection--keys-conflict (key-a key-b) - "Return t if KEY-A and KEY-B conflict. -Keys conflict if they're equal or if one is a prefix of the other." - (setq key-a (vconcat key-a) - key-b (vconcat key-b)) - (let ((len (min (length key-a) (length key-b)))) - (equal (substring key-a 0 len) (substring key-b 0 len)))) - -(defsubst evil-collection--can-bind-key (key whitelist blacklist) - "Return t if KEY can be bound. -Return nil if KEY conflicts with a key in BLACKLIST and is not -a member of WHITELIST. - -Both WHITELIST and BLACKLIST must be lists of keys in Emacs' -internal key representation (i.e., after calling `kbd' on the key -description." - (or (member key whitelist) - (not (cl-member key blacklist - :test #'evil-collection--keys-conflict)))) - -(defun evil-collection-define-key (state map-sym &rest bindings) - "Wrapper for `evil-define-key*' with additional features. -Unlike `evil-define-key*' MAP-SYM should be a quoted keymap other than the -unquoted keymap required for `evil-define-key*'. This function adds the ability -to filter keys on the basis of `evil-collection-key-whitelist' and -`evil-collection-key-blacklist'. It also records bindings with annalist.el." - (declare (indent defun)) - (let* ((whitelist (mapcar 'kbd evil-collection-key-whitelist)) - (blacklist (mapcar 'kbd evil-collection-key-blacklist)) - (states-to-bind (evil-collection--filter-states state)) - filtered-bindings) - (when (or states-to-bind (null state)) - (while bindings - (let ((key (pop bindings)) - (def (pop bindings))) - (when (evil-collection--can-bind-key key whitelist blacklist) - (when (featurep 'annalist) - (annalist-record 'evil-collection 'keybindings - (list map-sym state key def) - :local (or (eq map-sym 'local) - (local-variable-p map-sym)))) - (push key filtered-bindings) - (push def filtered-bindings)))) - (setq filtered-bindings (nreverse filtered-bindings)) - (evil-collection--define-key states-to-bind map-sym filtered-bindings)))) - -(defun evil-collection-can-bind-key (key) - "Return whether or not we should bind KEY." - (let* ((whitelist (mapcar 'kbd evil-collection-key-whitelist)) - (blacklist (mapcar 'kbd evil-collection-key-blacklist))) - (evil-collection--can-bind-key key whitelist blacklist))) - -(defun evil-collection--define-key (state map-sym bindings) - "Workhorse function for `evil-collection-define-key'. - -See `evil-collection-define-key' docstring for more details." - (cond ((null bindings)) - ((and (boundp map-sym) (keymapp (symbol-value map-sym))) - (condition-case-unless-debug err - (apply #'evil-define-key* - state (symbol-value map-sym) bindings) - (error - (message "evil-collection: error setting key in %s %S" - map-sym err)))) - ((boundp map-sym) - (user-error "evil-collection: %s is not a keymap" map-sym)) - (t - (let* ((fname (format "evil-collection-define-key-in-%s" map-sym)) - (fun (make-symbol fname))) - (fset fun `(lambda (&rest args) - (when (and (boundp ',map-sym) (keymapp ,map-sym)) - (remove-hook 'after-load-functions #',fun) - (condition-case-unless-debug err - (apply #'evil-define-key* - ',state ,map-sym ',bindings) - (error - (message - ,(format - "evil-collection: error setting key in %s %%S" - map-sym) - err)))))) - (add-hook 'after-load-functions fun t))))) - -(defun evil-collection-inhibit-insert-state (map-sym) - "Unmap insertion keys from normal state. -This is particularly useful for read-only modes." - (evil-collection-define-key 'normal map-sym - [remap evil-append] #'ignore - [remap evil-append-line] #'ignore - [remap evil-insert] #'ignore - [remap evil-insert-line] #'ignore - [remap evil-change] #'ignore - [remap evil-change-line] #'ignore - [remap evil-substitute] #'ignore - [remap evil-change-whole-line] #'ignore - [remap evil-delete] #'ignore - [remap evil-delete-line] #'ignore - [remap evil-delete-char] #'ignore - [remap evil-delete-backward-char] #'ignore - [remap evil-replace] #'ignore - [remap evil-replace-state] #'ignore - [remap evil-open-below] #'ignore - [remap evil-open-above] #'ignore - [remap evil-paste-after] #'ignore - [remap evil-paste-before] #'ignore - [remap evil-join] #'ignore - [remap evil-indent] #'ignore - [remap evil-shift-left] #'ignore - [remap evil-shift-right] #'ignore - [remap evil-invert-char] #'ignore)) - -(defun evil-collection-set-readonly-bindings (map-sym) - "Unmap insertion keys from normal state. Additionally q can `quit-window'. -This is particularly useful for read-only modes. Make sure it's -called before setting up other evil bindings so that it can be -overriden." - (evil-collection-inhibit-insert-state map-sym) - (evil-collection-define-key 'normal map-sym - "q" #'quit-window - "ZZ" #'quit-window - "ZQ" #'evil-quit)) - -(defun evil-collection--binding-lessp (a b) - "Comparison function used to sort bindings of the form (state key def)." - (let ((a-state (symbol-name (nth 0 a))) - (b-state (symbol-name (nth 0 b))) - (a-key (nth 1 a)) - (b-key (nth 1 b))) - (if (not (string= a-state b-state)) - (string-lessp a-state b-state) - (string-lessp a-key b-key)))) - -(with-eval-after-load 'annalist - (annalist-define-view 'keybindings 'evil-collection-valid - (list (list 'keymap :sort #'annalist-string-<) - (list 'state :sort #'annalist-string-<)) - :inherit 'valid) - - (annalist-define-view 'keybindings 'evil-collection-active - (list (list 'keymap :sort #'annalist-string-<) - (list 'state :sort #'annalist-string-<)) - :inherit 'active)) - -(defun evil-collection-describe-bindings (&optional arg) - "Print bindings made by Evil Collection to separate buffer. - -With non-nil ARG, restrict to bindings corresponding to active -modes in the current buffer. - -Requires the optional `annalist' package." - (interactive "P") - (unless (require 'annalist nil t) - (user-error - "`evil-collection-describe-bindings' requires the `annalist' package")) - (annalist-describe 'evil-collection 'keybindings - (if arg - 'evil-collection-active - 'evil-collection-valid))) - -(defun evil-collection--mode-file (mode file) - "Return path to FILE for MODE. Return nil if it doesn't exist." - (let ((path (expand-file-name - (format "modes/%s/%s" mode file) evil-collection-base-dir))) - (when (file-exists-p path) - path))) - -(defun evil-collection-open-config-file (mode) - "Open configuration file corresponding to MODE." - (interactive - (list - (completing-read - "Mode: " - (cl-remove-if-not - (lambda (mode) - (evil-collection--mode-file mode (format "evil-collection-%s.el" mode))) - (directory-files - (expand-file-name "modes" evil-collection-base-dir) - nil "^[^.]"))))) - (find-file (evil-collection--mode-file mode (format "evil-collection-%s.el" mode)))) - -(defun evil-collection-open-readme (mode) - "Open README.org corresponding to MODE." - (interactive - (list - (completing-read - "Mode: " - (cl-remove-if-not - (lambda (mode) - (evil-collection--mode-file mode "README.org")) - (directory-files - (expand-file-name "modes" evil-collection-base-dir) - nil "^[^.]"))))) - (find-file (evil-collection--mode-file mode "README.org"))) - -(defun evil-collection--delay (condition form hook &optional append local name) - "Execute FORM when CONDITION becomes true, checking with HOOK. -NAME specifies the name of the entry added to HOOK. If APPEND is -non-nil, the entry is appended to the hook. If LOCAL is non-nil, -the buffer-local value of HOOK is modified. - -This is a backport of `evil-delay' without the deprecation notice to deal with -CI until migration can be done. -Ref: https://github.com/emacs-evil/evil-collection/issues/750" - (eval `(evil-with-delay ,condition (,hook ,append ,local ,name) ,form) t)) - -;;;###autoload -(cl-defun evil-collection-translate-minor-mode-key (states modes - &rest translations - &key destructive - &allow-other-keys) - "Translate keys in the keymap(s) corresponding to STATES and MODES. - -Similar to `evil-collection-translate-key' but for minor modes. -STATES should be the name of an evil state, a list of states, or nil. MODES -should be a symbol corresponding to minor-mode to make the translations in or a -list of minor-mode symbols. TRANSLATIONS corresponds to a list of -key replacement pairs. For example, specifying \"a\" \"b\" will bind \"a\" to -\"b\"'s definition in the keymap. Specifying nil as a replacement will unbind a -key. If DESTRUCTIVE is nil, a backup of the keymap will be stored on the initial -invocation, and future invocations will always look up keys in the backup -keymap. When no TRANSLATIONS are given, this function will only create the -backup keymap without making any translations. On the other hand, if DESTRUCTIVE -is non-nil, the keymap will be destructively altered without creating a backup. -For example, calling this function multiple times with \"a\" \"b\" \"b\" \"a\" -would continue to swap and unswap the definitions of these keys. This means that -when DESTRUCTIVE is non-nil, all related swaps/cycles should be done in the same -invocation." - (declare (indent defun)) - (unless (listp modes) - (setq modes (list modes))) - (unless (and (listp states) - (not (null states))) - (setq states (list states))) - (dolist (mode-symbol modes) - (let ((keymap-symbol (intern (format "%S-map" mode-symbol)))) - (dolist (state states) - (let ((hook-name - (symbol-name - (gensym - (format "evil-collection-translate-key-in-%s" keymap-symbol))))) - (evil-collection--delay `(and (boundp ',keymap-symbol) - (keymapp ,keymap-symbol)) - `(evil-collection--translate-minor-mode-key - ',state - ',mode-symbol - ',translations - ,destructive) - 'after-load-functions - t - nil - hook-name)))))) - - -(defun evil-collection--translate-minor-mode-key (state - mode-symbol - translations - destructive) - "Helper function for `evil-collection-translate-minor-mode-key'. -In the minor mode keymap corresponding to STATE and MODE-SYMBOL, make the key -TRANSLATIONS. When DESTRUCTIVE is non-nil, make the TRANSLATIONS destructively -without creating/referencing a backup keymap." - (let* ((keymap-symbol (intern (format "%S-map" mode-symbol))) - (backup-keymap-symbol (intern (format "evil-collection-%s%s-backup-map" - mode-symbol - (if state - (format "-%s-state" state) - "")))) - (keymap (symbol-value keymap-symbol)) - (lookup-keymap (if (and (not destructive) - (boundp backup-keymap-symbol)) - (symbol-value backup-keymap-symbol) - (copy-keymap - (if state - (evil-get-minor-mode-keymap state mode-symbol) - keymap)))) - (maps (cl-loop for (key replacement) on translations by 'cddr - ;; :destructive can be in TRANSLATIONS - unless (keywordp key) - collect key - and collect (when replacement - (evil-lookup-key lookup-keymap replacement))))) - (unless (or destructive - (boundp backup-keymap-symbol)) - (set backup-keymap-symbol lookup-keymap)) - (apply #'evil-define-minor-mode-key state mode-symbol maps))) - -(defun evil-collection--translate-key (state keymap-symbol - translations - destructive) - "Helper function for `evil-collection-translate-key'. -In the keymap corresponding to STATE and KEYMAP-SYMBOL, make the key -TRANSLATIONS. When DESTRUCTIVE is non-nil, make the TRANSLATIONS destructively -without creating/referencing a backup keymap." - (let* ((backup-keymap-symbol (intern (format "evil-collection-%s%s-backup-map" - keymap-symbol - (if state - (format "-%s-state" state) - "")))) - (keymap (symbol-value keymap-symbol)) - (lookup-keymap (if (and (not destructive) - (boundp backup-keymap-symbol)) - (symbol-value backup-keymap-symbol) - (copy-keymap - (if state - (evil-get-auxiliary-keymap keymap state t t) - keymap)))) - (maps (cl-loop for (key replacement) on translations by 'cddr - ;; :destructive can be in TRANSLATIONS - unless (keywordp key) - collect key - and collect (when replacement - (evil-lookup-key lookup-keymap replacement))))) - (unless (or destructive - (boundp backup-keymap-symbol)) - (set backup-keymap-symbol lookup-keymap)) - (apply #'evil-define-key* state keymap maps))) - -;;;###autoload -(cl-defun evil-collection-translate-key (states keymaps - &rest translations - &key destructive - &allow-other-keys) - "Translate keys in the keymap(s) corresponding to STATES and KEYMAPS. -STATES should be the name of an evil state, a list of states, or nil. KEYMAPS -should be a symbol corresponding to the keymap to make the translations in or a -list of keymap symbols. Like `evil-define-key', when a keymap does not exist, -the keybindings will be deferred until the keymap is defined, so -`with-eval-after-load' is not necessary. TRANSLATIONS corresponds to a list of -key replacement pairs. For example, specifying \"a\" \"b\" will bind \"a\" to -\"b\"'s definition in the keymap. Specifying nil as a replacement will unbind a -key. If DESTRUCTIVE is nil, a backup of the keymap will be stored on the initial -invocation, and future invocations will always look up keys in the backup -keymap. When no TRANSLATIONS are given, this function will only create the -backup keymap without making any translations. On the other hand, if DESTRUCTIVE -is non-nil, the keymap will be destructively altered without creating a backup. -For example, calling this function multiple times with \"a\" \"b\" \"b\" \"a\" -would continue to swap and unswap the definitions of these keys. This means that -when DESTRUCTIVE is non-nil, all related swaps/cycles should be done in the same -invocation." - (declare (indent defun)) - (unless (listp keymaps) - (setq keymaps (list keymaps))) - (unless (and (listp states) - (not (null states))) - (setq states (list states))) - (dolist (keymap-symbol keymaps) - (dolist (state states) - (let ((hook-name - (symbol-name - (gensym - (format "evil-collection-translate-key-in-%s" keymap-symbol))))) - (evil-collection--delay `(and (boundp ',keymap-symbol) - (keymapp ,keymap-symbol)) - `(evil-collection--translate-key - ',state - ',keymap-symbol - ',translations - ,destructive) - 'after-load-functions - t - nil - hook-name))))) - - -;;;###autoload -(defmacro evil-collection-swap-key (states keymaps &rest args) - "Wrapper around `evil-collection-translate-key' for swapping keys. -STATES, KEYMAPS, and ARGS are passed to `evil-collection-translate-key'. ARGS -should consist of key swaps (e.g. \"a\" \"b\" is equivalent to \"a\" \"b\" \"b\" -\"a\" with `evil-collection-translate-key') and optionally keyword arguments for -`evil-collection-translate-key'." - (declare (indent defun)) - (setq args (cl-loop for (key replacement) on args by 'cddr - collect key and collect replacement - and unless (keywordp key) - collect replacement and collect key)) - `(evil-collection-translate-key ,states ,keymaps ,@args)) - -;;;###autoload -(defmacro evil-collection-swap-minor-mode-key (states modes &rest args) - "Wrapper around `evil-collection-translate-minor-mode-key' for swapping keys. -STATES, MODES, and ARGS are passed to -`evil-collection-translate-minor-mode-key'. ARGS should consist of key swaps -\(e.g. \"a\" \"b\" is equivalent to \"a\" \"b\" \"b\" \"a\" -with `evil-collection-translate-minor-mode-key') and optionally keyword -arguments for `evil-collection-translate-minor-mode-key'." - (declare (indent defun)) - (setq args (cl-loop for (key replacement) on args by 'cddr - collect key and collect replacement - and unless (keywordp key) - collect replacement and collect key)) - `(evil-collection-translate-minor-mode-key ,states ,modes ,@args)) - -;;;###autoload -(defun evil-collection-require (mode &optional noerror) - "Require the evil-collection-MODE file, but do not activate it. - -MODE should be a symbol. This requires the evil-collection-MODE -feature without needing to manipulate `load-path'. NOERROR is -forwarded to `require'." - (let* ((mode-name (symbol-name mode)) - (feature (intern (format "evil-collection-%s" mode-name))) - (file (expand-file-name - (format "modes/%s/evil-collection-%s" mode-name mode-name) - evil-collection-base-dir))) - (require feature file noerror))) - -(declare-function evil-collection-unimpaired-setup "evil-collection-unimpaired") - -;;;###autoload -(defun evil-collection-init (&optional modes) - "Register the Evil bindings for all modes in `evil-collection-mode-list'. - -Alternatively, you may register select bindings manually, for -instance: - - (with-eval-after-load \='calendar - (evil-collection-calendar-setup)) - -If MODES is specified (as either one mode or a list of modes), use those modes -instead of the modes in `evil-collection-mode-list'." - (interactive) - (evil-collection-maybe-display-startup-warning) - (if modes - (or (listp modes) (setq modes (list modes))) - (setq modes evil-collection-mode-list)) - (dolist (mode modes) - (let ((m mode) - (reqs (list mode))) - (when (listp mode) - (setq m (car mode) - reqs (cdr mode))) - (dolist (req reqs) - (with-eval-after-load req - ;; (message (format "Loaded %S..." req)) - (evil-collection-require m) - (funcall (intern (concat "evil-collection-" (symbol-name m) - "-setup"))) - (let ((mode-keymaps - (ignore-errors - (symbol-value - (intern (format "evil-collection-%s-maps" m)))))) - (when (or evil-collection-always-run-setup-hook-after-load - (not (memq m evil-collection--modes-with-delayed-setup))) - (run-hook-with-args 'evil-collection-setup-hook - m mode-keymaps))))))) - (when evil-collection-want-unimpaired-p - (evil-collection-require 'unimpaired) - (evil-collection-unimpaired-setup))) - -(defun evil-collection-setup (&optional modes) - "Register the Evil bindings for all modes in `evil-collection-mode-list'. - -----------------------EXPERIMENTAL------------------------------------------ - -This is a special wrapper over `evil-collection-init' that respects -configuration from `evil-collection-config'. This function is experimental, -so don't use if you don't want breakages or API changes. - -If MODES is specified (as either one mode or a list of modes), use those modes -instead of the modes in `evil-collection-mode-list'. - -----------------------EXPERIMENTAL------------------------------------------" - (if modes - (or (listp modes) (setq modes (list modes))) - (setq modes evil-collection-mode-list)) - (let ((configs evil-collection-config) - (deferred) ; alist of (mode . delay) - (hooked)) ; alist of (mode . hook) - (dolist (config configs) - (if-let* ((hook (plist-get (cdr config) :hook))) - (push (cons (car config) hook) hooked) - (when-let* ((defer (plist-get (cdr config) :defer))) - (push (cons (car config) defer) deferred)))) - (let ((filtered-modes - (cl-remove-if - (lambda (mode) - ;; `evil-collection-config' format is slightly different - ;; than `evil-collection-mode-list', so use the mode - ;; entry from the mode list instead. - (cl-some - (lambda (m) - (or (when-let* ((entry (assq m deferred))) - (setf (car entry) mode) t) - (when-let* ((entry (assq m hooked))) - (setf (car entry) mode) t))) - (if (consp mode) mode (list mode)))) - modes))) - (evil-collection-init filtered-modes)) - (message (format "Deferring: %S" (mapcar #'car deferred))) - (dolist (entry deferred) - (let ((mode (car entry)) - (delay (cdr entry))) - (run-with-idle-timer - (if (numberp delay) delay evil-collection-defer-delay) nil - (apply-partially 'evil-collection-init (list mode))))) - (dolist (entry hooked) - (let* ((mode (car entry)) - (hook-sym (cdr entry)) - (hook-name (let ((name (symbol-name hook-sym))) - (if (string-suffix-p "-hook" name) - hook-sym - (intern (concat name "-hook"))))) - (mode-sym (if (consp mode) (car mode) mode)) - (fn-sym (intern (format "evil-collection--init-%s" mode-sym)))) - (defalias fn-sym - (lambda () - (remove-hook hook-name fn-sym) - (evil-collection-init (list mode)))) - (add-hook hook-name fn-sym))))) - -(defvar evil-collection-delete-operators '(evil-delete - evil-cp-delete - evil-sp-delete - lispyville-delete) - "List of delete operators.") - -(defvar evil-collection-yank-operators '(evil-yank - evil-cp-yank - evil-sp-yank - lispyville-yank) - "List of yank operators.") - -;;* Search - -(defun evil-collection-evil-search-enabled () - (eq evil-search-module 'evil-search)) - -(defvar evil-collection-evil-search-forward - '(menu-item "" nil :filter (lambda (&optional _) - (if (eq evil-search-module 'evil-search) - #'evil-ex-search-forward - #'evil-search-forward)))) - -(defvar evil-collection-evil-search-backward - '(menu-item "" nil :filter (lambda (&optional _) - (if (eq evil-search-module 'evil-search) - #'evil-ex-search-backward - #'evil-search-backward)))) - -(defvar evil-collection-evil-search-next - '(menu-item "" nil :filter (lambda (&optional _) - (if (eq evil-search-module 'evil-search) - #'evil-ex-search-next - #'evil-search-next)))) - -(defvar evil-collection-evil-search-previous - '(menu-item "" nil :filter (lambda (&optional _) - (if (eq evil-search-module 'evil-search) - #'evil-ex-search-previous - #'evil-search-previous)))) - -(provide 'evil-collection) -;;; evil-collection.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/.nosearch b/.config/emacs/lisp/evil-collection/modes/.nosearch deleted file mode 100644 index e69de29..0000000 diff --git a/.config/emacs/lisp/evil-collection/modes/2048-game/evil-collection-2048-game.el b/.config/emacs/lisp/evil-collection/modes/2048-game/evil-collection-2048-game.el deleted file mode 100644 index ce64221..0000000 --- a/.config/emacs/lisp/evil-collection/modes/2048-game/evil-collection-2048-game.el +++ /dev/null @@ -1,54 +0,0 @@ -;;; evil-collection-2048-game.el --- Evil bindings for `2048-game' -*- lexical-binding: t -*- - -;; Copyright (C) 2019 James Nguyen - -;; Author: Daniel Phan -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, games - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `2048-game'. - -;;; Code: -(require 'evil-collection) -(require '2048-game nil t) - -(defconst evil-collection-2048-game-maps '(2048-mode-map)) - -;;;###autoload -(defun evil-collection-2048-game-setup () - "Set up `evil' bindings for `2048-game'." - (evil-set-initial-state '2048-mode 'normal) - (evil-collection-define-key 'normal '2048-mode-map - "h" '2048-left - "j" '2048-down - "k" '2048-up - "l" '2048-right - "r" '2048-random-move - (kbd "") '2048-up - (kbd "") '2048-left - (kbd "") '2048-right - (kbd "") '2048-down - "q" 'quit-window - "ZQ" 'evil-quit - "ZZ" 'quit-window)) - -(provide 'evil-collection-2048-game) -;;; evil-collection-2048-game.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/ag/README.org b/.config/emacs/lisp/evil-collection/modes/ag/README.org deleted file mode 100644 index 48ceccc..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ag/README.org +++ /dev/null @@ -1,22 +0,0 @@ -* ag - - Evil bindings for [[https://github.com/Wilfred/ag.el][ag]] search result buffers. - - Initial state for =ag-mode= is forced to =normal= so the buffer can be - edited with [[https://github.com/mhayashi1120/Emacs-wgrep][wgrep]]. - -** Key bindings - - Applied in =normal= and =visual= states. - - | Command | Original | Evil | - |------------------------------+----------+-------------------| - | =evil-previous-line= | | =k= | - | =evil-backward-char= | | =h= | - | =recompile= | =g= | =gr= | - | =compilation-next-error= | =n= | =gj=, =C-j=, =]]= | - | =compilation-previous-error= | =p= | =gk=, =C-k=, =[[= | - | =evil-search-backward= | | =?= | - | =evil-search-forward= | | =/= | - | =evil-search-next= | | =n= | - | =evil-search-previous= | | =N= | diff --git a/.config/emacs/lisp/evil-collection/modes/ag/evil-collection-ag.el b/.config/emacs/lisp/evil-collection/modes/ag/evil-collection-ag.el deleted file mode 100644 index 0ce8b90..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ag/evil-collection-ag.el +++ /dev/null @@ -1,63 +0,0 @@ -;;; evil-collection-ag.el --- Evil Bindings for Ag -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, ag, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `ag-mode' from the `wgrep-ag' package. - -;;; Code: -(require 'ag nil t) -(require 'evil-collection) - -(defconst evil-collection-ag-maps '(ag-mode-map)) - -;;;###autoload -(defun evil-collection-ag-setup () - "Set up `evil' bindings for `ag'." - (evil-collection-define-key '(normal visual) 'ag-mode-map - "k" 'evil-previous-line - "h" 'evil-backward-char - - ;; refresh - "gr" 'recompile - - ;; navigation - "gj" 'compilation-next-error - "gk" 'compilation-previous-error - (kbd "C-j") 'compilation-next-error - (kbd "C-k") 'compilation-previous-error - "]]" 'compilation-next-error - "[[" 'compilation-previous-error - - ;; search - "?" evil-collection-evil-search-backward - "/" evil-collection-evil-search-forward - "n" evil-collection-evil-search-next - "N" evil-collection-evil-search-previous) - ;; `ag' is best set in 'normal state because its buffer can be edited. - ;; https://github.com/mhayashi1120/Emacs-wgrep - (evil-set-initial-state 'ag-mode 'normal)) - -(provide 'evil-collection-ag) -;;; evil-collection-ag.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/agent-shell/README.org b/.config/emacs/lisp/evil-collection/modes/agent-shell/README.org deleted file mode 100644 index a362a2f..0000000 --- a/.config/emacs/lisp/evil-collection/modes/agent-shell/README.org +++ /dev/null @@ -1,137 +0,0 @@ -* agent-shell - - Evil bindings for [[https://github.com/xenodium/agent-shell][agent-shell]] -- a - comint-based chat REPL with permission prompts, a side viewport and a diff - buffer. - -** agent-shell-mode-map - - Upstream's =n= / =p= top-level bindings are unset so they don't intercept - keystrokes in insert state; in insert they self-insert. - -*** Permission dispatch (normal state) - - Only active when =evil-collection-agent-shell-want-permission-bindings= is - non-nil. Each key falls through to its default evil command unless a - pending permission button is visible. - - | Command | Action | Evil | - |-------------------------------------------------------+------------------+------| - | =evil-collection-agent-shell-permission-view-diff= | view diff =v= | =v= | - | =evil-collection-agent-shell-permission-allow-once= | allow =y= | =y= | - | =evil-collection-agent-shell-permission-reject-once= | reject =C-c C-c= | =n= | - | =evil-collection-agent-shell-permission-allow-always= | always allow =!= | =!= | - -*** Navigation (normal state) - - | Command | Original | Evil | - |----------------------------------+----------+-------------| - | =agent-shell-next-item= | =n= | =TAB= | - | =agent-shell-previous-item= | =p= | == | - | =agent-shell-cycle-session-mode= | n/a | =C-= | - -*** g-prefix (only when =evil-collection-want-g-bindings=) - - | Command | Evil | - |----------------------------------+------| - | =agent-shell-cycle-session-mode= | =gs= | - | =agent-shell-interrupt= | =gx= | - | =agent-shell-set-session-mode= | =gm= | - | =agent-shell-set-session-model= | =gv= | - | =agent-shell-other-buffer= | =go= | - | =agent-shell-yank-dwim= | =gp= | - | =agent-shell-reload= | =gr= | - | =agent-shell-restart= | =gR= | - | =agent-shell-fork= | =gF= | - | =agent-shell-copy-session-id= | =gy= | - | =agent-shell-prompt-compose= | =gc= | - | =agent-shell-queue-request= | =gq= | - | =agent-shell-open-transcript= | =gt= | - -** agent-shell-viewport-edit-mode-map - - The viewport's compose buffer. Standard save/quit verbs become send/cancel. - - | Command | Original | Evil | - |------------------------------------------+-----------+--------------------------------| - | =agent-shell-viewport-compose-send= | =C-c C-c= | =:w=, =:wq=, =ZZ=, =RET= remap | - | =agent-shell-viewport-compose-cancel= | =C-c C-k= | =:q=, =ZQ= | - | =agent-shell-viewport-previous-history= | n/a | =M-k= | - | =agent-shell-viewport-next-history= | n/a | =M-j= | - | =agent-shell-viewport-compose-peek-last= | n/a | =C-o= | - - When =evil-collection-want-g-bindings= is non-nil: - - | Command | Evil | - |------------------------------------------+------| - | =agent-shell-viewport-compose-help-menu= | =g?= | - | =agent-shell-cycle-session-mode= | =gs= | - | =agent-shell-viewport-set-session-mode= | =gm= | - | =agent-shell-viewport-set-session-model= | =gv= | - | =agent-shell-other-buffer= | =go= | - | =agent-shell-yank-dwim= | =gp= | - | =agent-shell-viewport-search-history= | =g/= | - | =agent-shell-viewport-copy-session-id= | =gy= | - | =agent-shell-viewport-open-transcript= | =gt= | - -** agent-shell-viewport-view-mode-map - - Read-only viewport. =RET= / =:w= / =ZZ= all interrupt the agent; =:q= / - =ZQ= bury. - - | Command | Original | Evil | - |--------------------------------------+-----------+-------------------------| - | =agent-shell-viewport-interrupt= | =C-c C-c= | =RET=, =:w=, =ZZ= remap | - | =bury-buffer= | =q= | =q=, =ZQ=, =:q= remap | - | =agent-shell-viewport-next-item= | =n= | =TAB=, =gj= | - | =agent-shell-viewport-previous-item= | =p= | ==, =gk= | - | =agent-shell-viewport-next-page= | =f= | =C-j= | - | =agent-shell-viewport-previous-page= | =b= | =C-k= | - - When =evil-collection-want-g-bindings= is non-nil: - - | Command | Evil | - |-------------------------------------------+--------------| - | =agent-shell-viewport-reply-1..9= | =g1= .. =g9= | - | =agent-shell-viewport-cycle-session-mode= | =gs= | - | =agent-shell-viewport-set-session-model= | =gv= | - | =agent-shell-other-buffer= | =go= | - | =agent-shell-viewport-set-session-mode= | =gm= | - | =agent-shell-viewport-help-menu= | =g?= | - | =agent-shell-viewport-reply= | =gr= | - | =agent-shell-viewport-reply-yes= | =gy= | - | =agent-shell-viewport-reply-more= | =gM= | - | =agent-shell-viewport-reply-again= | =ga= | - | =agent-shell-viewport-reply-continue= | =gc= | - | =agent-shell-viewport-edit= | =ge= | - | =agent-shell-viewport-fork= | =gF= | - | =agent-shell-viewport-copy-session-id= | =gY= | - | =agent-shell-viewport-open-transcript= | =gt= | - | =agent-shell-viewport-refresh= | =gz= | - -** agent-shell-diff-mode-map - - | Command | Original | Evil (=g-bindings=) | Evil (no =g-bindings=) | - |-------------------------------+----------+---------------------+------------------------| - | =agent-shell-diff-open-file= | =f= | =gf= | =f= | - | =agent-shell-diff-accept-all= | =y= | =gy= | =y= | - | =agent-shell-diff-reject-all= | =n= | =gn= | =n= | - | =kill-current-buffer= | n/a | =q= | =q= | - -** New commands - - | Command | Purpose | - |-------------------------------------------------------+----------------------------------------------------| - | =evil-collection-agent-shell-permission-allow-once= | Press =y= on the latest pending permission button. | - | =evil-collection-agent-shell-permission-reject-once= | Send =C-c C-c= to it. | - | =evil-collection-agent-shell-permission-allow-always= | Press =!=. | - | =evil-collection-agent-shell-permission-view-diff= | Press =v=. | - - Each only fires when a pending permission button is visible -- otherwise the - keymap entry resolves to nil via a =:filter= and evil's default takes over. - -** Customization - - | Variable | Default | Purpose | - |--------------------------------------------------------+---------+-------------------------------------------------------| - | =evil-collection-agent-shell-want-permission-bindings= | =t= | Bind =y= / =n= / =!= / =v= for the dispatchers above. | diff --git a/.config/emacs/lisp/evil-collection/modes/agent-shell/evil-collection-agent-shell.el b/.config/emacs/lisp/evil-collection/modes/agent-shell/evil-collection-agent-shell.el deleted file mode 100644 index c738d94..0000000 --- a/.config/emacs/lisp/evil-collection/modes/agent-shell/evil-collection-agent-shell.el +++ /dev/null @@ -1,254 +0,0 @@ -;;; evil-collection-agent-shell.el --- Bindings for agent-shell -*- lexical-binding: t -*- - -;; Copyright (C) 2026 Joseph LaFreniere - -;; Author: Joseph LaFreniere -;; Maintainer: Joseph LaFreniere -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "29.1")) -;; Keywords: evil, agent-shell, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for agent-shell. - -;;; Code: -(require 'evil-collection) -(require 'agent-shell nil t) - -(defconst evil-collection-agent-shell-maps '(agent-shell-mode-map - agent-shell-viewport-edit-mode-map - agent-shell-viewport-view-mode-map - agent-shell-diff-mode-map)) - -(defvar agent-shell-mode-map) -(defvar agent-shell-viewport-edit-mode-map) -(defvar agent-shell-viewport-view-mode-map) -(defvar agent-shell-diff-mode-map) - -(defcustom evil-collection-agent-shell-want-permission-bindings t - "When non-nil, bind permission button keys in normal state. - -`y', `n', `!', and `v' will activate the latest pending permission -button when one is visible, and fall through to their default Evil -commands otherwise." - :type 'boolean - :group 'evil-collection) - -;;; Permission button helpers. - -(defun evil-collection-agent-shell--latest-permission-keymap () - "Return the keymap of the latest pending permission button, or nil. -Walks the buffer backward from `point-max' looking for text with the -`agent-shell-permission-button' property -- the navigatable single-char -marker that `agent-shell--make-permission-button' adds to each button." - (save-excursion - (goto-char (point-max)) - (when-let* ((match (text-property-search-backward - 'agent-shell-permission-button t t))) - (get-text-property (prop-match-beginning match) 'keymap)))) - -(defun evil-collection-agent-shell--pending-permission-p () - "Return non-nil when the current buffer has a pending permission button." - (and (evil-collection-agent-shell--latest-permission-keymap) t)) - -(defun evil-collection-agent-shell--press (key) - "Dispatch KEY through the latest pending permission's button keymap. -KEY is a string passed to `kbd'." - (let* ((km (or (evil-collection-agent-shell--latest-permission-keymap) - (user-error "No pending permission"))) - (binding (lookup-key km (kbd key)))) - (cond - ((commandp binding) (call-interactively binding)) - ((null binding) (user-error "No `%s' action on this permission" key)) - (t (user-error "Unexpected binding for `%s': %S" key binding))))) - -(defun evil-collection-agent-shell-permission-allow-once () - "Allow the latest pending tool-call permission once." - (interactive) - (evil-collection-agent-shell--press "y")) - -(defun evil-collection-agent-shell-permission-reject-once () - "Reject the latest pending tool-call permission and interrupt the agent." - (interactive) - (evil-collection-agent-shell--press "C-c C-c")) - -(defun evil-collection-agent-shell-permission-allow-always () - "Always-allow the tool kind for the latest pending permission." - (interactive) - (evil-collection-agent-shell--press "!")) - -(defun evil-collection-agent-shell-permission-view-diff () - "View the diff for the latest pending permission, if any." - (interactive) - (evil-collection-agent-shell--press "v")) - -(defvar evil-collection-agent-shell-permission-allow-once - `(menu-item "" nil :filter - ,(lambda (&optional _) - (when (evil-collection-agent-shell--pending-permission-p) - 'evil-collection-agent-shell-permission-allow-once)))) - -(defvar evil-collection-agent-shell-permission-reject-once - `(menu-item "" nil :filter - ,(lambda (&optional _) - (when (evil-collection-agent-shell--pending-permission-p) - 'evil-collection-agent-shell-permission-reject-once)))) - -(defvar evil-collection-agent-shell-permission-allow-always - `(menu-item "" nil :filter - ,(lambda (&optional _) - (when (evil-collection-agent-shell--pending-permission-p) - 'evil-collection-agent-shell-permission-allow-always)))) - -(defvar evil-collection-agent-shell-permission-view-diff - `(menu-item "" nil :filter - ,(lambda (&optional _) - (when (evil-collection-agent-shell--pending-permission-p) - 'evil-collection-agent-shell-permission-view-diff)))) - -;;;###autoload -(defun evil-collection-agent-shell-setup () - "Set up `evil' bindings for `agent-shell'." - ;; `agent-shell-mode-map' binds \"n\" and \"p\" at the map level, which causes - ;; them to intercept keystrokes even in insert state. Remove those bindings - ;; entirely. - (if (fboundp 'keymap-unset) - (progn - (keymap-unset agent-shell-mode-map "n" t) - (keymap-unset agent-shell-mode-map "p" t)) - (define-key agent-shell-mode-map "n" nil) - (define-key agent-shell-mode-map "p" nil)) - - (evil-collection-define-key 'insert 'agent-shell-mode-map - "n" 'self-insert-command - "p" 'self-insert-command) - - (when evil-collection-agent-shell-want-permission-bindings - (evil-collection-define-key 'normal 'agent-shell-mode-map - "v" evil-collection-agent-shell-permission-view-diff - "y" evil-collection-agent-shell-permission-allow-once - "n" evil-collection-agent-shell-permission-reject-once - "!" evil-collection-agent-shell-permission-allow-always)) - - (evil-collection-define-key 'normal 'agent-shell-mode-map - (kbd "TAB") 'agent-shell-next-item - "" 'agent-shell-previous-item - (kbd "C-") 'agent-shell-cycle-session-mode) - - (when evil-collection-want-g-bindings - (evil-collection-define-key 'normal 'agent-shell-mode-map - "gs" 'agent-shell-cycle-session-mode - "gx" 'agent-shell-interrupt - "gm" 'agent-shell-set-session-mode - "gv" 'agent-shell-set-session-model - "go" 'agent-shell-other-buffer - "gp" 'agent-shell-yank-dwim - "gr" 'agent-shell-reload - "gR" 'agent-shell-restart - "gF" 'agent-shell-fork - "gy" 'agent-shell-copy-session-id - "gc" 'agent-shell-prompt-compose - "gq" 'agent-shell-queue-request - "gt" 'agent-shell-open-transcript)) - - (evil-collection-define-key 'normal 'agent-shell-viewport-edit-mode-map - [remap evil-save-and-close] 'agent-shell-viewport-compose-send - [remap evil-save-modified-and-close] 'agent-shell-viewport-compose-send - [remap evil-ret] 'agent-shell-viewport-compose-send - [remap evil-write] 'agent-shell-viewport-compose-send - [remap evil-quit] 'agent-shell-viewport-compose-cancel - "M-k" 'agent-shell-viewport-previous-history - "M-j" 'agent-shell-viewport-next-history - (kbd "C-o") 'agent-shell-viewport-compose-peek-last) - - (when evil-collection-want-g-bindings - (evil-collection-define-key 'normal 'agent-shell-viewport-edit-mode-map - "g?" 'agent-shell-viewport-compose-help-menu - "gs" 'agent-shell-cycle-session-mode - "gm" 'agent-shell-viewport-set-session-mode - "gv" 'agent-shell-viewport-set-session-model - "go" 'agent-shell-other-buffer - "gp" 'agent-shell-yank-dwim - "g/" 'agent-shell-viewport-search-history - "gy" 'agent-shell-viewport-copy-session-id - "gt" 'agent-shell-viewport-open-transcript)) - - (evil-collection-define-key 'normal 'agent-shell-viewport-view-mode-map - [remap evil-save-and-close] 'agent-shell-viewport-interrupt - [remap evil-save-modified-and-close] 'agent-shell-viewport-interrupt - [remap evil-ret] 'agent-shell-viewport-interrupt - [remap evil-write] 'agent-shell-viewport-interrupt - [remap evil-quit] 'bury-buffer - (kbd "TAB") 'agent-shell-viewport-next-item - (kbd "") 'agent-shell-viewport-previous-item - "gj" 'agent-shell-viewport-next-item - "gk" 'agent-shell-viewport-previous-item - (kbd "C-j") 'agent-shell-viewport-next-page - (kbd "C-k") 'agent-shell-viewport-previous-page - "q" 'bury-buffer) - - (when evil-collection-want-g-bindings - (evil-collection-define-key 'normal 'agent-shell-viewport-view-mode-map - "g1" 'agent-shell-viewport-reply-1 - "g2" 'agent-shell-viewport-reply-2 - "g3" 'agent-shell-viewport-reply-3 - "g4" 'agent-shell-viewport-reply-4 - "g5" 'agent-shell-viewport-reply-5 - "g6" 'agent-shell-viewport-reply-6 - "g7" 'agent-shell-viewport-reply-7 - "g8" 'agent-shell-viewport-reply-8 - "g9" 'agent-shell-viewport-reply-9 - "gs" 'agent-shell-viewport-cycle-session-mode - "gv" 'agent-shell-viewport-set-session-model - "go" 'agent-shell-other-buffer - "gm" 'agent-shell-viewport-set-session-mode - "g?" 'agent-shell-viewport-help-menu - ;; Maybe move elsewhere. - "gr" 'agent-shell-viewport-reply - "gy" 'agent-shell-viewport-reply-yes - "gM" 'agent-shell-viewport-reply-more - "ga" 'agent-shell-viewport-reply-again - "gc" 'agent-shell-viewport-reply-continue - "ge" 'agent-shell-viewport-edit - "gF" 'agent-shell-viewport-fork - "gY" 'agent-shell-viewport-copy-session-id - "gt" 'agent-shell-viewport-open-transcript - "gz" 'agent-shell-viewport-refresh)) - - (evil-collection-define-key 'normal 'agent-shell-diff-mode-map - "q" #'kill-current-buffer) - - (if evil-collection-want-g-bindings - (evil-collection-define-key 'normal 'agent-shell-diff-mode-map - "gf" 'agent-shell-diff-open-file - "gy" 'agent-shell-diff-accept-all - "gn" 'agent-shell-diff-reject-all) - (evil-collection-define-key 'normal 'agent-shell-diff-mode-map - "f" 'agent-shell-diff-open-file - "y" 'agent-shell-diff-accept-all - "n" 'agent-shell-diff-reject-all)) - - (add-hook 'agent-shell-diff-mode-hook #'evil-normalize-keymaps) - (add-hook 'agent-shell-mode-hook #'evil-normalize-keymaps) - (add-hook 'agent-shell-viewport-view-mode-hook #'evil-normalize-keymaps) - (add-hook 'agent-shell-viewport-edit-mode-hook #'evil-normalize-keymaps) - - (advice-add 'agent-shell-jump-to-latest-permission-button-row - :after (lambda (&rest _) (evil-normalize-keymaps)))) - -(provide 'evil-collection-agent-shell) -;;; evil-collection-agent-shell.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/alchemist/evil-collection-alchemist.el b/.config/emacs/lisp/evil-collection/modes/alchemist/evil-collection-alchemist.el deleted file mode 100644 index 43a823d..0000000 --- a/.config/emacs/lisp/evil-collection/modes/alchemist/evil-collection-alchemist.el +++ /dev/null @@ -1,114 +0,0 @@ -;;; evil-collection-alchemist.el --- Bindings for `alchemist' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, alchemist, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `alchemist'. - -;;; Code: -(require 'evil-collection) -(require 'alchemist nil t) - -(defconst evil-collection-alchemist-maps '(alchemist-compile-mode-map - alchemist-eval-mode-map - alchemist-execute-mode-map - alchemist-message-mode-map - alchemist-help-minor-mode-map - alchemist-macroexpand-mode-map - alchemist-mix-mode-map - alchemist-test-report-mode-map - alchemist-mode-map)) - - -;;;###autoload -(defun evil-collection-alchemist-setup () - "Set up `evil' bindings for `alchemist'." - (evil-set-initial-state 'alchemist-compile-mode 'normal) - (evil-set-initial-state 'alchemist-eval-mode 'normal) - (evil-set-initial-state 'alchemist-execute-mode 'normal) - (evil-set-initial-state 'alchemist-message-mode 'normal) - (evil-set-initial-state 'alchemist-help-minor-mode 'normal) - (evil-set-initial-state 'alchemist-macroexpand-mode 'normal) - (evil-set-initial-state 'alchemist-refcard-mode 'normal) - (evil-set-initial-state 'alchemist-mix-mode 'normal) - (evil-set-initial-state 'alchemist-test-mode 'normal) - (evil-set-initial-state 'alchemist-test-report-mode 'normal) - - (evil-collection-define-key 'normal 'alchemist-compile-mode-map - "q" 'quit-window) - - (evil-collection-define-key 'normal 'alchemist-eval-mode-map - "q" 'quit-window) - - (evil-collection-define-key 'normal 'alchemist-execute-mode-map - "q" 'quit-window) - - (evil-collection-define-key 'normal 'alchemist-message-mode-map - "q" 'quit-window) - - (evil-collection-define-key 'normal 'alchemist-help-minor-mode-map - "q" 'quit-window - "K" 'alchemist-help-search-at-point - "m" 'alchemist-help-module - "s" 'alchemist-help - "gh" 'alchemist-help-history - "gd" 'alchemist-goto-definition-at-point - "g?" 'alchemist-help-minor-mode-key-binding-summary) - - (evil-collection-define-key 'normal 'alchemist-macroexpand-mode-map - "q" 'quit-window) - - (evil-collection-define-key 'normal 'alchemist-refcard-mode-map - "gd" 'alchemist-refcard--describe-funtion-at-point - "g?" 'alchemist-refcard--describe-funtion-at-point - "q" 'quit-window) - - (evil-collection-define-key 'normal 'alchemist-mix-mode-map - "q" 'quit-window - "i" 'alchemist-mix-send-input-to-mix-process - "gr" 'alchemist-mix-rerun-last-task) - - (evil-collection-define-key 'normal 'alchemist-test-report-mode-map - "q" 'quit-window - "t" 'toggle-truncate-lines - "gr" 'alchemist-mix-rerun-last-test - "gj" 'alchemist-test-next-result - "gk" 'alchemist-test-previous-result - (kbd "C-j") 'alchemist-test-next-result - (kbd "C-k") 'alchemist-test-previous-result - "]]" 'alchemist-test-next-stacktrace-file - "[[" 'alchemist-test-previous-stacktrace-file - (kbd "C-c C-k") 'alchemist-report-interrupt-current-process) - - (evil-collection-define-key 'normal 'alchemist-mode-map - "gz" 'alchemist-iex-run - "K" 'alchemist-help-search-at-point - "gd" 'alchemist-goto-definition-at-point - (kbd "C-t") 'alchemist-goto-jump-back - "g?" 'alchemist-help - (kbd "C-j") 'alchemist-goto-jump-to-next-def-symbol - (kbd "C-k") 'alchemist-goto-jump-to-previous-def-symbol)) - -(provide 'evil-collection-alchemist) -;;; evil-collection-alchemist.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/anaconda-mode/evil-collection-anaconda-mode.el b/.config/emacs/lisp/evil-collection/modes/anaconda-mode/evil-collection-anaconda-mode.el deleted file mode 100644 index a37ecf6..0000000 --- a/.config/emacs/lisp/evil-collection/modes/anaconda-mode/evil-collection-anaconda-mode.el +++ /dev/null @@ -1,66 +0,0 @@ -;;; evil-collection-anaconda-mode.el --- Bindings for `anaconda-mode' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, python, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `anaconda-mode'. - -;;; Code: -(require 'anaconda-mode nil t) -(require 'evil-collection) - -(defconst evil-collection-anaconda-mode-maps '(anaconda-view-mode-map - anaconda-mode-map)) - -;;;###autoload -(defun evil-collection-anaconda-mode-setup () - "Set up `evil' bindings for `anaconda-mode'." - ;; Bindings don't seem to be set the first time. - (add-hook 'anaconda-mode-hook #'evil-normalize-keymaps) - - ;; latest anaconda has replaced view mode by an xref implementation, - ;; anaconda stable uses `anaconda-view-mode-map' - (when (boundp 'anaconda-view-mode-map) - (evil-collection-define-key 'normal 'anaconda-view-mode-map - "gj" 'next-error-no-select - "gk" 'previous-error-no-select - (kbd "C-j") 'next-error-no-select - (kbd "C-k") 'previous-error-no-select - "]]" 'next-error-no-select - "[[" 'previous-error-no-select - "q" 'quit-window)) - - (evil-collection-define-key 'normal 'anaconda-mode-map - "gd" 'anaconda-mode-find-definitions - (kbd "C-t") (if (fboundp 'anaconda-mode-go-back) - 'anaconda-mode-go-back - 'xref-pop-marker-stack) - "K" 'anaconda-mode-show-doc) - - (when evil-collection-want-find-usages-bindings - (evil-collection-define-key 'normal 'anaconda-mode-map - "gA" 'anaconda-mode-find-assignments - "gr" 'anaconda-mode-find-references))) - -(provide 'evil-collection-anaconda-mode) -;;; evil-collection-anaconda-mode.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/apropos/README.org b/.config/emacs/lisp/evil-collection/modes/apropos/README.org deleted file mode 100644 index 650102a..0000000 --- a/.config/emacs/lisp/evil-collection/modes/apropos/README.org +++ /dev/null @@ -1,15 +0,0 @@ -* apropos - - Evil bindings for =apropos-mode=. - -** Key bindings - - | Command | Original | Evil | - |-------------------+----------+-----------| - | =apropos-follow= | =RET= | =RET= | - | =forward-button= | =TAB= | =TAB= | - | =backward-button= | =S-TAB= | =S-TAB= | - | =describe-mode= | =h=, =?= | =g?= | - | =revert-buffer= | =g= | =gr= | - | =quit-window= | =q= | =q=, =ZZ= | - | =evil-quit= | n/a | =ZQ= | diff --git a/.config/emacs/lisp/evil-collection/modes/apropos/evil-collection-apropos.el b/.config/emacs/lisp/evil-collection/modes/apropos/evil-collection-apropos.el deleted file mode 100644 index 7820a49..0000000 --- a/.config/emacs/lisp/evil-collection/modes/apropos/evil-collection-apropos.el +++ /dev/null @@ -1,52 +0,0 @@ -;;; evil-collection-apropos.el --- Evil bindings for apropos-mode -*- lexical-binding: t -*- - -;; Copyright (C) 2019 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, help, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `apropos-mode'. - -;;; Code: -(require 'evil-collection) -(require 'apropos) - -(defconst evil-collection-apropos-maps '(apropos-mode-map)) - -;;;###autoload -(defun evil-collection-apropos-setup () - "Set up `evil' bindings for `apropos'." - (evil-set-initial-state 'apropos-mode 'normal) - (evil-collection-define-key 'normal 'apropos-mode-map - (kbd "RET") 'apropos-follow - (kbd "TAB") 'forward-button - (kbd "S-TAB") 'backward-button - "g?" 'describe-mode - "gr" 'revert-buffer - - ;; quit - "q" 'quit-window - "ZQ" 'evil-quit - "ZZ" 'quit-window)) - -(provide 'evil-collection-apropos) -;;; evil-collection-apropos.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/arc-mode/README.org b/.config/emacs/lisp/evil-collection/modes/arc-mode/README.org deleted file mode 100644 index 178486b..0000000 --- a/.config/emacs/lisp/evil-collection/modes/arc-mode/README.org +++ /dev/null @@ -1,30 +0,0 @@ -* arc-mode - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/File-Archives.html][arc-mode]] (archive file browser). - - =arc-mode= and =archive-mode= start in normal state. - -** Key bindings - - | Command | Original | Evil | - |--------------------------------+-----------------+------------------------------| - | =archive-next-line= | =n=, =C-n= | =j=, =C-j=, =gj=, =n=, =C-n= | - | =archive-previous-line= | =p=, =C-p= | =k=, =C-k=, =gk=, =p=, =C-p= | - | =beginning-of-buffer= | =<= | =gg=, =<= | - | =end-of-buffer= | =>= | =G=, =>= | - | =archive-extract= | =RET=, =e=, =f= | =RET= | - | =archive-extract-other-window= | =o= | =go=, =S-RET= | - | =archive-view= | =v= | =M-RET= | - | =archive-alternate-display= | =a= | =a= | - | =archive-flag-deleted= | =d=, =C-d= | =d=, =C-d= | - | =archive-rename-entry= | =r= | =r= | - | =archive-expunge= | =x= | =x= | - | =archive-copy-file= | =C= | =C= | - | =archive-chmod-entry= | =M= | =M= | - | =archive-chown-entry= | =O= | =O= | - | =archive-chgrp-entry= | =G= | =P= | - | =archive-mark= | =m= | =m= | - | =archive-unflag= | =u= | =u= | - | =archive-unmark-all-files= | =M-DEL= | =U=, =M-DEL= | - | =revert-buffer= | =g= | =gr= | - | =quit-window= | =q= | =q= | diff --git a/.config/emacs/lisp/evil-collection/modes/arc-mode/evil-collection-arc-mode.el b/.config/emacs/lisp/evil-collection/modes/arc-mode/evil-collection-arc-mode.el deleted file mode 100644 index 7392b37..0000000 --- a/.config/emacs/lisp/evil-collection/modes/arc-mode/evil-collection-arc-mode.el +++ /dev/null @@ -1,78 +0,0 @@ -;;; evil-collection-arc-mode.el --- Evil bindings for arc-mode -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, arc-mode, archive, bindings, files - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Evil bindings for arc-mode. - -;;; Code: -(require 'arc-mode) -(require 'evil-collection) - -(defconst evil-collection-arc-mode-maps '(archive-mode-map)) - -;;;###autoload -(defun evil-collection-arc-mode-setup () - "Set up `evil' bindings for `arc-mode'." - (evil-set-initial-state 'arc-mode 'normal) - (evil-set-initial-state 'archive-mode 'normal) - (evil-collection-define-key 'normal 'archive-mode-map - "j" 'archive-next-line - "k" 'archive-previous-line - (kbd "C-j") 'archive-next-line - (kbd "C-k") 'archive-previous-line - "gj" 'archive-next-line - "gk" 'archive-previous-line - - "gg" 'beginning-of-buffer - "G" 'end-of-buffer - - ;; open - (kbd "RET") 'archive-extract - (kbd "S-") 'archive-extract-other-window - (kbd "M-") 'archive-view - "go" 'archive-extract-other-window - - "a" 'archive-alternate-display - "d" 'archive-flag-deleted - "r" 'archive-rename-entry - "x" 'archive-expunge - "C" 'archive-copy-file - "M" 'archive-chmod-entry - "O" 'archive-chown-entry - "P" 'archive-chgrp-entry - - ;; refresh - "gr" 'revert-buffer - - ;; mark - "m" 'archive-mark - "u" 'archive-unflag - "U" 'archive-unmark-all-files - - ;; quit - "q" 'quit-window)) - -(provide 'evil-collection-arc-mode) -;;; evil-collection-arc-mode.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/atomic-chrome/evil-collection-atomic-chrome.el b/.config/emacs/lisp/evil-collection/modes/atomic-chrome/evil-collection-atomic-chrome.el deleted file mode 100644 index 61d2eb2..0000000 --- a/.config/emacs/lisp/evil-collection/modes/atomic-chrome/evil-collection-atomic-chrome.el +++ /dev/null @@ -1,42 +0,0 @@ -;;; evil-collection-atomic-chrome.el --- Evil bindings for atomic-chrome -*- lexical-binding: t -*- - -;; Copyright (C) 2022 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for atomic-chrome. - -;;; Code: -(require 'evil-collection) -(require 'atomic-chrome nil t) - -(defconst evil-collection-atomic-chrome-maps nil) - -;;;###autoload -(defun evil-collection-atomic-chrome-setup () - "Set up `evil' bindings for `atomic-chrome'." - ;; The browser is in "inserted" state, makes it consistent. - (evil-set-initial-state 'atomic-chrome-edit-mode 'insert)) - -(provide 'evil-collection-atomic-chrome) -;;; evil-collection-atomic-chrome.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/auto-package-update/evil-collection-auto-package-update.el b/.config/emacs/lisp/evil-collection/modes/auto-package-update/evil-collection-auto-package-update.el deleted file mode 100644 index 7f832b7..0000000 --- a/.config/emacs/lisp/evil-collection/modes/auto-package-update/evil-collection-auto-package-update.el +++ /dev/null @@ -1,44 +0,0 @@ -;;; evil-collection-auto-package-update.el --- Evil bindings for auto-package-update -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, auto-package-update, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for auto-package-update. - -;;; Code: -(require 'evil-collection) -(require 'auto-package-update nil t) - -(defconst evil-collection-auto-package-update-maps '(auto-package-update-minor-mode-map)) - -;;;###autoload -(defun evil-collection-auto-package-update-setup () - "Set up `evil' bindings for `auto-package-update'." - (add-hook 'auto-package-update-minor-mode-hook 'evil-normalize-keymaps) - (evil-collection-define-key 'normal 'auto-package-update-minor-mode-map - "q" 'quit-window)) - -(provide 'evil-collection-auto-package-update) - -;;; evil-collection-auto-package-update.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/beginend/evil-collection-beginend.el b/.config/emacs/lisp/evil-collection/modes/beginend/evil-collection-beginend.el deleted file mode 100644 index 715a471..0000000 --- a/.config/emacs/lisp/evil-collection/modes/beginend/evil-collection-beginend.el +++ /dev/null @@ -1,125 +0,0 @@ -;;; evil-collection-beginend.el --- Evil bindings for beginend -*- lexical-binding: t -*- - -;; Copyright (C) 2021 Balaji Sivaraman - -;; Author: Balaji Sivaraman -;; Maintainer: Balaji Sivaraman -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for beginend. - -;;; Code: - -(require 'evil-collection) -(require 'beginend nil t) - -(eval-and-compile - (defconst evil-collection-beginend-modes '(bs-mode - rg-mode - org-mode - deft-mode - prog-mode - LaTeX-mode - dired-mode - latex-mode - nroam-mode - occur-mode - vc-dir-mode - ibuffer-mode - message-mode - outline-mode - prodigy-mode - org-agenda-mode - compilation-mode - epa-key-list-mode - magit-status-mode - elfeed-search-mode - elfeed-show-mode - magit-revision-mode - notmuch-search-mode - recentf-dialog-mode))) - - -(defmacro evil-beginend--define-goto-beginning-motion (ec-mode-name) - "Macro to define new Evil motion that will use the corresponding -beginend-goto-beginning function for EC-MODE-NAME when count is not -provided for the motion; otherwise behave like `evil-goto-first-line' -if count is provided. - -This will also associate the regular Evil `gg' keybinding with the -newly defined motion." - (let ((motion-name (intern (format "evil-beginend-%s-goto-beginning" ec-mode-name))) - (beginend-beginning-fn-name (intern (format "beginend-%s-goto-beginning" ec-mode-name))) - (beginend-map-name (intern (format "beginend-%s-map" ec-mode-name)))) - `(progn - (declare-function ,motion-name "evil-collection") - (declare-function ,beginend-beginning-fn-name "ext:beginend") - (evil-define-motion ,motion-name (count) - :jump t - :type line - (if count - (evil-goto-first-line count) - (,beginend-beginning-fn-name))) - (evil-collection-define-key 'normal ',beginend-map-name - "gg" ',motion-name)))) - -(defmacro evil-beginend--define-goto-end-motion (ec-mode-name) - "Macro to define new Evil motion that will use the corresponding -beginend-goto-end function for EC-MODE-NAME when count is not -provided for the motion; otherwise behave like `evil-goto-line' -if count is provided. - -This will also associate the regular Evil `G' keybinding with the -newly defined motion." - (let ((motion-name (intern (format "evil-beginend-%s-goto-end" ec-mode-name))) - (beginend-end-fn-name (intern (format "beginend-%s-goto-end" ec-mode-name))) - (beginend-map-name (intern (format "beginend-%s-map" ec-mode-name)))) - `(progn - (declare-function ,motion-name "evil-collection") - (declare-function ,beginend-end-fn-name "ext:beginend") - (evil-define-motion ,motion-name (count) - :jump t - :type line - (if count - (evil-goto-line count) - (,beginend-end-fn-name))) - (evil-collection-define-key 'normal ',beginend-map-name - "G" ',motion-name)))) - -(defmacro evil-beginend--define-mode-motions () - "Define the goto-beginning and goto-end motions for all modes in -`evil-collection-beginend-modes'." - `(progn - ,@(mapcar - (lambda (mode-symbol) - (let ((mode-string (symbol-name mode-symbol))) - `(progn - (evil-beginend--define-goto-beginning-motion ,mode-string) - (evil-beginend--define-goto-end-motion ,mode-string)))) - evil-collection-beginend-modes))) - -;;;###autoload -(defun evil-collection-beginend-setup () - "Set up `evil' bindings for `beginend'." - (evil-beginend--define-mode-motions)) - -(provide 'evil-collection-beginend) -;;; evil-collection-beginend.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/bluetooth/evil-collection-bluetooth.el b/.config/emacs/lisp/evil-collection/modes/bluetooth/evil-collection-bluetooth.el deleted file mode 100644 index 8d18604..0000000 --- a/.config/emacs/lisp/evil-collection/modes/bluetooth/evil-collection-bluetooth.el +++ /dev/null @@ -1,59 +0,0 @@ -;;; evil-collection-bluetooth.el --- Bindings for `bluetooth' -*- lexical-binding: t -*- - -;; Copyright (C) 2022 Arian Dehghani - -;; Author: Arian Dehghani -;; Maintainer: Arian Dehghani -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "27.1")) -;; Keywords: evil, emacs, tools, blutooth - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `bluetooth'. - -;;; Code: -(require 'evil-collection) -(require 'bluetooth nil t) - -(defvar bluetooth-mode-map) - -(defconst evil-collection-bluetooth-maps '(bluetooth-mode-map)) - -;;;###autoload -(defun evil-collection-bluetooth-setup () - "Set up `evil' bindings for `bluetooth'." - (evil-collection-set-readonly-bindings 'bluetooth-mode-map) - (evil-collection-define-key 'normal 'bluetooth-mode-map - "c" 'bluetooth-connect - "d" 'bluetooth-disconnect - "b" 'bluetooth-toggle-blocked - "t" 'bluetooth-toggle-trusted - "a" 'bluetooth-set-alias - "r" 'bluetooth-start-discovery - "R" 'bluetooth-stop-discovery - "s" 'bluetooth-toggle-powered - "P" 'bluetooth-pair - "D" 'bluetooth-toggle-discoverable - "x" 'bluetooth-toggle-pairable - "i" 'bluetooth-show-device-info - "A" 'bluetooth-show-adapter-info - "K" 'bluetooth-remove-device - "<" 'bluetooth-beginning-of-list - ">" 'bluetooth-end-of-list)) - -(provide 'evil-collection-bluetooth) -;;; evil-collection-bluetooth.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/bm/evil-collection-bm.el b/.config/emacs/lisp/evil-collection/modes/bm/evil-collection-bm.el deleted file mode 100644 index d4470f5..0000000 --- a/.config/emacs/lisp/evil-collection/modes/bm/evil-collection-bm.el +++ /dev/null @@ -1,54 +0,0 @@ -;;; evil-collection-bm.el --- Evil bindings for bm -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, bm, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for bm. - -;;; Code: -(require 'evil-collection) -(require 'bm nil t) - -(defconst evil-collection-bm-maps '(bm-show-mode-map)) - -;;;###autoload -(defun evil-collection-bm-setup () - "Set up `evil' bindings for `bm'." - (evil-set-initial-state 'bm-show-mode 'normal) - - (evil-collection-define-key 'normal 'bm-show-mode-map - "q" 'bm-show-quit-window - "gr" 'revert-buffer - "g?" 'describe-mode - - "j" 'bm-show-next - "k" 'bm-show-prev - - ;; open - (kbd "RET") 'bm-show-goto-bookmark - (kbd "S-") 'bm-show-bookmark)) - - -(provide 'evil-collection-bm) -;;; evil-collection-bm.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/bookmark/README.org b/.config/emacs/lisp/evil-collection/modes/bookmark/README.org deleted file mode 100644 index 5d3aa8e..0000000 --- a/.config/emacs/lisp/evil-collection/modes/bookmark/README.org +++ /dev/null @@ -1,36 +0,0 @@ -* bookmark - - Evil bindings for the bookmark list (=bookmark-bmenu-mode=). - - Standard motion / quit bindings come from =evil-collection-set-readonly-bindings= - and are not repeated below. - -** Key bindings - - | Command | Original | Evil | - |---------------------------------------+-----------------+------------------------------| - | =bookmark-bmenu-this-window= | =RET=, =f=, =j= | =RET= | - | =bookmark-bmenu-other-window= | =o= | =o=, =go=, =S-RET= | - | =bookmark-bmenu-switch-other-window= | =C-o= | =gO=, =M-RET= | - | =bookmark-bmenu-select= | =v= | =o= (see above; =v= unbound) | - | =bookmark-bmenu-1-window= | =1= | =1= | - | =bookmark-bmenu-2-window= | =2= | =2= | - | =bookmark-bmenu-other-frame= | =5= | =5= | - | =bookmark-bmenu-delete= | =d=, =k= | =d= | - | =bookmark-bmenu-delete-backwards= | =C-d= | =D= | - | =bookmark-bmenu-execute-deletions= | =x= | =x= | - | =bookmark-bmenu-search= | =/= | =s= (=s= also via custom) | - | =bookmark-bmenu-rename= | =r= | =r= | - | =bookmark-bmenu-relocate= | =R= | =R= | - | =bookmark-bmenu-load= | =l= | =L= | - | =bookmark-bmenu-save= | =s= | =s=, remap of =evil-write= | - | =bookmark-bmenu-toggle-filenames= | =t= | =t= | - | =bookmark-bmenu-locate= | =w= | =W= | - | =bookmark-bmenu-show-annotation= | =a= | =a= | - | =bookmark-bmenu-show-all-annotations= | =A= | =A= | - | =bookmark-bmenu-edit-annotation= | =e= | =E= | - | =bookmark-bmenu-mark= | =m= | =m= | - | =bookmark-bmenu-mark-all= | =M= | =M= | - | =bookmark-bmenu-unmark= | =u= | =u= | - | =bookmark-bmenu-unmark-all= | =U= | =U= | - | =bookmark-bmenu-backup-unmark= | =DEL= | =DEL= | diff --git a/.config/emacs/lisp/evil-collection/modes/bookmark/evil-collection-bookmark.el b/.config/emacs/lisp/evil-collection/modes/bookmark/evil-collection-bookmark.el deleted file mode 100644 index f21ad32..0000000 --- a/.config/emacs/lisp/evil-collection/modes/bookmark/evil-collection-bookmark.el +++ /dev/null @@ -1,78 +0,0 @@ -;;; evil-collection-bookmark.el --- Evil bindings for bookmarks -*- lexical-binding: t -*- - -;; Copyright (C) 2017, 2022 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, bookmark, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for bookmarks. - -;;; Code: -(require 'evil-collection) -(require 'bookmark) - -(defconst evil-collection-bookmark-maps '(bookmark-bmenu-mode-map)) - -;;;###autoload -(defun evil-collection-bookmark-setup () - "Set up `evil' bindings for `bookmark'." - (evil-set-initial-state 'bookmark-bmenu-mode 'normal) - (evil-collection-set-readonly-bindings 'bookmark-bmenu-mode-map) - (evil-collection-define-key 'normal 'bookmark-bmenu-mode-map - [remap evil-write] 'bookmark-bmenu-save - - "1" 'bookmark-bmenu-1-window - "2" 'bookmark-bmenu-2-window - "5" 'bookmark-bmenu-other-frame - "d" 'bookmark-bmenu-delete - "x" 'bookmark-bmenu-execute-deletions - "s" 'bookmark-bmenu-search - "r" 'bookmark-bmenu-rename - "R" 'bookmark-bmenu-relocate - "L" 'bookmark-bmenu-load - "t" 'bookmark-bmenu-toggle-filenames - "W" 'bookmark-bmenu-locate - "D" 'bookmark-bmenu-delete-backwards - - ;; annotation - "a" 'bookmark-bmenu-show-annotation - "A" 'bookmark-bmenu-show-all-annotations - "E" 'bookmark-bmenu-edit-annotation - - ;; mark - "u" 'bookmark-bmenu-unmark - "U" 'bookmark-bmenu-unmark-all - "m" 'bookmark-bmenu-mark - "M" 'bookmark-bmenu-mark-all - - ;; open - "o" 'bookmark-bmenu-select - "O" 'bookmark-bmenu-other-window - "go" 'bookmark-bmenu-other-window - "gO" 'bookmark-bmenu-switch-other-window - (kbd "DEL") 'bookmark-bmenu-backup-unmark - (kbd "RET") 'bookmark-bmenu-this-window - (kbd "S-") 'bookmark-bmenu-other-window - (kbd "M-") 'bookmark-bmenu-switch-other-window)) - -(provide 'evil-collection-bookmark) -;;; evil-collection-bookmark.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/buff-menu/README.org b/.config/emacs/lisp/evil-collection/modes/buff-menu/README.org deleted file mode 100644 index b048631..0000000 --- a/.config/emacs/lisp/evil-collection/modes/buff-menu/README.org +++ /dev/null @@ -1,35 +0,0 @@ -* buff-menu - - Evil bindings for the buffer list (=Buffer-menu-mode=). - -** Key bindings - - | Command | Original | Evil | - |--------------------------------------+-----------------+--------------------| - | =Buffer-menu-this-window= | =RET=, =f=, =e= | =RET=, =go=, =C-m= | - | =Buffer-menu-other-window= | =o= | =gO= | - | =Buffer-menu-select= | =v= | =gv= | - | =Buffer-menu-view= | =V= | =gV= | - | =Buffer-menu-delete= | =d=, =k= | =d=, =C-k= | - | =Buffer-menu-delete-backwards= | =C-d= | =C-d= | - | =Buffer-menu-execute= | =x= | =x= | - | =Buffer-menu-save= | =s= | =s= | - | =Buffer-menu-bury= | =b= | =X= | - | =Buffer-menu-mark= | =m= | =m= | - | =Buffer-menu-unmark= | =u= | =u= | - | =Buffer-menu-unmark-all= | =U= | =U= | - | =Buffer-menu-backup-unmark= | =DEL= | =DEL= | - | =Buffer-menu-not-modified= | =~= | =~= | - | =Buffer-menu-toggle-read-only= | =%= | =%= | - | =Buffer-menu-toggle-files-only= | =T= | =T= | - | =Buffer-menu-visit-tags-table= | =t= | =t= | - | =tabulated-list-sort= | =S= | =o= | - | =revert-buffer= | =g= | =gr= | - | =evil-visual-char= | n/a | =v= | - | =quit-window= | =q= | =q=, =ZZ= | - | =evil-quit= | n/a | =ZQ= | - | =Buffer-menu-1-window= | =1= | =1= | - | =Buffer-menu-2-window= | =2= | =2= | - | =Buffer-menu-isearch-buffers= | =M-s a C-s= | =M-s a C-s= | - | =Buffer-menu-isearch-buffers-regexp= | =M-s a M-C-s= | =M-s a M-C-s= | - | =Buffer-menu-multi-occur= | =M-s a C-o= | =M-s a C-o= | diff --git a/.config/emacs/lisp/evil-collection/modes/buff-menu/evil-collection-buff-menu.el b/.config/emacs/lisp/evil-collection/modes/buff-menu/evil-collection-buff-menu.el deleted file mode 100644 index a754978..0000000 --- a/.config/emacs/lisp/evil-collection/modes/buff-menu/evil-collection-buff-menu.el +++ /dev/null @@ -1,78 +0,0 @@ -;;; evil-collection-buff-menu.el --- Bindings for `buff-menu' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `buff-menu'. - -;;; Code: -(require 'evil-collection) - -(defconst evil-collection-buff-menu-maps '(Buffer-menu-mode-map)) - -;;;###autoload -(defun evil-collection-buff-menu-setup () - "Set up `evil' bindings for `buff-menu'.." - (evil-set-initial-state 'Buffer-menu-mode 'normal) - - (evil-collection-define-key 'normal 'Buffer-menu-mode-map - "ZQ" 'evil-quit - "ZZ" 'quit-window - "gr" 'revert-buffer - "go" 'Buffer-menu-this-window - "gO" 'Buffer-menu-other-window - "d" 'Buffer-menu-delete - "s" 'Buffer-menu-save - [mouse-2] 'Buffer-menu-mouse-select - [follow-link] 'mouse-face - "x" 'Buffer-menu-execute - "o" 'tabulated-list-sort - "gv" 'Buffer-menu-select - "gV" 'Buffer-menu-view - "v" 'evil-visual-char - - ;; mark - "u" 'Buffer-menu-unmark - "U" 'Buffer-menu-unmark-all - "m" 'Buffer-menu-mark - - "X" 'Buffer-menu-bury - - ;; Default ones, unchanged. Redundant ones commented - "2" 'Buffer-menu-2-window - "1" 'Buffer-menu-1-window - (kbd "C-m") 'Buffer-menu-this-window - (kbd "C-k") 'Buffer-menu-delete - (kbd "C-d") 'Buffer-menu-delete-backwards - (kbd "") 'Buffer-menu-backup-unmark - "~" 'Buffer-menu-not-modified - "t" 'Buffer-menu-visit-tags-table - "%" 'Buffer-menu-toggle-read-only - "T" 'Buffer-menu-toggle-files-only - (kbd "M-s a C-s") 'Buffer-menu-isearch-buffers - (kbd "M-s a M-C-s") 'Buffer-menu-isearch-buffers-regexp - (kbd "M-s a C-o") 'Buffer-menu-multi-occur)) - -(provide 'evil-collection-buff-menu) -;;; evil-collection-buff-menu.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/bufler/evil-collection-bufler.el b/.config/emacs/lisp/evil-collection/modes/bufler/evil-collection-bufler.el deleted file mode 100644 index 85aa748..0000000 --- a/.config/emacs/lisp/evil-collection/modes/bufler/evil-collection-bufler.el +++ /dev/null @@ -1,57 +0,0 @@ -;;; evil-collection-bufler.el --- Evil bindings for mpdel -*- lexical-binding: t -*- - -;; Copyright (C) 2023 Ruoyu Feng - -;; Author: Ruoyu Feng -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "27.1")) -;; Keywords: evil, tools, bufler, buffer list - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for bufler. - -;;; Code: - -(require 'bufler nil t) -(require 'evil-collection) - -(defvar bufler-list-mode-map) - -(defconst evil-collection-bufler-maps '(bufler-list-mode-map)) - -(defconst evil-collection-bufler-modes '(bufler-list-mode)) - -;;;###autoload -(defun evil-collection-bufler-setup () - "Set up `evil' bindings for `bufler'." - - (evil-collection-set-readonly-bindings 'bufler-list-mode-map) - (dolist (mode evil-collection-bufler-modes) - (evil-set-initial-state mode 'normal)) - (evil-collection-define-key 'normal 'bufler-list-mode-map - "?" 'hydra:bufler/body - "B" 'bufler - "f" 'bufler-list-group-frame - "F" 'bufler-list-group-make-frame - "r" 'bufler-list-buffer-name-workspace - "D" 'bufler-list-buffer-kill - "w" 'bufler-list-buffer-save - (kbd "RET") 'bufler-list-buffer-switch - "J" 'bufler-list-buffer-peek)) - -(provide 'evil-collection-bufler) -;;; evil-collection-bufler.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/calc/README.org b/.config/emacs/lisp/evil-collection/modes/calc/README.org deleted file mode 100644 index 97a2e1b..0000000 --- a/.config/emacs/lisp/evil-collection/modes/calc/README.org +++ /dev/null @@ -1,52 +0,0 @@ -* calc - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/calc/index.html][calc]]. - - Standard motion / quit bindings come from =evil-collection-set-readonly-bindings= - and are not repeated below. Calc's =calc-ext= prefix maps (=V=, =Y=, =Z=, =a=, - =b=, =c=, =f=, =g=, =m=, =r=, =s=, =t=, =v=) are kept on their original keys; - prefixes that conflict with evil motions are relocated. - -** Key bindings - - | Command | Original | Evil | - |-----------------------------+--------------------------+---------------------------| - | =calc-enter= | =RET= | =RET=, =SPC= | - | =calc-over= | =C-j= | =S-RET= | - | =calc-roll-down= | =TAB= | =TAB= | - | =calc-roll-up= | =M-TAB= | =C-M-i= | - | =calc-pop= | =DEL=, ==, =C-d= | =DEL=, == | - | =calc-pop-above= | =M-DEL=, =M-d= | =M-DEL=, =C-M-d= | - | =calc-kill= | =C-k= | =d= | - | =calc-kill-region= (visual) | =C-w= | =d= | - | =calc-yank= | =C-y= | =pp= | - | =calc-copy-to-buffer= | =y= | =pP= | - | =calc-copy-as-kill= | =M-k= | =M-k= | - | =calc-copy-region-as-kill= | =M-w= | =M-w= | - | =calc-undo= | =U= | =u= | - | =calc-redo= | =D= | =D= (via prefix relocate) | - | =calc-precision= | =p= | =C-p= | - | =calc-call-last-kbd-macro= | =X= | =X= | - | =calc-help= | =?= | =?= | - | =calc-info= | =i= | =i= | - | =calc-quit= | =q= | =q= | - | =calc-last-args= | =M-RET= | =M-RET= | - | =calc-percent= | =M-%= | =M-%= | - | =calc-transpose-lines= | =C-x C-t= | =C-x C-t= | - | =calc-total-algebraic-mode= | =m t= | =M-m t= | - -** Relocated prefix maps - - Calc prefixes are moved off keys that conflict with evil motion or operators: - - | Original prefix | Evil prefix | - |-----------------+-------------| - | =d= | =D= | - | =j= | =zj= | - | =k= | =zk= | - | =l= | =zl= | - | =u= | =U= | - | =z= | =zz= | - - All operator / digit / symbol keys (=+=, =-=, =*=, =/=, digits, =A=–=T=, =[[=, - =]]=, etc.) keep their default calc bindings. diff --git a/.config/emacs/lisp/evil-collection/modes/calc/evil-collection-calc.el b/.config/emacs/lisp/evil-collection/modes/calc/evil-collection-calc.el deleted file mode 100644 index 8f35b98..0000000 --- a/.config/emacs/lisp/evil-collection/modes/calc/evil-collection-calc.el +++ /dev/null @@ -1,172 +0,0 @@ -;;; evil-collection-calc.el --- Evil bindings for calc -*- lexical-binding: t -*- - -;; Copyright (C) 2018 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen , Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, calc, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for calc. - -;;; Code: -(require 'evil-collection) -(require 'calc) - -(defconst evil-collection-calc-maps '(calc-mode-map)) - -;;;###autoload -(defun evil-collection-calc-setup () - "Set up `evil' bindings for `calc'." - (evil-collection-set-readonly-bindings 'calc-mode-map) - (evil-set-initial-state 'calc-mode 'normal) - - ;; Calc sets up its bindings just-in-time for its "extensions". I don't think - ;; it's worth copying this clumsy design (for what performance benefit?), - ;; while making the bindings much harder to maintain. - (require 'calc-ext) - - (evil-collection-define-key 'normal 'calc-mode-map - "0" 'calcDigit-start - "1" 'calcDigit-start - "2" 'calcDigit-start - "3" 'calcDigit-start - "4" 'calcDigit-start - "5" 'calcDigit-start - "6" 'calcDigit-start - "7" 'calcDigit-start - "8" 'calcDigit-start - "9" 'calcDigit-start - - (kbd "") 'calc-roll-down - (kbd "S-") 'calc-over - (kbd "RET") 'calc-enter - (kbd "SPC") 'calc-enter - - (kbd "C-x C-t") 'calc-transpose-lines - (kbd "C-M-d") 'calc-pop-above - (kbd "C-M-i") 'calc-roll-up - (kbd "M-RET") 'calc-last-args - (kbd "C-M-w") 'kill-ring-save - (kbd "M-%") 'calc-percent - (kbd "M-k") 'calc-copy-as-kill - (kbd "M-w") 'calc-copy-region-as-kill - (kbd "M-DEL") 'calc-pop-above - (kbd "M-m t") 'calc-total-algebraic-mode - (kbd "") 'calc-pop - (kbd "") 'calc-yank - (kbd "DEL") 'calc-pop ; was "C-d" - "d" 'calc-kill ; was "C-k" - "u" 'calc-undo ; was "U" - "X" 'calc-call-last-kbd-macro ; "@" is already used. - "pp" 'calc-yank ; was "C-y" - "pP" 'calc-copy-to-buffer ; was "y" - - (kbd "C-p") 'calc-precision ; was "p" - - "?" 'calc-help - ;; "h" 'calc-help-prefix ; TODO: Rebind? - "i" 'calc-info - - "\"" 'calc-auto-algebraic-entry - "$" 'calc-auto-algebraic-entry ; TODO: No need for this one? - "'" 'calc-algebraic-entry - - "!" 'calc-factorial - "#" 'calcDigit-start - "%" 'calc-mod - "&" 'calc-inv - "(" 'calc-begin-complex - ")" 'calc-end-complex - "*" 'calc-times - "+" 'calc-plus - "," 'calc-comma - "-" 'calc-minus - "." 'calcDigit-start - "/" 'calc-divide - ":" 'calc-fdiv - ";" 'calc-semi ; TODO: Shall we really override `evil-ex'? - "<" 'calc-scroll-left - "=" 'calc-evaluate - ">" 'calc-scroll-right - "@" 'calcDigit-start - "A" 'calc-abs - "B" 'calc-log - "C" 'calc-cos - ;; "D" 'calc-redo ; TODO: What's the purpose of this? Bind to C-r? - "E" 'calc-exp - "F" 'calc-floor - "G" 'calc-argument - "H" 'calc-hyperbolic - "I" 'calc-inverse - "J" 'calc-conj - "K" 'calc-keep-args - "L" 'calc-ln - "M" 'calc-more-recursion-depth - "N" 'calc-eval-num - "O" 'calc-option - "P" 'calc-pi - "Q" 'calc-sqrt - "R" 'calc-round - "S" 'calc-sin - "T" 'calc-tan - "[[" 'calc-begin-vector - "]]" 'calc-end-vector - "\\" 'calc-idiv - "^" 'calc-power - "_" 'calcDigit-start - "`" 'calc-edit - "e" 'calcDigit-start - "n" 'calc-change-sign - "o" 'calc-realign - "w" 'calc-why - "x" 'calc-execute-extended-command - "|" 'calc-concat - "{" 'calc-scroll-down ; TODO: Not necessary? - "}" 'calc-scroll-up ; TODO: Not necessary? - "~" 'calc-num-prefix - - "V" (lookup-key calc-mode-map (kbd "V")) - "Y" (lookup-key calc-mode-map (kbd "Y")) - "Z" (lookup-key calc-mode-map (kbd "Z")) - "a" (lookup-key calc-mode-map (kbd "a")) - "b" (lookup-key calc-mode-map (kbd "b")) - "c" (lookup-key calc-mode-map (kbd "c")) - "D" (lookup-key calc-mode-map (kbd "d")) - "f" (lookup-key calc-mode-map (kbd "f")) - "g" (lookup-key calc-mode-map (kbd "g")) - "zj" (lookup-key calc-mode-map (kbd "j")) - "zk" (lookup-key calc-mode-map (kbd "k")) - "zl" (lookup-key calc-mode-map (kbd "l")) - "m" (lookup-key calc-mode-map (kbd "m")) - "r" (lookup-key calc-mode-map (kbd "r")) - "s" (lookup-key calc-mode-map (kbd "s")) - "t" (lookup-key calc-mode-map (kbd "t")) - "U" (lookup-key calc-mode-map (kbd "u")) - "v" (lookup-key calc-mode-map (kbd "v")) - "zz" (lookup-key calc-mode-map (kbd "z")) - - ;; quit - "q" 'calc-quit) - - (evil-collection-define-key 'visual 'calc-mode-map - "d" 'calc-kill-region)) - -(provide 'evil-collection-calc) -;;; evil-collection-calc.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/calendar/README.org b/.config/emacs/lisp/evil-collection/modes/calendar/README.org deleted file mode 100644 index 2733b42..0000000 --- a/.config/emacs/lisp/evil-collection/modes/calendar/README.org +++ /dev/null @@ -1,63 +0,0 @@ -* calendar - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Calendar_002fDiary.html][calendar]]. - -** Key bindings - - | Command | Original | Evil | - |--------------------------------------+----------------+---------------------| - | =calendar-backward-day= | =C-b=, =left= | =h= | - | =calendar-forward-day= | =C-f=, =right= | =l= | - | =calendar-backward-week= | =C-p=, =up= | =k= | - | =calendar-forward-week= | =C-n=, =down= | =j= | - | =calendar-beginning-of-week= | =C-a= | =0=, =^= | - | =calendar-end-of-week= | =C-e= | =$= | - | =calendar-beginning-of-month= | =M-a= | =(= | - | =calendar-end-of-month= | =M-e= | =)= | - | =calendar-backward-month= | =M-{= | ={=, =C-k=, =gk= | - | =calendar-forward-month= | =M-}= | =}=, =C-j=, =gj= | - | =calendar-backward-year= | =C-x [= | =[[= | - | =calendar-forward-year= | =C-x ]= | =]]= | - | =calendar-beginning-of-year= | =M-<= | =M-<= | - | =calendar-end-of-year= | =M->= | =M->= | - | =calendar-scroll-right= | =>=, =C-x <= | =<= | - | =calendar-scroll-left= | =<=, =C-x >= | =>= | - | =calendar-scroll-right-three-months= | =M-v=, =prior= | =C-b= | - | =calendar-scroll-left-three-months= | =C-v=, =next= | =C-f= | - | =scroll-other-window= | =SPC= | =SPC= | - | =scroll-other-window-down= | =S-SPC=, =DEL= | =S-SPC=, == | - | =calendar-set-mark= | =C-SPC= | =v= | - | =calendar-goto-today= | =.= | =.= | - | =calendar-other-month= | =o= | =o=, =gD= | - | =calendar-goto-date= | =g d= | =gd= | - | =diary-view-entries= | =d= | =d= | - | =diary-view-other-diary-entries= | =D= | =D= | - | =diary-mark-entries= | =m= | =m= | - | =diary-show-all-entries= | =s= | =s= | - | =appt-add= | =A a= | =Aa= | - | =appt-delete= | =A d= | =Ad= | - | =calendar-unmark= | =u= | =u= | - | =calendar-mark-holidays= | =x= | =x= | - | =calendar-list-holidays= | =a= | =a=, =gh= | - | =calendar-cursor-holidays= | =h= | =r= | - | =calendar-lunar-phases= | =M= | =gm= | - | =calendar-sunrise-sunset= | =S= | =gs= | - | =org-calendar-goto-agenda= | n/a | =gc= | - | =calendar-redraw= | =C-c C-l= | =gr= | - | =calendar-goto-info-node= | =?= | =?=, =g?= | - | =calendar-count-days-region= | =M-== | =M-== | - | =calendar-exit= | =q= | =q=, =ZZ= | - | =evil-quit= | n/a | =ZQ= | - -** Org integration - - When =evil-collection-calendar-want-org-bindings= is non-nil, the key named by - =org-calendar-to-agenda-key= (default =c=) is bound to =org-calendar-goto-agenda=, - and =org-calendar-insert-diary-entry-key= (default =i=) to =org-agenda-diary-entry= - when =org-agenda-diary-file= is set. - -** Customization - - | Variable | Default | Purpose | - |----------------------------------------------+---------+---------------------------------------------| - | =evil-collection-calendar-want-org-bindings= | =nil= | Install =org-calendar-*= bindings on entry. | diff --git a/.config/emacs/lisp/evil-collection/modes/calendar/evil-collection-calendar.el b/.config/emacs/lisp/evil-collection/modes/calendar/evil-collection-calendar.el deleted file mode 100644 index 81464a8..0000000 --- a/.config/emacs/lisp/evil-collection/modes/calendar/evil-collection-calendar.el +++ /dev/null @@ -1,146 +0,0 @@ -;;; evil-collection-calendar.el --- Evil bindings for calendar -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, calendar, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for the calendar. - -;;; Code: -(require 'calendar) -(require 'evil-collection) - -(defconst evil-collection-calendar-maps '(calendar-mode-map)) - -(defun evil-collection-calendar-setup-org-bindings () - "Bind Org functions to Calendar keymap." - (require 'org) - (require 'org-agenda) - (defvar org-calendar-to-agenda-key) - (defvar org-agenda-diary-file) - (defvar org-calendar-insert-diary-entry-key) - - (let ((key (pcase org-calendar-to-agenda-key - ((and key (pred stringp)) key) - ;; The default value of `org-calendar-to-agenda-key' is [?c] in Org 9.1 - ;; We do make a minimal compatibility support for vector of integers. - ((and key (pred vectorp)) (mapconcat (lambda (x) (format "%c" x)) key "")) - ((and (pred symbolp) 'default) "c") - (_ "")))) - (evil-collection-define-key 'normal 'calendar-mode-map - (kbd key) 'org-calendar-goto-agenda)) - - ;; Similar to `org-calendar-to-agenda-key'. - (unless (eq org-agenda-diary-file 'diary-file) - (let ((key (pcase org-calendar-insert-diary-entry-key - ((and key (pred stringp)) key) - ((and key (pred vectorp)) (mapconcat (lambda (x) (format "%c" x)) key "")) - ;; NOTE Consistent behavior with `org-calendar-to-agenda-key' - ;; although it's not supported in Org officially. - ((and (pred symbolp) 'default) "i") - (_ "")))) - (evil-collection-define-key 'normal 'calendar-mode-map - (kbd key) 'org-agenda-diary-entry)))) - -;; Otherwise it will load tons of org stuff at startup. -(defvar evil-collection-calendar-want-org-bindings) -(when evil-collection-calendar-want-org-bindings - (add-hook 'calendar-mode-hook #'evil-collection-calendar-setup-org-bindings)) - -;;;###autoload -(defun evil-collection-calendar-setup () - "Set up `evil' bindings for `calendar'." - (evil-set-initial-state 'calendar-mode 'normal) - (evil-collection-define-key 'normal 'calendar-mode-map - ;; motion - "h" 'calendar-backward-day - "j" 'calendar-forward-week - "k" 'calendar-backward-week - "l" 'calendar-forward-day - "0" 'calendar-beginning-of-week - "^" 'calendar-beginning-of-week - "$" 'calendar-end-of-week - "[[" 'calendar-backward-year - "]]" 'calendar-forward-year - (kbd "M-<") 'calendar-beginning-of-year - (kbd "M->") 'calendar-end-of-year - "(" 'calendar-beginning-of-month - ")" 'calendar-end-of-month - (kbd "SPC") 'scroll-other-window - (kbd "S-SPC") 'scroll-other-window-down - (kbd "") 'scroll-other-window-down - "<" 'calendar-scroll-right - ">" 'calendar-scroll-left - (kbd "C-b") 'calendar-scroll-right-three-months - (kbd "C-f") 'calendar-scroll-left-three-months - "{" 'calendar-backward-month - "}" 'calendar-forward-month - (kbd "C-k") 'calendar-backward-month - (kbd "C-j") 'calendar-forward-month - "gk" 'calendar-backward-month - "gj" 'calendar-forward-month - - ;; visual - "v" 'calendar-set-mark - - ;; goto - "." 'calendar-goto-today - "o" 'calendar-other-month - "gd" 'calendar-goto-date ; "gd" in evil-org-agenda, "gd" in Emacs. - "gD" 'calendar-other-month - - ;; diary - "D" 'diary-view-other-diary-entries - "d" 'diary-view-entries - "m" 'diary-mark-entries - "s" 'diary-show-all-entries - - ;; appointment - "Aa" 'appt-add - "Ad" 'appt-delete - - "u" 'calendar-unmark - "x" 'calendar-mark-holidays - - ;; show - "gm" 'calendar-lunar-phases ; "gm" in evil-org-agenda. TODO: Shadows calendar-mayan. - "gs" 'calendar-sunrise-sunset ; "gs" in evil-org-agenda - "gh" 'calendar-list-holidays ; "gh" in evil-org-agenda. TODO: Shadows calendar-hebrew. - "gc" 'org-calendar-goto-agenda ; "gc" in evil-org-agenda. TODO: Shadows calendar-iso. - "a" 'calendar-list-holidays - "r" 'calendar-cursor-holidays - - ;; refresh - "gr" 'calendar-redraw - - "g?" 'calendar-goto-info-node - "?" 'calendar-goto-info-node ; Search is not very useful. - (kbd "M-=") 'calendar-count-days-region - - ;; quit - "q" 'calendar-exit - "ZQ" 'evil-quit - "ZZ" 'calendar-exit)) - -(provide 'evil-collection-calendar) -;;; evil-collection-calendar.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/cider/README.org b/.config/emacs/lisp/evil-collection/modes/cider/README.org deleted file mode 100644 index a72a3a7..0000000 --- a/.config/emacs/lisp/evil-collection/modes/cider/README.org +++ /dev/null @@ -1,164 +0,0 @@ -* cider - - Evil bindings for [[https://github.com/clojure-emacs/cider][CIDER]]. - - The bulk of CIDER's commands live under the =C-c= prefix in =cider-mode-map= - -- those are left alone. Evil only adds vim-style navigation, doc lookup and - the debugger keys. - -** cider-mode-map - - | Command | Original | Evil | - |----------------------------------+---------------+-----------| - | =cider-switch-to-repl-buffer= | =C-c C-z= | =gz= | - | =cider-find-resource= | =C-c M-.= | =gf= | - | =cider-doc= | =C-c C-d C-d= | =K= | - | =cider-find-var= | =M-.= | =gd= ([[#xref][†]]) | - | =cider-pop-back= | =M-,= | =C-t= ([[#xref][†]]) | - | =cider-browse-instrumented-defs= | n/a | == | - | =cider-debug-defun-at-point= | =C-u C-M-x= | == | - - The == / == bindings only fire when - =evil-collection-setup-debugger-keys= is non-nil. - -** cider-repl-mode-map - - | Command | Original | Evil | - |---------------------------------------+---------------+----------------------------------------------| - | =cider-switch-to-last-clojure-buffer= | =C-c C-z= | =gz= | - | =cider-refresh= | =C-c M-n r= | =gr= | - | =cider-find-resource= | =C-c M-.= | =gf= | - | =cider-doc= | =C-c C-d C-d= | =K= | - | =cider-find-var= | =M-.= | =gd= ([[#xref][†]]) | - | =cider-pop-back= | =M-,= | =C-t= ([[#xref][†]]) | - | =cider-repl-return= | =RET= | =RET= in =evil-collection-repl-submit-state= | - | =newline= | =C-j= | =RET= in the opposite state | - - See =evil-collection-repl-submit-state= (normal or insert) for which state - submits. - -** cider-repl-history-mode-map - - | Command | Original | Evil | - |----------------------------------------+----------+-------------------| - | =cider-repl-history-previous= | =p= | =C-k=, =gk=, =[[= | - | =cider-repl-history-forward= | =n= | =C-j=, =gj=, =]]= | - | =cider-repl-history-insert-and-quit= | =RET= | =RET= | - | =cider-repl-history-update= | =g= | =gr= | - | =cider-repl-history-quit= | =q= | =q= | - | =cider-repl-history-undo-other-window= | =U= | =u= | - -** cider-test-report-mode-map - - | Command | Original | Evil | - |------------------------------------+------------+--------------------| - | =cider-test-commands-map= | n/a | =C-c ,=, =C-c C-t= | - | =cider-test-previous-result= | n/a | =M-p=, == | - | =cider-test-next-result= | =TAB= | =M-n=, == | - | =cider-test-jump= | =t=, =RET= | =gd=, =t=, =RET= | - | =cider-test-ediff= | =d= | =d= | - | =cider-test-stacktrace= | =e= | =e= | - | =cider-test-rerun-failed-tests= | =f= | =f= | - | =cider-test-run-ns-tests= | =n= | =n= | - | =cider-test-run-loaded-tests= | =l= | =L= | - | =cider-test-run-project-tests= | =p= | =p= | - | =cider-test-run-test= | =g= | =gr= | - | =cider-popup-buffer-quit-function= | n/a | =q= | - -** cider-macroexpansion-mode-map - - | Command | Original | Evil | - |--------------------------------------------+----------+-------------| - | =cider-popup-buffer-quit-function= | n/a | =q= | - | =cider-macroexpand-again= | =g= | =r= | - | =cider-doc= | =d= | =K= | - | =cider-javadoc= | =j= | =J= | - | =cider-find-var= / =xref-find-definitions= | =.= | =.= | - | =cider-macroexpand-1-inplace= | =m= | =m= | - | =cider-macroexpand-all-inplace= | =a= | =a= | - | =cider-macroexpand-undo= | =u= | =u=, =undo= | - -** cider-connections-buffer-mode-map - - | Command | Original | Evil | - |--------------------------------------+----------+-------| - | =cider-connections-make-default= | n/a | =d= | - | =cider-connection-browser= | n/a | =c= | - | =cider-connections-close-connection= | n/a | =x= | - | =cider-connections-goto-connection= | n/a | =RET= | - | =describe-mode= | n/a | =g?= | - -** cider-stacktrace-mode-map - - Initial evil state is forced to normal. - - | Command | Original | Evil | - |----------------------------------------+----------+-------------------| - | =cider-stacktrace-previous-cause= | n/a | =C-k=, =gk=, =[[= | - | =cider-stacktrace-next-cause= | n/a | =C-j=, =gj=, =]]= | - | =cider-stacktrace-jump= | n/a | =gd= | - | =cider-popup-buffer-quit-function= | =q= | =q= | - | =cider-stacktrace-toggle-java= | =j= | =J= | - | =cider-stacktrace-toggle-clj= | =c= | =C= | - | =cider-stacktrace-toggle-repl= | =r= | =R= | - | =cider-stacktrace-toggle-tooling= | =t= | =T= | - | =cider-stacktrace-toggle-duplicates= | =d= | =D= | - | =cider-stacktrace-show-only-project= | =p= | =P= | - | =cider-stacktrace-toggle-all= | =a= | =A= | - | =cider-stacktrace-cycle-cause-1..5= | =1..5= | =1..5= | - | =cider-stacktrace-cycle-all-causes= | =0= | =0=, == | - | =cider-stacktrace-cycle-current-cause= | =TAB= | =TAB= | - -** cider-inspector-mode-map - - | Command | Original | Evil | - |-----------------------------------------------+--------------+--------------| - | =quit-window= | n/a | =q= | - | =cider-inspector-operate-on-point= | =RET= | =RET= | - | =cider-inspector-pop= | =l= | =L= | - | =cider-inspector-refresh= | =g= | =gr= | - | =cider-inspector-next-page= | =SPC= | =C-j=, =SPC= | - | =cider-inspector-prev-page= | =S-SPC= | =C-k= | - | =cider-inspector-set-page-size= | =s= | =s= | - | =cider-inspector-next-inspectable-object= | =n=, =TAB= | =]]=, =gj= | - | =cider-inspector-previous-inspectable-object= | =p=, =S-TAB= | =[[=, =gk= | - -** cider--debug-mode-map - - Only active when =evil-collection-setup-debugger-keys= is non-nil. Each key - sends a reply through =cider-debug-mode-send-reply=. - - | Command | Reply | Evil | - |----------------------------------------------+-------------------+------| - | =cider-debug-defun-at-point= | (re-instrument) | =b= | - | =evil-collection-cider-debug-continue= | =:continue= | =c= | - | =evil-collection-cider-debug-continue-all= | =:continue-all= | =C= | - | =evil-collection-cider-debug-next= | =:next= | =n= | - | =evil-collection-cider-debug-in= | =:in= | =I= | - | =evil-collection-cider-debug-out= | =:out= | =o= | - | =evil-collection-cider-debug-force-out= | =:force-out= | =O= | - | =cider-debug-move-here= | (move here) | =H= | - | =evil-collection-cider-debug-eval= | =:eval= | =e= | - | =evil-collection-cider-debug-inspect= | =:inspect= | =p= | - | =evil-collection-cider-debug-inspect-prompt= | =:inspect-prompt= | =P= | - | =evil-collection-cider-debug-locals= | =:locals= | =L= | - | =evil-collection-cider-debug-inject= | =:inject= | =J= | - | =evil-collection-cider-debug-stacktrace= | =:stacktrace= | =s= | - | =evil-collection-cider-debug-trace= | =:trace= | =t= | - | =evil-collection-cider-debug-quit= | =:quit= | =q= | - -** New commands - - | Command | Purpose | - |-----------------------------------+------------------------------------------------------------------------------------------------------| - | =evil-collection-cider-debug-*= | One per cider-debug reply keyword (see =cider--debug-mode-map=). | - | =evil-collection-cider-last-sexp= | Advice for =cider-eval-last-sexp= so the last sexp ends at point when =evil-move-beyond-eol= is nil. | - -** Xref fallbacks - :PROPERTIES: - :CUSTOM_ID: xref - :END: - - =gd= / =C-t= are only bound when =cider-use-xref= is nil. With xref enabled - the user already has =M-.= / =M-,= going through =xref-find-definitions= and - nothing extra is added. diff --git a/.config/emacs/lisp/evil-collection/modes/cider/evil-collection-cider.el b/.config/emacs/lisp/evil-collection/modes/cider/evil-collection-cider.el deleted file mode 100644 index e8ec712..0000000 --- a/.config/emacs/lisp/evil-collection/modes/cider/evil-collection-cider.el +++ /dev/null @@ -1,253 +0,0 @@ -;;; evil-collection-cider.el --- Evil bindings for Cider -*- lexical-binding: t -*- - -;; Copyright (C) 2017, 2024 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, cider, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for Cider. - -;;; Code: -(require 'cl-lib) -(require 'cider nil t) -(require 'evil-collection) - -(defvar cider-use-xref) - -(declare-function cider-debug-mode-send-reply "cider-debug") - -(defconst evil-collection-cider-maps '(cider-mode-map - cider-repl-mode-map - cider-repl-history-mode-map - cider-test-report-mode-map - cider-macroexpansion-mode-map - cider-connections-buffer-mode-map)) - -(defun evil-collection-cider-last-sexp (command &rest args) - "In normal-state or motion-state, last sexp ends at point." - (if (and (not evil-move-beyond-eol) - (or (evil-normal-state-p) (evil-motion-state-p))) - (save-excursion - (unless (or (eobp) (eolp)) (forward-char)) - (apply command args)) - (apply command args))) - -(defmacro evil-collection-cider-make-debug-command (&rest cider-commands) - "Make functions that wrap `cider-debug' commands. - -Cider debug commands are sent through `cider-debug-mode-send-reply'. - -ex. \(cider-debug-mode-send-reply \":next\"\)" - (let ((commands (if (consp cider-commands) - cider-commands - (list cider-commands)))) - `(progn - ,@(cl-loop - for command in commands - collect - (let ((funsymbol - (intern (format "evil-collection-cider-debug-%s" command)))) - `(defun ,funsymbol () - ,(format - "Send :%s to `cider-debug-mode-send-reply'." command) - (interactive) - (cider-debug-mode-send-reply ,(format ":%s" command)))))))) - -(evil-collection-cider-make-debug-command "continue" - "continue-all" - "next" - "in" - "out" - "force-out" - "eval" - "inspect" - "inspect-prompt" - "locals" - "inject" - "stacktrace" - "trace" - "quit") - -;;;###autoload -(defun evil-collection-cider-setup () - "Set up `evil' bindings for `cider'." - (unless evil-move-beyond-eol - (advice-add 'cider-eval-last-sexp :around 'evil-collection-cider-last-sexp) - (advice-add 'cider-eval-last-sexp-and-replace :around 'evil-collection-cider-last-sexp) - (advice-add 'cider-eval-last-sexp-to-repl :around 'evil-collection-cider-last-sexp) - (with-eval-after-load 'cider-eval-sexp-fu - (advice-add 'cider-esf--bounds-of-last-sexp :around 'evil-collection-cider-last-sexp))) - - (when evil-collection-setup-debugger-keys - (add-hook 'cider-mode-hook #'evil-normalize-keymaps) - (add-hook 'cider--debug-mode-hook #'evil-normalize-keymaps) - (evil-collection-define-key 'normal 'cider-mode-map - [f6] 'cider-browse-instrumented-defs - [f9] 'cider-debug-defun-at-point) - - (evil-collection-define-key 'normal 'cider--debug-mode-map - "b" 'cider-debug-defun-at-point - "c" 'evil-collection-cider-debug-continue - "C" 'evil-collection-cider-debug-continue-all - "n" 'evil-collection-cider-debug-next - "I" 'evil-collection-cider-debug-in - "o" 'evil-collection-cider-debug-out - "O" 'evil-collection-cider-debug-force-out - "H" 'cider-debug-move-here - "e" 'evil-collection-cider-debug-eval - "p" 'evil-collection-cider-debug-inspect - "P" 'evil-collection-cider-debug-inspect-prompt - "L" 'evil-collection-cider-debug-locals - "J" 'evil-collection-cider-debug-inject - "s" 'evil-collection-cider-debug-stacktrace - "t" 'evil-collection-cider-debug-trace - "q" 'evil-collection-cider-debug-quit)) - - (evil-collection-define-key '(normal visual) 'cider-mode-map - "gz" 'cider-switch-to-repl-buffer - "gf" 'cider-find-resource - "K" 'cider-doc) - - (unless cider-use-xref - (evil-collection-define-key '(normal visual) 'cider-mode-map - "gd" 'cider-find-var - (kbd "C-t") 'cider-pop-back)) - - (evil-collection-define-key '(normal visual) 'cider-repl-mode-map - ;; FIXME: This seems to get overwritten by `cider-switch-to-repl-buffer'. - "gz" 'cider-switch-to-last-clojure-buffer - "gr" 'cider-refresh - "gf" 'cider-find-resource - "K" 'cider-doc) - - (let* ((submit evil-collection-repl-submit-state) - (newline-state (if (eq submit 'normal) 'insert 'normal))) - (evil-collection-define-key submit 'cider-repl-mode-map - (kbd "RET") 'cider-repl-return) - (evil-collection-define-key newline-state 'cider-repl-mode-map - (kbd "RET") 'newline)) - - (unless cider-use-xref - (evil-collection-define-key '(normal visual) 'cider-repl-mode-map - "gd" 'cider-find-var - (kbd "C-t") 'cider-pop-back)) - - (evil-collection-define-key '(normal visual) 'cider-repl-history-mode-map - (kbd "C-k") 'cider-repl-history-previous - (kbd "C-j") 'cider-repl-history-forward - "gk" 'cider-repl-history-previous - "gj" 'cider-repl-history-forward - "[[" 'cider-repl-history-previous - "]]" 'cider-repl-history-forward - - (kbd "RET") 'cider-repl-history-insert-and-quit - "gr" 'cider-repl-history-update - "q" 'cider-repl-history-quit - "u" 'cider-repl-history-undo-other-window) - - (evil-collection-define-key 'normal 'cider-test-report-mode-map - (kbd "C-c ,") 'cider-test-commands-map - (kbd "C-c C-t") 'cider-test-commands-map - (kbd "M-p") 'cider-test-previous-result - (kbd "M-n") 'cider-test-next-result - - ;; goto - "gd" 'cider-test-jump - - (kbd "") 'cider-test-previous-result - (kbd "") 'cider-test-next-result - (kbd "RET") 'cider-test-jump - "t" 'cider-test-jump - "d" 'cider-test-ediff - "e" 'cider-test-stacktrace - "f" 'cider-test-rerun-failed-tests - "n" 'cider-test-run-ns-tests - "L" 'cider-test-run-loaded-tests - "p" 'cider-test-run-project-tests - "gr" 'cider-test-run-test - "q" 'cider-popup-buffer-quit-function) - - (evil-collection-define-key 'normal 'cider-macroexpansion-mode-map - ;; quit - "q" 'cider-popup-buffer-quit-function - - "r" 'cider-macroexpand-again - "K" 'cider-doc ; Evil has `evil-lookup'. - "J" 'cider-javadoc - "." (if cider-use-xref 'xref-find-definitions 'cider-find-var) - "m" 'cider-macroexpand-1-inplace - "a" 'cider-macroexpand-all-inplace - "u" 'cider-macroexpand-undo - [remap undo] 'cider-macroexpand-undo) - - (evil-collection-define-key 'normal 'cider-connections-buffer-mode-map - "d" 'cider-connections-make-default - "c" 'cider-connection-browser - "x" 'cider-connections-close-connection - (kbd "RET") 'cider-connections-goto-connection - "g?" 'describe-mode) - - (evil-set-initial-state 'cider-stacktrace-mode 'normal) - (evil-collection-define-key 'normal 'cider-stacktrace-mode-map - (kbd "C-k") 'cider-stacktrace-previous-cause - (kbd "C-j") 'cider-stacktrace-next-cause - (kbd "gk") 'cider-stacktrace-previous-cause - (kbd "gj") 'cider-stacktrace-next-cause - (kbd "[[") 'cider-stacktrace-previous-cause - (kbd "]]") 'cider-stacktrace-next-cause - "gd" 'cider-stacktrace-jump - "q" 'cider-popup-buffer-quit-function - "J" 'cider-stacktrace-toggle-java - "C" 'cider-stacktrace-toggle-clj - "R" 'cider-stacktrace-toggle-repl - "T" 'cider-stacktrace-toggle-tooling - "D" 'cider-stacktrace-toggle-duplicates - "P" 'cider-stacktrace-show-only-project - "A" 'cider-stacktrace-toggle-all - "1" 'cider-stacktrace-cycle-cause-1 - "2" 'cider-stacktrace-cycle-cause-2 - "3" 'cider-stacktrace-cycle-cause-3 - "4" 'cider-stacktrace-cycle-cause-4 - "5" 'cider-stacktrace-cycle-cause-5 - "0" 'cider-stacktrace-cycle-all-causes - (kbd "TAB") 'cider-stacktrace-cycle-current-cause - [backtab] 'cider-stacktrace-cycle-all-causes) - - (add-hook 'cider-inspector-mode-hook #'evil-normalize-keymaps) - (evil-collection-define-key 'normal 'cider-inspector-mode-map - "q" 'quit-window - (kbd "RET") 'cider-inspector-operate-on-point - [mouse-1] 'cider-inspector-operate-on-click - "L" 'cider-inspector-pop - "gr" 'cider-inspector-refresh - ;; Page-up/down - (kbd "C-j") 'cider-inspector-next-page - (kbd "C-k") 'cider-inspector-prev-page - " " 'cider-inspector-next-page - "s" 'cider-inspector-set-page-size - (kbd "]]") 'cider-inspector-next-inspectable-object - (kbd "[[") 'cider-inspector-previous-inspectable-object - "gj" 'cider-inspector-next-inspectable-object - "gk" 'cider-inspector-previous-inspectable-object)) - -(provide 'evil-collection-cider) -;;; evil-collection-cider.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/citre/evil-collection-citre.el b/.config/emacs/lisp/evil-collection/modes/citre/evil-collection-citre.el deleted file mode 100644 index 2bce581..0000000 --- a/.config/emacs/lisp/evil-collection/modes/citre/evil-collection-citre.el +++ /dev/null @@ -1,47 +0,0 @@ -;;; evil-collection-citre.el --- Bindings for `citre' -*- lexical-binding: t -*- - -;; Copyright (C) 2024 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, citre, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `citre' - -;;; Code: -(require 'evil-collection) - -(defun evil-collection-citre-set-bindings () - "Set jump point for citre commands." - (dolist (cmd '(citre-jump - citre-query-jump - citre-jump-to-reference - citre-query-jump-to-reference)) - (evil-declare-not-repeat cmd) - (evil-set-command-property cmd :jump t))) - -;;;###autoload -(defun evil-collection-citre-setup () - "Set up `evil' bindings for `citre'." - (evil-collection-citre-set-bindings)) - -(provide 'evil-collection-citre) -;;; evil-collection-citre.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/cmake-mode/README.org b/.config/emacs/lisp/evil-collection/modes/cmake-mode/README.org deleted file mode 100644 index d7a7975..0000000 --- a/.config/emacs/lisp/evil-collection/modes/cmake-mode/README.org +++ /dev/null @@ -1,13 +0,0 @@ -* cmake-mode - - Evil setup for [[https://gitlab.kitware.com/cmake/cmake][cmake-mode]]. No key - rebindings -- only =evil-shift-width= is aligned to =cmake-tab-width=. - -** New commands - - | Command | Purpose | - |---------------------------------------------------+------------------------------------------------------| - | =evil-collection-cmake-mode-set-evil-shift-width= | Buffer-local =evil-shift-width= = =cmake-tab-width=. | - - Hooked to =cmake-mode-hook= so =>=, =<= and friends indent by the same width - cmake-mode uses. diff --git a/.config/emacs/lisp/evil-collection/modes/cmake-mode/evil-collection-cmake-mode.el b/.config/emacs/lisp/evil-collection/modes/cmake-mode/evil-collection-cmake-mode.el deleted file mode 100644 index 5b0113e..0000000 --- a/.config/emacs/lisp/evil-collection/modes/cmake-mode/evil-collection-cmake-mode.el +++ /dev/null @@ -1,44 +0,0 @@ -;;; evil-collection-cmake-mode.el --- Bindings for `cmake-mode' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `cmake-mode' - -;;; Code: -(require 'evil-collection) -(require 'cmake-mode nil t) - -(defvar cmake-tab-width) -(defun evil-collection-cmake-mode-set-evil-shift-width () - "Set `evil-shift-width' according to `cmake-tab-with'." - (setq-local evil-shift-width cmake-tab-width)) - -;;;###autoload -(defun evil-collection-cmake-mode-setup () - "Set up `evil' bindings for `cmake-mode'." - (add-hook 'cmake-mode-hook #'evil-collection-cmake-mode-set-evil-shift-width)) - -(provide 'evil-collection-cmake-mode) -;;; evil-collection-cmake-mode.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/color-rg/evil-collection-color-rg.el b/.config/emacs/lisp/evil-collection/modes/color-rg/evil-collection-color-rg.el deleted file mode 100644 index 5a53b25..0000000 --- a/.config/emacs/lisp/evil-collection/modes/color-rg/evil-collection-color-rg.el +++ /dev/null @@ -1,71 +0,0 @@ -;;; evil-collection-color-rg.el --- Bindings for color-rg -*- lexical-binding: t -*- - -;; Copyright (C) 2023 Mumulhl - -;; Author: Mumulhl -;; Maintainer: Mumulhl -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, convenience, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for color-rg. - -;;; Code: -(require 'evil-collection) -(require 'color-rg nil t) - -(defvar color-rg-mode-map) -(defconst evil-collection-color-rg-maps '(color-rg-mode-map)) - -;;;###autoload -(defun evil-collection-color-rg-setup () - "Set up `evil' bindings for color-rg." - (evil-collection-define-key 'normal 'color-rg-mode-map - (kbd "") 'color-rg-jump-prev-keyword - (kbd "") 'color-rg-jump-next-keyword - "C" 'color-rg-rerun-toggle-case - (kbd "C-a") 'color-rg-beginning-of-line - "D" 'color-rg-remove-line-from-results - "E" 'color-rg-rerun-change-exclude-files - "F" 'color-rg-filter-mismatch-results - "G" 'color-rg-rerun-change-globs - "I" 'color-rg-rerun-toggle-ignore - "L" 'color-rg-rerun-literal - "N" 'color-rg-rerun-toggle-node - "O" 'color-rg-rerun-in-project - "R" 'color-rg-rerun-regexp - (kbd "RET") 'color-rg-open-file-and-stay - "S" 'color-rg-customized-search - (kbd "SPC") 'color-rg-open-file - "X" 'color-rg-filter-mismatch-files - "e" 'color-rg-switch-to-edit-mode - "f" 'color-rg-filter-match-results - "h" 'color-rg-jump-next-file - "i" 'color-rg-insert-current-line - "j" 'color-rg-jump-next-keyword - "k" 'color-rg-jump-prev-keyword - "l" 'color-rg-jump-prev-file - "o" 'color-rg-rerun-in-parent-dir - "q" 'color-rg-quit - "r" 'color-rg-replace-all-matches - "s" 'color-rg-rerun-change-dir - "u" 'color-rg-unfilter - "x" 'color-rg-filter-match-files)) - -(provide 'evil-collection-color-rg) -;;; evil-collection-color-rg.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/comint/README.org b/.config/emacs/lisp/evil-collection/modes/comint/README.org deleted file mode 100644 index 0b03dd2..0000000 --- a/.config/emacs/lisp/evil-collection/modes/comint/README.org +++ /dev/null @@ -1,29 +0,0 @@ -* comint - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Comint.html][comint-mode]], the base mode for many Emacs shells and - REPLs (shell, inferior-lisp, sql, python, etc.). Bindings here propagate to - every derived mode that does not override them. - -** Key bindings - - Normal-state additions to =comint-mode-map=: - - | Command | Original | Evil | - |--------------------------+-----------+-------------------------------------| - | =comint-next-prompt= | =C-c C-n= | =C-j=, =gj=, =]]= | - | =comint-previous-prompt= | =C-c C-p= | =C-k=, =gk=, =[[= | - | =comint-previous-input= | =M-p= | =C-p= | - | =comint-next-input= | =M-n= | =C-n= | - | =evil-scroll-down= | n/a | =C-d= (when =evil-want-C-d-scroll=) | - - Insert state: - - | Command | Original | Evil | - |-------------------------+-----------+-------------------------------------| - | =comint-previous-input= | =M-p= | == | - | =comint-next-input= | =M-n= | == | - | =comint-kill-input= | =C-c C-u= | =C-u= (when =evil-want-C-u-delete=) | - - =RET= sends input in the state named by =evil-collection-repl-submit-state= - and inserts a newline in the complementary state (both =RET= and =C-m= / - =[return]= are wired). diff --git a/.config/emacs/lisp/evil-collection/modes/comint/evil-collection-comint.el b/.config/emacs/lisp/evil-collection/modes/comint/evil-collection-comint.el deleted file mode 100644 index 40d0a00..0000000 --- a/.config/emacs/lisp/evil-collection/modes/comint/evil-collection-comint.el +++ /dev/null @@ -1,74 +0,0 @@ -;;; evil-collection-comint.el --- Bindings for `comint-mode' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, comint, processes - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `comint-mode'. - -;;; Code: -(require 'comint) -(require 'evil-collection) - -(defconst evil-collection-comint-maps '(comint-mode-map)) - -;;;###autoload -(defun evil-collection-comint-setup () - "Set up `evil' bindings for `comint'." - (when evil-want-C-d-scroll - (evil-collection-define-key 'normal 'comint-mode-map - (kbd "C-d") #'evil-scroll-down)) - - (let* ((submit evil-collection-repl-submit-state) - (newline-state (if (eq submit 'normal) 'insert 'normal))) - (evil-collection-define-key submit 'comint-mode-map - (kbd "RET") #'comint-send-input - (kbd "\C-m") #'comint-send-input - [return] #'comint-send-input) - (evil-collection-define-key newline-state 'comint-mode-map - (kbd "RET") #'newline - (kbd "\C-m") #'newline - [return] #'newline)) - - (evil-collection-define-key 'normal 'comint-mode-map - ;; Match Eshell bindings: - (kbd "C-j") #'comint-next-prompt - (kbd "C-k") #'comint-previous-prompt - (kbd "gj") #'comint-next-prompt - (kbd "gk") #'comint-previous-prompt - (kbd "]]") #'comint-next-prompt - (kbd "[[") #'comint-previous-prompt - (kbd "C-p") #'comint-previous-input - (kbd "C-n") #'comint-next-input) - - ;; TODO: What if the user changes `evil-want-C-u-delete' after this is run? - (when evil-want-C-u-delete - (evil-collection-define-key 'insert 'comint-mode-map - (kbd "C-u") #'comint-kill-input)) - - (evil-collection-define-key 'insert 'comint-mode-map - (kbd "") #'comint-previous-input - (kbd "") #'comint-next-input)) - -(provide 'evil-collection-comint) -;;; evil-collection-comint.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/company/README.org b/.config/emacs/lisp/evil-collection/modes/company/README.org deleted file mode 100644 index 22c1d84..0000000 --- a/.config/emacs/lisp/evil-collection/modes/company/README.org +++ /dev/null @@ -1,51 +0,0 @@ -* company - - Evil bindings for [[https://github.com/company-mode/company-mode][company-mode]]. - Bindings are installed without an explicit state so they apply whenever the - company overlay is active. - -** company-active-map - - | Command | Original | Evil | - |------------------------------------+----------+-------------------------------------| - | =company-select-next-or-abort= | =C-n= | =C-n=, =C-j= | - | =company-select-previous-or-abort= | =C-p= | =C-p=, =C-k= | - | =company-select-next= | n/a | =M-j= | - | =company-select-previous= | n/a | =M-k= | - | =company-previous-page= | =M-<= | =C-u= (when =evil-want-C-u-scroll=) | - | =company-next-page= | =M->= | =C-d= (when =evil-want-C-d-scroll=) | - - With =evil-collection-want-company-extended-keybindings= (vim's =C-x ...= - completion family): - - | Command | Evil | - |---------------------------------------+-------| - | =evil-collection-company-whole-lines= | =C-l= | - | =company-etags= | =C-]= | - | =company-files= | =C-f= | - | =company-capf= | =C-o= | - | =company-ispell= | =C-s= | - -** company-search-map - - | Command | Original | Evil | - |------------------------------------+----------+------------| - | =company-select-next-or-abort= | =C-n= | =C-j= | - | =company-select-previous-or-abort= | =C-p= | =C-k= | - | =company-select-next= | n/a | =M-j= | - | =company-select-previous= | n/a | =M-k= | - | =company-search-abort= | =C-g= | == | - -** New commands - - | Command | Purpose | - |---------------------------------------+------------------------------------------------| - | =evil-collection-company-whole-lines= | Whole-line completion backend (vim =C-x C-l=). | - -** Customization - - | Variable | Default | Purpose | - |-----------------------------------------------------+--------------------------+--------------------------------------------------------------------------------------------------| - | =evil-collection-company-supported-states= | =(insert replace emacs)= | Evil states in which company is allowed to pop up. | - | =evil-collection-want-company-extended-keybindings= | =nil= | Enable the vim-style =C-x= completion bindings above. | - | =evil-collection-company-enable-keymap-protection= | =t= | Re-install =company-active-map= after =company-doc-buffer= et al. so evil does not eat the keys. | diff --git a/.config/emacs/lisp/evil-collection/modes/company/evil-collection-company.el b/.config/emacs/lisp/evil-collection/modes/company/evil-collection-company.el deleted file mode 100644 index 7042221..0000000 --- a/.config/emacs/lisp/evil-collection/modes/company/evil-collection-company.el +++ /dev/null @@ -1,138 +0,0 @@ -;;; evil-collection-company.el --- Bindings for `company-mode' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, company, abbrev, convenience, matching - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `company-mode'. - -;;; Code: -(require 'company nil t) -(require 'evil-collection) - -(declare-function company-tng-mode "company-tng") -(declare-function company-grab-line "company") -(declare-function company-begin-backend "company") -(declare-function company-ensure-emulation-alist "company") - -(defgroup evil-collection-company nil - "Evil bindings for `company-mode'." - :group 'evil-collection) - -(defcustom evil-collection-company-supported-states '(insert replace emacs) - "The `evil-state's which `company' function can be requested." - :type '(repeat symbol)) -(defcustom evil-collection-want-company-extended-keybindings nil - "The \='evil-company-extended' keybindings should be requested" - :type 'boolean) - -(defcustom evil-collection-company-enable-keymap-protection t - "Prevent evil from breaking company completion keymap. -When non-nil, prevents evil from overriding `company-active-map' -after calling `company-doc-buffer'. If disabled, the completion -keymap will be in a broken state." - :type 'boolean) - -(defvar company-active-map) -(defvar company-search-map) - -(defconst evil-collection-company-maps '(company-active-map company-search-map)) - -(defun evil-collection-company-supported-p (command &rest _) - "Return non-nil if `evil-state' is in supported states." - (cond - ((not (bound-and-true-p evil-mode)) t) - ((eq command 'prefix) - (memq evil-state evil-collection-company-supported-states)) - (t t))) - -(defun evil-collection-company-protect-keymap () - "Prevent evil from overriding `company-mode' completion keymap." - (when (and evil-collection-company-enable-keymap-protection - (memq 'company-emulation-alist emulation-mode-map-alists)) - (company-ensure-emulation-alist))) - -;;;###autoload -(defun evil-collection-company-whole-lines (command &optional arg &rest _ignored) - "`company-mode' completion backend that completes whole-lines, akin to vim's -C-x C-l." - (interactive (list 'interactive)) - (require 'company) - (pcase command - (`interactive (company-begin-backend 'evil-collection-company-whole-lines)) - (`prefix (company-grab-line "^[\t\s]*\\(.+\\)" 1)) - (`candidates - (all-completions - arg - (delete-dups - (split-string - (replace-regexp-in-string - "^[\t\s]+" "" - (concat (buffer-substring-no-properties (point-min) (line-beginning-position)) - (buffer-substring-no-properties (line-end-position) (point-max)))) - "\\(\r\n\\|[\n\r]\\)" t)))))) - -;;;###autoload -(defun evil-collection-company-setup () - "Set up `evil' bindings for `company'." - (evil-collection-define-key nil 'company-active-map - (kbd "C-n") 'company-select-next-or-abort - (kbd "C-p") 'company-select-previous-or-abort - (kbd "C-j") 'company-select-next-or-abort - (kbd "C-k") 'company-select-previous-or-abort - (kbd "M-j") 'company-select-next - (kbd "M-k") 'company-select-previous) - - (when evil-collection-want-company-extended-keybindings - (evil-collection-define-key nil 'company-active-map - (kbd "C-l") 'evil-collection-company-whole-lines - (kbd "C-]") 'company-etags - (kbd "C-f") 'company-files - (kbd "C-o") 'company-capf - (kbd "C-s") 'company-ispell)) - - (when evil-want-C-u-scroll - (evil-collection-define-key nil 'company-active-map - (kbd "C-u") 'company-previous-page)) - - (when evil-want-C-d-scroll - (evil-collection-define-key nil 'company-active-map - (kbd "C-d") 'company-next-page)) - - (evil-collection-define-key nil 'company-search-map - (kbd "C-j") 'company-select-next-or-abort - (kbd "C-k") 'company-select-previous-or-abort - (kbd "M-j") 'company-select-next - (kbd "M-k") 'company-select-previous - (kbd "") 'company-search-abort) - - ;; https://github.com/emacs-evil/evil-collection/issues/664 - (add-hook 'evil-local-mode-hook #'evil-collection-company-protect-keymap) - - ;; Make `company-mode' not show popup when not in supported state - (advice-add 'company-call-backend - :before-while 'evil-collection-company-supported-p)) - - -(provide 'evil-collection-company) -;;; evil-collection-company.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/compile/README.org b/.config/emacs/lisp/evil-collection/modes/compile/README.org deleted file mode 100644 index c8e3c60..0000000 --- a/.config/emacs/lisp/evil-collection/modes/compile/README.org +++ /dev/null @@ -1,18 +0,0 @@ -* compile - - Evil bindings for =compilation-mode= and =compilation-minor-mode=. - - Standard motion / quit bindings come from =evil-collection-set-readonly-bindings= - and are not repeated below. - -** Key bindings - - | Command | Original | Evil | - |------------------------------+------------------+------------------------| - | =compile-goto-error= | =RET=, =C-c C-c= | =RET= | - | =compilation-display-error= | =C-o= | =go=, =M-RET=, =S-RET= | - | =compilation-next-error= | =M-n= | =TAB=, =gj=, =C-j= | - | =compilation-previous-error= | =M-p= | =S-TAB=, =gk=, =C-k= | - | =compilation-next-file= | =M-}= | =]]= | - | =compilation-previous-file= | =M-{= | =[[= | - | =recompile= | =g= | =gr= | diff --git a/.config/emacs/lisp/evil-collection/modes/compile/evil-collection-compile.el b/.config/emacs/lisp/evil-collection/modes/compile/evil-collection-compile.el deleted file mode 100644 index b59f9d4..0000000 --- a/.config/emacs/lisp/evil-collection/modes/compile/evil-collection-compile.el +++ /dev/null @@ -1,67 +0,0 @@ -;;; evil-collection-compile.el --- Evil bindings for `compile' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, compile, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `compile'. - -;;; Code: -(require 'evil-collection) -(require 'compile) - -(defconst evil-collection-compile-maps '(compilation-mode-map - compilation-minor-mode-map)) - -;;;###autoload -(defun evil-collection-compile-setup () - "Set up `evil' bindings for `compile'." - (evil-set-initial-state 'compilation-mode 'normal) - (evil-collection-set-readonly-bindings 'compilation-mode-map) - - (dolist (keymap evil-collection-compile-maps) - - (evil-collection-define-key nil keymap - "g" nil) - - (evil-collection-define-key 'normal keymap - (kbd "RET") 'compile-goto-error - - "go" 'compilation-display-error - (kbd "M-RET") 'compilation-display-error - (kbd "M-") 'compilation-display-error - (kbd "S-") 'compilation-display-error - - (kbd "TAB") 'compilation-next-error - (kbd "S-TAB") 'compilation-previous-error - - "gj" 'compilation-next-error - "gk" 'compilation-previous-error - (kbd "C-j") 'compilation-next-error - (kbd "C-k") 'compilation-previous-error - "[[" 'compilation-previous-file - "]]" 'compilation-next-file - "gr" 'recompile))) - -(provide 'evil-collection-compile) -;;; evil-collection-compile.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/consult/README.org b/.config/emacs/lisp/evil-collection/modes/consult/README.org deleted file mode 100644 index c71d837..0000000 --- a/.config/emacs/lisp/evil-collection/modes/consult/README.org +++ /dev/null @@ -1,26 +0,0 @@ -* consult - - Evil bindings for [[https://github.com/minad/consult][consult]]. - - No keymap is rebound. Setup marks a small set of jump-style commands as - non-repeatable and registers them as evil jumps so =C-o= / =C-i= work after - selection. - -** Jump commands - - The following are declared with =:jump t= and =evil-declare-not-repeat=: - - - =consult-outline= - - =consult-mark= - - =consult-global-mark= - - =consult-imenu= - - =consult-org-heading= - - =consult-org-agenda= - - =consult-line= - -** New commands - - | Command | Purpose | - |-------------------------------------+---------------------------------------------------------------| - | =evil-collection-consult-mark= | =consult-mark= over evil's per-buffer marker ring. | - | =evil-collection-consult-jump-list= | =consult-global-mark= over the evil jump list of this window. | diff --git a/.config/emacs/lisp/evil-collection/modes/consult/evil-collection-consult.el b/.config/emacs/lisp/evil-collection/modes/consult/evil-collection-consult.el deleted file mode 100644 index f8b0e93..0000000 --- a/.config/emacs/lisp/evil-collection/modes/consult/evil-collection-consult.el +++ /dev/null @@ -1,123 +0,0 @@ -;;; evil-collection-consult.el --- Evil bindings for consult -*- lexical-binding: t -*- - -;; Copyright (C) 2017, 2024 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, consult, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `consult'. -;; -;; Since -;; -;; `consult-outline' -;; `consult-mark' -;; `consult-global-mark' -;; `consult-imenu' -;; `consult-org-heading' -;; `consult-org-agenda' -;; `consult-line' -;; -;; are all autoloaded, no (require 'consult nil t) is needed. - -;;; Code: -(require 'evil-collection) - -(defvar consult-line-numbers-widen) -(declare-function consult--forbid-minibuffer "consult") -(declare-function consult--fontify-all "consult") -(declare-function consult--in-range-p "consult") -(declare-function consult--line-with-mark "consult") -(declare-function consult--location-candidate "consult") -(declare-function consult--remove-dups "consult") -(declare-function consult--mark-candidates "consult") -(declare-function consult-mark "consult") -(declare-function consult-global-mark "consult") - -(defun evil-collection-consult-set-bindings () - "Set the bindings." - (dolist (cmd '(consult-outline - consult-mark - consult-global-mark - consult-imenu - consult-org-heading - consult-org-agenda - consult-line)) - (evil-declare-not-repeat cmd) - (evil-set-command-property cmd :jump t))) - -(defun evil-collection-consult--evil-mark-ring () - "Return alist of char & marker for evil markers in current buffer." - (sort (cl-remove-if (lambda (elem) - (or (evil-global-marker-p (car elem)) - (not (markerp (cdr-safe elem))))) - evil-markers-alist) - #'car-less-than-car)) - -(defun evil-collection-consult--mark-candidates (&optional markers) - "Return alist of lines containing markers from `evil-mark-alist'. -Opional MARKERS should be an alist containing (char . marker) pairs -as defined in `evil-collection-consult--evil-mark-ring'." - (consult--forbid-minibuffer) - (unless (evil-collection-consult--evil-mark-ring) - (user-error "No marks")) - (let* ((candidates) - (current-buf (current-buffer))) - (save-excursion - (pcase-dolist (`(,char . ,marker) (or markers (evil-collection-consult--evil-mark-ring))) - (let ((pos (marker-position marker)) - (buf (marker-buffer marker))) - (when (and (eq buf current-buf) - (consult--in-range-p pos)) - (goto-char pos) - (push (consult--location-candidate - (format "%s: %s" (char-to-string char) (consult--line-with-mark marker)) - marker - (line-number-at-pos pos consult-line-numbers-widen) - marker) - candidates))))) - (nreverse (delete-dups candidates)))) - -;;;###autoload -(defun evil-collection-consult-mark () - "Jump to an evil marker in the current buffer." - (interactive) - (cl-letf (((symbol-function 'consult--mark-candidates) - #'evil-collection-consult--mark-candidates)) - (consult-mark (evil-collection-consult--evil-mark-ring)))) - -;;;###autoload -(defun evil-collection-consult-jump-list () - "Jump to a position in the evil jump list." - (interactive) - (consult-global-mark (delq nil (mapcar (lambda (jump) - (let ((mark (car jump))) - (when (markerp mark) - mark))) - (ring-elements (evil--jumps-get-window-jump-list)))))) - -;;;###autoload -(defun evil-collection-consult-setup () - "Set up `evil' bindings for `consult'." - (evil-collection-consult-set-bindings)) - -(provide 'evil-collection-consult) -;;; evil-collection-consult.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/corfu/README.org b/.config/emacs/lisp/evil-collection/modes/corfu/README.org deleted file mode 100644 index 71820eb..0000000 --- a/.config/emacs/lisp/evil-collection/modes/corfu/README.org +++ /dev/null @@ -1,54 +0,0 @@ -* corfu - - Evil bindings for [[https://github.com/minad/corfu][corfu]] in-buffer completion. - - Bindings apply in =insert= state on =corfu-map= and are gated by - =evil-collection-corfu-key-themes=. Only =default= is enabled out of the box. - -** Key bindings - -*** default theme - - | Command | Original | Evil | - |-----------------------------------------+----------+-------------------------------------| - | =corfu-next= | == | =C-n=, =C-j=, =M-j=, == | - | =corfu-previous= | == | =C-p=, =C-k=, =M-k=, == | - | =corfu-insert= | =RET= | =RET= | - | =corfu-complete= | =TAB= | =TAB= | - | =corfu-quit= | =C-g= | =C-g= | - | =evil-collection-corfu-quit-and-escape= | n/a | == | - | =corfu-scroll-up= | n/a | =C-d= (when =evil-want-C-u-scroll=) | - | =corfu-scroll-down= | n/a | =C-u= (when =evil-want-C-d-scroll=) | - -*** tab-n-go theme - - Also sets =corfu-cycle= to =t= and =corfu-preselect= to =prompt=. - - | Command | Original | Evil | - |------------------+----------+--------------------| - | =corfu-next= | n/a | =TAB= | - | =corfu-previous= | n/a | =S-TAB=, =backtab= | - -*** magic-return theme - - =RET= / == insert the candidate when one is selected, otherwise - fall through to the buffer's default newline. - -*** magic-backspace theme - - =DEL= / == reset the selection when one is active, otherwise - fall through. - -** New commands - - | Command | Purpose | - |-----------------------------------------+----------------------------------------------------------| - | =evil-collection-corfu-quit-and-escape= | =corfu-quit= then =evil-normal-state=. | - | =evil-collection-corfu-insert-exact= | Insert current candidate with =exact= status, else quit. | - -** Customization - - | Variable | Default | Purpose | - |------------------------------------------+------------------------------+-----------------------------------------------------------------------| - | =evil-collection-corfu-key-themes= | =(default)= | Themes from =default=, =tab-n-go=, =magic-return=, =magic-backspace=. | - | =evil-collection-corfu-supported-states= | =(insert replace emacs nil)= | Evil states in which =corfu= is allowed to run. | diff --git a/.config/emacs/lisp/evil-collection/modes/corfu/evil-collection-corfu.el b/.config/emacs/lisp/evil-collection/modes/corfu/evil-collection-corfu.el deleted file mode 100644 index f70dedc..0000000 --- a/.config/emacs/lisp/evil-collection/modes/corfu/evil-collection-corfu.el +++ /dev/null @@ -1,180 +0,0 @@ -;;; evil-collection-corfu.el --- Bindings for `corfu-mode' -*- lexical-binding: t -*- - -;; Copyright (C) 2022 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "27.1")) -;; Keywords: evil, corfu, convenience, matching - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `corfu-mode'. - -;;; Code: -(require 'corfu nil t) -(require 'evil-collection) - -(defgroup evil-collection-corfu nil - "Evil bindings for `corfu-mode'." - :group 'evil-collection) - -(defvar corfu-map) -(defvar corfu-cycle) -(defvar corfu-preselect) -(defvar corfu--index) - -(declare-function corfu-insert "corfu") -(declare-function corfu-reset "corfu") -(declare-function corfu-quit "corfu") - -(defconst evil-collection-corfu-maps '(corfu-map)) - -(defun evil-collection-corfu-quit-and-escape () - "Call `corfu-quit' and then return to Normal State." - (interactive) - (call-interactively 'corfu-quit) - (evil-normal-state)) - -;; https://github.com/minad/corfu/pull/169 -;; https://github.com/minad/corfu/pull/225 -(defun evil-collection-corfu-unread-this-command-keys () - (when (> (length (this-command-keys)) 0) - (setq unread-command-events (nconc - (listify-key-sequence (this-command-keys)) - unread-command-events)) - (clear-this-command-keys t))) - -(defun evil-collection-corfu-insert-exact () - "Insert current candidate with the `exact' status. -Quit if no candidate is selected." - (interactive) - (if (>= corfu--index 0) - (corfu--insert 'exact) - (corfu-quit))) - -(defcustom evil-collection-corfu-key-themes '(default) - "Determines the key theme to be mapped. - -This variable should be set before `evil-collection-corfu-setup' is called. - -By default, only default is added to this list as the other key themes might -be too obtrusive. - -This key theme variable may be refactored in the future so use with caution." - :type - '(repeat - :tag "Key Themes" - (choice - (const - :tag "Default Theme" default) - (const - :tag "Tab & Go" tab-n-go) - (const - :tag "Magic Return" magic-return) - (const - :tag "Magic Backspace" magic-backspace)))) - -(defcustom evil-collection-corfu-supported-states '(insert replace emacs nil) - "The `evil-state's which `corfu' function can be requested." - :type '(repeat symbol)) - -;;;###autoload -(defun evil-collection-corfu-setup () - "Set up `evil' bindings for `corfu'." - (when (memq 'default evil-collection-corfu-key-themes) - (evil-collection-define-key 'insert 'corfu-map - (kbd "C-n") 'corfu-next - (kbd "C-p") 'corfu-previous - (kbd "C-j") 'corfu-next - (kbd "C-k") 'corfu-previous - (kbd "M-j") 'corfu-next - (kbd "M-k") 'corfu-previous - (kbd "") 'corfu-next - (kbd "") 'corfu-previous - (kbd "") 'evil-collection-corfu-quit-and-escape)) - - ;; https://github.com/minad/corfu#tab-and-go-completion - (when (memq 'tab-n-go evil-collection-corfu-key-themes) - (setq corfu-cycle t - corfu-preselect 'prompt) - (evil-collection-define-key 'insert 'corfu-map - (kbd "TAB") 'corfu-next - [tab] 'corfu-next - [S-tab] 'corfu-previous - [backtab] 'corfu-previous)) - - (when (memq 'magic-return evil-collection-corfu-key-themes) - (defvar evil-collection-corfu-insert-or-next-line - `(menu-item "" nil :filter ,(lambda (&optional _) - (when (>= corfu--index 0) - 'corfu-insert))) - "If we made a selection during `corfu' completion, select it.") - ;; FIXME: Not sure why we need to use `define-key' here instead of - ;; `evil-collection-define-key';. - (when (evil-collection-can-bind-key "") - (define-key corfu-map (kbd "") - evil-collection-corfu-insert-or-next-line)) - (when (evil-collection-can-bind-key "RET") - (define-key corfu-map (kbd "RET") - evil-collection-corfu-insert-or-next-line))) - - (when (memq 'magic-backspace evil-collection-corfu-key-themes) - (defvar evil-collection-corfu-cancel-or-backspace - `(menu-item "" nil :filter ,(lambda (&optional _) - (when (>= corfu--index 0) - 'corfu-reset))) - "If we made a selection during `corfu' completion, cancel it.") - (evil-collection-define-key 'insert - 'corfu-map (kbd "DEL") evil-collection-corfu-cancel-or-backspace) - (evil-collection-define-key 'insert - 'corfu-map [backspace] evil-collection-corfu-cancel-or-backspace) - (evil-collection-define-key 'insert - 'corfu-map (kbd "") evil-collection-corfu-cancel-or-backspace)) - - (when evil-want-C-u-scroll - (evil-collection-define-key 'insert 'corfu-map - (kbd "C-d") 'corfu-scroll-up)) - (when evil-want-C-d-scroll - (evil-collection-define-key 'insert 'corfu-map - (kbd "C-u") 'corfu-scroll-down)) - - (advice-add 'corfu--setup :after (lambda (&rest _) (evil-normalize-keymaps))) - (advice-add 'corfu--teardown :after (lambda (&rest _) (evil-normalize-keymaps))) - (advice-add 'corfu--continue-p - :before-while (lambda (&rest _) (memq evil-state evil-collection-corfu-supported-states))) - - (cl-defmethod corfu--insert :around (status) - (if (or (eq this-command 'evil-collection-corfu-insert-exact) - (not (eq status 'exact))) - (cl-call-next-method) - (evil-collection-corfu-unread-this-command-keys) - (setq this-command 'evil-collection-corfu-insert-exact))) - - (mapc #'evil-declare-ignore-repeat - '(corfu-next - corfu-previous - corfu-first - corfu-last)) - - (mapc #'evil-declare-change-repeat - '(evil-collection-corfu-insert-exact - corfu-insert - corfu-complete))) - -(provide 'evil-collection-corfu) -;;; evil-collection-corfu.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/crdt/evil-collection-crdt.el b/.config/emacs/lisp/evil-collection/modes/crdt/evil-collection-crdt.el deleted file mode 100644 index 25cd61f..0000000 --- a/.config/emacs/lisp/evil-collection/modes/crdt/evil-collection-crdt.el +++ /dev/null @@ -1,57 +0,0 @@ -;;; evil-collection-crdt.el --- Bindings for `crdt' -*- lexical-binding: t -*- - -;; Copyright (C) 2022 Arte Ebrahimi and Jonathan Ming - -;; Authors: Arte Ebrahimi and Jonathan Ming -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.2 -;; Package-Requires: ((emacs "27.1")) -;; Keywords: evil, emacs, convenience, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for crdt. - -;;; Code: -(require 'evil-collection) -(require 'crdt nil t) - -(defvar crdt-mode-map) -(defconst evil-collection-crdt-maps - '(crdt-buffer-menu-mode-map crdt-session-menu-mode-map crdt-user-menu-mode-map crdt-read-settings-map)) - -(defun evil-collection-crdt-setup () - "Set up `evil' bindings for crdt." - (evil-collection-define-key 'normal 'crdt-buffer-menu-mode-map - (kbd "RET") 'crdt-switch-to-buffer-other-window - "x" 'crdt-stop-share-buffer) - - (evil-collection-define-key 'normal 'crdt-session-menu-mode-map - (kbd "RET") 'crdt-list-buffers - "x" 'crdt--stop-session) - - (evil-collection-define-key 'normal 'crdt-user-menu-mode-map - (kbd "RET") 'crdt-goto-user - "x" 'crdt-kill-user - "f" 'crdt-follow-user) - - (evil-collection-define-key 'normal 'crdt-read-settings-map - (kbd "RET") 'exit-recursive-edit - "q" 'abort-recursive-edit - "ZZ" 'exit-recursive-edit)) - -(provide 'evil-collection-crdt) -;;; evil-collection-crdt.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/csv/evil-collection-csv.el b/.config/emacs/lisp/evil-collection/modes/csv/evil-collection-csv.el deleted file mode 100644 index 395aee2..0000000 --- a/.config/emacs/lisp/evil-collection/modes/csv/evil-collection-csv.el +++ /dev/null @@ -1,43 +0,0 @@ -;;; evil-collection-csv.el --- Bindings for `csv' -*- lexical-binding: t -*- - -;; Copyright (C) 2024 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.2 -;; Package-Requires: ((emacs "27.1")) -;; Keywords: evil, emacs, convenience, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for csv. - -;;; Code: -(require 'evil-collection) -(require 'csv nil t) - -(defvar csv-mode-map) -(defconst evil-collection-csv-maps '(csv-mode-map)) - -;;;###autoload -(defun evil-collection-csv-setup () - "Set up `evil' bindings for csv." - (evil-collection-define-key 'normal 'csv-mode-map - [tab] 'csv-tab-command - [backtab] 'csv-backtab-command)) - -(provide 'evil-collection-csv) -;;; evil-collection-csv.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/cus-theme/README.org b/.config/emacs/lisp/evil-collection/modes/cus-theme/README.org deleted file mode 100644 index f34e2c0..0000000 --- a/.config/emacs/lisp/evil-collection/modes/cus-theme/README.org +++ /dev/null @@ -1,30 +0,0 @@ -* cus-theme - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Custom-Themes.html][cus-theme]] (=M-x customize-themes=, =M-x customize-create-theme=). - - Both =custom-theme-choose-mode= and =custom-new-theme-mode= start in - normal state. - -** Key bindings - -*** custom-theme-choose-mode-map - - | Command | Original | Evil | - |-------------------------+--------------+---------------------------------| - | =widget-forward= | =TAB=, =n= | =gj=, =]]=, =C-j=, =TAB=, =n= | - | =widget-backward= | =S-TAB=, =p= | =gk=, =[[=, =C-k=, =S-TAB=, =p= | - | =custom-describe-theme= | =?= | =K= | - | =widget-button-press= | =RET= | =RET= | - | =quit-window= | =q= | =q= | - | =revert-buffer= | =g= | =g= | - -*** custom-new-theme-mode-map - - | Command | Original | Evil | - |-----------------------+--------------+---------------------------------| - | =widget-forward= | =TAB=, =n= | =gj=, =]]=, =C-j=, =TAB=, =n= | - | =widget-backward= | =S-TAB=, =p= | =gk=, =[[=, =C-k=, =S-TAB=, =p= | - | =Custom-buffer-done= | =q= | =q=, =ZZ= | - | =evil-quit= | n/a | =ZQ= | - | =widget-button-press= | =RET= | =RET= | - | =revert-buffer= | =g= | =g= | diff --git a/.config/emacs/lisp/evil-collection/modes/cus-theme/evil-collection-cus-theme.el b/.config/emacs/lisp/evil-collection/modes/cus-theme/evil-collection-cus-theme.el deleted file mode 100644 index 09926a3..0000000 --- a/.config/emacs/lisp/evil-collection/modes/cus-theme/evil-collection-cus-theme.el +++ /dev/null @@ -1,65 +0,0 @@ -;;; evil-collection-cus-theme.el --- Bindings for `cus-theme' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, custom themes, help, faces - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `cus-theme'. - -;;; Code: -(require 'cus-theme) -(require 'evil-collection) - -(defconst evil-collection-cus-theme-maps '(custom-theme-choose-mode-map - custom-new-theme-mode-map)) - -;;;###autoload -(defun evil-collection-cus-theme-setup () - "Set up `evil' bindings for `cus-theme'." - (evil-set-initial-state 'custom-new-theme-mode 'normal) - (evil-set-initial-state 'custom-theme-choose-mode 'normal) - - (evil-collection-define-key 'normal 'custom-theme-choose-mode-map - "gj" 'widget-forward - "gk" 'widget-backward - (kbd "]]") 'widget-forward - (kbd "[[") 'widget-backward - (kbd "C-j") 'widget-forward - (kbd "C-k") 'widget-backward - "K" 'custom-describe-theme) - - (evil-collection-define-key 'normal 'custom-new-theme-mode-map - "gj" 'widget-forward - "gk" 'widget-backward - (kbd "]]") 'widget-forward - (kbd "[[") 'widget-backward - (kbd "C-j") 'widget-forward - (kbd "C-k") 'widget-backward - - ;; quit - "q" 'Custom-buffer-done - "ZQ" 'evil-quit - "ZZ" 'Custom-buffer-done)) - -(provide 'evil-collection-cus-theme) -;;; evil-collection-cus-theme.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/custom/README.org b/.config/emacs/lisp/evil-collection/modes/custom/README.org deleted file mode 100644 index d06b556..0000000 --- a/.config/emacs/lisp/evil-collection/modes/custom/README.org +++ /dev/null @@ -1,16 +0,0 @@ -* custom - - Evil bindings for the Customize interface (=Custom-mode=). - -** Key bindings - - | Command | Original | Evil | - |-----------------------+-------------------------+---------------------------------------| - | =Custom-newline= | =RET= | =RET= | - | =widget-forward= | =TAB=, =n= | =TAB=, =]]=, =gj=, =C-j= | - | =widget-backward= | =S-TAB=, =backtab=, =p= | =S-TAB=, =backtab=, =[[=, =gk=, =C-k= | - | =scroll-up-command= | =SPC= | =SPC= | - | =scroll-down-command= | =S-SPC=, =DEL= | =S-SPC=, == | - | =Custom-goto-parent= | =u= | =^=, =<=, =C-o= | - | =Custom-buffer-done= | =q= | =q=, =ZZ= | - | =evil-quit= | n/a | =ZQ= | diff --git a/.config/emacs/lisp/evil-collection/modes/custom/evil-collection-custom.el b/.config/emacs/lisp/evil-collection/modes/custom/evil-collection-custom.el deleted file mode 100644 index bf9114b..0000000 --- a/.config/emacs/lisp/evil-collection/modes/custom/evil-collection-custom.el +++ /dev/null @@ -1,68 +0,0 @@ -;;; evil-collection-custom.el --- Evil bindings for Customize -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, custom, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for the Customize interface. - -;;; Code: -(require 'cus-edit) -(require 'evil-collection) - -(defconst evil-collection-custom-maps '(custom-mode-map)) - -;;;###autoload -(defun evil-collection-custom-setup () - "Set up `evil' bindings for `Custom-mode'." - (evil-set-initial-state 'Custom-mode 'normal) - - (evil-collection-define-key 'normal 'custom-mode-map - ;; motion - (kbd "") 'widget-forward - (kbd "S-") 'widget-backward - (kbd "") 'widget-backward - (kbd "SPC") 'scroll-up-command - (kbd "S-SPC") 'scroll-down-command - (kbd "") 'scroll-down-command - (kbd "RET") 'Custom-newline - (kbd "]]") 'widget-forward - (kbd "[[") 'widget-backward - ;; TODO: Should the following be added? - (kbd "C-j") 'widget-forward - (kbd "C-k") 'widget-backward - "gj" 'widget-forward - "gk" 'widget-backward - - "^" 'Custom-goto-parent - (kbd "C-o") 'Custom-goto-parent - ;; TODO: Should the following be added? - "<" 'Custom-goto-parent - - ;; quit - "q" 'Custom-buffer-done - "ZQ" 'evil-quit - "ZZ" 'Custom-buffer-done)) - -(provide 'evil-collection-custom) -;;; evil-collection-custom.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/daemons/evil-collection-daemons.el b/.config/emacs/lisp/evil-collection/modes/daemons/evil-collection-daemons.el deleted file mode 100644 index d02ea44..0000000 --- a/.config/emacs/lisp/evil-collection/modes/daemons/evil-collection-daemons.el +++ /dev/null @@ -1,68 +0,0 @@ -;;; evil-collection-daemons.el --- Evil Bindings for Daemons -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: Jay Kamat -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, daemons, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `daemons' from the `daemons.el' package. - -;;; Code: -(require 'daemons nil t) -(require 'evil-collection) - -(defconst evil-collection-daemons-maps '(daemons-mode-map - daemons-output-mode-map)) - -;;;###autoload -(defun evil-collection-daemons-setup () - "Set up `evil' bindings for `daemons'." - (evil-collection-define-key '(normal visual) 'daemons-mode-map - (kbd "RET") 'daemons-status-at-point - "s" 'daemons-start-at-point - "S" 'daemons-stop-at-point - "r" 'daemons-reload-at-point - "R" 'daemons-restart-at-point - - "gr" 'revert-buffer - - "q" 'quit-window - "ZZ" 'quit-window - "ZQ" 'quit-window) - - ;; Functions are available in daemons-output-mode-map as well - (evil-collection-define-key '(normal visual) 'daemons-output-mode-map - (kbd "RET") 'daemons-status-at-point - "s" 'daemons-start-at-point - "S" 'daemons-stop-at-point - "r" 'daemons-reload-at-point - "R" 'daemons-restart-at-point - - "q" 'quit-window - "ZZ" 'quit-window - "ZQ" 'quit-window) - - (evil-set-initial-state 'daemons-mode 'normal) - (evil-set-initial-state 'daemons-output-mode 'normal)) - -(provide 'evil-collection-daemons) -;;; evil-collection-daemons.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/dape/README.org b/.config/emacs/lisp/evil-collection/modes/dape/README.org deleted file mode 100644 index 7899945..0000000 --- a/.config/emacs/lisp/evil-collection/modes/dape/README.org +++ /dev/null @@ -1,29 +0,0 @@ -* dape - - Evil bindings for [[https://github.com/svaante/dape][dape]] (Debug Adapter - Protocol for Emacs). - - The =dape-info-*= mode maps are marked as overriding so dape's single-letter - commands still win in normal state. - -** dape-info-watch-mode-map - - | Command | Original | Evil | - |-----------------------------+----------+------| - | =dape-info-watch-edit-mode= | n/a | =i= | - - Underlying upstream keys (=e=, =m=, ===, =W=, =b= for scope ops) remain - reachable through the overriding map. - -** dape-info-watch-edit-mode-map - - | Command | Original | Evil | - |---------------------------------+-----------+------------------------| - | =dape-info-watch-finish-edit= | =C-c C-c= | =ZZ=, ==, =:w= | - | =dape-info-watch-abort-changes= | =C-c C-k= | =ZQ= | - -** dape-memory-mode-map - - | Command | Original | Evil | - |---------------+-----------+------------| - | =save-buffer= | =C-x C-s= | =ZZ=, =:w= | diff --git a/.config/emacs/lisp/evil-collection/modes/dape/evil-collection-dape.el b/.config/emacs/lisp/evil-collection/modes/dape/evil-collection-dape.el deleted file mode 100644 index 9f4f5a9..0000000 --- a/.config/emacs/lisp/evil-collection/modes/dape/evil-collection-dape.el +++ /dev/null @@ -1,74 +0,0 @@ -;;; evil-collection-dape.el --- Bindings for `dape' -*- lexical-binding: t -*- - -;; Copyright (C) 2024 Daniel Pettersson - -;; Author: Daniel Pettersson -;; Maintainer: Daniel Pettersson -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.2 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools, dape - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `dape'. - -;;; Code: -(require 'evil-collection) -(require 'dape nil t) - -(defvar dape-info-scope-mode-map) -(defvar dape-info-watch-mode-map) -(defvar dape-info-stack-mode-map) -(defvar dape-info-sources-mode-map) -(defvar dape-info-modules-mode-map) -(defvar dape-info-breakpoints-mode-map) -(defvar dape-info-threads-mode-map) - -(defconst evil-collection-dape--info-mode-maps '(dape-info-scope-mode-map - dape-info-watch-mode-map - dape-info-stack-mode-map - dape-info-sources-mode-map - dape-info-modules-mode-map - dape-info-breakpoints-mode-map - dape-info-threads-mode-map)) - -(defconst evil-collection-dape-maps `(dape-info-watch-edit-mode-map - dape-memory-mode-map - . ,evil-collection-dape--info-mode-maps)) - -;;;###autoload -(defun evil-collection-dape-setup () - "Set up `evil' bindings for `dape'." - (dolist (map-symbol evil-collection-dape--info-mode-maps) - (evil-make-overriding-map (symbol-value map-symbol))) - - (evil-collection-define-key 'normal 'dape-info-watch-mode-map - "i" 'dape-info-watch-edit-mode) - - (evil-collection-define-key nil 'dape-info-watch-edit-mode-map - [remap evil-write] 'dape-info-watch-finish-edit) - - (evil-collection-define-key 'normal 'dape-memory-mode-map - [remap evil-write] 'save-buffer - "ZZ" 'save-buffer) - - (evil-collection-define-key 'normal 'dape-info-watch-edit-mode-map - "ZQ" 'dape-info-watch-abort-changes - "ZZ" 'dape-info-watch-finish-edit - (kbd "") 'dape-info-watch-finish-edit)) - -(provide 'evil-collection-dape) -;;; evil-collection-dape.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/dashboard/evil-collection-dashboard.el b/.config/emacs/lisp/evil-collection/modes/dashboard/evil-collection-dashboard.el deleted file mode 100644 index 2cc1386..0000000 --- a/.config/emacs/lisp/evil-collection/modes/dashboard/evil-collection-dashboard.el +++ /dev/null @@ -1,91 +0,0 @@ -;;; evil-collection-dashboard.el --- Evil bindings for Dashboard -*- lexical-binding: t; -*- - -;; Copyright (C) 2020, 2022 Kisaragi Hiu - -;; Author: Kisaragi Hiu -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, dashboard, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; Evil bindings for Dashboard. - -;;; Code: - -(require 'evil-collection) -(require 'dashboard nil t) - -(defvar dashboard-mode-map) - -(defconst evil-collection-dashboard-maps '(dashboard-mode-map)) - -(defun evil-collection-dashboard-setup-jump-commands (&rest _) - "Set up bindings for jump commands in Dashboard." - (evil-collection-define-key 'normal 'dashboard-mode-map - "r" (lookup-key dashboard-mode-map "r") ; recents - "m" (lookup-key dashboard-mode-map "m") ; bookmarks - "p" (lookup-key dashboard-mode-map "p") ; projects - "a" (lookup-key dashboard-mode-map "a") ; agenda - ;; - Dashboard inserts shortcut hints in its buffer, so it's - ;; hard to differ from the default. - ;; - ;; - "registers" isn't shown in Dashboard by default; those who - ;; added it would have to choose between the widget and losing - ;; `evil-forward-word-end'. That's probably still better than - ;; having a shortcut hint that isn't correct. - "e" (lookup-key dashboard-mode-map "e"))) ; registers - -;;;###autoload -(defun evil-collection-dashboard-setup () - "Set up Evil bindings for Dashboard." - (evil-collection-set-readonly-bindings 'dashboard-mode-map) - (evil-collection-define-key 'normal 'dashboard-mode-map - ;; Movement - "j" 'dashboard-next-line - "k" 'dashboard-previous-line - ;; Like `evil-collection-outline.el'. - ;; These don't support COUNT, so it's probably better to leave [[ - ;; and ]] alone. - "gj" 'dashboard-next-section - "gk" 'dashboard-previous-section - - ;; Enabling this binding makes RET insert a newline. - ;; Default `evil-ret' works better. - ;; (kbd "RET") 'dashboard-return - - ;; Other commands - [tab] 'widget-forward - [backtab] 'widget-backward - [down-mouse-1] 'widget-button-click) - - ;; Jump commands - ;; - ;; I had to use an advice as dashboard.el defines these bindings - ;; after the map has been defined, as unnamed functions bound to a - ;; local variable. See - ;; https://github.com/emacs-dashboard/emacs-dashboard/blob/f15d3e2e/dashboard-widgets.el#L308 - ;; for what I mean. - ;; - ;; Despite the name, this function is what sets up the dashboard - ;; buffer itself. - (advice-add 'dashboard-insert-startupify-lists :after - 'evil-collection-dashboard-setup-jump-commands)) - -(provide 'evil-collection-dashboard) - -;;; evil-collection-dashboard.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/deadgrep/README.org b/.config/emacs/lisp/evil-collection/modes/deadgrep/README.org deleted file mode 100644 index c35427a..0000000 --- a/.config/emacs/lisp/evil-collection/modes/deadgrep/README.org +++ /dev/null @@ -1,24 +0,0 @@ -* deadgrep - - Evil bindings for [[https://github.com/Wilfred/deadgrep][deadgrep]]. - -** deadgrep-mode-map - - | Command | Original | Evil | - |--------------------------------------+-----------+---------------| - | =deadgrep-visit-result= | =RET= | =RET= | - | =deadgrep-visit-result-other-window= | =o= | =S-RET=, =go= | - | =deadgrep-forward-match= | =n= | =C-j=, =gj= | - | =deadgrep-backward-match= | =p= | =C-k=, =gk= | - | =deadgrep-toggle-file-results= | =TAB= | =TAB= | - | =deadgrep-restart= | =g= | =gr= | - | =deadgrep-edit-mode= | =C-x C-q= | =i= | - | =quit-window= | n/a | =q=, =ZZ= | - | =evil-quit= | n/a | =ZQ= | - -** deadgrep-edit-mode-map - - | Command | Original | Evil | - |-------------------------+-----------+------------| - | =deadgrep-visit-result= | =RET= | =RET= | - | =deadgrep-mode= | =C-c C-c= | == | diff --git a/.config/emacs/lisp/evil-collection/modes/deadgrep/evil-collection-deadgrep.el b/.config/emacs/lisp/evil-collection/modes/deadgrep/evil-collection-deadgrep.el deleted file mode 100644 index 89e3444..0000000 --- a/.config/emacs/lisp/evil-collection/modes/deadgrep/evil-collection-deadgrep.el +++ /dev/null @@ -1,64 +0,0 @@ -;;; evil-collection-deadgrep.el --- Bindings for deadgrep -*- lexical-binding: t -*- - -;; Copyright (C) 2018 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for deadgrep. - -;;; Code: -(require 'evil-collection) -(require 'deadgrep nil t) - -(defconst evil-collection-deadgrep-maps '(deadgrep-edit-mode-map - deadgrep-mode-map)) - -;;;###autoload -(defun evil-collection-deadgrep-setup () - "Set up `evil' bindings for deadgrep.." - (evil-collection-define-key 'normal 'deadgrep-edit-mode-map - (kbd "RET") 'deadgrep-visit-result - (kbd "") 'deadgrep-mode) - (evil-collection-define-key 'normal 'deadgrep-mode-map - (kbd "RET") 'deadgrep-visit-result - (kbd "") 'deadgrep-visit-result-other-window - "go" 'deadgrep-visit-result-other-window - "gr" 'deadgrep-restart - (kbd "C-j") 'deadgrep-forward - (kbd "C-k") 'deadgrep-backward - "gj" 'deadgrep-forward - "gk" 'deadgrep-backward - (kbd "TAB") 'deadgrep-toggle-file-results - - "i" 'deadgrep-edit-mode - - ;; FIXME: Maybe we should bind this to something? - ;; (define-key map (kbd "C-c C-k") #'deadgrep-kill-process) - - ;; Quit - "q" 'quit-window - "ZZ" 'quit-window - "ZQ" 'evil-quit)) - -(provide 'evil-collection-deadgrep) -;;; evil-collection-deadgrep.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/debbugs/evil-collection-debbugs.el b/.config/emacs/lisp/evil-collection/modes/debbugs/evil-collection-debbugs.el deleted file mode 100644 index be0b7bf..0000000 --- a/.config/emacs/lisp/evil-collection/modes/debbugs/evil-collection-debbugs.el +++ /dev/null @@ -1,81 +0,0 @@ -;;; evil-collection-debbugs.el --- Evil bindings for debbugs -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, debbugs, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for debbugs. - -;;; Code: -(require 'debbugs nil t) -(require 'evil-collection) - -(defconst evil-collection-debbugs-maps '(debbugs-gnu-mode-map)) - -;;;###autoload -(defun evil-collection-debbugs-setup () - "Set up `evil' bindings for `debbugs-gnu-mode'." - (evil-set-initial-state 'debbugs-gnu-mode 'normal) - - (evil-collection-define-key 'normal 'debbugs-gnu-mode-map - ;; motion - (kbd "") 'forward-button - (kbd "") 'backward-button - (kbd "SPC") 'scroll-up-command - - (kbd "RET") 'debbugs-gnu-select-report - "c" 'debbugs-gnu-send-control-message - "d" 'debbugs-gnu-display-status - - ;; filter - "s" 'debbugs-gnu-narrow-to-status - "S" 'debbugs-gnu-search - ;; "S" 'debbugs-gnu-widen ; Useless if we can just press "s RET" (empty filter). - "x" 'debbugs-gnu-toggle-suppress - "r" 'debbugs-gnu-show-all-blocking-reports - - ;; sort - "o" 'debbugs-gnu-toggle-sort - "O" 'tabulated-list-sort - - ;; show - "gB" 'debbugs-gnu-show-blocking-reports - "gb" 'debbugs-gnu-show-blocked-by-reports - - ;; mark - "m" 'debbugs-gnu-toggle-tag - - ;; refresh - "gr" 'debbugs-gnu-rescan - - "g?" 'debbugs-gnu-manual - "gt" 'debbugs-gnu-view-bug-triage - "g#" 'debbugs-gnu-bugs - - ;; quit - "q" 'quit-window - "ZQ" 'quit-window - "ZZ" 'quit-window)) - -(provide 'evil-collection-debbugs) -;;; evil-collection-debbugs.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/debug/README.org b/.config/emacs/lisp/evil-collection/modes/debug/README.org deleted file mode 100644 index ea4dcfe..0000000 --- a/.config/emacs/lisp/evil-collection/modes/debug/README.org +++ /dev/null @@ -1,26 +0,0 @@ -* debug - - Evil bindings for the Elisp debugger (=debugger-mode=). - -** Key bindings - - | Command | Original | Evil | - |------------------------------------------------------+----------+-----------| - | =debug-help-follow= / =backtrace-help-follow-symbol= | =RET= | =RET= | - | =forward-button= | =TAB= | =TAB= | - | =backward-button= | =S-TAB= | =S-TAB= | - | =next-line= | n/a | =SPC= | - | =debugger-continue= | =c= | =c= | - | =debugger-step-through= | =d= | =d= | - | =debugger-jump= | =j= | =J= | - | =debugger-eval-expression= | =e= | =x=, =E= | - | =debugger-record-expression= | =R= | =R= | - | =debugger-return-value= | =r= | =r= | - | =debugger-frame= | =b= | =gb= | - | =debugger-frame-clear= | =u= | =u= | - | =debugger-list-functions= | =l= | =gl= | - | =debugger-toggle-locals= / =backtrace-toggle-locals= | =v= | =L=, =p= | - | =backtrace-multi-line= | =+= | =zo= | - | =backtrace-single-line= | =-= | =zc= | - | =top-level= | =q= | =q=, =ZZ= | - | =evil-quit= | n/a | =ZQ= | diff --git a/.config/emacs/lisp/evil-collection/modes/debug/evil-collection-debug.el b/.config/emacs/lisp/evil-collection/modes/debug/evil-collection-debug.el deleted file mode 100644 index cf00b51..0000000 --- a/.config/emacs/lisp/evil-collection/modes/debug/evil-collection-debug.el +++ /dev/null @@ -1,79 +0,0 @@ -;;; evil-collection-debug.el --- Evil bindings for the debugger -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, debug, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for the debugger. - -;;; Code: - -(require 'evil-collection) -(require 'debug) - -(defconst evil-collection-debug-maps '(debugger-mode-map)) - -;;;###autoload -(defun evil-collection-debug-setup () - "Set up `evil' bindings for `debug'." - (evil-set-initial-state 'debugger-mode 'normal) - - (evil-collection-define-key 'normal 'debugger-mode-map - ;; motion - (kbd "") 'forward-button - (kbd "S-") 'backward-button - (kbd "RET") (if (fboundp 'debug-help-follow) - 'debug-help-follow - 'backtrace-help-follow-symbol) - (kbd "SPC") 'next-line - - "R" 'debugger-record-expression - "c" 'debugger-continue - "d" 'debugger-step-through - - "x" 'debugger-eval-expression - "E" 'debugger-eval-expression - - "J" 'debugger-jump - - "gl" 'debugger-list-functions - "gb" 'debugger-frame - "r" 'debugger-return-value - "u" 'debugger-frame-clear - "L" (if (fboundp 'debugger-toggle-locals) - 'debugger-toggle-locals - 'backtrace-toggle-locals) - "p" (if (fboundp 'debugger-toggle-locals) - 'debugger-toggle-locals - 'backtrace-toggle-locals) - - "zo" 'backtrace-multi-line - "zc" 'backtrace-single-line - - ;; quit - "q" 'top-level - "ZQ" 'evil-quit - "ZZ" 'top-level)) - -(provide 'evil-collection-debug) -;;; evil-collection-debug.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/devdocs/evil-collection-devdocs.el b/.config/emacs/lisp/evil-collection/modes/devdocs/evil-collection-devdocs.el deleted file mode 100644 index 696f669..0000000 --- a/.config/emacs/lisp/evil-collection/modes/devdocs/evil-collection-devdocs.el +++ /dev/null @@ -1,66 +0,0 @@ -;;; evil-collection-devdocs.el --- Evil bindings for devdocs -*- lexical-binding: t -*- - -;; Copyright (C) 2021 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for devdocs. - -;;; Code: -(require 'evil-collection) -(require 'devdocs nil t) - -(defconst evil-collection-devdocs-maps '(devdocs-mode-map)) - -;;;###autoload -(defun evil-collection-devdocs-setup () - "Set up `evil' bindings for `devdocs'." - (evil-set-initial-state 'devdocs-mode 'normal) - (evil-collection-set-readonly-bindings 'devdocs-mode-map) - - (evil-collection-define-key 'normal 'devdocs-mode-map - ;; motion - (kbd "SPC") 'scroll-up-command - (kbd "S-SPC") 'scroll-down-command - (kbd "") 'forward-button - (kbd "") 'backward-button - - "[[" 'devdocs-previous-page - "]]" 'devdocs-next-page - "gk" 'devdocs-previous-page - "gj" 'devdocs-next-page - - "g." 'devdocs-goto-target - - ;; history - (kbd "C-p") 'devdocs-go-back - (kbd "C-n") 'devdocs-go-forward - - ;; copy - "C" 'devdocs-copy-url - - ;; search - "s" 'devdocs-lookup)) - -(provide 'evil-collection-devdocs) -;;; evil-collection-devdocs.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/dictionary/evil-collection-dictionary.el b/.config/emacs/lisp/evil-collection/modes/dictionary/evil-collection-dictionary.el deleted file mode 100644 index 7113fb3..0000000 --- a/.config/emacs/lisp/evil-collection/modes/dictionary/evil-collection-dictionary.el +++ /dev/null @@ -1,51 +0,0 @@ -;;; evil-collection-dictionary.el --- Evil bindings for dictionary-mode -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: Sid Kasivajhula -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, dictionary, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `dictionary'. - -;;; Code: -(require 'evil-collection) -(require 'dictionary nil t) - -(defconst evil-collection-dictionary-maps '(dictionary-mode-map)) - -;;;###autoload -(defun evil-collection-dictionary-setup () - "Set up `evil' bindings for `dictionary'." - (evil-set-initial-state 'dictionary-mode 'normal) - (evil-collection-set-readonly-bindings 'dictionary-mode-map) - (evil-collection-define-key 'normal 'dictionary-mode-map - ;; button - [tab] 'forward-button - [backtab] 'backward-button - ;; mouse - [mouse-1] 'link-selected - ;; misc - "g?" 'dictionary-help ; normally under `h` which is rebound here - (kbd "C-o") 'dictionary-previous)) ; normally under `l` which is rebound here - -(provide 'evil-collection-dictionary) -;;; evil-collection-dictionary.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/diff-hl/README.org b/.config/emacs/lisp/evil-collection/modes/diff-hl/README.org deleted file mode 100644 index 67e87a7..0000000 --- a/.config/emacs/lisp/evil-collection/modes/diff-hl/README.org +++ /dev/null @@ -1,29 +0,0 @@ -* diff-hl - - Evil bindings for [[https://github.com/dgutov/diff-hl][diff-hl]]'s show-hunk popup and inline overlay. - - Also adds =evil-normalize-keymaps= to - =diff-hl-show-hunk-inline-transient-mode-hook= so the bindings take - effect when the transient mode toggles on. - -** Key bindings - -*** diff-hl-show-hunk-map - - | Command | Original | Evil | - |----------------------------------------+----------+------| - | =diff-hl-show-hunk-previous= | =p=, ={= | =p= | - | =diff-hl-show-hunk-next= | =n=, =}= | =n= | - | =diff-hl-show-hunk-copy-original-text= | =c= | =c= | - | =diff-hl-show-hunk-revert-hunk= | =r= | =r= | - | =diff-hl-show-hunk-stage-hunk= | =S= | =S= | - -*** diff-hl-show-hunk-inline-transient-mode-map - - | Command | Original | Evil | - |--------------------------------------------+-------------------+------------| - | =diff-hl-show-hunk-inline-hide= | =q=, =C-g=, =ESC= | =q=, =ESC= | - | =diff-hl-show-hunk-inline--popup-down= | ==, =C-n= | =j= | - | =diff-hl-show-hunk-inline--popup-up= | ==, =C-p= | =k= | - | =diff-hl-show-hunk-inline--popup-pagedown= | ==, =C-v= | =C-f= | - | =diff-hl-show-hunk-inline--popup-pageup= | ==, =M-v= | =C-b= | diff --git a/.config/emacs/lisp/evil-collection/modes/diff-hl/evil-collection-diff-hl.el b/.config/emacs/lisp/evil-collection/modes/diff-hl/evil-collection-diff-hl.el deleted file mode 100644 index 9a9fe5b..0000000 --- a/.config/emacs/lisp/evil-collection/modes/diff-hl/evil-collection-diff-hl.el +++ /dev/null @@ -1,75 +0,0 @@ -;;; evil-collection-diff-hl.el --- Evil bindings for diff-hl -*- lexical-binding: t -*- - -;; Copyright (C) 2021 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, diff, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for diff-hl. -;; -;; All functions used below are autoloaded except for -;; `diff-hl-show-hunk-inline--popup-down' et al commands. -;; -;; When users invoke `diff-hl-show-hunk' (it invokes -;; `diff-hl-show-hunk-function' under the hood), `diff-hl-show-hunk-inline.el' or -;; `diff-hl-show-hunk-posframe.el' will be loaded eventually. -;; -;; So there is no -;; -;; (require 'diff-hl nil t) -;; -;; below. - -;;; Code: -(require 'evil-collection) - -(defconst evil-collection-diff-hl-maps '(diff-hl-show-hunk-map - diff-hl-show-hunk-inline-transient-mode-map)) - -;;;###autoload -(defun evil-collection-diff-hl-setup() - "Set up `evil' bindings for `diff-hl'." - (add-hook 'diff-hl-show-hunk-inline-transient-mode-hook 'evil-normalize-keymaps) - - (evil-collection-define-key 'normal 'diff-hl-show-hunk-inline-transient-mode-map - ;; quit - "q" 'diff-hl-show-hunk-inline-hide - (kbd "") 'diff-hl-show-hunk-inline-hide - - ;; motion - "j" 'diff-hl-show-hunk-inline--popup-down - "k" 'diff-hl-show-hunk-inline--popup-up - (kbd "C-f") 'diff-hl-show-hunk-inline--popup-pagedown - (kbd "C-b") 'diff-hl-show-hunk-inline--popup-pageup) - - ;; Actually `diff-hl-show-hunk-inline-transient-mode-map' will inherit it by - ;; `set-keymap-parent'. - (evil-collection-define-key 'normal 'diff-hl-show-hunk-map - ;; Keep it the same as the overlay shows. - "p" 'diff-hl-show-hunk-previous - "n" 'diff-hl-show-hunk-next - "c" 'diff-hl-show-hunk-copy-original-text - "r" 'diff-hl-show-hunk-revert-hunk - "S" 'diff-hl-show-hunk-stage-hunk)) - -(provide 'evil-collection-diff-hl) -;;; evil-collection-diff-hl.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/diff-mode/README.org b/.config/emacs/lisp/evil-collection/modes/diff-mode/README.org deleted file mode 100644 index a15d829..0000000 --- a/.config/emacs/lisp/evil-collection/modes/diff-mode/README.org +++ /dev/null @@ -1,66 +0,0 @@ -* diff-mode - - Evil bindings for =diff-mode=. By default they are installed on a dedicated - minor mode (=evil-collection-diff-mode=) attached to every =diff-mode= buffer, - so normal/insert states keep working for editing. Set - =evil-collection-diff-mode-want-minor-mode= to =nil= to instead bind on - =diff-mode-map= and have read-only / motion state toggle together. - -** Key bindings (minor-mode setup, default) - - Active in normal state. - - | Command | Original | Evil | - |--------------------+-----------+-------------| - | =diff-goto-source= | =C-c C-c= | =RET= | - | =diff-file-prev= | =M-{= | =[[= | - | =diff-file-next= | =M-}= | =]]= | - | =diff-hunk-prev= | =M-p= | =gk=, =C-k= | - | =diff-hunk-next= | =M-n= | =gj=, =C-j= | - | =diff-ediff-patch= | =C-c C-e= | =ge= | - | =read-only-mode= | n/a | =\= | - | =quit-window= | n/a | =q= | - - With =evil-collection-want-g-bindings= (the default), edit commands sit under - =g=: - - | Command | Original | Evil | - |-----------------------------------------------+-----------+------| - | =diff-apply-hunk= | =C-c C-a= | =ga= | - | =diff-refine-hunk= | =C-c C-b= | =g*= | - | =diff-hunk-kill= | =C-c C-k= | =gx= | - | =diff-file-kill= | =C-c M-k= | =gX= | - | =diff-split-hunk= | =C-c C-s= | =gs= | - | =diff-test-hunk= | =C-c C-t= | =gc= | - | =diff-reverse-direction= | =C-c C-r= | =g~= | - | =diff-ignore-whitespace-hunk= | =C-c C-w= | =g#= | - | =diff-add-change-log-entries-other-window= | =C-x 4 A= | =gA= | - | =evil-collection-diff-toggle-context-unified= | n/a | =g%= | - | =evil-collection-diff-toggle-restrict-view= | =C-c C-n= | =go= | - | =next-error-follow-minor-mode= | =C-c C-f= | =gi= | - - Without =evil-collection-want-g-bindings=, the commands above land on their - single-letter equivalents (=a=, =*=, =d=, =D=, =s=, =c=, =~=, =#=, =A=, =x=, - =o=, =i=) instead. - -** Motion-state setup (when =evil-collection-diff-mode-want-minor-mode= is nil) - - Same set of commands, but they go on =diff-mode-map= directly in normal and - motion states. A hook (=evil-collection-diff-toggle-setup=) flips state - whenever the buffer's read-only flag changes — read-only buffers enter motion - state, writable buffers normal state. Toggle this hook per-buffer with =M-x - evil-collection-diff-toggle-setup=. - -** New commands - - | Command | Key | | - |-----------------------------------------------+------+--------------------------------------------------| - | =evil-collection-diff-toggle-context-unified= | =g%= | Toggle context <-> unified view. | - | =evil-collection-diff-toggle-restrict-view= | =go= | Toggle =diff-restrict-view=; widens if narrowed. | - | =evil-collection-diff-toggle-setup= | n/a | Toggle the read-only state hook in the buffer. | - -** Customization - - | Variable | Default | Purpose | - |---------------------------------------------+---------+----------------------------------------------------------------------------| - | =evil-collection-diff-mode-want-minor-mode= | =t= | Bind on =evil-collection-diff-mode= minor mode instead of =diff-mode-map=. | diff --git a/.config/emacs/lisp/evil-collection/modes/diff-mode/evil-collection-diff-mode.el b/.config/emacs/lisp/evil-collection/modes/diff-mode/evil-collection-diff-mode.el deleted file mode 100644 index 1015705..0000000 --- a/.config/emacs/lisp/evil-collection/modes/diff-mode/evil-collection-diff-mode.el +++ /dev/null @@ -1,222 +0,0 @@ -;;; evil-collection-diff-mode.el --- Add Evil bindings to diff-mode -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, diff, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; -;; Evil-Collection-Diff re-uses the read-only particularity of `diff-mode': -;; When the buffer is read-only, enter motion state -;; and manipulate the diffs with simple bindings. -;; When the buffer is writage, use normal/insert states with some Evil-specific -;; keys to ease navigation. -;; -;; See also `evil-collection-diff-toggle-setup'. - -;;; Code: - -(require 'evil-collection) -(require 'diff-mode) - -(defconst evil-collection-diff-mode-maps '(diff-mode-map)) - -(defun evil-collection-diff-read-only-state-switch () - "Make read-only in motion state, writable in normal state." - (when (eq major-mode 'diff-mode) - (if buffer-read-only - (evil-motion-state) - (evil-normal-state)))) - -;;;###autoload -(defun evil-collection-diff-toggle-setup () - "Toggle visiting diff buffers in motion state." - (interactive) - (when (eq major-mode 'diff-mode) - (if (memq 'evil-collection-diff-read-only-state-switch read-only-mode-hook) - (remove-hook 'read-only-mode-hook 'evil-collection-diff-read-only-state-switch t) - (add-hook 'read-only-mode-hook 'evil-collection-diff-read-only-state-switch nil t)))) - -;;; TODO: Report toggle function upstream? -(defun evil-collection-diff-toggle-context-unified (start end) - "Toggle between context and unified views. - -START and END are either taken from the region (if a prefix arg is given) or -else cover the whole buffer." - (interactive (if (or current-prefix-arg (use-region-p)) - (list (region-beginning) (region-end)) - (list (point-min) (point-max)))) - ;; There seems to be no way to know whether we are in context or unified views. - ;; Workaround: assume that point-max will change. This is brittle. - (let ((old-point-max (point-max))) - (diff-unified->context start end) - (when (= old-point-max (point-max)) - (diff-context->unified start end)))) - -;;; TODO: Report toggle function upstream? -(defun evil-collection-diff-toggle-restrict-view (&optional arg) - "Toggle the restriction of the view to the current hunk. -When restricting and if the prefix ARG is given, restrict the view to the -current file instead." - (interactive "P") - (if (buffer-narrowed-p) - (widen) - (diff-restrict-view arg))) - -(defcustom evil-collection-diff-mode-want-minor-mode t - "Whether to bind keys to a `evil-collection' created minor mode. - -When this is enabled, disable bootstrap related to setting up keys for motion, -binding keys to a minor mode created by `evil-collection' instead." - :type 'boolean - :group 'evil-collection) - -(define-obsolete-variable-alias 'evil-collection-diff-mode-want-g-bindings - 'evil-collection-want-g-bindings "0.0.11") - -(defvar evil-collection-diff-mode-map (make-sparse-keymap)) - -(define-minor-mode evil-collection-diff-mode - "A minor mode to attach to `diff-mode' results" - :group 'evil-collection-diff-mode - :keymap evil-collection-diff-mode-map - :lighter nil) - -(defun evil-collection-diff-mode-turn-on () - "Turn on `evil-collection-diff-mode' and normalize keymaps." - (evil-collection-diff-mode) - (evil-normalize-keymaps)) - -(defun evil-collection-diff-mode-setup-on-minor-mode () - "Set up bindings on `evil-collection-diff-mode'." - (evil-collection-define-key 'normal 'evil-collection-diff-mode-map - (kbd "[[") 'diff-file-prev - (kbd "]]") 'diff-file-next - (kbd "C-j") 'diff-hunk-next - (kbd "C-k") 'diff-hunk-prev - "gj" 'diff-hunk-next - "gk" 'diff-hunk-prev - "ge" 'diff-ediff-patch - "q" 'quit-window - "\\" 'read-only-mode - (kbd "RET") 'diff-goto-source) - - (if evil-collection-want-g-bindings - (evil-collection-define-key 'normal 'evil-collection-diff-mode-map - "gA" 'diff-add-change-log-entries-other-window - "ga" 'diff-apply-hunk - "g*" 'diff-refine-hunk - "gX" 'diff-file-kill - "gx" 'diff-hunk-kill - "gi" 'next-error-follow-minor-mode - "go" 'evil-collection-diff-toggle-restrict-view - "g~" 'diff-reverse-direction - "gs" 'diff-split-hunk - "gc" 'diff-test-hunk - "g%" 'evil-collection-diff-toggle-context-unified - "g#" 'diff-ignore-whitespace-hunk) - (evil-collection-define-key 'normal 'evil-collection-diff-mode-map - "A" 'diff-add-change-log-entries-other-window - "a" 'diff-apply-hunk - "*" 'diff-refine-hunk - "D" 'diff-file-kill - "d" 'diff-hunk-kill - "i" 'next-error-follow-minor-mode - "o" 'evil-collection-diff-toggle-restrict-view - "~" 'diff-reverse-direction - "s" 'diff-split-hunk - "c" 'diff-test-hunk - "x" 'evil-collection-diff-toggle-context-unified - "#" 'diff-ignore-whitespace-hunk)) - - ;; Enable a separate minor mode so that we can bind keys to it. - (add-hook 'diff-mode-hook 'evil-collection-diff-mode)) - -(defun evil-collection-diff-mode-setup-on-motion-state () - "Set up keys with motion state." - (evil-collection-define-key 'normal 'diff-mode-map - ;; motion - (kbd "SPC") 'scroll-up-command - (kbd "S-SPC") 'scroll-down-command - (kbd "[[") 'diff-file-prev - (kbd "]]") 'diff-file-next - (kbd "C-j") 'diff-hunk-next - (kbd "C-k") 'diff-hunk-prev - "gj" 'diff-hunk-next - "gk" 'diff-hunk-prev - - "q" 'quit-window - - "\\" 'read-only-mode) ; magit has "\" - - (evil-collection-define-key 'motion 'diff-mode-map - ;; motion - (kbd "SPC") 'scroll-up-command - (kbd "S-SPC") 'scroll-down-command - (kbd "[[") 'diff-file-prev - (kbd "]]") 'diff-file-next - (kbd "C-j") 'diff-hunk-next - (kbd "C-k") 'diff-hunk-prev - "gj" 'diff-hunk-next - "gk" 'diff-hunk-prev - - (kbd "RET") 'diff-goto-source - "A" 'diff-add-change-log-entries-other-window - - "a" 'diff-apply-hunk - "*" 'diff-refine-hunk - "D" 'diff-file-kill - "d" 'diff-hunk-kill - - "ge" 'diff-ediff-patch - "i" 'next-error-follow-minor-mode - "o" 'evil-collection-diff-toggle-restrict-view - "~" 'diff-reverse-direction - "s" 'diff-split-hunk - "c" 'diff-test-hunk - "x" 'evil-collection-diff-toggle-context-unified - "#" 'diff-ignore-whitespace-hunk - - "\\" 'read-only-mode) ; magit has "\" - ) - -;;;###autoload -(defun evil-collection-diff-mode-setup () - "Set up `evil' bindings for `diff-mode'." - ;; Don't switch to read-only/motion state by default as this can interfere - ;; with other modes which require a writable buffer, e.g. magit. - (evil-set-initial-state 'diff-mode 'normal) - - (if evil-collection-diff-mode-want-minor-mode - (evil-collection-diff-mode-setup-on-minor-mode) - (evil-collection-diff-mode-setup-on-motion-state))) - -(unless evil-collection-diff-mode-want-minor-mode - (add-hook 'diff-mode-hook 'evil-collection-diff-toggle-setup)) - -(defun evil-collection-diff-unload-function () - "For `unload-feature'." - (unless evil-collection-diff-mode-want-minor-mode - (remove-hook 'diff-mode-hook 'evil-collection-diff-toggle-setup))) - -(provide 'evil-collection-diff-mode) -;;; evil-collection-diff-mode.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/difftastic/README.org b/.config/emacs/lisp/evil-collection/modes/difftastic/README.org deleted file mode 100644 index 2486a73..0000000 --- a/.config/emacs/lisp/evil-collection/modes/difftastic/README.org +++ /dev/null @@ -1,20 +0,0 @@ -* difftastic - - Evil bindings for [[https://github.com/pkryger/difftastic.el][difftastic]] result buffers. - -** Key bindings - - | Command | Original | Evil | - |---------------------------------------+---------------------+-------------| - | =difftastic-previous-file= | =P=, =M-p= | =[[= | - | =difftastic-next-file= | =N=, =M-n= | =]]= | - | =difftastic-next-chunk= | =n= | =C-j=, =gj= | - | =difftastic-previous-chunk= | =p= | =C-k=, =gk= | - | =difftastic-hide-chunk= | | =zc= | - | =difftastic-show-chunk= | | =zo= | - | =difftastic-toggle-chunk= | =TAB= | =TAB= | - | =difftastic-diff-visit-file= | =RET= | =RET= | - | =difftastic-diff-visit-worktree-file= | =C-=, =C-j= | =o= | - | =difftastic-rerun= | =g= | =gr= | - | =difftastic-leave= | =c=, =e= | =q= | - | =difftastic-quit= | =q= | =ZQ= | diff --git a/.config/emacs/lisp/evil-collection/modes/difftastic/evil-collection-difftastic.el b/.config/emacs/lisp/evil-collection/modes/difftastic/evil-collection-difftastic.el deleted file mode 100644 index e1b223c..0000000 --- a/.config/emacs/lisp/evil-collection/modes/difftastic/evil-collection-difftastic.el +++ /dev/null @@ -1,57 +0,0 @@ -;;; evil-collection-difftastic.el --- Bindings for `difftastic' -*- lexical-binding: t -*- - -;; Copyright (C) 2025 hiecaq - -;; Author: hiecaq -;; Maintainer: hiecaq -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, convenience, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for difftastic. - -;;; Code: -(require 'evil-collection) -(require 'difftastic nil t) - -(defvar difftastic-mode-map) - -(defconst evil-collection-difftastic-maps '(difftastic-mode-map)) - -;;;###autoload -(defun evil-collection-difftastic-setup () - "Set up `evil' bindings for `difftastic'." - (evil-collection-define-key 'normal 'difftastic-mode-map - (kbd "[[") 'difftastic-previous-file - (kbd "]]") 'difftastic-next-file - (kbd "C-j") 'difftastic-next-chunk - (kbd "C-k") 'difftastic-previous-chunk - "gj" 'difftastic-next-chunk - "gk" 'difftastic-previous-chunk - "zc" 'difftastic-hide-chunk - "zo" 'difftastic-show-chunk - (kbd "TAB") 'difftastic-toggle-chunk - (kbd "RET") 'difftastic-diff-visit-file - "o" 'difftastic-diff-visit-worktree-file - "gr" 'difftastic-rerun - "q" 'difftastic-leave - "ZQ" 'difftastic-quit)) - -(provide 'evil-collection-difftastic) - -;;; evil-collection-difftastic.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/dired-sidebar/evil-collection-dired-sidebar.el b/.config/emacs/lisp/evil-collection/modes/dired-sidebar/evil-collection-dired-sidebar.el deleted file mode 100644 index f03f379..0000000 --- a/.config/emacs/lisp/evil-collection/modes/dired-sidebar/evil-collection-dired-sidebar.el +++ /dev/null @@ -1,52 +0,0 @@ -;;; evil-collection-dired-sidebar.el --- Evil bindings for dired-sidebar -*- lexical-binding: t; -*- - -;; Copyright (C) 2019 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, dired, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for `dired-sidebar' - -;;; Code: - -(require 'evil-collection) -(require 'dired-sidebar nil t) - -(defconst evil-collection-dired-sidebar-maps '(dired-sidebar-mode-map)) - -;;;###autoload -(defun evil-collection-dired-sidebar-setup () - "Set up `evil' bindings for `dired-sidebar'." - (evil-collection-define-key 'normal 'dired-sidebar-mode-map - (kbd "RET") 'dired-sidebar-find-file - (kbd "C-m") 'dired-sidebar-find-file - (kbd "") 'dired-sidebar-find-file - (kbd "TAB") 'dired-sidebar-subtree-toggle - [tab] 'dired-sidebar-subtree-toggle - "^" 'dired-sidebar-up-directory - "-" 'dired-sidebar-up-directory - (kbd "C-o") 'dired-sidebar-find-file-alt - [mouse-2] 'dired-sidebar-mouse-subtree-cycle-or-find-file - "ZZ" 'quit-window)) - -(provide 'evil-collection-dired-sidebar) -;;; evil-collection-dired-sidebar.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/dired/README.org b/.config/emacs/lisp/evil-collection/modes/dired/README.org deleted file mode 100644 index 4068799..0000000 --- a/.config/emacs/lisp/evil-collection/modes/dired/README.org +++ /dev/null @@ -1,40 +0,0 @@ -* dired - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html][Dired]]. - -** Key bindings - - | Command | Original | Evil | - |--------------------------------+-----------------+-----------------| - | =dired-next-line= | =n=, =SPC= | =j=, =SPC= | - | =dired-previous-line= | =p=, =S-SPC= | =k=, =S-SPC= | - | =dired-find-file= | =f=, =RET=, =e= | =gf=, =RET= | - | =dired-find-file-other-window= | =o= | =gO= | - | =dired-view-file= | =v= | =go= | - | =revert-buffer= | =g= | =gr= | - | =dired-summary= | =?=, =h= | =g?= | - | =dired-show-file-type= | =y= | =gy= | - | =dired-copy-filename-as-kill= | =w= | =Y= | - | =dired-do-kill-lines= | =k= | =K= | - | =dired-do-chgrp= | =G= | =gG= | - | =dired-hide-subdir= | =$= | =g$= | - | =dired-next-dirline= | =>= | =gj=, =]]=, =>= | - | =dired-prev-dirline= | =<= | =gk=, =[[=, =<= | - | =dired-up-directory= | =^= | =^=, =-= | - | =dired-sort-toggle-or-edit= | =s= | =o= | - | =dired-do-redisplay= | =l= | =r= | - | =dired-find-alternate-file= | =a= | =a= | - | =quit-window= | =q= | =q= | - - Uppercase operator keys (=A=, =B=, =C=, =D=, =H=, =L=, =M=, =O=, =P=, =Q=, - =R=, =S=, =T=, =U=, =W=, =X=, =Z=) and marking/flagging keys (=+=, =&=, - =!=, =%=, =*=, =~=, =#=, =.=, ===) keep their default dired bindings. - - On Emacs 30+: =E= → =dired-do-open=. - -** Integrations - - - [[https://github.com/Fuco1/dired-hacks][dired-narrow]]: =s= → =dired-narrow-regexp=. - - [[https://github.com/Fuco1/dired-hacks][dired-subtree]]: =TAB= toggle, =gh= / =gl= up/down, =M-j= / =M-k= sibling navigation. - - [[https://github.com/Fuco1/dired-hacks][dired-filter]]: =*= → =dired-filter-mark-map=, =g/= → =dired-filter-map=. - - dired-x: =*(=, =*.=, =*O= for sexp / extension / omitted marking. diff --git a/.config/emacs/lisp/evil-collection/modes/dired/evil-collection-dired.el b/.config/emacs/lisp/evil-collection/modes/dired/evil-collection-dired.el deleted file mode 100644 index 7898c1a..0000000 --- a/.config/emacs/lisp/evil-collection/modes/dired/evil-collection-dired.el +++ /dev/null @@ -1,224 +0,0 @@ -;;; evil-collection-dired.el --- Evil bindings for Dired -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, dired, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for Dired. - -;;; Code: -(require 'dired) -(require 'evil-collection) - -(defvar dired-filter-mark-map) -(defvar dired-filter-map) - -(defconst evil-collection-dired-maps '(dired-mode-map - dired-filter-mark-map - dired-filter-map)) - -;;;###autoload -(defun evil-collection-dired-setup () - "Set up `evil' bindings for `dired'." - (evil-collection-define-key 'normal 'dired-mode-map - "q" 'quit-window - "j" 'dired-next-line - "k" 'dired-previous-line - [mouse-2] 'dired-mouse-find-file-other-window - [follow-link] 'mouse-face - ;; Commands to mark or flag certain categories of files - "#" 'dired-flag-auto-save-files - "." 'dired-clean-directory - "~" 'dired-flag-backup-files - ;; Upper case keys (except !) for operating on the marked files - "A" 'dired-do-find-regexp - "C" 'dired-do-copy - "B" 'dired-do-byte-compile - "D" 'dired-do-delete - "gG" 'dired-do-chgrp ;; FIXME: This can probably live on a better binding. - "H" 'dired-do-hardlink - "L" 'dired-do-load - "M" 'dired-do-chmod - "O" 'dired-do-chown - "P" 'dired-do-print - "Q" 'dired-do-find-regexp-and-replace - "R" 'dired-do-rename - "S" 'dired-do-symlink - "T" 'dired-do-touch - "X" 'dired-do-shell-command - "Z" 'dired-do-compress - "c" 'dired-do-compress-to - "!" 'dired-do-shell-command - "&" 'dired-do-async-shell-command - ;; Comparison commands - "=" 'dired-diff - ;; Tree Dired commands - (kbd "M-C-?") 'dired-unmark-all-files - (kbd "M-C-d") 'dired-tree-down - (kbd "M-C-u") 'dired-tree-up - (kbd "M-C-n") 'dired-next-subdir - (kbd "M-C-p") 'dired-prev-subdir - ;; move to marked files - (kbd "M-{") 'dired-prev-marked-file - (kbd "M-}") 'dired-next-marked-file - ;; Make all regexp commands share a `%' prefix: - ;; We used to get to the submap via a symbol dired-regexp-prefix, - ;; but that seems to serve little purpose, and copy-keymap - ;; does a better job without it. - "%" nil - "%u" 'dired-upcase - "%l" 'dired-downcase - "%d" 'dired-flag-files-regexp - "%g" 'dired-mark-files-containing-regexp - "%m" 'dired-mark-files-regexp - "%r" 'dired-do-rename-regexp - "%C" 'dired-do-copy-regexp - "%H" 'dired-do-hardlink-regexp - "%R" 'dired-do-rename-regexp - "%S" 'dired-do-symlink-regexp - "%&" 'dired-flag-garbage-files - ;; mark - "*" nil - "**" 'dired-mark-executables - "*/" 'dired-mark-directories - "*@" 'dired-mark-symlinks - "*%" 'dired-mark-files-regexp - "*c" 'dired-change-marks - "*s" 'dired-mark-subdir-files - "*m" 'dired-mark - "*u" 'dired-unmark - "*?" 'dired-unmark-all-files - "*!" 'dired-unmark-all-marks - "U" 'dired-unmark-all-marks - (kbd "* ") 'dired-unmark-backward - (kbd "* C-n") 'dired-next-marked-file - (kbd "* C-p") 'dired-prev-marked-file - "*t" 'dired-toggle-marks - ;; Lower keys for commands not operating on all the marked files - "a" 'dired-find-alternate-file - "d" 'dired-flag-file-deletion - "gf" 'dired-find-file - (kbd "C-m") 'dired-find-file - "gr" 'revert-buffer - "i" 'dired-toggle-read-only - "I" 'dired-maybe-insert-subdir - "J" 'dired-goto-file - "K" 'dired-do-kill-lines - "r" 'dired-do-redisplay - "m" 'dired-mark - "t" 'dired-toggle-marks - "u" 'dired-unmark ; also "*u" - "W" 'browse-url-of-dired-file - "x" 'dired-do-flagged-delete - "gy" 'dired-show-file-type ;; FIXME: This could probably go on a better key. - "Y" 'dired-copy-filename-as-kill - "+" 'dired-create-directory - ;; open - (kbd "RET") 'dired-find-file - (kbd "S-") 'dired-find-file-other-window - (kbd "M-RET") 'dired-display-file - "gO" 'dired-find-file-other-window - "go" 'dired-view-file - ;; sort - "o" 'dired-sort-toggle-or-edit - ;; moving - "gj" 'dired-next-dirline - "gk" 'dired-prev-dirline - "[[" 'dired-prev-dirline - "]]" 'dired-next-dirline - "<" 'dired-prev-dirline - ">" 'dired-next-dirline - "^" 'dired-up-directory - "-" 'dired-up-directory - " " 'dired-next-line - [?\S-\ ] 'dired-previous-line - [remap next-line] 'dired-next-line - [remap previous-line] 'dired-previous-line - ;; hiding - "g$" 'dired-hide-subdir ;; FIXME: This can probably live on a better binding. - (kbd "M-$") 'dired-hide-all - "(" 'dired-hide-details-mode - ;; isearch - (kbd "M-s a C-s") 'dired-do-isearch - (kbd "M-s a M-C-s") 'dired-do-isearch-regexp - (kbd "M-s f C-s") 'dired-isearch-filenames - (kbd "M-s f M-C-s") 'dired-isearch-filenames-regexp - ;; misc - [remap read-only-mode] 'dired-toggle-read-only - ;; `toggle-read-only' is an obsolete alias for `read-only-mode' - [remap toggle-read-only] 'dired-toggle-read-only - "g?" 'dired-summary - (kbd "") 'dired-unmark-backward - [remap undo] 'dired-undo - [remap advertised-undo] 'dired-undo - ;; thumbnail manipulation (image-dired) - (kbd "C-t d") 'image-dired-display-thumbs - (kbd "C-t t") 'image-dired-tag-files - (kbd "C-t r") 'image-dired-delete-tag - (kbd "C-t j") 'image-dired-jump-thumbnail-buffer - (kbd "C-t i") 'image-dired-dired-display-image - (kbd "C-t x") 'image-dired-dired-display-external - (kbd "C-t a") 'image-dired-display-thumbs-append - (kbd "C-t .") 'image-dired-display-thumb - (kbd "C-t c") 'image-dired-dired-comment-files - (kbd "C-t f") 'image-dired-mark-tagged-files - (kbd "C-t C-t") 'image-dired-dired-toggle-marked-thumbs - (kbd "C-t e") 'image-dired-dired-edit-comment-and-tags - ;; encryption and decryption (epa-dired) - ";d" 'epa-dired-do-decrypt - ";v" 'epa-dired-do-verify - ";s" 'epa-dired-do-sign - ";e" 'epa-dired-do-encrypt) - - (when (>= emacs-major-version 30) - (evil-collection-define-key 'normal 'dired-mode-map - "E" 'dired-do-open)) - - ;; dired-x commands - (with-eval-after-load 'dired-x - (evil-collection-define-key 'normal 'dired-mode-map - "*(" 'dired-mark-sexp - "*." 'dired-mark-extension - "*O" 'dired-mark-omitted)) - - ;; dired-narrow commands - (with-eval-after-load 'dired-narrow - (evil-collection-define-key 'normal 'dired-mode-map - "s" 'dired-narrow-regexp)) - - ;; dired-subtree commands - (with-eval-after-load 'dired-subtree - (evil-collection-define-key 'normal 'dired-mode-map - (kbd "TAB") 'dired-subtree-toggle - "gh" 'dired-subtree-up - "gl" 'dired-subtree-down - (kbd "M-j") 'dired-subtree-next-sibling - (kbd "M-k") 'dired-subtree-previous-sibling)) - - (with-eval-after-load 'dired-filter - (evil-collection-define-key 'normal 'dired-mode-map - "*" dired-filter-mark-map - "g/" dired-filter-map))) - -(provide 'evil-collection-dired) -;;; evil-collection-dired.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/disk-usage/evil-collection-disk-usage.el b/.config/emacs/lisp/evil-collection/modes/disk-usage/evil-collection-disk-usage.el deleted file mode 100644 index ee1b5c9..0000000 --- a/.config/emacs/lisp/evil-collection/modes/disk-usage/evil-collection-disk-usage.el +++ /dev/null @@ -1,89 +0,0 @@ -;;; evil-collection-disk-usage.el --- Evil bindings for disk-usage.el -*- lexical-binding: t -*- - -;; Copyright (C) 2019 Pierre Neidhardt - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, files, convenience, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `disk-usage-mode'. - -;;; Code: -(require 'evil-collection) -(require 'disk-usage nil t) - -(defconst evil-collection-disk-usage-maps '(disk-usage-mode-map - disk-usage-by-types-mode-map)) - -;;;###autoload -(defun evil-collection-disk-usage-setup () - "Set up `evil' bindings for `disk-usage'." - (evil-collection-set-readonly-bindings 'disk-usage-mode-map) - (evil-collection-define-key 'normal 'disk-usage-mode-map - ;; motion - (kbd "SPC") 'scroll-up-command - (kbd "S-SPC") 'scroll-down-command - (kbd "") 'forward-button - (kbd "") 'backward-button - - "S" 'tabulated-list-sort - "^" 'disk-usage-up - - "zh" 'disk-usage-toggle-human-readable - "zf" 'disk-usage-toggle-full-path - "zr" 'disk-usage-toggle-recursive - - (kbd "ze") 'disk-usage-eshell-at-point - (kbd "zs") 'disk-usage-shell-at-point - (kbd "d") 'disk-usage-dired-at-point - - "m" 'disk-usage-mark - "u" 'disk-usage-unmark - "x" 'disk-usage-delete-marked-files - - "a" 'disk-usage-add-filters - "A" 'disk-usage-remove-filters - - "g?" 'describe-mode - "gr" 'revert-buffer) - - (evil-collection-set-readonly-bindings 'disk-usage-by-types-mode-map) - (evil-collection-define-key 'normal 'disk-usage-by-types-mode-map - ;; motion - (kbd "SPC") 'scroll-up-command - (kbd "S-SPC") 'scroll-down-command - (kbd "") 'forward-button - (kbd "") 'backward-button - - (kbd "RET") 'disk-usage-files - - "S" 'tabulated-list-sort - - "zh" 'disk-usage-toggle-human-readable - - "g?" 'describe-mode - "gr" 'revert-buffer - - "a" 'disk-usage-add-filters - "A" 'disk-usage-remove-filters)) - -(provide 'evil-collection-disk-usage) -;;; evil-collection-disk-usage.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/distel/evil-collection-distel.el b/.config/emacs/lisp/evil-collection/modes/distel/evil-collection-distel.el deleted file mode 100644 index 098cc1d..0000000 --- a/.config/emacs/lisp/evil-collection/modes/distel/evil-collection-distel.el +++ /dev/null @@ -1,81 +0,0 @@ -;;; evil-collection-distel.el --- Bindings for `distel' -*- lexical-binding: t -*- - -;; Copyright (C) 2021 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, elisp, lisp - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `distel'. - -;;; Code: -(require 'distel nil t) -(require 'evil-collection) - -(defconst evil-collection-distel-maps '(erlang-extended-mode-map - edb-attach-mode-map - edb-monitor-mode-map - edb-variables-mode-map)) - -;;;###autoload -(defun evil-collection-distel-setup () - "Set up `evil' bindings for `distel'." - (evil-collection-define-key 'normal 'erlang-extended-mode-map - "gd" 'erl-find-source-under-point - (kbd "C-t") 'erl-find-source-unwind - "gz" 'erl-ie-show-session - "K" 'erl-find-doc-under-point) - - (when evil-collection-setup-debugger-keys - (evil-collection-define-key 'normal 'erlang-extended-mode-map - [f5] 'edb-toggle-interpret - [f9] 'edb-toggle-breakpoint - ;; ("\C-c\C-ds" edb-synch-breakpoints) - ;; ("\C-c\C-dS" edb-save-dbg-state) - ;; ("\C-c\C-dR" edb-restore-dbg-state) - ;; ("\C-c\C-dm" edb-monitor) - ) - - (evil-collection-define-key 'normal 'edb-monitor-mode-map - (kbd "RET") 'edb-attach-command - "q" 'erl-bury-viewer) - - (evil-collection-define-key 'normal 'edb-variables-mode-map - (kbd "RET") 'edb-show-variable) - - (evil-collection-define-key 'normal 'edb-attach-mode-map - "i" 'edb-attach-step ;; Step Into - "n" 'edb-attach-next - "c" 'edb-attach-continue - "U" 'edb-attach-up - "D" 'edb-attach-down - "H" 'edb-attach-finish - "q" 'erl-quit-viewer - "g?" 'edb-attach-help - "b" 'edb-toggle-breakpoint)) - - (when evil-collection-want-find-usages-bindings - (evil-collection-define-key 'normal 'erlang-extended-mode-map - "gr" 'erl-who-calls)) - - (add-hook 'erlang-extended-mode-hook 'evil-normalize-keymaps)) - -(provide 'evil-collection-distel) -;;; evil-collection-distel.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/doc-view/README.org b/.config/emacs/lisp/evil-collection/modes/doc-view/README.org deleted file mode 100644 index ea0af7c..0000000 --- a/.config/emacs/lisp/evil-collection/modes/doc-view/README.org +++ /dev/null @@ -1,42 +0,0 @@ -* doc-view - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Document-View.html][doc-view]] (PDF / PS / DVI viewer). - - =doc-view-mode= starts in normal state. - -** Key bindings - - | Command | Original | Evil | - |-------------------------------------------+----------------+-------------------------------------| - | =doc-view-next-line-or-next-page= | =C-n=, =down= | =j= (remap) | - | =doc-view-previous-line-or-previous-page= | =C-p=, =up= | =k= (remap) | - | =image-forward-hscroll= | n/a | =l= (remap) | - | =image-backward-hscroll= | n/a | =h= (remap) | - | =doc-view-next-page= | =n= | =gj=, =C-j=, =n= | - | =doc-view-previous-page= | =p= | =gk=, =C-k=, =p= | - | =doc-view-first-page= | =M-<= | =gg= | - | =doc-view-last-page= | =M->= | =G= | - | =doc-view-goto-page= | =M-g M-g= | =J= | - | =doc-view-scroll-up-or-next-page= | =SPC= | =SPC= | - | =doc-view-scroll-down-or-previous-page= | =DEL=, =S-SPC= | =DEL=, =S-SPC= | - | =forward-page= | =next= | =C-d= | - | =backward-page= | =prior= | =C-u= (when =evil-want-C-u-scroll=) | - | =image-next-line= | =RET= | =RET= | - | =doc-view-enlarge= | =+=, === | =+=, === | - | =doc-view-shrink= | =-= | =-= | - | =doc-view-scale-reset= | =0= | =0= | - | =doc-view-fit-width-to-window= | =W= | =W= | - | =doc-view-fit-height-to-window= | =H= | =H= | - | =doc-view-fit-page-to-window= | =P= | =P= | - | =doc-view-kill-proc= | =K= | =X= | - | =doc-view-set-slice= | =c s= | =s s= | - | =doc-view-set-slice-using-mouse= | =c m= | =s m= | - | =doc-view-set-slice-from-bounding-box= | =c b= | =s b= | - | =doc-view-reset-slice= | =c r= | =s r= | - | =doc-view-search= | =C-s=, =find= | =/= | - | =doc-view-search-backward= | =C-r= | =?= | - | =doc-view-show-tooltip= | =C-t= | =C-t= | - | =doc-view-toggle-display= | =C-c C-c= | =C-c C-c= | - | =doc-view-open-text= | =C-c C-t= | =C-c C-t= | - | =doc-view-revert-buffer= | n/a | =gr= | - | =quit-window= | n/a | =q= | diff --git a/.config/emacs/lisp/evil-collection/modes/doc-view/evil-collection-doc-view.el b/.config/emacs/lisp/evil-collection/modes/doc-view/evil-collection-doc-view.el deleted file mode 100644 index 42b10ff..0000000 --- a/.config/emacs/lisp/evil-collection/modes/doc-view/evil-collection-doc-view.el +++ /dev/null @@ -1,89 +0,0 @@ -;;; evil-collection-doc-view.el --- Evil bindings for docview -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, bindings, files, pdf, ps, dvi - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Evil bindings for doc-view. - -;;; Code: -(require 'evil-collection) -(require 'doc-view) - -(defconst evil-collection-doc-view-maps '(doc-view-mode-map)) - -;;;###autoload -(defun evil-collection-doc-view-setup () - "Set up `evil' bindings for `doc-view'." - (evil-set-initial-state 'doc-view-mode 'normal) - (evil-collection-define-key 'normal 'doc-view-mode-map - "q" 'quit-window - [remap evil-next-line] 'doc-view-next-line-or-next-page - [remap evil-previous-line] 'doc-view-previous-line-or-previous-page - [remap evil-backward-char] 'image-backward-hscroll - [remap evil-forward-char] 'image-forward-hscroll - (kbd "C-j") 'doc-view-next-page - (kbd "C-k") 'doc-view-previous-page - "gj" 'doc-view-next-page - "gk" 'doc-view-previous-page - (kbd "C-d") 'forward-page - (kbd "SPC") 'doc-view-scroll-up-or-next-page - (kbd "DEL") 'doc-view-scroll-down-or-previous-page - (kbd "S-SPC") 'doc-view-scroll-down-or-previous-page - "gg" 'doc-view-first-page - "G" 'doc-view-last-page - "J" 'doc-view-goto-page - (kbd "RET") 'image-next-line - - ;; zoom - "+" 'doc-view-enlarge - "=" 'doc-view-enlarge - "0" 'doc-view-scale-reset - "-" 'doc-view-shrink - - "W" 'doc-view-fit-width-to-window ; Like evil-image. - "H" 'doc-view-fit-height-to-window ; Like evil-image. - "P" 'doc-view-fit-page-to-window - "X" 'doc-view-kill-proc - - (kbd "s s") 'doc-view-set-slice - (kbd "s m") 'doc-view-set-slice-using-mouse - (kbd "s b") 'doc-view-set-slice-from-bounding-box - (kbd "s r") 'doc-view-reset-slice - - (kbd "/") 'doc-view-search - (kbd "?") 'doc-view-search-backward - (kbd "C-t") 'doc-view-show-tooltip - (kbd "C-c C-c") 'doc-view-toggle-display - (kbd "C-c C-t") 'doc-view-open-text - - ;; refresh - (kbd "gr") 'doc-view-revert-buffer) - - ;; TODO: What if the user changes `evil-want-C-u-scroll' after this is run? - (when evil-want-C-u-scroll - (evil-collection-define-key 'normal 'doc-view-mode-map - (kbd "C-u") 'backward-page))) - -(provide 'evil-collection-doc-view) -;;; evil-collection-doc-view.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/docker/evil-collection-docker.el b/.config/emacs/lisp/evil-collection/modes/docker/evil-collection-docker.el deleted file mode 100644 index 29ecd21..0000000 --- a/.config/emacs/lisp/evil-collection/modes/docker/evil-collection-docker.el +++ /dev/null @@ -1,89 +0,0 @@ -;;; evil-collection-docker.el --- Evil bindings for docker.el -*- lexical-binding: t -*- - -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, docker, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for docker.el - -;;; Code: -(require 'docker nil t) -(require 'evil-collection) - -(defconst evil-collection-docker-maps '(docker-container-mode-map - docker-context-mode-map - docker-image-mode-map - docker-machine-mode-map - docker-network-mode-map - docker-volume-mode-map)) - -(defun evil-collection-docker-setup () - "Set up `evil' bindings for `docker'." - (evil-collection-define-key 'normal 'docker-container-mode-map - ";" 'docker-container-ls - "?" 'docker-container-help - "C" 'docker-container-cp - "D" 'docker-container-rm - "I" 'docker-container-inspect - "K" 'docker-container-kill - "L" 'docker-container-logs - "O" 'docker-container-stop - "P" 'docker-container-pause - "R" 'docker-container-restart - "S" 'docker-container-start - "a" 'docker-container-attach - "b" 'docker-container-shells - "d" 'docker-container-diff - "f" 'docker-container-open - "r" 'docker-container-rename-selection) - - (evil-collection-define-key 'normal 'docker-context-mode-map - "?" 'docker-context-help - "D" 'docker-context-rm - "I" 'docker-context-inspect - "X" 'docker-context-use) - - (evil-collection-define-key 'normal 'docker-image-mode-map - ";" 'docker-image-ls - "?" 'docker-image-help - "D" 'docker-image-rm - "F" 'docker-image-pull - "I" 'docker-image-inspect - "P" 'docker-image-push - "R" 'docker-image-run - "T" 'docker-image-tag-selection - "d" 'docker-image-mark-dangling) - - (evil-collection-define-key 'normal 'docker-network-mode-map - ";" 'docker-network-ls - "?" 'docker-network-help - "D" 'docker-network-rm - "I" 'docker-network-inspect - "d" 'docker-network-mark-dangling) - - (evil-collection-define-key 'normal 'docker-volume-mode-map - ";" 'docker-volume-ls - "?" 'docker-volume-help - "D" 'docker-volume-rm - "I" 'docker-volume-inspect - "d" 'docker-volume-mark-dangling - "f" 'docker-volume-dired-selection)) - -(provide 'evil-collection-docker) - -;;; evil-collection-docker.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/eat/README.org b/.config/emacs/lisp/evil-collection/modes/eat/README.org deleted file mode 100644 index b8fdfae..0000000 --- a/.config/emacs/lisp/evil-collection/modes/eat/README.org +++ /dev/null @@ -1,37 +0,0 @@ -* eat - - Evil bindings for [[https://codeberg.org/akib/emacs-eat][eat]], the Emulate A Terminal package. - - Initial state for =eat-mode= is =insert=. The same =C-*= keys that vterm - forwards raw to the terminal are bound to =eat-self-input= here so that - shells and TUIs receive them instead of evil-insert-state. - -** Key bindings - -*** eat-mode-map - - | Command | Original | Evil | - |------------------------------------------+----------+-----------| - | =evil-collection-eat-toggle-send-escape= | n/a | =C-c C-z= | - - The following keys are forwarded raw to the terminal via =eat-self-input= - in insert state: =C-a=, =C-b=, =C-d=, =C-e=, =C-f=, =C-k=, =C-l=, =C-n=, - =C-o=, =C-p=, =C-q=, =C-r=, =C-s=, =C-t=, =C-u=, =C-v=, =C-w=, =C-y=, - =C-z=, ==. =C-c= (prefix) and =C-h= (help) are not forwarded. - -*** eat-line-mode-map - - =RET=, =C-m= and =[return]= send input to the terminal in the state - named by =evil-collection-repl-submit-state=, and insert a newline in - the opposite state. - - | Command | Original | State | - |-----------------------+----------+-------------------------------------| - | =eat-line-send-input= | =RET= | =evil-collection-repl-submit-state= | - | =newline= | n/a | opposite of submit state | - -** New commands - - | Command | Purpose | - |------------------------------------------+---------------------------------------------------| - | =evil-collection-eat-toggle-send-escape= | Toggle whether =ESC= goes to eat or back to evil. | diff --git a/.config/emacs/lisp/evil-collection/modes/eat/evil-collection-eat.el b/.config/emacs/lisp/evil-collection/modes/eat/evil-collection-eat.el deleted file mode 100644 index b5a6262..0000000 --- a/.config/emacs/lisp/evil-collection/modes/eat/evil-collection-eat.el +++ /dev/null @@ -1,124 +0,0 @@ -;;; evil-collection-eat.el --- Bindings for `eat' -*- lexical-binding: t -*- - -;; Copyright (C) 2024 James Cherti - -;; Maintainer: James Cherti -;; Author: James Cherti -;; Based on evil-collection-vterm.el by James Nguyen and Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, eat, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; This package provides `evil-mode' keybindings for `eat'. - -;;; Code: -(require 'evil-collection) -(require 'eat nil t) - -(defconst evil-collection-eat-maps '(eat-mode-map - eat-line-mode-map - eat-semi-char-mode-map - eat-char-mode-map - eat-eshell-semi-char-mode-map - eat-eshell-char-mode-map)) - -;; The map symbols below are only referenced inside quoted lists in this -;; file, so the byte-compiler does not actually require these declarations. -;; Defining them keeps certain linters happy. -(defvar eat-line-mode-map) -(defvar eat-semi-char-mode-map) -(defvar eat-char-mode-map) -(defvar eat-eshell-semi-char-mode-map) -(defvar eat-eshell-char-mode-map) - -(defvar-local evil-collection-eat-send-escape-to-eat-p nil - "Track whether or not we send ESC to `eat' or `emacs'.") - -(defun evil-collection-eat-toggle-send-escape () - "Toggle the destination of the ESC key between `eat' and `emacs'. -This adjustment is necessary for programs that utilize ESC, such as Vim or an -SSH-accessed Emacs that also uses `evil-mode'." - (interactive) - (if evil-collection-eat-send-escape-to-eat-p - (evil-collection-define-key 'insert 'eat-mode-map (kbd "") - (lookup-key evil-insert-state-map (kbd ""))) - (evil-collection-define-key 'insert 'eat-mode-map - (kbd "") 'eat-self-input)) - (setq evil-collection-eat-send-escape-to-eat-p - (not evil-collection-eat-send-escape-to-eat-p)) - (message (format "Sending ESC to %s." - (if evil-collection-eat-send-escape-to-eat-p - "eat" - "emacs")))) - -;;;###autoload -(defun evil-collection-eat-setup () - "Set up `evil' bindings for `eat'." - (evil-set-initial-state 'eat-mode 'insert) - - (let* ((submit evil-collection-repl-submit-state) - (newline-state (if (eq submit 'normal) 'insert 'normal))) - (evil-collection-define-key submit 'eat-line-mode-map - (kbd "RET") 'eat-line-send-input - (kbd "\C-m") 'eat-line-send-input - [return] 'eat-line-send-input) - (evil-collection-define-key newline-state 'eat-line-mode-map - (kbd "RET") #'newline - (kbd "\C-m") #'newline - [return] #'newline)) - - (evil-collection-define-key '(normal insert) 'eat-mode-map - (kbd "C-c C-z") 'evil-collection-eat-toggle-send-escape) - - ;; `Evil' has some "C-" bindings in insert state that shadow the `eat' terminal - ;; bindings. Do not send "C-c" (prefix key) nor "C-h" (help prefix) as raw input. - (evil-collection-define-key 'insert 'eat-mode-map - (kbd "C-a") 'eat-self-input - (kbd "C-b") 'eat-self-input - (kbd "C-d") 'eat-self-input - (kbd "C-e") 'eat-self-input - (kbd "C-f") 'eat-self-input - (kbd "C-k") 'eat-self-input - (kbd "C-l") 'eat-self-input - (kbd "C-n") 'eat-self-input - (kbd "C-o") 'eat-self-input - (kbd "C-p") 'eat-self-input - (kbd "C-q") 'eat-self-input - (kbd "C-r") 'eat-self-input - (kbd "C-s") 'eat-self-input - (kbd "C-t") 'eat-self-input - (kbd "C-u") 'eat-self-input - (kbd "C-v") 'eat-self-input - (kbd "C-w") 'eat-self-input - (kbd "C-y") 'eat-self-input - (kbd "C-z") 'eat-self-input - (kbd "") 'eat-self-input) - - ;; Paste bindings: in a terminal, "paste before/after" is meaningless because - ;; the cursor position is controlled by the running program. Bind both `p' - ;; and `P' to `eat-yank' so the kill-ring is sent as terminal input. - (dolist (map '(eat-semi-char-mode-map - eat-char-mode-map - eat-eshell-semi-char-mode-map - eat-eshell-char-mode-map)) - (evil-collection-define-key 'normal map - (kbd "p") 'eat-yank - (kbd "P") 'eat-yank))) - -(provide 'evil-collection-eat) -;;; evil-collection-eat.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/ebib/evil-collection-ebib.el b/.config/emacs/lisp/evil-collection/modes/ebib/evil-collection-ebib.el deleted file mode 100644 index 1c51451..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ebib/evil-collection-ebib.el +++ /dev/null @@ -1,77 +0,0 @@ -;;; evil-collection-ebib.el --- Evil bindings for ebib -*- lexical-binding: t -*- - -;; Author: Justin Burkett -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, ebib, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for the ebib. - -;;; Code: -(require 'evil-collection) -(require 'ebib nil t) - -(defconst evil-collection-ebib-maps '(ebib-index-mode-map - ebib-entry-mode-map)) - -(defvar ebib-index-mode-map) -(defvar ebib-entry-mode-map) - -;;;###autoload -(defun evil-collection-ebib-setup () - "Set up `evil' bindings for `ebib'." - (evil-set-initial-state 'ebib-index-mode 'normal) - (evil-make-overriding-map ebib-index-mode-map 'normal) - (evil-collection-inhibit-insert-state 'ebib-index-mode-map) - (evil-collection-define-key 'normal 'ebib-index-mode-map - "d" 'ebib-kill-entry - "D" 'ebib-delete-entry - "gg" 'ebib-goto-first-entry - "G" 'ebib-goto-last-entry - "j" 'ebib-next-entry - "k" 'ebib-prev-entry - "n" 'ebib-search-next - "p" 'ebib-yank-entry - "gj" 'ebib-jump-to-entry - "ZQ" 'ebib-quit - "ZZ" 'ebib-lower - (kbd "C-u") 'ebib-index-scroll-down - (kbd "C-d") 'ebib-index-scroll-up - (kbd "C-b") 'ebib-index-scroll-down - (kbd "C-f") 'ebib-index-scroll-up) - (evil-set-initial-state 'ebib-entry-mode 'normal) - (evil-make-overriding-map ebib-entry-mode-map 'normal) - (evil-collection-inhibit-insert-state 'ebib-entry-mode-map) - (evil-collection-define-key 'normal 'ebib-entry-mode-map - "[[" 'ebib-goto-prev-set - "]]" 'ebib-goto-next-set - "d" 'ebib-kill-field-contents - "D" 'ebib-delete-field-contents - "gg" 'ebib-goto-first-field - "gk" 'ebib-goto-prev-set - "gj" 'ebib-goto-next-set - "G" 'ebib-goto-last-field - "j" 'ebib-next-field - "k" 'ebib-prev-field - "p" 'ebib-yank-field-contents - "y" 'ebib-copy-current-field-contents - "ZZ" 'ebib-quit-entry-buffer - "ZQ" 'ebib-quit-entry-buffer)) - -(provide 'evil-collection-ebib) -;;; evil-collection-ebib.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/ebuku/evil-collection-ebuku.el b/.config/emacs/lisp/evil-collection/modes/ebuku/evil-collection-ebuku.el deleted file mode 100644 index 8ab4129..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ebuku/evil-collection-ebuku.el +++ /dev/null @@ -1,63 +0,0 @@ -;;; evil-collection-ebuku.el --- Evil bindings for Ebuku -*- lexical-binding: t -*- - -;; Copyright (C) 2020-2022 Alexis - -;; Author: Alexis -;; Maintainer: Alexis -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, ebuku, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; Evil bindings for Ebuku. - -;;; Code: - -(require 'evil-collection) -(require 'ebuku nil t) - - -;;;###autoload -(defun evil-collection-ebuku-setup () - "Set up `evil' bindings for `Ebuku'." - (evil-collection-define-key 'normal 'ebuku-mode-map - "q" 'quit-window - "a" 'ebuku-add-bookmark - "d" 'ebuku-delete-bookmark - "x" 'ebuku-delete-bookmark - "e" 'ebuku-edit-bookmark - "gr" 'ebuku-refresh - "j" 'ebuku-next-bookmark - (kbd "C-j") 'ebuku-next-bookmark - "k" 'ebuku-previous-bookmark - (kbd "C-k") 'ebuku-previous-bookmark - "r" 'ebuku-search-on-recent - "s" 'ebuku-search - "*" 'ebuku-show-all - "-" 'ebuku-toggle-results-limit - "t" 'ebuku-toggle-results-limit - (kbd "RET") 'ebuku-open-url - "C" 'ebuku-copy-url - "T" 'ebuku-copy-title - "I" 'ebuku-copy-index - [mouse-1] 'ebuku-open-url - [mouse-2] 'ebuku-open-url)) - - -(provide 'evil-collection-ebuku) -;;; evil-collection-ebuku.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/eca/evil-collection-eca.el b/.config/emacs/lisp/evil-collection/modes/eca/evil-collection-eca.el deleted file mode 100644 index 37657bd..0000000 --- a/.config/emacs/lisp/evil-collection/modes/eca/evil-collection-eca.el +++ /dev/null @@ -1,56 +0,0 @@ -;;; evil-collection-eca.el --- Bindings for eca -*- lexical-binding: t -*- - -;; Copyright (C) 2026 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "29.1")) -;; Keywords: evil, eca, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for eca. - -;;; Code: -(require 'evil-collection) -(require 'eca nil t) - -(defconst evil-collection-eca-maps '(eca-chat-mode-map)) - -(defvar eca-chat-mode-map) - -;;;###autoload -(defun evil-collection-eca-setup () - "Set up `evil' bindings for `eca'." - (add-hook 'eca-chat-mode-hook 'evil-normalize-keymaps) - - (let* ((submit evil-collection-repl-submit-state) - (newline-state (if (eq submit 'normal) 'insert 'normal))) - (evil-collection-define-key submit 'eca-chat-mode-map - (kbd "") 'eca-chat--key-pressed-return - (kbd "RET") 'eca-chat--key-pressed-return) - (evil-collection-define-key newline-state 'eca-chat-mode-map - (kbd "") 'eca-chat--key-pressed-newline - (kbd "RET") 'eca-chat--key-pressed-newline)) - - (evil-collection-define-key 'insert 'eca-chat-mode-map - (kbd "S-") 'eca-chat--key-pressed-newline) - (evil-collection-define-key 'normal 'eca-chat-mode-map - (kbd "S-") 'eca-chat--key-pressed-newline)) - -(provide 'evil-collection-eca) -;;; evil-collection-eca.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/edbi/evil-collection-edbi.el b/.config/emacs/lisp/evil-collection/modes/edbi/evil-collection-edbi.el deleted file mode 100644 index f6b7f63..0000000 --- a/.config/emacs/lisp/evil-collection/modes/edbi/evil-collection-edbi.el +++ /dev/null @@ -1,108 +0,0 @@ -;;; evil-collection-edbi.el --- Evil bindings for EDBI -*- lexical-binding: t -*- - -;; Copyright (C) 2019 Pierre Neidhardt - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, database, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for EDBI. - -;;; Code: -(require 'evil-collection) -(require 'edbi nil t) - -(defvar ctbl:table-mode-map) -(defvar edbi:dbview-keymap) -(declare-function ctbl:define-keymap "ctable") -(declare-function epc:add-keymap "epc") - -(defconst evil-collection-edbi-maps '(edbi:dbview-query-result-keymap - edbi:sql-mode-map)) - -(defun evil-collection-edbi-dbview-setup () - "The `ctbl:table-mode-map' and `edbi:dbview-keymap' are stored -as local maps and are not bound to any mode. As such, the only -way to add Evil bindings to the dbview is to overwrite the -default bindings." - (setq ctbl:table-mode-map - (ctbl:define-keymap - '( - ("k" . ctbl:navi-move-up) - ("j" . ctbl:navi-move-down) - ("h" . ctbl:navi-move-left) - ("l" . ctbl:navi-move-right) - - ("gc" . ctbl:navi-jump-to-column) - - ("$" . ctbl:navi-move-right-most) - ("0" . ctbl:navi-move-left-most) - - ("gr" . ctbl:action-update-buffer) - - ("g?" . ctbl:describe-bindings) - - ([mouse-1] . ctbl:navi-on-click) - ("C-m" . ctbl:navi-on-click) - ("RET" . ctbl:navi-on-click)))) - - (setq edbi:dbview-keymap - (epc:add-keymap - ctbl:table-mode-map - '(("gr" . edbi:dbview-update-command) - ("SPC" . edbi:dbview-show-tabledef-command) - ("c" . edbi:dbview-query-editor-command) - ("C" . edbi:dbview-query-editor-new-command) - ("C-m" . edbi:dbview-show-table-data-command) - ("q" . edbi:dbview-quit-command))))) - -;;;###autoload -(defun evil-collection-edbi-setup () - "Set up `evil' bindings for EDBI." - (evil-collection-edbi-dbview-setup) - (evil-collection-define-key 'normal 'edbi:dbview-query-result-keymap - "0" 'ctbl:navi-move-left-most - "$" 'ctbl:navi-move-right-most - - "h" 'ctbl:navi-move-left - "j" 'ctbl:navi-move-down - "k" 'ctbl:navi-move-up - "l" 'ctbl:navi-move-right - - "gc" 'ctbl:navi-jump-to-column - - "g?" 'ctbl:describe-bindings - - ;; motion - "gr" 'ctbl:action-update-buffer - - ;; quit - "q" 'edbi:dbview-query-result-quit-command - "ZQ" 'evil-quit - "ZZ" 'quit-window) - - (evil-collection-define-key 'normal 'edbi:sql-mode-map - "q" 'edbi:dbview-query-editor-quit-command - (kbd "C-n") 'edbi:dbview-query-editor-history-forward-command - (kbd "C-p") 'edbi:dbview-query-editor-history-back-command)) - -(provide 'evil-collection-edbi) -;;; evil-collection-edbi.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/edebug/README.org b/.config/emacs/lisp/evil-collection/modes/edebug/README.org deleted file mode 100644 index aba73a1..0000000 --- a/.config/emacs/lisp/evil-collection/modes/edebug/README.org +++ /dev/null @@ -1,53 +0,0 @@ -* edebug - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Edebug.html][Edebug]]. - -** Key bindings - - Bindings live in =edebug-mode-map=. Edebug overlays the source while a form - is instrumented; evil-collection sets the initial state to normal and frees - =g=, =G=, and =h= as prefixes. - - | Command | Original | Evil | - |-------------------------------------+-----------+-----------------| - | =edebug-step-mode= | =SPC= | =s=, =C-c C-s= | - | =edebug-next-mode= | =n= | =n=, =C-c C-n= | - | =edebug-go-mode= | =g= | =go=, =C-c C-c= | - | =edebug-Go-nonstop-mode= | =G= | =gO= | - | =edebug-trace-mode= | =t= | =t= | - | =edebug-Trace-fast-mode= | =T= | =T= | - | =edebug-continue-mode= | =c= | =c= | - | =edebug-Continue-fast-mode= | =C= | =C= | - | =edebug-forward-sexp= | =f= | =f= | - | =edebug-step-in= | =i= | =i= | - | =edebug-step-out= | =o= | =o= | - | =edebug-goto-here= | =h= | =H= | - | =edebug-instrument-callee= | =I= | =I= | - | =edebug-stop= | =S= | =S= | - | =top-level= | =q= | =q= | - | =edebug-top-level-nonstop= | =Q= | =Q= | - | =abort-recursive-edit= | =a= | =a= | - | =edebug-set-breakpoint= | =b= | =b=, =C-x SPC= | - | =edebug-unset-breakpoint= | =u= | =u=, =C-c C-d= | - | =edebug-next-breakpoint= | =B= | =B= | - | =edebug-set-conditional-breakpoint= | =x= | =x= | - | =edebug-set-global-break-condition= | =X= | =X= | - | =edebug-previous-result= | =r= | =r= | - | =edebug-eval-expression= | =e= | =e= | - | =edebug-eval-last-sexp= | =C-x C-e= | =C-x C-e= | - | =edebug-visit-eval-list= | =E= | =EL= | - | =edebug-where= | =w= | =WW=, =C-c C-l= | - | =edebug-bounce-point= | =p= | =p= | - | =edebug-view-outside= | =v=, =P= | =P= | - | =edebug-toggle-save-windows= | =W= | =WS= | - | =edebug-help= | =?= | =g?= | - | =edebug-backtrace= | =d= | =d= | - | =edebug-temp-display-freq-count= | === | === | - | =negative-argument= | =-= | =-= | - -** Integrations - - - edebug-x: in =edebug-x-instrumented-function-list-mode-map=, =RET= jumps to - the function, =E= evaluates, =Q= clears data, =q= quits. In - =edebug-x-breakpoint-list-mode-map=, =RET= visits the breakpoint, =x= kills - it, =Q= clears data, =q= quits. diff --git a/.config/emacs/lisp/evil-collection/modes/edebug/evil-collection-edebug.el b/.config/emacs/lisp/evil-collection/modes/edebug/evil-collection-edebug.el deleted file mode 100644 index 2c3d1d7..0000000 --- a/.config/emacs/lisp/evil-collection/modes/edebug/evil-collection-edebug.el +++ /dev/null @@ -1,126 +0,0 @@ -;;; evil-collection-edebug.el --- Evil bindings for Edebug -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, edebug, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `edebug-mode'. - -;;; Code: -(require 'edebug) -(require 'evil-collection) - -(defconst evil-collection-edebug-maps - '(edebug-mode-map - edebug-x-instrumented-function-list-mode-map - edebug-x-breakpoint-list-mode-map)) - -;;;###autoload -(defun evil-collection-edebug-setup () - "Set up `evil' bindings for `edebug'." - (evil-set-initial-state 'edebug-mode 'normal) - - (add-hook 'edebug-mode-hook #'evil-normalize-keymaps) - - (evil-collection-define-key nil 'edebug-mode-map - "g" nil - "G" nil - "h" nil) - - ;; FIXME: Seems like other minor modes will readily clash with `edebug'. - ;; `lispyville' and `edebug' 's' key? - (evil-collection-define-key 'normal 'edebug-mode-map - ;; control - "s" 'edebug-step-mode - "n" 'edebug-next-mode - "go" 'edebug-go-mode - "gO" 'edebug-Go-nonstop-mode - "t" 'edebug-trace-mode - "T" 'edebug-Trace-fast-mode - "c" 'edebug-continue-mode - "C" 'edebug-Continue-fast-mode - - "f" 'edebug-forward-sexp - "H" 'edebug-goto-here - "I" 'edebug-instrument-callee - "i" 'edebug-step-in - "o" 'edebug-step-out - - ;; quit - "q" 'top-level - "Q" 'edebug-top-level-nonstop - "a" 'abort-recursive-edit - "S" 'edebug-stop - - ;; breakpoints - "b" 'edebug-set-breakpoint - "u" 'edebug-unset-breakpoint - "B" 'edebug-next-breakpoint - "x" 'edebug-set-conditional-breakpoint - "X" 'edebug-set-global-break-condition - - ;; evaluation - "r" 'edebug-previous-result - "e" 'edebug-eval-expression - (kbd "C-x C-e") 'edebug-eval-last-sexp - "EL" 'edebug-visit-eval-list - - ;; views - "WW" 'edebug-where - "p" 'edebug-bounce-point - "P" 'edebug-view-outside ;; same as v - "WS" 'edebug-toggle-save-windows - - ;; misc - "g?" 'edebug-help - "d" 'edebug-backtrace - - "-" 'negative-argument - - ;; statistics - "=" 'edebug-temp-display-freq-count - - ;; GUD bindings - (kbd "C-c C-s") 'edebug-step-mode - (kbd "C-c C-n") 'edebug-next-mode - (kbd "C-c C-c") 'edebug-go-mode - - (kbd "C-x SPC") 'edebug-set-breakpoint - (kbd "C-c C-d") 'edebug-unset-breakpoint - (kbd "C-c C-t") (lambda () (interactive) (edebug-set-breakpoint t)) - (kbd "C-c C-l") 'edebug-where) - - (with-eval-after-load 'edebug-x - (evil-collection-define-key 'normal 'edebug-x-instrumented-function-list-mode-map - "E" 'edebug-x-evaluate-function - "Q" 'edebug-x-clear-data - (kbd "RET") 'edebug-x-find-function - "q" 'quit-window) - (evil-collection-define-key 'normal 'edebug-x-breakpoint-list-mode-map - (kbd "RET") 'edebug-x-visit-breakpoint - "x" 'edebug-x-kill-breakpoint - "Q" 'edebug-x-clear-data - "q" 'quit-window))) - -(provide 'evil-collection-edebug) -;;; evil-collection-edebug.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/ediff/README.org b/.config/emacs/lisp/evil-collection/modes/ediff/README.org deleted file mode 100644 index 6aa4b6f..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ediff/README.org +++ /dev/null @@ -1,21 +0,0 @@ -* ediff - - The table below shows the binding changes that are made to ediff-mode. - -| Command | Original Binding | evil-collection-ediff | -|-----------------------------+------------------+-----------------------| -| =ediff-next-difference= | =n, SPC= | =j, n, SPC= | -| =ediff-previous-difference= | =p, DEL= | =k, N, p, DEL= | -| =ediff-jump-to-difference= | =j= | =d= | -| jump to first difference | =1j= | =gg, 1d= | -| jump to last difference | N/A | =G= | -| copy region A to region B | =a= | =a, l= | -| copy region B to region A | =b= | =b, h= | -| scroll down 1 line | =C-u 1 v= | =C-e= | -| scroll up 1 line | =C-u 1 V= | =C-y= | -| scroll down half page | =v, C-v= | =C-d, v, C-v= | -| scroll up half page | =V, M-v= | =C-u, V, M-v= | -| scroll left | =>= | =zh= | -| scroll right | =<= | =zl= | -| toggle highlighting | =h= | =H= | -| =ediff-suspend= | =z= | =C-z= | diff --git a/.config/emacs/lisp/evil-collection/modes/ediff/evil-collection-ediff.el b/.config/emacs/lisp/evil-collection/modes/ediff/evil-collection-ediff.el deleted file mode 100644 index 549d692..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ediff/evil-collection-ediff.el +++ /dev/null @@ -1,205 +0,0 @@ -;;; evil-collection-ediff.el --- Evil bindings for ediff -*- lexical-binding: t -*- -;; Copyright (C) 2015 Justin Burkett - -;; Author: Justin Burkett -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Homepage: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3") (evil "1.2.3")) -;; Keywords: evil, ediff, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: - -;; Make ediff a little evil. This configures ediff to be friendlier to users -;; of vim-like keybindings. Consult the help buffer (=?=) for more info. - -;; Here's a table describing the bindings - -;; | Command | Original Binding | Evil-ediff | -;; |-----------------------------+------------------+-------------| -;; | ediff-next-difference | n,SPC | C-j,n,SPC | -;; | ediff-previous-difference | p,DEL | C-k,N,p,DEL | -;; | ediff-jump-to-difference | j | d | -;; | jump to first difference | 1j | gg (or 1d) | -;; | jump to last difference | N/A | G | -;; | copy region A to region B | a | a,l | -;; | copy region B to region A | b | b,h | -;; | scroll down 1 line | C-u 1 v | j | -;; | scroll up 1 line | C-u 1 V | k | -;; | scroll down half page | v,C-v | C-d,v,C-v | -;; | scroll up half page | V,M-v | C-u,V,M-v | -;; | scroll left | > | zh | -;; | scroll right | < | zl | -;; | toggle highlighting | h | H | -;; | ediff-suspend | z | C-z | - -;; Not implemented yet -;; | restore old diff | ra,rb,rc | u | - -;;; Code: - -(require 'evil-collection) -(require 'ediff nil t) - -(defconst evil-collection-ediff-maps '(ediff-mode-map)) - -(defvar evil-collection-ediff-initial-state-backup (evil-initial-state 'ediff-mode)) -(defvar evil-collection-ediff-long-help-message-compare2-backup ediff-long-help-message-compare2) -(defvar evil-collection-ediff-long-help-message-compare3-backup ediff-long-help-message-compare3) -(defvar evil-collection-ediff-long-help-message-narrow2-backup ediff-long-help-message-narrow2) -(defvar evil-collection-ediff-long-help-message-word-backup ediff-long-help-message-word-mode) -(defvar evil-collection-ediff-long-help-message-merge-backup ediff-long-help-message-merge) -(defvar evil-collection-ediff-long-help-message-head-backup ediff-long-help-message-head) -(defvar evil-collection-ediff-long-help-message-tail-backup ediff-long-help-message-tail) - -(defvar evil-collection-ediff-help-changed nil) - -(defun evil-collection-ediff-adjust-help () - "Adjust long help messages to reflect evil-ediff bindings." - (unless evil-collection-ediff-help-changed - (dolist (msg '(ediff-long-help-message-compare2 - ediff-long-help-message-compare3 - ediff-long-help-message-narrow2 - ediff-long-help-message-word-mode - ediff-long-help-message-merge - ediff-long-help-message-head - ediff-long-help-message-tail)) - (dolist (chng '( ;;("^" . " ") - ("p,DEL -previous diff " . "k,N,p -previous diff ") - ("n,SPC -next diff " . " j,n -next diff ") - (" j -jump to diff " . " d -jump to diff ") - (" h -highlighting " . " H -highlighting ") - (" v/V -scroll up/dn " . "C-u/d -scroll up/dn ") - (" -scroll lt/rt " . "zh/zl -scroll lt/rt ") - (" z/q -suspend/quit" . "C-z/q -suspend/quit"))) - (setf (symbol-value msg) - (replace-regexp-in-string (car chng) (cdr chng) (symbol-value msg)))))) - (setq evil-collection-ediff-help-changed t)) - -(defun evil-collection-ediff-scroll-left (&optional arg) - "Scroll left." - (interactive "P") - (let ((last-command-event ?>)) - (ediff-scroll-horizontally arg))) - -(defun evil-collection-ediff-scroll-right (&optional arg) - "Scroll right." - (interactive "P") - (let ((last-command-event ?<)) - (ediff-scroll-horizontally arg))) - -(defun evil-collection-ediff-scroll-up (&optional arg) - "Scroll up by half of a page." - (interactive "P") - (let ((last-command-event ?V)) - (ediff-scroll-vertically arg))) - -(defun evil-collection-ediff-scroll-down (&optional arg) - "Scroll down by half of a page." - (interactive "P") - (let ((last-command-event ?v)) - (ediff-scroll-vertically arg))) - -(defun evil-collection-ediff-scroll-down-1 () - "Scroll down by a line." - (interactive) - (let ((last-command-event ?v)) - (ediff-scroll-vertically 1))) - -(defun evil-collection-ediff-scroll-up-1 () - "Scroll down by a line." - (interactive) - (let ((last-command-event ?V)) - (ediff-scroll-vertically 1))) - -(defun evil-collection-ediff-first-difference () - "Jump to first difference." - (interactive) - (ediff-jump-to-difference 1)) - -(defun evil-collection-ediff-last-difference () - "Jump to last difference." - (interactive) - (ediff-jump-to-difference ediff-number-of-differences)) - -;; (defun evil-collection-ediff-restore-diff () -;; "Restore the copy of current region." -;; (interactive) -;; (ediff-restore-diff nil ?a) -;; (ediff-restore-diff nil ?b)) - -(defvar evil-collection-ediff-bindings - '(("d" . ediff-jump-to-difference) - ("H" . ediff-toggle-hilit) - ("\C-e" . evil-collection-ediff-scroll-down-1) - ("\C-y" . evil-collection-ediff-scroll-up-1) - ("j" . ediff-next-difference) - ("k" . ediff-previous-difference) - ("N" . ediff-previous-difference) - ("gg" . evil-collection-ediff-first-difference) - ("G" . evil-collection-ediff-last-difference) - ("\C-d" . evil-collection-ediff-scroll-down) - ("\C-u" . evil-collection-ediff-scroll-up) - ("\C-z" . ediff-suspend) - ("z" . nil) - ("zl" . evil-collection-ediff-scroll-right) - ("zh" . evil-collection-ediff-scroll-left) - ;; Not working yet - ;; ("u" . evil-collection-ediff-restore-diff) - ) - "A list of bindings changed/added in evil-ediff.") - -(defun evil-collection-ediff-startup-hook () - "Place evil-ediff bindings in `ediff-mode-map'." - (evil-make-overriding-map ediff-mode-map 'normal) - (dolist (entry evil-collection-ediff-bindings) - (define-key ediff-mode-map (car entry) (cdr entry))) - (unless (or ediff-3way-comparison-job - (eq ediff-split-window-function 'split-window-vertically)) - (define-key ediff-mode-map "l" 'ediff-copy-A-to-B) - (define-key ediff-mode-map "h" 'ediff-copy-B-to-A)) - (evil-normalize-keymaps) - nil) - -;;;###autoload -(defun evil-collection-ediff-setup () - "Initialize evil-ediff." - (interactive) - (evil-set-initial-state 'ediff-mode 'normal) - (add-hook 'ediff-keymap-setup-hook 'evil-collection-ediff-startup-hook) - (evil-collection-ediff-adjust-help)) - -(defun evil-collection-ediff-revert () - "Revert changes made by evil-ediff." - (interactive) - (evil-set-initial-state 'ediff-mode evil-collection-ediff-initial-state-backup) - (unless evil-collection-ediff-help-changed - (dolist (msg - '((ediff-long-help-message-compare2 . ediff-long-help-message-compare2-backup) - (ediff-long-help-message-compare3 . ediff-long-help-message-compare3-backup) - (ediff-long-help-message-narrow2 . ediff-long-help-message-narrow2-backup) - (ediff-long-help-message-word-mode . ediff-long-help-message-word-mode-backup) - (ediff-long-help-message-merge . ediff-long-help-message-merge-backup) - (ediff-long-help-message-head . ediff-long-help-message-head-backup) - (ediff-long-help-message-tail . ediff-long-help-message-tail-backup))) - (setf (symbol-value (car msg)) (symbol-value (cdr msg))))) - (setq evil-collection-ediff-help-changed nil) - (remove-hook 'ediff-keymap-setup-hook 'evil-collection-ediff-startup-hook)) - -(provide 'evil-collection-ediff) -;;; evil-collection-ediff.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/eglot/README.org b/.config/emacs/lisp/evil-collection/modes/eglot/README.org deleted file mode 100644 index b93d3c1..0000000 --- a/.config/emacs/lisp/evil-collection/modes/eglot/README.org +++ /dev/null @@ -1,19 +0,0 @@ -* eglot - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/eglot/index.html][eglot]], the built-in LSP client. - -** Key bindings (normal state) - - | Command | Original | Evil | - |--------------------------------------+-----------+-------| - | =xref-find-definitions= | =M-.= | =gd= | - | =xref-find-definitions-other-window= | =C-x 4 .= | =gD= | - | =xref-find-definitions-other-frame= | =C-x 5 .= | =g5= | - | =xref-pop-marker-stack= | =M-,= | =C-t= | - | =eldoc-doc-buffer= | n/a | =K= | - | =xref-find-references= | =M-?= | =gr= | - - =gr= is only bound when =evil-collection-want-find-usages-bindings= is non-nil. - - =eglot-managed-mode-hook= adds =evil-normalize-keymaps= so the bindings - activate as soon as eglot manages a buffer. diff --git a/.config/emacs/lisp/evil-collection/modes/eglot/evil-collection-eglot.el b/.config/emacs/lisp/evil-collection/modes/eglot/evil-collection-eglot.el deleted file mode 100644 index 6633107..0000000 --- a/.config/emacs/lisp/evil-collection/modes/eglot/evil-collection-eglot.el +++ /dev/null @@ -1,50 +0,0 @@ -;;; evil-collection-eglot.el --- Bindings for `eglot' -*- lexical-binding: t -*- - -;; Copyright (C) 2018 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, eglot, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `eglot'. - -;;; Code: -(require 'eglot nil t) -(require 'evil-collection) - -(defconst evil-collection-eglot-maps '(eglot-mode-map)) - -;;;###autoload -(defun evil-collection-eglot-setup () - "Set up `evil' bindings for `eglot'." - (add-hook 'eglot-managed-mode-hook 'evil-normalize-keymaps) - (evil-collection-define-key 'normal 'eglot-mode-map - "gd" 'xref-find-definitions - "gD" 'xref-find-definitions-other-window - "g5" 'xref-find-definitions-other-frame - (kbd "C-t") 'xref-pop-marker-stack - "K" 'eldoc-doc-buffer) - - (when evil-collection-want-find-usages-bindings - (evil-collection-define-key 'normal 'eglot-mode-map - "gr" 'xref-find-references))) - -(provide 'evil-collection-eglot) -;;; evil-collection-eglot.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/eldoc/README.org b/.config/emacs/lisp/evil-collection/modes/eldoc/README.org deleted file mode 100644 index 1f1f776..0000000 --- a/.config/emacs/lisp/evil-collection/modes/eldoc/README.org +++ /dev/null @@ -1,19 +0,0 @@ -* eldoc - - Evil bindings for the buffer popped by =eldoc-doc-buffer=. - -** Key bindings - - Applied via =evil-collection-eldoc-doc-buffer-mode=, a minor mode attached - to the =*eldoc*= buffer. - - | Command | Original | Evil | - |---------------+----------+-----------| - | =quit-window= | =q= | =q=, =ZZ= | - | =evil-quit= | n/a | =ZQ= | - -** Notes - - On Emacs < 29, the minor mode is attached via advice on =eldoc-doc-buffer=. - On Emacs 29+, eldoc buffers derive from =special-mode=, which - evil-collection covers separately. diff --git a/.config/emacs/lisp/evil-collection/modes/eldoc/evil-collection-eldoc.el b/.config/emacs/lisp/evil-collection/modes/eldoc/evil-collection-eldoc.el deleted file mode 100644 index 698ab10..0000000 --- a/.config/emacs/lisp/evil-collection/modes/eldoc/evil-collection-eldoc.el +++ /dev/null @@ -1,67 +0,0 @@ -;;; evil-collection-eldoc.el --- Bindings for `eldoc' -*- lexical-binding: t -*- - -;; Copyright (C) 2022 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.2 -;; Package-Requires: ((emacs "27.1")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `eldoc'. - -;;; Code: -(require 'evil-collection) -(require 'eldoc nil t) - -(defconst evil-collection-eldoc-maps - '(evil-collection-eldoc-doc-buffer-mode-map)) - -(defvar eldoc--doc-buffer) ;; Internal to `eldoc'. - -(defvar evil-collection-eldoc-doc-buffer-mode-map (make-sparse-keymap)) - -(define-minor-mode evil-collection-eldoc-doc-buffer-mode - "A minor mode to attach to `eldoc-doc-buffer' buffers." - :group 'evil-collection-eldoc-mode - :keymap evil-collection-eldoc-doc-buffer-mode-map - :lighter nil) - -(defun evil-collection-eldoc-setup-doc-buffer-mode (&rest _) - "Set up `evil-collection-eldoc-doc-buffer-mode'." - (with-current-buffer eldoc--doc-buffer - (evil-collection-eldoc-doc-buffer-mode +1) - (evil-normalize-keymaps))) - -;;;###autoload -(defun evil-collection-eldoc-setup () - "Set up `evil' bindings for `eldoc'." - (evil-collection-define-key 'normal 'evil-collection-eldoc-doc-buffer-mode-map - "q" #'quit-window - "ZZ" #'quit-window - "ZQ" #'evil-quit) - - ;; 'special-mode' is used in eldoc since - ;; https://github.com/emacs-mirror/emacs/commit/97abe8511a829861f6efb865209ac2dd0e7ae129 - (when (< emacs-major-version 29) - ;; Enable a separate minor mode so that we can bind keys to it. - (advice-add 'eldoc-doc-buffer - :after 'evil-collection-eldoc-setup-doc-buffer-mode))) - -(provide 'evil-collection-eldoc) -;;; evil-collection-eldoc.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/elfeed/README.org b/.config/emacs/lisp/evil-collection/modes/elfeed/README.org deleted file mode 100644 index b1f2dcd..0000000 --- a/.config/emacs/lisp/evil-collection/modes/elfeed/README.org +++ /dev/null @@ -1,64 +0,0 @@ -* elfeed - - Evil bindings for [[https://github.com/skeeto/elfeed][elfeed]]. - - Standard motion / quit bindings (=gg=, =G=, =j=, =k=, =q=, =ZZ=, =ZQ=) come - from =evil-collection-set-readonly-bindings= and are not repeated below. - -** elfeed-search-mode-map - - | Command | Original | Evil | - |----------------------------------+----------+---------------------| - | =elfeed-search-show-entry= | =RET= | =RET= | - | =elfeed-search-browse-url= | =b= | =S-RET=, =go= | - | =elfeed-search-yank= | =y= | =y= | - | =elfeed-search-live-filter= | =s= | =s= | - | =elfeed-search-set-filter= | =S= | =S= | - | =elfeed-search-clear-filter= | =c= | =c= | - | =elfeed-search-fetch= | =G= | =gR= | - | =revert-buffer= | =g= | =gr= | - | =elfeed-search-tag-all= | =+= | =+= | - | =elfeed-search-untag-all= | =-= | =-= | - | =elfeed-search-tag-all-unread= | =u= | =U= | - | =elfeed-search-untag-all-unread= | =r= | =u= | - | =scroll-up-command= | n/a | =SPC= | - | =scroll-down-command= | n/a | =S-SPC= | - | =elfeed-search-quit-window= | =q= | =q=, =ZQ=, =ZZ= ([[#fallbacks][†]]) | - -** elfeed-show-mode-map - - | Command | Original | Evil | - |-----------------------------------------+----------+-------------------| - | =elfeed-show-visit= | =b= | =S-RET=, =go= | - | =elfeed-show-yank= | =y= | =yu= | - | =elfeed-show-next= | =n= | =]]=, =gj=, =C-j= | - | =elfeed-show-prev= | =p= | =[[=, =gk=, =C-k= | - | =elfeed-show-refresh= | n/a | =gr= | - | =elfeed-show-new-live-search= | =s= | =s= | - | =elfeed-show-tag= | =+= | =+= | - | =elfeed-show-untag= | =-= | =-= | - | =elfeed-show-play-enclosure= | =P= | =P= | - | =elfeed-show-add-enclosure-to-playlist= | =A= | =A= | - | =elfeed-show-save-enclosure= | =d= | =d= | - | =elfeed-show-next-link= | =TAB= | =TAB= | - | =scroll-up-command= | =SPC= | =SPC= | - | =scroll-down-command= | =S-SPC= | =S-SPC= | - | =elfeed-kill-buffer= | =q= | =q=, =ZQ=, =ZZ= | - -** elfeed-tree-mode-map - - | Command | Original | Evil | - |----------------------+----------+-------| - | =elfeed-tree-search= | =RET= | =RET= | - -** Fallbacks - :PROPERTIES: - :CUSTOM_ID: fallbacks - :END: - - Two version-compat fallbacks fire only when running older elfeed: - - - Before elfeed commit =518e5bd3= (no =revert-buffer-function=), =gr= calls - =elfeed-search-update--force= instead of =revert-buffer=. - - Before elfeed commit =2ef14c92= (no =quit-window-hook= save), =q=, =ZQ=, - =ZZ= use =elfeed-search-quit-window= to persist the db on exit. diff --git a/.config/emacs/lisp/evil-collection/modes/elfeed/evil-collection-elfeed.el b/.config/emacs/lisp/evil-collection/modes/elfeed/evil-collection-elfeed.el deleted file mode 100644 index c691575..0000000 --- a/.config/emacs/lisp/evil-collection/modes/elfeed/evil-collection-elfeed.el +++ /dev/null @@ -1,139 +0,0 @@ -;;; evil-collection-elfeed.el --- Evil bindings for elfeed -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, elfeed, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for elfeed. - -;;; Code: -(require 'elfeed nil t) -(require 'evil-collection) - -(defvar elfeed-search-mode-map) -(defvar elfeed-show-mode-map) -(defvar elfeed-tree-mode-map) - -(defconst evil-collection-elfeed-maps '(elfeed-search-mode-map - elfeed-show-mode-map - elfeed-tree-mode-map)) - -;;;###autoload -(defun evil-collection-elfeed-setup () - "Set up `evil' bindings for `elfeed'." - - (evil-collection-set-readonly-bindings 'elfeed-search-mode-map) - (evil-set-initial-state 'elfeed-search-mode 'normal) - (evil-collection-define-key 'normal 'elfeed-search-mode-map - ;; open - (kbd "RET") 'elfeed-search-show-entry - (kbd "S-") 'elfeed-search-browse-url - "go" 'elfeed-search-browse-url - - "y" 'elfeed-search-yank - - (kbd "SPC") 'scroll-up-command - (kbd "S-SPC") 'scroll-down-command - - ;; filter - "s" 'elfeed-search-live-filter - "S" 'elfeed-search-set-filter - "c" 'elfeed-search-clear-filter - - ;; refresh - "gR" 'elfeed-search-fetch ; TODO: Which update function is more useful? - "gr" 'revert-buffer - - ;; quit -- `q'/`ZZ' default to `quit-window' via - ;; `evil-collection-set-readonly-bindings'. - "ZQ" 'quit-window) - - ;; Refresh fallback for elfeed before commit 518e5bd3, where - ;; `revert-buffer-function' is not wired up. - (unless (fboundp 'elfeed-search--update-force) - (evil-collection-define-key 'normal 'elfeed-search-mode-map - "gr" 'elfeed-search-update--force)) - - ;; Quit fallback for elfeed before commit 2ef14c92, where - ;; `quit-window-hook' does not run `elfeed-db-save'. - (when (and (fboundp 'elfeed-search-quit-window) - (not (eq (indirect-function 'elfeed-search-quit-window) - (symbol-function 'quit-window)))) - (evil-collection-define-key 'normal 'elfeed-search-mode-map - "q" 'elfeed-search-quit-window - "ZQ" 'elfeed-search-quit-window - "ZZ" 'elfeed-search-quit-window)) - - (evil-collection-define-key '(normal visual) 'elfeed-search-mode-map - "+" 'elfeed-search-tag-all - "-" 'elfeed-search-untag-all - "U" 'elfeed-search-tag-all-unread - "u" 'elfeed-search-untag-all-unread) - - (evil-collection-set-readonly-bindings 'elfeed-show-mode-map) - (evil-set-initial-state 'elfeed-show-mode 'normal) - (evil-collection-define-key 'normal 'elfeed-show-mode-map - (kbd "S-") 'elfeed-show-visit - "go" 'elfeed-show-visit - - (kbd "SPC") 'scroll-up-command - (kbd "S-SPC") 'scroll-down-command - (kbd "") 'elfeed-show-next-link - - ;; filter - "s" 'elfeed-show-new-live-search - - "+" 'elfeed-show-tag - "-" 'elfeed-show-untag - - "A" 'elfeed-show-add-enclosure-to-playlist - "P" 'elfeed-show-play-enclosure - "d" 'elfeed-show-save-enclosure - - "]]" 'elfeed-show-next - "[[" 'elfeed-show-prev - "gj" 'elfeed-show-next - "gk" 'elfeed-show-prev - (kbd "C-j") 'elfeed-show-next - (kbd "C-k") 'elfeed-show-prev - - ;; refresh - "gr" 'elfeed-show-refresh - - ;; quit - "q" 'elfeed-kill-buffer - "ZQ" 'elfeed-kill-buffer - "ZZ" 'elfeed-kill-buffer) - - ;; yu, like `eww' - (evil-collection-define-operator-key 'yank 'elfeed-show-mode-map - "u" 'elfeed-show-yank) - - (evil-collection-set-readonly-bindings 'elfeed-tree-mode-map) - (evil-set-initial-state 'elfeed-tree-mode 'normal) - (evil-collection-define-key 'normal 'elfeed-tree-mode-map - ;; open - (kbd "RET") 'elfeed-tree-search)) - -(provide 'evil-collection-elfeed) -;;; evil-collection-elfeed.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/elisp-mode/README.org b/.config/emacs/lisp/evil-collection/modes/elisp-mode/README.org deleted file mode 100644 index 1fbd2a9..0000000 --- a/.config/emacs/lisp/evil-collection/modes/elisp-mode/README.org +++ /dev/null @@ -1,23 +0,0 @@ -* elisp-mode - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/elisp/index.html][Emacs Lisp]] editing (=emacs-lisp-mode= and - =emacs-lisp-compilation-mode=). - -** Key bindings - - | Command | Original | Evil | - |-------------------------------------------------------+----------+------| - | =evil-collection-elisp-mode-ielm-repl= (=elisp-mode=) | n/a | =gz= | - | =emacs-lisp-compilation-recompile= | n/a | =gr= | - | =xref-find-references= (when find-usages enabled) | =M-?= | =gr= | - - In the =*Help*= printed-value overlay (=eval-print-last-sexp= output), =RET= - in normal/motion state calls =elisp-last-sexp-toggle-display=; in insert - state =RET= falls through to the global binding. - -** Notes - - - =elisp--eval-last-sexp= is advised so its output ends at point in - normal/motion state when =evil-move-beyond-eol= is nil. - - =last-sexp-setup-props= is overridden to install an evil-aware =C-m= - handler on the printed-value text properties. diff --git a/.config/emacs/lisp/evil-collection/modes/elisp-mode/evil-collection-elisp-mode.el b/.config/emacs/lisp/evil-collection/modes/elisp-mode/evil-collection-elisp-mode.el deleted file mode 100644 index b92f262..0000000 --- a/.config/emacs/lisp/evil-collection/modes/elisp-mode/evil-collection-elisp-mode.el +++ /dev/null @@ -1,99 +0,0 @@ -;;; evil-collection-elisp-mode.el --- Bindings for `elisp-mode' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, elisp, lisp - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `elisp-mode'. - -;;; Code: -(require 'elisp-mode) -(require 'evil-collection) - -(defconst evil-collection-elisp-mode-maps '(emacs-lisp-mode-map - emacs-lisp-compilation-mode-map)) - -(defun evil-collection-elisp-mode-last-sexp-setup-props (beg end value alt1 alt2) - "Set up text properties for the output of `elisp--eval-last-sexp'. -BEG and END are the start and end of the output in current-buffer. -VALUE is the Lisp value printed, ALT1 and ALT2 are strings for the -alternative printed representations that can be displayed." - (let ((map (make-sparse-keymap))) - (define-key map (kbd "C-m") 'evil-collection-elisp-mode-return-or-last-sexp-toggle-display) - (define-key map [down-mouse-2] 'mouse-set-point) - (define-key map [mouse-2] 'elisp-last-sexp-toggle-display) - (add-text-properties - beg end - `(printed-value (,value ,alt1 ,alt2) - mouse-face highlight - keymap ,map - help-echo "RET, mouse-2: toggle abbreviated display" - rear-nonsticky (mouse-face keymap help-echo - printed-value))))) - -(defun evil-collection-elisp-mode-return-or-last-sexp-toggle-display () - "Trigger RET or call `elisp-last-sexp-toggle-display'." - (interactive) - (if (eq evil-state 'insert) - (call-interactively - (lookup-key (current-global-map) (kbd "C-m"))) - (call-interactively 'elisp-last-sexp-toggle-display))) - -(defun evil-collection-elisp-mode-last-sexp (command &rest args) - "In normal-state or motion-state, last sexp ends at point." - (if (and (not evil-move-beyond-eol) - (or (evil-normal-state-p) (evil-motion-state-p))) - (save-excursion - (unless (or (eobp) (eolp)) (forward-char)) - (apply command args)) - (apply command args))) - -(defun evil-collection-elisp-mode-ielm-repl () - "Open the Emacs Lisp REPL (`ielm')." - (interactive) - (pop-to-buffer (get-buffer-create "*ielm*")) - (ielm)) - -;;;###autoload -(defun evil-collection-elisp-mode-setup () - "Set up `evil' bindings for `elisp-mode'." - (add-hook 'emacs-lisp-compilation-mode-hook 'evil-normalize-keymaps) - - (unless evil-move-beyond-eol - (advice-add 'eval-print-last-sexp :around 'evil-collection-elisp-mode-last-sexp)) - (advice-add 'last-sexp-setup-props - :override 'evil-collection-elisp-mode-last-sexp-setup-props) - - (evil-set-initial-state 'emacs-lisp-mode 'normal) - (evil-collection-define-key 'normal 'emacs-lisp-mode-map - "gz" 'evil-collection-elisp-mode-ielm-repl) - - (evil-collection-define-key 'normal 'emacs-lisp-compilation-mode-map - "gr" 'emacs-lisp-compilation-recompile) - - (when evil-collection-want-find-usages-bindings - (evil-collection-define-key 'normal 'emacs-lisp-mode-map - "gr" 'xref-find-references))) - -(provide 'evil-collection-elisp-mode) -;;; evil-collection-elisp-mode.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/elisp-refs/README.org b/.config/emacs/lisp/evil-collection/modes/elisp-refs/README.org deleted file mode 100644 index fe6eb22..0000000 --- a/.config/emacs/lisp/evil-collection/modes/elisp-refs/README.org +++ /dev/null @@ -1,12 +0,0 @@ -* elisp-refs - - Evil bindings for [[https://github.com/Wilfred/elisp-refs][elisp-refs]]. - -** Key bindings - - | Command | Original | Evil | - |--------------------------+--------------+----------------------| - | =elisp-refs-next-match= | =n=, =TAB= | =TAB=, =C-j=, =gj= | - | =elisp-refs-prev-match= | =p=, =S-TAB= | =S-TAB=, =C-k=, =gk= | - | =elisp-refs-visit-match= | =RET= | =RET= | - | =kill-current-buffer= | n/a | =q= | diff --git a/.config/emacs/lisp/evil-collection/modes/elisp-refs/evil-collection-elisp-refs.el b/.config/emacs/lisp/evil-collection/modes/elisp-refs/evil-collection-elisp-refs.el deleted file mode 100644 index c146c04..0000000 --- a/.config/emacs/lisp/evil-collection/modes/elisp-refs/evil-collection-elisp-refs.el +++ /dev/null @@ -1,52 +0,0 @@ -;;; evil-collection-elisp-refs.el --- Evil bindings for Elisp Refs -*- lexical-binding: t -*- - -;; Copyright (C) 2017, 2024 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, elisp-refs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; This package provides a sane set of defaults for `elisp-refs' when using -;; `evil-mode'. - -;;; Code: -(require 'evil-collection) -(require 'elisp-refs nil t) - -(defconst evil-collection-elisp-refs-maps '(elisp-refs-mode-map)) - -;;;###autoload -(defun evil-collection-elisp-refs-setup () - "Set up `evil' bindings for `elisp-refs'." - (evil-collection-define-key 'normal 'elisp-refs-mode-map - (kbd "") 'elisp-refs-next-match - (kbd "") 'elisp-refs-prev-match - (kbd "C-j") 'elisp-refs-next-match - (kbd "C-k") 'elisp-refs-prev-match - "gj" 'elisp-refs-next-match - "gk" 'elisp-refs-prev-match - (kbd "RET") 'elisp-refs-visit-match - - ;; quit - "q" 'kill-current-buffer)) - -(provide 'evil-collection-elisp-refs) -;;; evil-collection-elisp-refs.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/elisp-slime-nav/README.org b/.config/emacs/lisp/evil-collection/modes/elisp-slime-nav/README.org deleted file mode 100644 index 97a2d86..0000000 --- a/.config/emacs/lisp/evil-collection/modes/elisp-slime-nav/README.org +++ /dev/null @@ -1,11 +0,0 @@ -* elisp-slime-nav - - Evil bindings for [[https://github.com/purcell/elisp-slime-nav][elisp-slime-nav]]. - -** Key bindings - - | Command | Original | Evil | - |-------------------------------------------------+-----------------------------+-------| - | =elisp-slime-nav-find-elisp-thing-at-point= | =M-.= | =gd= | - | =pop-tag-mark= | =M-,= | =C-t= | - | =elisp-slime-nav-describe-elisp-thing-at-point= | =C-c C-d C-d= / =C-c C-d d= | =K= | diff --git a/.config/emacs/lisp/evil-collection/modes/elisp-slime-nav/evil-collection-elisp-slime-nav.el b/.config/emacs/lisp/evil-collection/modes/elisp-slime-nav/evil-collection-elisp-slime-nav.el deleted file mode 100644 index c3d9f04..0000000 --- a/.config/emacs/lisp/evil-collection/modes/elisp-slime-nav/evil-collection-elisp-slime-nav.el +++ /dev/null @@ -1,44 +0,0 @@ -;;; evil-collection-elisp-slime-nav.el --- Bindings for `elisp-slime-nav' -*- lexical-binding: t -*- - -;; Copyright (C) 2019 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, elisp-slime-nav, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `elisp-slime-nav'. - -;;; Code: -(require 'evil-collection) -(require 'elisp-slime-nav nil t) - -(defconst evil-collection-elisp-slime-nav-maps '(elisp-slime-nav-mode-map)) - -;;;###autoload -(defun evil-collection-elisp-slime-nav-setup () - "Set up `evil' bindings for `elisp-slime-nav'." - (evil-collection-define-key 'normal 'elisp-slime-nav-mode-map - "gd" 'elisp-slime-nav-find-elisp-thing-at-point - (kbd "C-t") 'pop-tag-mark - "K" 'elisp-slime-nav-describe-elisp-thing-at-point)) - -(provide 'evil-collection-elisp-slime-nav) -;;; evil-collection-elisp-slime-nav.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/elpaca/evil-collection-elpaca.el b/.config/emacs/lisp/evil-collection/modes/elpaca/evil-collection-elpaca.el deleted file mode 100644 index c501f91..0000000 --- a/.config/emacs/lisp/evil-collection/modes/elpaca/evil-collection-elpaca.el +++ /dev/null @@ -1,118 +0,0 @@ -;;; evil-collection-elpaca.el --- Bindings for `elpaca' -*- lexical-binding: t -*- - -;; Copyright (C) 2023 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.2 -;; Package-Requires: ((emacs "27.1")) -;; Keywords: evil, emacs, convenience, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `elpaca'. - -;;; Code: -(require 'evil-collection) -(require 'elpaca nil t) -(require 'elpaca-ui nil t) - -(defvar elpaca-info-mode-map) -(defvar elpaca-ui-mode-map) -(defvar elpaca-ui-view-map) -(declare-function elpaca-ui-search "elpaca-ui") -(declare-function elpaca-ui-visit "elpaca-ui") - - -(defconst evil-collection-elpaca-maps '(elpaca-info-mode-map - elpaca-ui-mode-map)) - -(defcustom evil-collection-elpaca-want-movement t - "When non nil, prioritize movement keys like \"h\", \"l\", \"b\", etc." - :group 'evil-collection - :type 'boolean) - -(defcustom evil-collection-elpaca-want-v t - "When non nil, use v for visual mode. -When this is true, move the `elpaca-visit' to gv and gd." - :group 'evil-collection - :type 'boolean) - -(defun evil-collection-elpaca-ui-visit-build-dir () - "Visit package's build-dir." - (interactive) - (elpaca-ui-visit 'build)) - -(defmacro evil-collection-elpaca-defsearch (name query) - "Return search command with NAME for QUERY." - (declare (indent 1) (debug t)) - `(defun ,(intern (format "elpaca-ui-search-%s" name)) () - ,(format "Search for %S" query) - (interactive) - (elpaca-ui-search ,query))) - -(defun evil-collection-elpaca-setup () - "Set up `evil' bindings for elpaca." - (evil-collection-define-key 'normal 'elpaca-ui-view-map - (kbd "a") (evil-collection-elpaca-defsearch marked "#unique #marked") - (kbd "i") (evil-collection-elpaca-defsearch installed "#unique #installed") - (kbd "l") 'elpaca-log - (kbd "m") 'elpaca-manager - (kbd "o") (evil-collection-elpaca-defsearch orphaned "#unique #orphan") - (kbd "r") 'elpaca-ui-search-refresh - (kbd "t") (evil-collection-elpaca-defsearch tried "#unique #installed !#declared") - (kbd "b") 'evil-collection-elpaca-ui-visit-build-dir) - - (evil-collection-define-key 'normal 'elpaca-info-mode-map - (kbd "TAB") 'forward-button - (kbd "") 'forward-button - (kbd "S-TAB") 'backward-button - (kbd "") 'backward-button - (kbd "i") 'elpaca-info - (kbd "s") 'elpaca-info) - - (evil-collection-define-key 'normal 'elpaca-ui-mode-map - (kbd "RET") 'elpaca-ui-info - (kbd "!") 'elpaca-ui-send-input - (kbd "+") 'elpaca-ui-show-hidden-rows - (kbd "c") 'elpaca-ui-copy - (kbd "d") 'elpaca-ui-mark-delete - (kbd "g") elpaca-ui-view-map - (kbd "i") 'elpaca-ui-mark-try - (kbd "m") 'elpaca-ui-mark-merge - (kbd "p") 'elpaca-ui-mark-pull - (kbd "r") 'elpaca-ui-mark-rebuild - (kbd "s") 'elpaca-ui-search - (kbd "u") 'elpaca-ui-unmark - (kbd "x") 'elpaca-ui-execute-marks) - - (if evil-collection-elpaca-want-v - (evil-collection-define-key 'normal 'elpaca-ui-view-map - (kbd "v") 'elpaca-ui-visit) - (evil-collection-define-key 'normal 'elpaca-ui-mode-map - (kbd "v") 'elpaca-ui-visit)) - - (if evil-collection-elpaca-want-movement - (evil-collection-define-key 'normal 'elpaca-ui-mode-map - (kbd "B") 'elpaca-ui-browse-package ;; b -> B - (kbd "F") 'elpaca-ui-mark-fetch ;; f -> F - ) - (evil-collection-define-key 'normal 'elpaca-ui-mode-map - (kbd "b") 'elpaca-ui-browse-package - (kbd "f") 'elpaca-ui-mark-fetch))) - -(provide 'evil-collection-elpaca) -;;; evil-collection-elpaca.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/embark/README.org b/.config/emacs/lisp/evil-collection/modes/embark/README.org deleted file mode 100644 index 3a76f32..0000000 --- a/.config/emacs/lisp/evil-collection/modes/embark/README.org +++ /dev/null @@ -1,19 +0,0 @@ -* embark - - Evil bindings for [[https://github.com/oantolin/embark][embark]]. Only - =embark-collect-mode-map= is touched -- the embark action keymaps - (=embark-general-map=, =embark-file-map=, ...) are left alone so embark's own - prefix UI keeps working. - -** embark-collect-mode-map - - Initial state is forced to normal. - - | Command | Original | Evil | - |-------------------------------------------+----------+-------| - | =embark-act= | =a= | =a= | - | =embark-act-all= | =A= | =A= | - | =embark-export= | =E= | =E= | - | =embark-select= | n/a | =m= | - | =embark-collect-direct-action-minor-mode= | =M-a= | =M-a= | - | =revert-buffer= | =g= | =gr= | diff --git a/.config/emacs/lisp/evil-collection/modes/embark/evil-collection-embark.el b/.config/emacs/lisp/evil-collection/modes/embark/evil-collection-embark.el deleted file mode 100644 index c22d294..0000000 --- a/.config/emacs/lisp/evil-collection/modes/embark/evil-collection-embark.el +++ /dev/null @@ -1,52 +0,0 @@ -;;; evil-collection-embark.el --- Evil bindings for embark -*- lexical-binding: t -*- - -;; Copyright (C) 2021 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for embark. - -;;; Code: - -(require 'evil-collection) -(require 'embark nil t) - -(defconst evil-collection-embark-maps '(embark-collect-mode-map)) - -;;;###autoload -(defun evil-collection-embark-setup () - "Set up `evil' bindings for `embark'." - (evil-set-initial-state 'embark-collect-mode 'normal) - (evil-collection-define-key 'normal 'embark-collect-mode-map - ;; embark specific commands. `isearch-forward' isn't defined, use - ;; `evil-search-forward' instead. - "a" 'embark-act - "A" 'embark-act-all - "E" 'embark-export ;; was e - "m" 'embark-select - (kbd "M-a") 'embark-collect-direct-action-minor-mode - - "gr" 'revert-buffer)) - -(provide 'evil-collection-embark) -;;; evil-collection-embark.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/ement/evil-collection-ement.el b/.config/emacs/lisp/evil-collection/modes/ement/evil-collection-ement.el deleted file mode 100644 index a9c7a1b..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ement/evil-collection-ement.el +++ /dev/null @@ -1,138 +0,0 @@ -;;; evil-collection-ement.el --- Evil integration for Ement.el -*- lexical-binding: t; -*- - -;; Copyright (C) 2023 Nicholas Vollmer - -;; Author: Nicholas Vollmer -;; Keywords: convenience -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.0 -;; Package-Requires: ((emacs "27.1")) -;; Keywords: evil, emacs, convenience, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; Evil bindings for Ement.el - -;;; Code: -(require 'evil-collection) -(require 'ement nil t) -(require 'ement-room-list nil t) - -(defgroup evil-collection-ement nil - "Evil bindings for Ement.el." - :group 'evil-collection) - -(defcustom evil-collection-ement-want-auto-retro nil - "When non-nil, automatically run `ement-room-retro' when scrolled up at `bob'." - :type 'boolean) - -(defconst evil-collection-ement-maps '(ement-describe-room-mode-map - ement-directory-mode-map - ement-room-list-mode-map - ement-room-mode-map)) - -(declare-function ement-room-retro "ement-room") -(defun evil-collection-ement--auto-retro () - "Call `ement-room-retro' scroll requested from beginning of buffer hit." - (and (= (line-beginning-position) (point-min)) - (not (eq evil-state 'emacs)) - (member this-command '(previous-line evil-scroll-up)) - (call-interactively #'ement-room-retro) - (setq this-command 'ement-room-retro))) - -(defun evil-collection-ement--install-auto-retro () - "Install `evil-collection-ement--auto-retro'." - (add-hook 'post-command-hook #'evil-collection-ement--auto-retro nil t)) - -(defun evil-collection-ement-setup () - "Set up `evil' bindings for Ement.el." - (evil-collection-define-key 'normal 'ement-describe-room-mode-map - (kbd "q") 'quit-window) - - (evil-collection-define-key 'normal 'ement-directory-mode-map - (kbd "RET") 'ement-directory-RET - (kbd "") 'ement-directory-RET - (kbd "s") 'ement-directory-search - (kbd "q") 'quit-window) - - (evil-collection-define-key 'normal 'ement-room-list-mode-map - (kbd "d") 'ement-room-list-kill-buffer - (kbd "x") 'ement-room-leave - (kbd "X") 'ement-forget-room - (kbd "RET") 'ement-room-list-RET - (kbd "") 'ement-room-list-RET) - - (let* ((submit evil-collection-repl-submit-state) - (newline-state (if (eq submit 'normal) 'insert 'normal))) - (evil-collection-define-key submit 'ement-room-mode-map - (kbd "") 'ement-room-send-message - (kbd "RET") 'ement-room-send-message) - (evil-collection-define-key newline-state 'ement-room-mode-map - (kbd "") 'newline - (kbd "RET") 'newline)) - - (evil-collection-define-key '(normal motion) 'ement-room-mode-map - (kbd "<") 'ement-room-transient - (kbd "M-RET") 'ement-room-compose-message - (kbd "") 'ement-room-compose-message - (kbd "a") 'ement-room-send-message - (kbd "A") 'ement-room-compose-message - (kbd "d") 'ement-room-delete-message - (kbd "D") 'ement-room-delete-message - (kbd "J") 'ement-room-write-reply - (kbd "]]") 'ement-room-goto-next - (kbd "[[") 'ement-room-goto-prev - (kbd "gr") 'ement-room-sync - (kbd "gu") 'ement-room-goto-fully-read-marker - (kbd "gm") 'ement-room-mark-read - (kbd "gv") 'ement-room-view-event - (kbd "i") 'ement-room-edit-message - (kbd "q") 'quit-window - ;; Room prefix bindings - (kbd "r/") 'ement-room-occur - (kbd "rd") 'ement-room-describe - (kbd "rf") 'ement-room-set-message-format - (kbd "rl") 'ement-room-list - (kbd "rm") 'ement-list-members - (kbd "rn") 'ement-room-override-name - (kbd "rN") 'ement-room-set-notification-state - (kbd "rt") 'ement-room-set-topic - (kbd "rT") 'ement-tag-room - ;; Room membership - (kbd "Rc") 'ement-create-room - (kbd "Rj") 'ement-room-join - (kbd "Rl") 'ement-room-leave - (kbd "RF") 'ement-room-forget - (kbd "Rn") 'ement-room-set-display-name - (kbd "Rs") 'ement-room-toggle-space - ;; Send prefix bindings - (kbd "se") 'ement-room-send-emote - (kbd "sf") 'ement-room-send-file - (kbd "si") 'ement-room-send-image - (kbd "sr") 'ement-room-send-reaction - ;; User prefix bindings - (kbd "ui") 'ement-invite-user - (kbd "uI") 'ement-ignore-user - (kbd "u RET") 'ement-send-direct-message - (kbd "u ") 'ement-send-direct-message) - - (when evil-collection-ement-want-auto-retro - (add-hook 'ement-room-mode-hook #'evil-collection-ement--install-auto-retro)) - nil) - -(provide 'evil-collection-ement) -;;; evil-collection-ement.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/emms/README.org b/.config/emacs/lisp/evil-collection/modes/emms/README.org deleted file mode 100644 index cd6d6af..0000000 --- a/.config/emacs/lisp/evil-collection/modes/emms/README.org +++ /dev/null @@ -1,131 +0,0 @@ -* emms - - Evil bindings for [[https://www.gnu.org/software/emms/][EMMS]]. - -** emms-browser-mode-map - - Insert state is inhibited; the browser is forced into normal state. - - | Command | Original | Evil | - |--------------------------------------------+-------------+-------------------| - | =emms-pause= | =P= | =x= | - | =emms-stop= | =s= | =X= | - | =emms-random= | =r= | =r= | - | =emms-seek-backward= | =<= | =<= | - | =emms-seek-forward= | =>= | =>= | - | =emms-browser-add-tracks= | =RET= | =RET= | - | =emms-browser-add-tracks-and-play= | =C-RET= | =C-RET= | - | =emms-volume-raise= | =+= | =+=, === | - | =emms-volume-lower= | =-= | =-= | - | =emms-playlist-mode-undo= | =C-/= | =u= | - | =emms-browser-prev-non-track= | == | =[[=, =C-k=, =gk= | - | =emms-browser-next-non-track= | n/a | =]]=, =C-j=, =gj= | - | =emms-browser-toggle-subitems-recursively= | n/a | =TAB=, =S-TAB= | - | =emms-browser-move-up-level= | =^= | =^= | - | =emms-browser-toggle-subitems= | =SPC= | =SPC= | - | =emms-browser-collapse-all= | =1= | =g1=, =zm=, =zc= | - | =emms-browser-expand-to-level-2= | =2= | =g2= | - | =emms-browser-expand-to-level-3= | =3= | =g3= | - | =emms-browser-expand-to-level-4= | =4= | =g4= | - | =emms-browser-expand-all= | =E= | =g0=, =zr= | - | =emms-browser-expand-one-level= | n/a | =zo= | - | =emms-browse-by-artist= | =b 1= | =ga= | - | =emms-browse-by-album= | =b 2= | =gA= | - | =emms-browse-by-genre= | =b 3= | =gb= | - | =emms-browse-by-year= | =b 4= | =gy= | - | =emms-browse-by-composer= | =b 5= | =gc= | - | =emms-browse-by-performer= | =b 6= | =gp= | - | =emms-isearch-buffer= | =/= | =/= | - | =isearch-repeat-forward= | n/a | =n= | - | =isearch-repeat-backward= | n/a | =N= | - | =emms-browser-clear-playlist= | =C= | =C= | - | =emms-browser-delete-files= | =D= | (default) | - | =emms-browser-remove-tracks= | n/a | =D= | - | =emms-browser-view-in-dired= | =d= | =d=, =gd= | - | (parent =W= prefix) | =W= | =g= | - | (parent =s= prefix) | =s= | =s= | - -** emms-playlist-mode-map - - Initial evil state is normal. - - | Command | Original | Evil | - |-----------------------------------------------------------+------------+-------------| - | =emms-pause= | =P= | =x= | - | =emms-stop= | =s= | =X= | - | =emms-random= | =r= | =r= | - | =emms-seek-backward= | =<= | =<= | - | =emms-seek-forward= | =>= | =>= | - | =emms-next= | =n= | =C-j=, =gj= | - | =emms-previous= | =p= | =C-k=, =gk= | - | =emms-playlist-mode-play-smart= | =RET= | =RET= | - | =emms-volume-raise= | =+= | =+=, === | - | =emms-volume-lower= | =-= | =-= | - | =emms-playlist-mode-undo= | =C-/= | =u= | - | =emms-playlist-mode-first= | =M-<= | =gg= | - | =emms-playlist-mode-last= | =M->= | =G= | - | =emms-playlist-mode-next= | =M-n= | =]]= | - | =emms-playlist-mode-previous= | =M-p= | =[[= | - | =emms-playlist-mode-kill-track= | =C-k=, =D= | =D= | - | =emms-playlist-clear= | =C= | =C= | - | =evil-collection-emms-playlist-mode-insert-newline-above= | n/a | =O= | - | =evil-collection-emms-playlist-mode-insert-newline-below= | n/a | =o= | - | =evil-collection-emms-playlist-mode-paste-before= | n/a | =P= | - | =evil-collection-emms-playlist-mode-paste-after= | n/a | =p= | - | =emms-tag-editor-edit= | n/a | =ze= | - | =emms-tag-editor-rename= | n/a | =R= | - | =emms-playlist-mode-center-current= | =c= | =.= | - | =emms-playlist-mode-goto-dired-at-point= | =d= | =d=, =gd= | - | =emms-show= | =f= | =zs= | - | =emms-playlist-mode-add-contents= | =a= | =a= | - | =emms-playlist-set-playlist-buffer= | =b= | =zp= | - | (parent =S= sort prefix) | =S= | =S= | - | (parent =/= filter prefix) | =/= | =s= | - | =emms-playlist-mode-yank-pop= | =M-y= | =M-y= | - | =emms-playlist-mode-kill= (visual) | =C-w= | =D= | - -** emms-browser-search-mode-map - - | Command | Original | Evil | - |----------------------------+----------+------| - | =emms-browser-kill-search= | n/a | =q= | - -** emms-metaplaylist-mode-map - - Initial evil state is normal. - - | Command | Original | Evil | - |-----------------------------------------+----------+-------| - | =emms-metaplaylist-mode-goto-current= | =RET= | =RET= | - | =emms-metaplaylist-mode-set-active= | =SPC= | =SPC= | - | =emms-metaplaylist-mode-update= | =g= | =gr= | - | =emms-metaplaylist-mode-new-buffer= | =C= | =C= | - | =emms-metaplaylist-mode-center-current= | =c= | =.= | - | =emms-metaplaylist-mode-kill-buffer= | =C-k= | =D= | - | =kill-current-buffer= | =q= | =q= | - -** emms-stream-mode-map - - Initial evil state is normal. - - | Command | Original | Evil | - |-------------------------------------+----------+----------| - | =emms-stream-play= | =RET= | =RET= | - | =emms-stream-next-line= | =n= | =j= | - | =emms-stream-previous-line= | =p= | =k= | - | =emms-stream-yank-bookmark= | =y= | =y= | - | =emms-stream-kill-bookmark= | =k= | =d= | - | =emms-stream-edit-bookmark= | =e= | =c=, =r= | - | =emms-stream-info-bookmark= | =i= | =i= | - | =emms-stream-save-bookmarks-file= | =s= | =s= | - | =emms-stream-toggle-default-action= | =t= | =x= | - | =emms-stream-quit= | =q= | =q= | - -** New commands - - | Command | Purpose | - |-----------------------------------------------------------+---------------------------------------------------------------| - | =evil-collection-emms-playlist-mode-insert-newline-above= | =O= equivalent that respects =emms-with-inhibit-read-only-t=. | - | =evil-collection-emms-playlist-mode-insert-newline-below= | =o= variant. | - | =evil-collection-emms-playlist-mode-paste-before= | =P= -- yank playlist items before point. | - | =evil-collection-emms-playlist-mode-paste-after= | =p= -- yank playlist items after point. | diff --git a/.config/emacs/lisp/evil-collection/modes/emms/evil-collection-emms.el b/.config/emacs/lisp/evil-collection/modes/emms/evil-collection-emms.el deleted file mode 100644 index 47b4e8d..0000000 --- a/.config/emacs/lisp/evil-collection/modes/emms/evil-collection-emms.el +++ /dev/null @@ -1,266 +0,0 @@ -;;; evil-collection-emms.el --- Evil bindings for EMMS -*- lexical-binding: t -*- - -;; Copyright (C) 2017, 2024 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emms, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for EMMS. - -;;; Code: -(require 'emms nil t) -(require 'evil-collection) - -(declare-function emms-with-inhibit-read-only-t "emms") -(declare-function emms-playlist-mode-correct-previous-yank "emms-playlist-mode") -(declare-function emms-playlist-mode-yank "emms-playlist-mode") - -(defvar emms-browser-mode-map) -(defvar emms-playlist-mode-map) - -(defconst evil-collection-emms-maps '(emms-browser-mode-map - emms-playlist-mode-map - emms-browser-search-mode-map - emms-metaplaylist-mode-map - emms-stream-mode-map)) - -(defun evil-collection-emms-playlist-mode-insert-newline-above () - "Insert a newline above point." - (interactive) - (emms-with-inhibit-read-only-t - (evil-insert-newline-above))) - -(defun evil-collection-emms-playlist-mode-insert-newline-below () - "Insert a newline below point." - (interactive) - (emms-with-inhibit-read-only-t - (evil-insert-newline-below))) - -(defun evil-collection-emms-playlist-mode-paste-before () - "Pastes the latest yanked playlist items before the cursor position. -The return value is the yanked text." - (interactive) - (emms-with-inhibit-read-only-t - (goto-char (line-beginning-position)) - (emms-playlist-mode-yank) - (emms-playlist-mode-correct-previous-yank) - (evil-previous-line) - (evil-beginning-of-line))) - -(defun evil-collection-emms-playlist-mode-paste-after () - "Pastes the latest yanked playlist items behind point. -The return value is the yanked text." - (interactive) - (unless (eobp) (evil-next-line)) - (evil-collection-emms-playlist-mode-paste-before)) - -;;;###autoload -(defun evil-collection-emms-browser-setup () - "Set up `evil' bindings for `emms-browser'." - ;; TODO: Why doesn't evil-set-initial-state work with emms-browser-mode? - - (evil-collection-inhibit-insert-state 'emms-browser-mode-map) - (add-hook 'emms-browser-mode-hook 'evil-normal-state) - (evil-collection-define-key 'normal 'emms-browser-mode-map - ;; The following overrides other "g-" and "s-" prefixed keys so we set it first. - "g" nil - "g" (lookup-key emms-browser-mode-map (kbd "W")) - "s" nil - "s" (lookup-key emms-browser-mode-map (kbd "s")) - - ;; playback controls - "x" 'emms-pause - "X" 'emms-stop - "r" 'emms-random - "<" 'emms-seek-backward - ">" 'emms-seek-forward - (kbd "RET") 'emms-browser-add-tracks - (kbd "C-") 'emms-browser-add-tracks-and-play - - ;; volume controls - "+" 'emms-volume-raise - "=" 'emms-volume-raise - "-" 'emms-volume-lower - - "u" 'emms-playlist-mode-undo - - ;; motion - "[[" 'emms-browser-prev-non-track - "]]" 'emms-browser-next-non-track - (kbd "C-k") 'emms-browser-prev-non-track - (kbd "C-j") 'emms-browser-next-non-track - "gk" 'emms-browser-prev-non-track - "gj" 'emms-browser-next-non-track - - (kbd "") 'emms-browser-toggle-subitems-recursively - (kbd "") 'emms-browser-toggle-subitems-recursively - "^" 'emms-browser-move-up-level - (kbd "SPC") 'emms-browser-toggle-subitems - "g1" 'emms-browser-collapse-all - "g2" 'emms-browser-expand-to-level-2 - "g3" 'emms-browser-expand-to-level-3 - "g4" 'emms-browser-expand-to-level-4 - "g0" 'emms-browser-expand-all - "ga" 'emms-browse-by-artist - "gA" 'emms-browse-by-album - "gb" 'emms-browse-by-genre - "gy" 'emms-browse-by-year - "gc" 'emms-browse-by-composer - "gp" 'emms-browse-by-performer - "zm" 'emms-browser-collapse-all - "zr" 'emms-browser-expand-all - "zo" 'emms-browser-expand-one-level - ;; TODO find a real replacement for zc - "zc" 'emms-browser-collapse-all - - ;; TODO find a way to integrate this with evil-collection-evil-search - "/" 'emms-isearch-buffer ; This shows hidden items during search. - "n" 'isearch-repeat-forward - "N" 'isearch-repeat-backward - - ;; filter - ;; "" 'emms-browser-previous-filter ; TODO: What does this do? - ;; "" 'emms-browser-next-filter - - - "C" 'emms-browser-clear-playlist - "D" 'emms-browser-remove-tracks - "d" 'emms-browser-view-in-dired - ;; "d" does the same, keep "gd" for consistency. - "gd" 'emms-browser-view-in-dired) - - (unless evil-collection-always-run-setup-hook-after-load - (run-hook-with-args 'evil-collection-setup-hook - 'emms '(emms-browser-mode-map)))) - -;;;###autoload -(defun evil-collection-emms-playlist-setup () - "Set up `evil' bindings for `emms-playlist'." - (evil-set-initial-state 'emms-playlist-mode 'normal) - (evil-collection-define-key 'normal 'emms-playlist-mode-map - ;; playback controls - "x" 'emms-pause - "X" 'emms-stop - "r" 'emms-random - "<" 'emms-seek-backward - ">" 'emms-seek-forward - (kbd "C-j") 'emms-next - (kbd "C-k") 'emms-previous - "gj" 'emms-next - "gk" 'emms-previous - (kbd "RET") 'emms-playlist-mode-play-smart - - ;; volume controls - "+" 'emms-volume-raise - "=" 'emms-volume-raise - "-" 'emms-volume-lower - - "u" 'emms-playlist-mode-undo - - ;; motion - "gg" 'emms-playlist-mode-first - "G" 'emms-playlist-mode-last - "]]" 'emms-playlist-mode-next - "[[" 'emms-playlist-mode-previous - - "D" 'emms-playlist-mode-kill-track ; emms-browser uses "D" - "C" 'emms-playlist-clear - "O" 'evil-collection-emms-playlist-mode-insert-newline-above - "o" 'evil-collection-emms-playlist-mode-insert-newline-below - "P" 'evil-collection-emms-playlist-mode-paste-before - "p" 'evil-collection-emms-playlist-mode-paste-after - - "u" 'emms-playlist-mode-undo - - "ze" 'emms-tag-editor-edit - "R" 'emms-tag-editor-rename - - "." 'emms-playlist-mode-center-current - "d" 'emms-playlist-mode-goto-dired-at-point - "gd" 'emms-playlist-mode-goto-dired-at-point ; "d" does the same, keep "gd" for consistency. - - "zs" 'emms-show - "a" 'emms-playlist-mode-add-contents - "zp" 'emms-playlist-set-playlist-buffer - - ;; filter - "S" (lookup-key emms-playlist-mode-map (kbd "S")) - "s" (lookup-key emms-playlist-mode-map (kbd "/")) - ;; "" 'emms-playlist-limit-to-all ; TODO: Test. - - (kbd "M-y") 'emms-playlist-mode-yank-pop) - - (evil-collection-define-key 'visual 'emms-playlist-mode-map - ;; "d" 'emms-playlist-mode-kill - "D" 'emms-playlist-mode-kill) - - (unless evil-collection-always-run-setup-hook-after-load - (run-hook-with-args 'evil-collection-setup-hook - 'emms '(emms-playlist-mode-map)))) - -;;;###autoload -(defun evil-collection-emms-setup () - "Set up `evil' bindings for `emms'." - ;; emms-browser and emms-playlist-mode must be set up after they are loaded - ;; because we need the mode map to be defined when we `(lookup-key - ;; ...-mode-map ...)'. - (with-eval-after-load 'emms-browser - (evil-collection-emms-browser-setup)) - (with-eval-after-load 'emms-playlist-mode - (evil-collection-emms-playlist-setup)) - - (evil-collection-define-key 'normal 'emms-browser-search-mode-map - "q" 'emms-browser-kill-search) - - (evil-set-initial-state 'emms-metaplaylist-mode 'normal) - (evil-collection-define-key 'normal 'emms-metaplaylist-mode-map - (kbd "RET") 'emms-metaplaylist-mode-goto-current - (kbd "") 'emms-metaplaylist-mode-set-active - "gr" 'emms-metaplaylist-mode-update - "C" 'emms-metaplaylist-mode-new-buffer - "." 'emms-metaplaylist-mode-center-current - "D" 'emms-metaplaylist-mode-kill-buffer - "q" 'kill-current-buffer) - - (evil-set-initial-state 'emms-stream-mode 'normal) - (evil-collection-define-key 'normal 'emms-stream-mode-map - (kbd "RET") 'emms-stream-play - "j" 'emms-stream-next-line - "k" 'emms-stream-previous-line - "y" 'emms-stream-yank-bookmark - "d" 'emms-stream-kill-bookmark - "c" 'emms-stream-edit-bookmark - "r" 'emms-stream-edit-bookmark - "i" 'emms-stream-info-bookmark - "s" 'emms-stream-save-bookmarks-file - "x" 'emms-stream-toggle-default-action - "q" 'emms-stream-quit) - - (unless evil-collection-always-run-setup-hook-after-load - (run-hook-with-args - 'evil-collection-setup-hook 'emms - '(emms-browser-search-mode-map - emms-metaplaylist-mode-map - emms-stream-mode-map)))) - -(provide 'evil-collection-emms) -;;; evil-collection-emms.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/emoji/README.org b/.config/emacs/lisp/evil-collection/modes/emoji/README.org deleted file mode 100644 index 5a3c09b..0000000 --- a/.config/emacs/lisp/evil-collection/modes/emoji/README.org +++ /dev/null @@ -1,13 +0,0 @@ -* emoji - - Evil bindings for =emoji-list-mode= (the buffer produced by =M-x emoji-list=). - -** Key bindings - - Read-only motion/quit bindings come from =evil-collection-set-readonly-bindings= - and are not repeated below. - - | Command | Original | Evil | - |---------------------+----------+-------| - | =emoji-list-select= | =RET= | =RET= | - | =emoji-list-help= | =h= | =gh= | diff --git a/.config/emacs/lisp/evil-collection/modes/emoji/evil-collection-emoji.el b/.config/emacs/lisp/evil-collection/modes/emoji/evil-collection-emoji.el deleted file mode 100644 index 0cb0972..0000000 --- a/.config/emacs/lisp/evil-collection/modes/emoji/evil-collection-emoji.el +++ /dev/null @@ -1,44 +0,0 @@ -;;; evil-collection-emoji.el --- Evil bindings for emoji -*- lexical-binding: t -*- - -;; Copyright (C) 2021 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for emoji. - -;;; Code: -(require 'evil-collection) -(require 'emoji nil t) - -(defconst evil-collection-emoji-maps '(emoji-list-mode-map)) - -;;;###autoload -(defun evil-collection-emoji-setup () - "Set up `evil' bindings for `emoji'." - (evil-collection-set-readonly-bindings 'emoji-list-mode-map) - (evil-collection-define-key 'normal 'emoji-list-mode-map - (kbd "RET") 'emoji-list-select - "gh" 'emoji-list-help)) - -(provide 'evil-collection-emoji) -;;; evil-collection-emoji.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/epa/README.org b/.config/emacs/lisp/evil-collection/modes/epa/README.org deleted file mode 100644 index 52f4696..0000000 --- a/.config/emacs/lisp/evil-collection/modes/epa/README.org +++ /dev/null @@ -1,34 +0,0 @@ -* epa - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/epa/index.html][EasyPG Assistant]] (=epa-key-list-mode=, =epa-key-mode=, - =epa-info-mode=). - -** Key bindings - -*** epa-key-list-mode-map - - | Command | Original | Evil | - |--------------------+----------+-------| - | =widget-forward= | =TAB= | =TAB= | - | =revert-buffer= | =g= | =gr= | - | =epa-exit-buffer= | =q= | =q= | - | =quit-window= | n/a | =ZZ= | - | =evil-quit= | n/a | =ZQ= | - | =epa-decrypt-file= | =d= | =E= | - | =epa-delete-keys= | =r= | =d= | - | =epa-verify-file= | =v= | =V= | - | =epa-mark-key= | =m= | =m= | - | =epa-unmark-key= | =u= | =u= | - | =epa-sign-file= | =s= | =s= | - | =epa-encrypt-file= | =e= | =e= | - | =epa-import-keys= | =i= | =i= | - | =epa-export-keys= | =o= | =o= | - -*** epa-key-mode-map / epa-info-mode-map - - | Command | Original | Evil | - |-------------------+----------+------------| - | =epa-exit-buffer= | =q= | =q= | - | =delete-window= | n/a | =q= (info) | - | =quit-window= | n/a | =ZZ= | - | =evil-quit= | n/a | =ZQ= | diff --git a/.config/emacs/lisp/evil-collection/modes/epa/evil-collection-epa.el b/.config/emacs/lisp/evil-collection/modes/epa/evil-collection-epa.el deleted file mode 100644 index 04d818e..0000000 --- a/.config/emacs/lisp/evil-collection/modes/epa/evil-collection-epa.el +++ /dev/null @@ -1,71 +0,0 @@ -;;; evil-collection-epa.el --- Evil bindings for epa-mode -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: Maximiliano Sandoval -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, epa, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `epa-mode'. - -;;; Code: - -(require 'evil-collection) -(require 'epa nil t) - -(defconst evil-collection-epa-maps '(epa-key-list-mode-map - epa-key-mode-map - epa-info-mode-map)) - -;;;###autoload -(defun evil-collection-epa-setup () - (evil-collection-define-key 'normal 'epa-key-list-mode-map - (kbd "") 'widget-forward - "gr" 'revert-buffer - "q" 'epa-exit-buffer - "E" 'epa-decrypt-file - "d" 'epa-delete-keys - "ZZ" 'quit-window - "ZQ" 'evil-quit - "V" 'epa-verify-file - - ;; mark - "m" 'epa-mark-key - "u" 'epa-unmark-key - - ;; Unchanged keybindings. - "s" 'epa-sign-file - "e" 'epa-encrypt-file - "i" 'epa-import-keys - "o" 'epa-export-keys) - - (evil-collection-define-key 'normal 'epa-key-mode-map - "q" 'epa-exit-buffer - "ZZ" 'quit-window - "ZQ" 'evil-quit) - - (evil-collection-define-key 'normal 'epa-info-mode-map - "q" 'delete-window - "ZZ" 'quit-window - "ZQ" 'evil-quit)) - -(provide 'evil-collection-epa) -;;; evil-collection-epa.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/ert/README.org b/.config/emacs/lisp/evil-collection/modes/ert/README.org deleted file mode 100644 index c1f8a94..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ert/README.org +++ /dev/null @@ -1,24 +0,0 @@ -* ert - - Evil bindings for =ert-results-mode=. - -** Key bindings - - | Command | Original | Evil | - |-------------------------------------------------------+----------+-------------------| - | =ert-results-next-test= | =n= | =gj=, =]]=, =C-j= | - | =ert-results-previous-test= | =p= | =gk=, =[[=, =C-k= | - | =ert-results-jump-between-summary-and-result= | =j= | =J= | - | =ert-results-toggle-printer-limits-for-test-at-point= | =L= | =L= | - | =ert-results-rerun-all-tests= | =R= | =gr=, =R= | - | =ert-results-rerun-test-at-point= | =r= | =r= | - | =ert-results-rerun-test-at-point-debugging-errors= | =d= | =d= | - | =ert-results-find-test-at-point-other-window= | =.= | =.=, =gd= | - | =ert-results-pop-to-backtrace-for-test-at-point= | =b= | =B= | - | =ert-results-pop-to-messages-for-test-at-point= | =m= | =M= | - | =ert-results-pop-to-should-forms-for-test-at-point= | =l= | =s= | - | =ert-results-describe-test-at-point= | =h= | =K=, =g?= | - | =ert-results-pop-to-timings= | =T= | =T= | - | =ert-delete-test= | =D= | =x= | - | =evil-next-line= / =evil-previous-line= | n/a | =j= / =k= | - | =evil-backward-char= / =evil-forward-char= | n/a | =h= / =l= | diff --git a/.config/emacs/lisp/evil-collection/modes/ert/evil-collection-ert.el b/.config/emacs/lisp/evil-collection/modes/ert/evil-collection-ert.el deleted file mode 100644 index 0e97f66..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ert/evil-collection-ert.el +++ /dev/null @@ -1,71 +0,0 @@ -;;; evil-collection-ert.el --- Bindings for `ert' -*- lexical-binding: t -*- - -;; Copyright (C) 2018 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `ert'. - -;;; Code: -(require 'ert) -(require 'evil-collection) - -(defconst evil-collection-ert-maps '(ert-results-mode-map)) - -;;;###autoload -(defun evil-collection-ert-setup () - "Set up `evil' bindings for `ert'." - (evil-collection-inhibit-insert-state 'ert-results-mode-map) - (evil-set-initial-state 'ert-results-mode 'normal) - - (evil-collection-define-key 'normal 'ert-results-mode-map - "j" 'evil-next-line - "k" 'evil-previous-line - "h" 'evil-backward-char - "l" 'evil-forward-char - ;; Stuff that's not in the menu. - "J" 'ert-results-jump-between-summary-and-result - "L" 'ert-results-toggle-printer-limits-for-test-at-point - "gj" 'ert-results-next-test - "gk" 'ert-results-previous-test - "]]" 'ert-results-next-test - "[[" 'ert-results-previous-test - (kbd "C-j") 'ert-results-next-test - (kbd "C-k") 'ert-results-previous-test - ;; Stuff that is in the menu. - "gr" 'ert-results-rerun-all-tests - "R" 'ert-results-rerun-all-tests - "r" 'ert-results-rerun-test-at-point - "d" 'ert-results-rerun-test-at-point-debugging-errors - "." 'ert-results-find-test-at-point-other-window - "gd" 'ert-results-find-test-at-point-other-window - "B" 'ert-results-pop-to-backtrace-for-test-at-point - "M" 'ert-results-pop-to-messages-for-test-at-point - "s" 'ert-results-pop-to-should-forms-for-test-at-point - "K" 'ert-results-describe-test-at-point - "g?" 'ert-results-describe-test-at-point - "x" 'ert-delete-test - "T" 'ert-results-pop-to-timings)) - -(provide 'evil-collection-ert) -;;; evil-collection-ert.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/eshell/README.org b/.config/emacs/lisp/evil-collection/modes/eshell/README.org deleted file mode 100644 index 0d4ab5f..0000000 --- a/.config/emacs/lisp/evil-collection/modes/eshell/README.org +++ /dev/null @@ -1,36 +0,0 @@ -* eshell - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/eshell/index.html][Eshell]]. - -** Key bindings - - Normal-state bindings added to =eshell-mode-map=. - - | Command | Original | Evil | - |---------------------------------------------------+-----------+-------------------| - | =eshell-previous-prompt= | =C-c C-p= | =[[=, =gk=, =C-k= | - | =eshell-next-prompt= | =C-c C-n= | =]]=, =gj=, =C-j= | - | =eshell-backward-argument= | =C-c C-b= | =M-h= | - | =eshell-forward-argument= | =C-c C-f= | =M-l= | - | =eshell-previous-matching-input-from-input= | =C-c M-p= | =C-p= | - | =eshell-next-matching-input-from-input= | =C-c M-n= | =C-n= | - | =eshell-bol= (Emacs < 30) | =C-a= | =0=, =^= | - | =eshell-kill-input= (when =evil-want-C-u-delete=) | =C-c C-u= | =C-u= (insert) | - - =RET= sends input in the state named by =evil-collection-repl-submit-state=, - and inserts a newline in the complementary state. - -** New commands - - | Command | Key | | - |--------------------------------------------+-----------+-----------------------------------------| - | =evil-collection-eshell-interrupt-process= | =C-c C-c= | interrupt process, then enter insert | - | =evil-collection-eshell-evil-change= | =c= | change, never touches prompt or history | - | =evil-collection-eshell-evil-change-line= | =C= | change to end-of-line | - | =evil-collection-eshell-evil-delete= | =d= | delete, never touches prompt or history | - | =evil-collection-eshell-evil-delete-line= | =D= | delete to end-of-line | - -** Notes - - - On entering insert/replace state, point jumps to the next prompt. - - On entering normal state, point stays put (no Vim-style backward step). diff --git a/.config/emacs/lisp/evil-collection/modes/eshell/evil-collection-eshell.el b/.config/emacs/lisp/evil-collection/modes/eshell/evil-collection-eshell.el deleted file mode 100644 index 30580d2..0000000 --- a/.config/emacs/lisp/evil-collection/modes/eshell/evil-collection-eshell.el +++ /dev/null @@ -1,168 +0,0 @@ -;;; evil-collection-eshell.el --- Evil bindings for Eshell -*- lexical-binding: t -*- - -;; Copyright (C) 2017, 2021 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, eshell, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for Eshell. - -;;; Code: -(require 'em-prompt) -(require 'eshell) -(require 'evil-collection) - -(defconst evil-collection-eshell-maps '(eshell-mode-map)) - -(defun evil-collection-eshell-next-prompt () - "`evil' wrapper around `eshell-next-prompt'." - (when (get-text-property (point) 'read-only) - ;; If at end of prompt, `eshell-next-prompt' will not move, so go backward. - (beginning-of-line) - (eshell-next-prompt 1))) - -(defun evil-collection-eshell-next-prompt-on-insert () - "Go to next prompt on `evil' replace/insert enter." - (dolist (hook '(evil-replace-state-entry-hook evil-insert-state-entry-hook)) - (add-hook hook 'evil-collection-eshell-next-prompt nil t))) - -(defun evil-collection-eshell-interrupt-process () - "Interupt `eshell' process and enter insert state." - (interactive) - (eshell-interrupt-process) - (evil-insert 1)) - -(defun evil-collection-eshell-escape-stay () - "Go back to normal state but don't move cursor backwards. -Moving cursor backwards is the default Vim behavior but it is not -appropriate in some cases like terminals." - (setq-local evil-move-cursor-back nil)) - -;; Taken from Doom Emacs -(evil-define-operator evil-collection-eshell-evil-change (beg end type register yank-handler delete-func) - "Like `evil-change' but will not delete/copy the prompt." - (interactive "") - (save-restriction - (narrow-to-region eshell-last-output-end (point-max)) - (evil-change (max beg (point-min)) - (if (eq type 'line) (point-max) (min (or end (point-max)) (point-max))) - type register yank-handler delete-func))) - -;; Taken from Doom Emacs -(evil-define-operator evil-collection-eshell-evil-change-line (beg end type register yank-handler) - "Change to end of line." - :motion evil-end-of-line - (interactive "") - (evil-collection-eshell-evil-change beg end type register yank-handler #'evil-delete-line)) - -;; Taken from Doom Emacs -(evil-define-operator evil-collection-eshell-evil-delete (beg end type register yank-handler) - "Like `evil-delete' but will not delete/copy the prompt." - (interactive "") - (save-restriction - (narrow-to-region eshell-last-output-end (point-max)) - (evil-delete (if beg (max beg (point-min)) (point-min)) - (if (eq type 'line) (point-max) (min (or end (point-max)) (point-max))) - type register yank-handler))) - -;; Taken from Doom Emacs -;; -;; Although the BEG argument doesn't get used in any meaningful way, -;; `evil-define-operator' must access it nonetheless, so putting an underscore -;; in front will make the CI fail. -(evil-define-operator evil-collection-eshell-evil-delete-line (beg end type register yank-handler) - "Change to end of line." - :motion nil - :keep-visual t - (interactive "") - (evil-collection-eshell-evil-delete (point) end type register yank-handler)) - -;; `eshell-mode-map' is reset when Eshell is initialized in `eshell-mode'. We -;; need to add bindings to `eshell-first-time-mode-hook'. -(defun evil-collection-eshell-setup-keys () - "Set up `evil' bindings for `eshell'." - (evil-collection-define-key 'normal 'eshell-mode-map - ;; motion - "[[" 'eshell-previous-prompt - "]]" 'eshell-next-prompt - (kbd "C-k") 'eshell-previous-prompt - (kbd "C-j") 'eshell-next-prompt - "gk" 'eshell-previous-prompt - "gj" 'eshell-next-prompt - (kbd "M-h") 'eshell-backward-argument - (kbd "M-l") 'eshell-forward-argument - - (kbd "C-n") 'eshell-next-matching-input-from-input - (kbd "C-p") 'eshell-previous-matching-input-from-input - - (kbd "C-c C-c") 'evil-collection-eshell-interrupt-process - "c" 'evil-collection-eshell-evil-change - "C" 'evil-collection-eshell-evil-change-line - "d" 'evil-collection-eshell-evil-delete - "D" 'evil-collection-eshell-evil-delete-line) - - (let* ((submit evil-collection-repl-submit-state) - (newline-state (if (eq submit 'normal) 'insert 'normal))) - (evil-collection-define-key submit 'eshell-mode-map - (kbd "RET") 'eshell-send-input) - (evil-collection-define-key newline-state 'eshell-mode-map - (kbd "RET") 'newline)) - - (when (< emacs-major-version 30) - (evil-collection-define-key 'normal 'eshell-mode-map - "0" 'eshell-bol - "^" 'eshell-bol)) - - (when evil-want-C-u-delete - (evil-collection-define-key 'insert 'eshell-mode-map - (kbd "C-u") 'eshell-kill-input)) - - (evil-collection-define-key 'visual 'eshell-mode-map - ;; motion - ;; TODO: This does not work with `evil-visual-line'. - "[[" 'eshell-previous-prompt - "]]" 'eshell-next-prompt - (kbd "C-k") 'eshell-previous-prompt - (kbd "C-j") 'eshell-next-prompt - "gk" 'eshell-previous-prompt - "gj" 'eshell-next-prompt) - - (when (< emacs-major-version 30) - (evil-collection-define-key 'visual 'eshell-mode-map - "0" 'eshell-bol - "^" 'eshell-bol)) - - (evil-normalize-keymaps) - (unless evil-collection-always-run-setup-hook-after-load - (run-hook-with-args - 'evil-collection-setup-hook 'eshell evil-collection-eshell-maps))) - -;; TODO: Compare this setup procedure with evil-ediff. -;;;###autoload -(defun evil-collection-eshell-setup () - "Set up `evil' bindings for `eshell'." - (add-hook 'eshell-mode-hook 'evil-collection-eshell-escape-stay) - (add-hook 'eshell-mode-hook 'evil-collection-eshell-next-prompt-on-insert) - (add-hook 'eshell-first-time-mode-hook 'evil-collection-eshell-setup-keys)) - -(provide 'evil-collection-eshell) -;;; evil-collection-eshell.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/eval-sexp-fu/README.org b/.config/emacs/lisp/evil-collection/modes/eval-sexp-fu/README.org deleted file mode 100644 index 6563ec9..0000000 --- a/.config/emacs/lisp/evil-collection/modes/eval-sexp-fu/README.org +++ /dev/null @@ -1,16 +0,0 @@ -* eval-sexp-fu - - Evil compatibility for [[https://github.com/hchbaw/eval-sexp-fu.el][eval-sexp-fu]]. No key bindings. - - When =evil-move-beyond-eol= is nil, the setup advises - =ad-Advice-eval-last-sexp= so that =eval-last-sexp= treats the sexp under - point as ending at point (rather than one character earlier as evil's - normal-state cursor positioning would imply). This makes =C-x C-e= and - related commands work the way they do in evil's insert/emacs states. - -** New commands - - - =evil-collection-eval-sexp-fu-bounds-of-thing-at-point-sexp= - Advice - wrapper that fixes the sexp bounds in evil normal/motion state. - - =evil-collection-eval-sexp-fu-advise-bounds-of-thing-at-point= - Wraps - the advice around a single call to =eval-last-sexp=. diff --git a/.config/emacs/lisp/evil-collection/modes/eval-sexp-fu/evil-collection-eval-sexp-fu.el b/.config/emacs/lisp/evil-collection/modes/eval-sexp-fu/evil-collection-eval-sexp-fu.el deleted file mode 100644 index b6743cb..0000000 --- a/.config/emacs/lisp/evil-collection/modes/eval-sexp-fu/evil-collection-eval-sexp-fu.el +++ /dev/null @@ -1,61 +0,0 @@ -;;; evil-collection-eval-sexp-fu.el --- Bindings for `eval-sexp-fu' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, eval-sexp-fu, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `eval-sexp-fu'. - -;;; Code: -(require 'evil-collection) -(require 'eval-sexp-fu nil t) - -(defconst evil-collection-eval-sexp-fu-maps nil) - -(defun evil-collection-eval-sexp-fu-bounds-of-thing-at-point-sexp (command &rest args) - "In normal-state or motion-state, last sexp ends at point." - (if (and (eq (nth 0 args) 'sexp) - (and (not evil-move-beyond-eol) - (or (evil-normal-state-p) (evil-motion-state-p)))) - (save-excursion - (unless (or (eobp) (eolp)) (forward-char)) - (apply command args)) - (apply command args))) - -(defun evil-collection-eval-sexp-fu-advise-bounds-of-thing-at-point (command &rest args) - "Advise `bounds-of-thing-at-point' to handle `evil's `evil-move-beyond-eol'." - (advice-add 'bounds-of-thing-at-point - :around 'evil-collection-eval-sexp-fu-bounds-of-thing-at-point-sexp) - (apply command args) - (advice-remove 'bounds-of-thing-at-point - 'evil-collection-eval-sexp-fu-bounds-of-thing-at-point-sexp)) - -;;;###autoload -(defun evil-collection-eval-sexp-fu-setup () - "Set up `evil' with `eval-sexp-fu'." - (unless evil-move-beyond-eol - (advice-add 'ad-Advice-eval-last-sexp - :around 'evil-collection-eval-sexp-fu-advise-bounds-of-thing-at-point))) - -(provide 'evil-collection-eval-sexp-fu) -;;; evil-collection-eval-sexp-fu.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/evil-mc/README.org b/.config/emacs/lisp/evil-collection/modes/evil-mc/README.org deleted file mode 100644 index c23adfd..0000000 --- a/.config/emacs/lisp/evil-collection/modes/evil-mc/README.org +++ /dev/null @@ -1,49 +0,0 @@ -* evil-mc - - Evil bindings for [[https://github.com/gabesoft/evil-mc][evil-mc]], multiple cursors for evil. - - Upstream installs its cursors map under =gr= on top of the normal/visual - state. evil-collection clears both =evil-mc-key-map= and - =evil-mc-cursors-map= and re-installs the cursors map under =g.= so =gr= - stays free for =xref-find-references=. - -** Key bindings - -*** evil-mc-key-map - - | Command | Original | Evil | - |-----------------------+----------+------| - | =evil-mc-cursors-map= | =gr= | =g.= | - -*** evil-mc-cursors-map - - Prefix is =g.= in normal/visual state. - - | Command | Original | Evil | - |-----------------------------------------------+----------+---------| - | =evil-mc-make-all-cursors= | =m= | =a= | - | =evil-mc-undo-all-cursors= | =q= | =q= | - | =evil-mc-undo-last-added-cursor= | =u= | =u= | - | =evil-mc-pause-cursors= | =s= | =C-p= | - | =evil-mc-resume-cursors= | =r= | =C-r= | - | =evil-mc-make-cursor-here= | =h= | =C-m= | - | =evil-mc-make-and-goto-first-cursor= | =f= | =0= | - | =evil-mc-make-and-goto-last-cursor= | =l= | =$= | - | =evil-mc-make-cursor-in-visual-selection-beg= | =I= | =I= | - | =evil-mc-make-cursor-in-visual-selection-end= | =A= | =A= | - | =evil-mc-make-cursor-move-next-line= | =j= | =o= | - | =evil-mc-make-cursor-move-prev-line= | =k= | =O= | - | =evil-mc-make-and-goto-next-match= | =n= | =n= | - | =evil-mc-make-and-goto-prev-match= | =N= | =N= | - | =evil-mc-skip-and-goto-next-match= | =n= | =C-n= | - | =evil-mc-skip-and-goto-prev-match= | =p= | =C-S-n= | - | =evil-mc-make-and-goto-next-cursor= | =M-n= | =M-n= | - | =evil-mc-make-and-goto-prev-cursor= | =M-p= | =M-N= | - | =evil-mc-skip-and-goto-next-cursor= | =N= | =C-u= | - | =evil-mc-skip-and-goto-prev-cursor= | =P= | =C-S-u= | - -** Notes - - A hook on =evil-mc-after-cursors-deleted= sets - =evil-was-yanked-without-register= so paste after cursor deletion does - not clobber the unnamed register (see upstream issue #70). diff --git a/.config/emacs/lisp/evil-collection/modes/evil-mc/evil-collection-evil-mc.el b/.config/emacs/lisp/evil-collection/modes/evil-mc/evil-collection-evil-mc.el deleted file mode 100644 index 7de6405..0000000 --- a/.config/emacs/lisp/evil-collection/modes/evil-mc/evil-collection-evil-mc.el +++ /dev/null @@ -1,79 +0,0 @@ -;;; evil-collection-evil-mc.el --- Bindings for evil-mc -*- lexical-binding: t -*- - -;; Copyright (C) 2018 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.2 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for evil-mc. - -;;; Code: -(require 'evil-collection) -(require 'evil-mc nil t) -(eval-when-compile (require 'subr-x)) ; `if-let*' and `when-let*' - -(defvar evil-mc-key-map) -(defvar evil-mc-cursors-map) -(defconst evil-collection-evil-mc-maps '(evil-mc-key-map evil-mc-cursors-map)) - -;;;###autoload -(defun evil-collection-evil-mc-setup () - "Set up `evil' bindings for evil-mc." - - (setcdr evil-mc-cursors-map nil) - - (define-key evil-mc-cursors-map (kbd "a") 'evil-mc-make-all-cursors) - (define-key evil-mc-cursors-map (kbd "q") 'evil-mc-undo-all-cursors) - (define-key evil-mc-cursors-map (kbd "u") 'evil-mc-undo-last-added-cursor) - - (define-key evil-mc-cursors-map (kbd "C-p") 'evil-mc-pause-cursors) - (define-key evil-mc-cursors-map (kbd "C-r") 'evil-mc-resume-cursors) - (define-key evil-mc-cursors-map (kbd "C-m") 'evil-mc-make-cursor-here) - - (define-key evil-mc-cursors-map (kbd "0") 'evil-mc-make-and-goto-first-cursor) - (define-key evil-mc-cursors-map (kbd "$") 'evil-mc-make-and-goto-last-cursor) - - (define-key evil-mc-cursors-map (kbd "I") 'evil-mc-make-cursor-in-visual-selection-beg) - (define-key evil-mc-cursors-map (kbd "A") 'evil-mc-make-cursor-in-visual-selection-end) - - (define-key evil-mc-cursors-map (kbd "o") 'evil-mc-make-cursor-move-next-line) - (define-key evil-mc-cursors-map (kbd "O") 'evil-mc-make-cursor-move-prev-line) - - (define-key evil-mc-cursors-map (kbd "n") 'evil-mc-make-and-goto-next-match) - (define-key evil-mc-cursors-map (kbd "N") 'evil-mc-make-and-goto-prev-match) - (define-key evil-mc-cursors-map (kbd "C-n") 'evil-mc-skip-and-goto-next-match) - (define-key evil-mc-cursors-map (kbd "C-S-n") 'evil-mc-skip-and-goto-prev-match) - (define-key evil-mc-cursors-map (kbd "M-n") 'evil-mc-make-and-goto-next-cursor) - (define-key evil-mc-cursors-map (kbd "M-N") 'evil-mc-make-and-goto-prev-cursor) - (define-key evil-mc-cursors-map (kbd "C-u") 'evil-mc-skip-and-goto-next-cursor) - (define-key evil-mc-cursors-map (kbd "C-S-u") 'evil-mc-skip-and-goto-prev-cursor) - - (setcdr evil-mc-key-map nil) - (evil-collection-define-key '(normal visual) 'evil-mc-key-map (kbd "g.") evil-mc-cursors-map) - - ;; https://github.com/gabesoft/evil-mc/issues/70 - (add-hook 'evil-mc-after-cursors-deleted - (lambda () - (setq evil-was-yanked-without-register t)))) - -(provide 'evil-collection-evil-mc) -;;; evil-collection-evil-mc.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/eww/README.org b/.config/emacs/lisp/evil-collection/modes/eww/README.org deleted file mode 100644 index 2b0aaa4..0000000 --- a/.config/emacs/lisp/evil-collection/modes/eww/README.org +++ /dev/null @@ -1,61 +0,0 @@ -* eww - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/eww/index.html][EWW]] (Emacs Web Wowser). - -** eww-mode-map - - | Command | Original | Evil | - |------------------------------------+------------+--------------------| - | =eww-up-url= | =u= | =^=, =u= | - | =eww-top-url= | =t= | =U= | - | =eww-back-url= | =l=, =DEL= | =H=, =DEL= | - | =eww-forward-url= | =r= | =L= | - | =eww-view-source= | =v= | =gf= | - | =eww-browse-with-external-browser= | =&= | =&=, =S-RET=, =go= | - | =url-cookie-list= | =C= | =gc= | - | =eww-toggle-paragraph-direction= | =D= | =zd= | - | =eww-set-character-encoding= | =E= | =ze= | - | =eww-toggle-fonts= | =F= | =zf= | - | =eww-download= | =d= | =d= | - | =eww-add-bookmark= | =b= | =m= | - | =eww-readable= | =R= | =R=, =r= | - | =eww-next-url= | =n= | =]]=, =gj= | - | =eww-previous-url= | =p= | =[[=, =gk= | - | =eww= | =G= | =o= | - | =scroll-up-command= | n/a | =SPC= | - | =scroll-down-command= | n/a | =S-SPC= | - | =shr-next-link= | =TAB= | =TAB= | - | =shr-previous-link= | =S-TAB= | =S-TAB= | - | =eww-list-bookmarks= | =B= | =gb= | - | =eww-list-histories= | =H= | =gh= | - | =eww-list-buffers= | =S= | =gt= | - | =eww-reload= | =g= | =gr= | - | =eww-copy-page-url= (=y= operator) | =w= | =yu= | - | =quit-window= | n/a | =q=, =ZQ=, =ZZ= | - -** eww-history-mode-map - - | Command | Original | Evil | - |----------------------+----------+-------| - | =eww-history-browse= | =RET= | =RET= | - | =revert-buffer= | n/a | =gr= | - -** eww-buffers-mode-map - - | Command | Original | Evil | - |----------------------------+----------+------------| - | =eww-buffer-kill= | =D= | =D= | - | =eww-buffer-select= | =RET= | =RET= | - | =eww-buffer-show-next= | n/a | =]]=, =gj= | - | =eww-buffer-show-previous= | n/a | =[[=, =gk= | - | =revert-buffer= | n/a | =gr= | - -** eww-bookmark-mode-map - - | Command | Original | Evil | - |------------------------------------+----------+-------| - | =eww-bookmark-kill= | =D= | =D= | - | =eww-bookmark-yank= | =P= | =P= | - | =eww-bookmark-browse= | =RET= | =RET= | - | =revert-buffer= | n/a | =gr= | - | =eww-copy-page-url= (=y= operator) | n/a | =yu= | diff --git a/.config/emacs/lisp/evil-collection/modes/eww/evil-collection-eww.el b/.config/emacs/lisp/evil-collection/modes/eww/evil-collection-eww.el deleted file mode 100644 index 96a848e..0000000 --- a/.config/emacs/lisp/evil-collection/modes/eww/evil-collection-eww.el +++ /dev/null @@ -1,128 +0,0 @@ -;;; evil-collection-eww.el --- Evil bindings for EWW -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, eww, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for EWW. - -;;; Code: -(require 'eww) -(require 'evil-collection) - -(defvar evil-collection-eww-maps '(eww-mode-map - eww-history-mode-map - eww-buffers-mode-map - eww-bookmark-mode-map)) - -;;;###autoload -(defun evil-collection-eww-setup () - "Set up `evil' bindings for `eww'." - - (evil-set-initial-state 'eww-mode 'normal) - (evil-collection-define-key 'normal 'eww-mode-map - "^" 'eww-up-url - "u" 'eww-up-url - "U" 'eww-top-url - (kbd "DEL") 'eww-back-url - "H" 'eww-back-url - "L" 'eww-forward-url - - "gf" 'eww-view-source ; Like qutebrowser. - - "&" 'eww-browse-with-external-browser - "gc" 'url-cookie-list - "zd" 'eww-toggle-paragraph-direction - "ze" 'eww-set-character-encoding - "zf" 'eww-toggle-fonts - "d" 'eww-download - "m" 'eww-add-bookmark - "R" 'eww-readable ; Default binding. - "r" 'eww-readable - - "]]" 'eww-next-url - "[[" 'eww-previous-url - "gj" 'eww-next-url - "gk" 'eww-previous-url - - ;; open - (kbd "S-") 'eww-browse-with-external-browser - "go" 'eww-browse-with-external-browser - "o" 'eww ; Like qutebrowser. - - (kbd "SPC") 'scroll-up-command - (kbd "S-SPC") 'scroll-down-command - (kbd "") 'shr-next-link - (kbd "") 'shr-previous-link - - ;; bookmarks - "gb" 'eww-list-bookmarks - - "gh" 'eww-list-histories - "gt" 'eww-list-buffers ; Like dwb, qutebrowser. - - ;; refresh - "gr" 'eww-reload - - ;; quit - "q" 'quit-window - "ZQ" 'quit-window - "ZZ" 'quit-window) - - (evil-collection-define-operator-key 'yank 'eww-mode-map - "u" 'eww-copy-page-url) - - (evil-collection-set-readonly-bindings 'eww-history-mode-map) - (evil-set-initial-state 'eww-history-mode 'normal) - (evil-collection-define-key 'normal 'eww-history-mode-map - (kbd "RET") 'eww-history-browse - ;; refresh - "gr" 'revert-buffer) - - (evil-collection-set-readonly-bindings 'eww-buffers-mode-map) - (evil-set-initial-state 'eww-buffers-mode 'normal) - (evil-collection-define-key 'normal 'eww-buffers-mode-map - "D" 'eww-buffer-kill - (kbd "RET") 'eww-buffer-select - "]]" 'eww-buffer-show-next - "[[" 'eww-buffer-show-previous - "gj" 'eww-buffer-show-next - "gk" 'eww-buffer-show-previous - ;; refresh - "gr" 'revert-buffer) - - (evil-collection-set-readonly-bindings 'eww-bookmark-mode-map) - (evil-set-initial-state 'eww-bookmark-mode 'normal) - (evil-collection-define-key 'normal 'eww-bookmark-mode-map - "D" 'eww-bookmark-kill - "P" 'eww-bookmark-yank - - (kbd "RET") 'eww-bookmark-browse - ;; refresh - "gr" 'revert-buffer) - - (evil-collection-define-operator-key 'yank 'eww-bookmark-mode-map - "u" 'eww-copy-page-url)) - -(provide 'evil-collection-eww) -;;; evil-collection-eww.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/explain-pause-mode/evil-collection-explain-pause-mode.el b/.config/emacs/lisp/evil-collection/modes/explain-pause-mode/evil-collection-explain-pause-mode.el deleted file mode 100644 index fa5b43f..0000000 --- a/.config/emacs/lisp/evil-collection/modes/explain-pause-mode/evil-collection-explain-pause-mode.el +++ /dev/null @@ -1,50 +0,0 @@ -;;; evil-collection-explain-pause-mode.el --- Evil bindings for explain-pause-mode -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for explain-pause-mode. - -;;; Code: -(require 'evil-collection) -(require 'explain-pause-mode nil t) - -(defconst evil-collection-explain-pause-mode-maps '(explain-pause-top-mode-map)) - -;;;###autoload -(defun evil-collection-explain-pause-mode-setup () - "Set up `evil' bindings for `explain-pause-mode'." - (evil-set-initial-state 'explain-pause-top-mode 'normal) - (evil-collection-define-key 'normal 'explain-pause-top-mode-map - "a" 'explain-pause-top-auto-refresh - "c" 'explain-pause-top-clear - "o" 'explain-pause-top-sort - - "q" 'quit-window - "ZZ" 'quit-window - "ZQ" 'quit-window)) - -(provide 'evil-collection-explain-pause-mode) - -;;; evil-collection-explain-pause-mode.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/fanyi/evil-collection-fanyi.el b/.config/emacs/lisp/evil-collection/modes/fanyi/evil-collection-fanyi.el deleted file mode 100644 index 69e589c..0000000 --- a/.config/emacs/lisp/evil-collection/modes/fanyi/evil-collection-fanyi.el +++ /dev/null @@ -1,47 +0,0 @@ -;;; evil-collection-fanyi.el --- Evil bindings for fanyi -*- lexical-binding: t -*- - -;; Copyright (C) 2021 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for fanyi. - -;;; Code: -(require 'evil-collection) -(require 'fanyi nil t) - -(defconst evil-collection-fanyi-maps '(fanyi-mode-map)) - -;;;###autoload -(defun evil-collection-fanyi-setup () - "Set up `evil' bindings for `fanyi'." - (evil-collection-set-readonly-bindings 'fanyi-mode-map) - (evil-collection-define-key 'normal 'fanyi-mode-map - ;; tab - [tab] 'forward-button - [backtab] 'backward-button - - "s" 'fanyi-dwim)) - -(provide 'evil-collection-fanyi) -;;; evil-collection-fanyi.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/finder/README.org b/.config/emacs/lisp/evil-collection/modes/finder/README.org deleted file mode 100644 index 56562b9..0000000 --- a/.config/emacs/lisp/evil-collection/modes/finder/README.org +++ /dev/null @@ -1,13 +0,0 @@ -* finder - - Evil bindings for =finder-mode= (the package-keyword browser opened by - =M-x finder-by-keyword=). - -** Key bindings - - | Command | Original | Evil | - |------------------------+------------+--------------| - | =finder-select= | =RET=, =f= | =RET=, =SPC= | - | =finder-list-keywords= | =d= | =d= | - | =finder-summary= | =?= | =s= | - | =finder-exit= | =q= | =q= | diff --git a/.config/emacs/lisp/evil-collection/modes/finder/evil-collection-finder.el b/.config/emacs/lisp/evil-collection/modes/finder/evil-collection-finder.el deleted file mode 100644 index 3ec4f25..0000000 --- a/.config/emacs/lisp/evil-collection/modes/finder/evil-collection-finder.el +++ /dev/null @@ -1,49 +0,0 @@ -;;; evil-collection-finder.el --- Evil bindings for finder -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, finder, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for finder. - -;;; Code: -(require 'evil-collection) -(require 'finder) - -(defconst evil-collection-finder-maps '(finder-mode-map)) - -;;;###autoload -(defun evil-collection-finder-setup () - "Set up `evil' bindings for `finder'." - (evil-set-initial-state 'finder-mode 'normal) - - (evil-collection-define-key 'normal 'finder-mode-map - (kbd "RET") 'finder-select - (kbd "SPC") 'finder-select - - "d" 'finder-list-keywords - "s" 'finder-summary - "q" 'finder-exit)) - -(provide 'evil-collection-finder) -;;; evil-collection-finder.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/flycheck/README.org b/.config/emacs/lisp/evil-collection/modes/flycheck/README.org deleted file mode 100644 index 04031fe..0000000 --- a/.config/emacs/lisp/evil-collection/modes/flycheck/README.org +++ /dev/null @@ -1,18 +0,0 @@ -* flycheck - - Evil bindings for the [[https://www.flycheck.org/][flycheck]] error list. - - Initial state for =flycheck-error-list-mode= is =normal=. - -** flycheck-error-list-mode-map (normal state) - - | Command | Original | Evil | - |--------------------------------------+----------+-------------------| - | =flycheck-error-list-next-error= | =n= | =gj=, =C-j=, =]]= | - | =flycheck-error-list-previous-error= | =p= | =gk=, =C-k=, =[[= | - | =flycheck-error-list-check-source= | =g= | =gr= | - | =flycheck-error-list-set-filter= | =f= | =s= | - | =flycheck-error-list-reset-filter= | =F= | =S= | - | =flycheck-error-list-explain-error= | =e= | =x= | - | =flycheck-error-list-goto-error= | =RET= | =RET= | - | =quit-window= | =q= | =q= | diff --git a/.config/emacs/lisp/evil-collection/modes/flycheck/evil-collection-flycheck.el b/.config/emacs/lisp/evil-collection/modes/flycheck/evil-collection-flycheck.el deleted file mode 100644 index 889ba32..0000000 --- a/.config/emacs/lisp/evil-collection/modes/flycheck/evil-collection-flycheck.el +++ /dev/null @@ -1,56 +0,0 @@ -;;; evil-collection-flycheck.el --- Evil bindings for flycheck -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, flycheck, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `flycheck-mode'. - -;;; Code: -(require 'evil-collection) -(require 'flycheck nil t) - -(defvar flycheck-error-list-mode-map) - -(defconst evil-collection-flycheck-maps '(flycheck-error-list-mode-map)) - -;;;###autoload -(defun evil-collection-flycheck-setup () - "Set up `evil' bindings for `flycheck'." - (evil-set-initial-state 'flycheck-error-list-mode 'normal) - (evil-collection-define-key 'normal 'flycheck-error-list-mode-map - "gj" 'flycheck-error-list-next-error - "gk" 'flycheck-error-list-previous-error - (kbd "C-j") 'flycheck-error-list-next-error - (kbd "C-k") 'flycheck-error-list-previous-error - "]]" 'flycheck-error-list-next-error - "[[" 'flycheck-error-list-previous-error - "gr" 'flycheck-error-list-check-source - "s" 'flycheck-error-list-set-filter - "S" 'flycheck-error-list-reset-filter - "x" 'flycheck-error-list-explain-error - (kbd "RET") 'flycheck-error-list-goto-error - "q" 'quit-window)) - -(provide 'evil-collection-flycheck) -;;; evil-collection-flycheck.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/flymake/README.org b/.config/emacs/lisp/evil-collection/modes/flymake/README.org deleted file mode 100644 index d46e8c2..0000000 --- a/.config/emacs/lisp/evil-collection/modes/flymake/README.org +++ /dev/null @@ -1,15 +0,0 @@ -* flymake - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/flymake/index.html][Flymake]]. - -** Key bindings - - Applied to both =flymake-diagnostics-buffer-mode-map= and - =flymake-project-diagnostics-mode-map=. - - | Command | Original | Evil | - |---------------------------+----------+------------------------------| - | =flymake-goto-next-error= | n/a | =C-j= | - | =flymake-goto-prev-error= | n/a | =C-k= | - | =flymake-goto-diagnostic= | =RET= | =RET= | - | =flymake-show-diagnostic= | =SPC= | =S-RET=, =M-RET=, =go=, =gO= | diff --git a/.config/emacs/lisp/evil-collection/modes/flymake/evil-collection-flymake.el b/.config/emacs/lisp/evil-collection/modes/flymake/evil-collection-flymake.el deleted file mode 100644 index 86ce75e..0000000 --- a/.config/emacs/lisp/evil-collection/modes/flymake/evil-collection-flymake.el +++ /dev/null @@ -1,52 +0,0 @@ -;;; evil-collection-flymake.el --- Evil Bindings for Flymake -*- lexical-binding: t -*- - -;; Copyright (C) 2018, 2022 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, flymake, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `flymake-mode'. - -;;; Code: -(require 'flymake) -(require 'evil-collection) - -(defconst evil-collection-flymake-maps '(flymake-mode-map - flymake-project-diagnostics-mode-map - flymake-diagnostics-buffer-mode-map)) - -;;;###autoload -(defun evil-collection-flymake-setup () - "Set up `evil' bindings for `flymake'." - (dolist (map '(flymake-diagnostics-buffer-mode-map flymake-project-diagnostics-mode-map)) - (evil-collection-set-readonly-bindings map) - (evil-collection-define-key 'normal map - (kbd "C-j") 'flymake-goto-next-error - (kbd "C-k") 'flymake-goto-prev-error - (kbd "RET") 'flymake-goto-diagnostic - (kbd "S-RET") 'flymake-show-diagnostic - (kbd "M-RET") 'flymake-show-diagnostic - (kbd "go") 'flymake-show-diagnostic - (kbd "gO") 'flymake-show-diagnostic))) - -(provide 'evil-collection-flymake) -;;; evil-collection-flymake.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/forge/README.org b/.config/emacs/lisp/evil-collection/modes/forge/README.org deleted file mode 100644 index b7cf5d5..0000000 --- a/.config/emacs/lisp/evil-collection/modes/forge/README.org +++ /dev/null @@ -1,44 +0,0 @@ -* forge - - Evil bindings for [[https://github.com/magit/forge][forge]]. - - Setup disables =forge-add-default-bindings= (which would clobber evil keys - on magit maps), then rebinds forge dispatch and remaps =magit-browse-thing= - on the relevant magit section maps. The state used is controlled by - =evil-collection-forge-state=. - -** Key bindings - -*** magit-mode-map - - | Command | Original | Evil | - |------------------+----------+------| - | =forge-dispatch= | (none) | =@= | - -*** magit-commit-section-map / magit-remote-section-map / magit-branch-section-map - - | Command | Original | Evil | - |---------------------------------------------------------+----------+---------------------------------| - | =forge-browse-dwim= / =forge-browse-remote= / =-branch= | n/a | (remap of =magit-browse-thing=) | - | =forge-visit-topic= | n/a | =C-c C-v= (commit / branch) | - -** Transient extensions - - The following are appended to magit transients: - - | Transient | Suffix | - |---------------------+-------------------------------------------| - | =magit-dispatch= | =@= Forge | - | =magit-fetch= | =n= forge topics, =N= forge notifications | - | =magit-pull= | =n= forge topics, =N= forge notifications | - | =magit-branch= | =f= pull-request, =F= from pull-request | - | =magit-worktree= | =n= pull-request worktree | - | =magit-status-jump= | =Np= pull-requests, =Ni= issues | - | =magit-merge= | =M= Merge using API | - -** Customization - - | Variable | Default | Purpose | - |----------------------------------------+----------------------+---------------------------------------------------| - | =evil-collection-forge-use-y-for-yank= | =t= | Keep =y= as yank; also adds visual state. | - | =evil-collection-forge-state= | =normal= or =motion= | Evil state used for forge bindings on magit maps. | diff --git a/.config/emacs/lisp/evil-collection/modes/forge/evil-collection-forge.el b/.config/emacs/lisp/evil-collection/modes/forge/evil-collection-forge.el deleted file mode 100644 index 1392c96..0000000 --- a/.config/emacs/lisp/evil-collection/modes/forge/evil-collection-forge.el +++ /dev/null @@ -1,113 +0,0 @@ -;;; evil-collection-forge.el --- Evil-based key bindings for forge -*- lexical-binding: t; -*- - -;; Copyright (C) 2021 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Package-Requires: ((emacs "26.3") (evil "1.2.3")) -;; Homepage: https://github.com/emacs-evil/evil-collection -;; Version: 0.4.1 - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: - -;; This library configures Magit and Evil to play well with each -;; other. For some background see: -;; https://github.com/emacs-evil/evil-collection/issues/543. - -;;; Code: - -(require 'evil-collection) -(require 'forge nil t) -(require 'transient nil t) - -(defcustom evil-collection-forge-use-y-for-yank t - "View `evil-collection-magit-state' for more information." - :group 'magit - :type 'boolean) - -(defcustom evil-collection-forge-state - (if evil-collection-forge-use-y-for-yank 'normal 'motion) - "State to use for forge." - :group 'magit - :type 'symbol) - -(defvar forge-add-default-bindings) - -;;;###autoload -(defun evil-collection-forge-setup () - "Set up `evil' bindings for `magit'." - ;; The latest release tag of forge doesn't include - ;; `forge-add-default-bindings' yet, it will throw an error: - ;; - ;; void-variable `forge-add-default-bindings' - ;; - ;; for GNU Guix and MELPA stable users. - (when (bound-and-true-p forge-add-default-bindings) - (message "Setting `forge-add-default-bindings' to nil in `evil-collection-forge-setup'. -To suppress this message you can set this variable to nil in your init.el file.") - (setq forge-add-default-bindings nil)) - (let ((states (if evil-collection-forge-use-y-for-yank - `(,evil-collection-forge-state visual) - `(,evil-collection-forge-state)))) - (dolist (state states) - (evil-collection-define-key state 'magit-mode-map "@" 'forge-dispatch) - - (evil-collection-define-key - state 'magit-commit-section-map - [remap magit-browse-thing] 'forge-browse-dwim) - (evil-collection-define-key - state 'magit-remote-section-map - [remap magit-browse-thing] 'forge-browse-remote) - (evil-collection-define-key - state 'magit-branch-section-map - [remap magit-browse-thing] 'forge-browse-branch) - - (evil-collection-define-key - state 'magit-commit-section-map (kbd "C-c C-v") 'forge-visit-topic) - (evil-collection-define-key - state 'magit-branch-section-map (kbd "C-c C-v") 'forge-visit-topic))) - - ;; https://github.com/magit/forge/blob/master/lisp/forge.el - - (transient-append-suffix 'magit-dispatch "!" - '("@" "Forge" forge-dispatch)) ;; N -> @ - - (transient-append-suffix 'magit-fetch "m" - '("n" "forge topics" forge-pull)) - (transient-append-suffix 'magit-fetch "n" - '("N" "forge notifications" forge-pull-notifications)) - (transient-append-suffix 'magit-pull "m" - '("n" "forge topics" forge-pull)) - (transient-append-suffix 'magit-pull "n" - '("N" "forge notifications" forge-pull-notifications)) - (transient-append-suffix 'magit-branch "w" - '("f" "pull-request" forge-checkout-pullreq)) - (transient-append-suffix 'magit-branch "W" - '("F" "from pull-request" forge-branch-pullreq)) - (transient-append-suffix 'magit-worktree "c" - '("n" "pull-request worktree" forge-checkout-worktree)) - (transient-append-suffix 'magit-status-jump "w" - '("Np" "pull-requests" forge-jump-to-pullreqs)) - (transient-append-suffix 'magit-status-jump "Np" - '("Ni" "issues" forge-jump-to-issues)) - (transient-append-suffix 'magit-merge "a" - '(7 "M" "Merge using API" forge-merge))) - -;;; evil-collection-forge.el ends soon -(provide 'evil-collection-forge) -;; Local Variables: -;; End: -;;; evil-collection-forge.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/free-keys/evil-collection-free-keys.el b/.config/emacs/lisp/evil-collection/modes/free-keys/evil-collection-free-keys.el deleted file mode 100644 index b6a5f49..0000000 --- a/.config/emacs/lisp/evil-collection/modes/free-keys/evil-collection-free-keys.el +++ /dev/null @@ -1,53 +0,0 @@ -;;; evil-collection-free-keys.el --- Bindings for `free-keys' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `free-keys'. -(require 'evil-collection) -(require 'free-keys nil t) - -;;; Code: -(defvar free-keys-mode-map) - -(defconst evil-collection-free-keys-maps '(free-keys-mode-map)) - -(defun evil-collection-free-keys-set-header-line-format () - "Tweak `header-line-format' locally for `free-keys'." - (setq-local header-line-format - "Help: (c) change buffer (p) change prefix (q) quit")) - -;;;###autoload -(defun evil-collection-free-keys-setup () - "Set up `evil' bindings for `free-keys'." - (add-hook 'free-keys-mode-hook - #'evil-collection-free-keys-set-header-line-format) - (evil-set-initial-state 'free-keys-mode 'normal) - (evil-collection-define-key 'normal 'free-keys-mode-map - "c" 'free-keys-change-buffer - "p" 'free-keys-set-prefix - "q" 'quit-window)) - -(provide 'evil-collection-free-keys) -;;; evil-collection-free-keys.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/fzfa/README.org b/.config/emacs/lisp/evil-collection/modes/fzfa/README.org deleted file mode 100644 index a093e2f..0000000 --- a/.config/emacs/lisp/evil-collection/modes/fzfa/README.org +++ /dev/null @@ -1,19 +0,0 @@ -* fzfa - - Evil bindings for [[https://github.com/jojojames/fzfa][fzfa]]. - - No keymap is rebound. Setup marks fzfa's jump-style commands as - non-repeatable and registers them as evil jumps so =C-o= / =C-i= work after - selection. - -** Jump commands - - The commands in =evil-collection-fzfa-jump-commands= are declared with - =:jump t= and =evil-declare-not-repeat=. This includes buffer-local jumps - (e.g. =fzfa-swiper=, =fzfa-imenu=, =fzfa-mark=, =fzfa-outline=, - =fzfa-evil-marks=) and cross-buffer / file jumps (e.g. =fzfa-buffer=, - =fzfa-recent-file=, =fzfa-find=, =fzfa-grep=, =fzfa-project-find-file=, - =fzfa-evil-jumps=, =fzfa-org-heading=, =fzfa-info=, etc.). - - Non-jumping commands like =fzfa-yank-pop=, =fzfa-register=, =fzfa-M-x= and - the various history pickers are intentionally excluded. diff --git a/.config/emacs/lisp/evil-collection/modes/fzfa/evil-collection-fzfa.el b/.config/emacs/lisp/evil-collection/modes/fzfa/evil-collection-fzfa.el deleted file mode 100644 index ad54dbf..0000000 --- a/.config/emacs/lisp/evil-collection/modes/fzfa/evil-collection-fzfa.el +++ /dev/null @@ -1,111 +0,0 @@ -;;; evil-collection-fzfa.el --- Evil bindings for fzfa -*- lexical-binding: t -*- - -;; Copyright (C) 2026 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "29.1")) -;; Keywords: evil, fzfa, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `fzfa'. -;; -;; The fzfa commands are autoloaded so no (require 'fzfa nil t) is needed. - -;;; Code: -(require 'evil-collection) - -(defvar evil-collection-fzfa-jump-commands - '(;; Buffer-local jumps. - fzfa-swiper - fzfa-imenu - fzfa-imenu-all-but-current - fzfa-mark - fzfa-outline - fzfa-evil-marks - ;; Cross-buffer / file jumps. - fzfa-swiper-all - fzfa-imenu-all - fzfa-global-mark - fzfa-recent-file - fzfa-buffer - fzfa-bookmark - fzfa-tramp - fzfa-evil-jumps - fzfa-find - fzfa-fd - fzfa-locate - fzfa-grep - fzfa-grep-current-file - fzfa-ugrep - fzfa-rg - fzfa-rg-files - fzfa-ag - fzfa-ag-files - fzfa-git-grep - fzfa-git-ls-files - fzfa-git-modified-locally - fzfa-git-added-files - fzfa-git-staged-for-commit - fzfa-git-modified-in-head - fzfa-git-log-grep - fzfa-hg-files - fzfa-hg-modified-locally - fzfa-hg-added-files - fzfa-hg-modified-in-head - fzfa-project-find-file - fzfa-project-find-dir - fzfa-project-buffer - fzfa-project-recentf - fzfa-project-switch-project - fzfa-compile-error - fzfa-flymake - fzfa-flymake-project - fzfa-org-heading - fzfa-org-heading-all - fzfa-org-agenda - fzfa-org-todo - fzfa-org-tags-view - fzfa-info - fzfa-info-emacs - fzfa-info-elisp - fzfa-info-org - fzfa-info-cl - fzfa-info-eieio - fzfa-info-magit - fzfa-info-at-point - fzfa-hungry-swiper - fzfa-hungry-find - fzfa-find-any - fzfa-find-some - fzfa-evil-any) - "List of `fzfa' commands that should be treated as evil jumps.") - -(defun evil-collection-fzfa-set-bindings () - "Set the bindings." - (dolist (cmd evil-collection-fzfa-jump-commands) - (evil-declare-not-repeat cmd) - (evil-set-command-property cmd :jump t))) - -;;;###autoload -(defun evil-collection-fzfa-setup () - "Set up `evil' bindings for `fzfa'." - (evil-collection-fzfa-set-bindings)) - -(provide 'evil-collection-fzfa) -;;; evil-collection-fzfa.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/geiser/README.org b/.config/emacs/lisp/evil-collection/modes/geiser/README.org deleted file mode 100644 index d20565b..0000000 --- a/.config/emacs/lisp/evil-collection/modes/geiser/README.org +++ /dev/null @@ -1,62 +0,0 @@ -* geiser - - Evil bindings for [[https://www.nongnu.org/geiser/][Geiser]] (Scheme). - - Sets initial state to =normal= for =geiser-debug-mode= and - =geiser-doc-mode=. When =evil-move-beyond-eol= is nil, advises - =geiser-eval-last-sexp= and =geiser-eval-last-sexp-and-print= so the - last sexp is taken with point treated as one past EOL in normal/motion - state. - -** Key bindings - -*** geiser-mode-map - - | Command | Original | Evil | - |----------------------------------------+---------------+-------| - | =geiser-edit-symbol-at-point= | =M-.= | =gd= | - | =geiser-pop-symbol-stack= | =M-,= | =C-t= | - | =geiser-mode-switch-to-repl= | =C-c C-z= | =gz= | - | =geiser-mode-switch-to-repl-and-enter= | =C-c C-a= | =gZ= | - | =geiser-doc-symbol-at-point= | =C-c C-d C-d= | =K= | - -*** geiser-repl-mode-map - - | Command | Original | Evil | - |-----------------------------------+---------------+-------------------------------------| - | =geiser-edit-symbol-at-point= | =M-.= | =gd= | - | =geiser-pop-symbol-stack= | =M-,= | =C-t= | - | =geiser-repl-next-prompt= | =C-c C-n= | =gj=, =C-j=, =]]= | - | =geiser-repl-previous-prompt= | =C-c C-p= | =gk=, =C-k=, =[[= | - | =geiser-doc-symbol-at-point= | =C-c C-d C-d= | =K= | - | =geiser-repl-maybe-send= | =RET= | =RET= (submit state) | - | =geiser-repl--newline-and-indent= | =C-j= | =S-=, =RET= (newline state) | - - Whether =RET= submits depends on =evil-collection-repl-submit-state=: - in =insert= (default) =RET= submits, =S-= inserts a newline; - in =normal=, =RET= inserts a newline in insert state and submits in - normal state. - -*** geiser-doc-mode-map - - | Command | Original | Evil | - |-------------------------------+--------------+----------------------| - | =forward-button= | =TAB=, =n= | =TAB=, =gj=, =C-j= | - | =backward-button= | =S-TAB=, =p= | =S-TAB=, =gk=, =C-k= | - | =geiser-edit-symbol-at-point= | =.= | =gd= | - | =geiser-pop-symbol-stack= | =M-,= | =C-t= | - | =geiser-doc-refresh= | =g=, =r= | =gr= | - | =View-quit= | =q= (View) | =q= | - | =geiser-doc-switch-to-repl= | =z= | =gz= | - | =geiser-doc-next= | =f= | =>= | - | =geiser-doc-previous= | =b= | =<= | - | =geiser-doc-next-section= | =N= | =]]= | - | =geiser-doc-previous-section= | =P= | =[[= | - | =geiser-doc-kill-page= | =k= | =x= | - | =geiser-doc-clean-history= | =c= | =X= | - -*** geiser-debug-mode-map - - | Command | Original | Evil | - |---------------+----------+------| - | =quit-window= | | =q= | diff --git a/.config/emacs/lisp/evil-collection/modes/geiser/evil-collection-geiser.el b/.config/emacs/lisp/evil-collection/modes/geiser/evil-collection-geiser.el deleted file mode 100644 index 24fb46e..0000000 --- a/.config/emacs/lisp/evil-collection/modes/geiser/evil-collection-geiser.el +++ /dev/null @@ -1,115 +0,0 @@ -;;; evil-collection-geiser.el --- Bindings for `geiser' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, geiser, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `geiser'. - -;;; Code: -(require 'evil-collection) -(require 'geiser nil t) - -(defvar geiser-debug-mode-map) -(defvar geiser-doc-mode-map) - -(defconst evil-collection-geiser-maps '(geiser-debug-mode-map - geiser-doc-mode-map - geiser-repl-mode-map - geiser-mode-map)) - -(defun evil-collection-geiser-last-sexp (command &rest args) - "In normal-state or motion-state, last sexp ends at point." - (if (and (not evil-move-beyond-eol) - (or (evil-normal-state-p) (evil-motion-state-p))) - (save-excursion - (unless (or (eobp) (eolp)) (forward-char)) - (apply command args)) - (apply command args))) - -;;;###autoload -(defun evil-collection-geiser-setup () - "Set up bindings for `geiser'." - (unless evil-move-beyond-eol - (advice-add 'geiser-eval-last-sexp :around 'evil-collection-geiser-last-sexp) - (advice-add 'geiser-eval-last-sexp-and-print :around 'evil-collection-geiser-last-sexp)) - - (evil-set-initial-state 'geiser-debug-mode 'normal) - (evil-set-initial-state 'geiser-doc-mode 'normal) - - (evil-collection-define-key 'normal 'geiser-debug-mode-map - "q" 'quit-window) - - (evil-collection-define-key 'normal 'geiser-doc-mode-map - (kbd "") 'forward-button - (kbd "") 'backward-button - "gd" 'geiser-edit-symbol-at-point - (kbd "C-t") 'geiser-pop-symbol-stack - "gr" 'geiser-doc-refresh - "q" 'View-quit - "gz" 'geiser-doc-switch-to-repl - ">" 'geiser-doc-next - "<" 'geiser-doc-previous - "gj" 'forward-button - "gk" 'backward-button - (kbd "C-j") 'forward-button - (kbd "C-k") 'backward-button - "]]" 'geiser-doc-next-section - "[[" 'geiser-doc-previous-section - "x" 'geiser-doc-kill-page - "X" 'geiser-doc-clean-history) - - (evil-collection-define-key 'insert 'geiser-repl-mode-map - (kbd "S-") 'geiser-repl--newline-and-indent) - - (let* ((submit evil-collection-repl-submit-state) - (newline-state (if (eq submit 'normal) 'insert 'normal))) - (evil-collection-define-key submit 'geiser-repl-mode-map - (kbd "RET") 'geiser-repl-maybe-send - (kbd "\C-m") 'geiser-repl-maybe-send - [return] 'geiser-repl-maybe-send) - (evil-collection-define-key newline-state 'geiser-repl-mode-map - (kbd "RET") 'geiser-repl--newline-and-indent - (kbd "\C-m") 'geiser-repl--newline-and-indent - [return] 'geiser-repl--newline-and-indent)) - - (evil-collection-define-key 'normal 'geiser-repl-mode-map - "gd" 'geiser-edit-symbol-at-point - (kbd "C-t") 'geiser-pop-symbol-stack - "gj" 'geiser-repl-next-prompt - "gk" 'geiser-repl-previous-prompt - (kbd "C-j") 'geiser-repl-next-prompt - (kbd "C-k") 'geiser-repl-previous-prompt - "]]" 'geiser-repl-next-prompt - "[[" 'geiser-repl-previous-prompt - "K" 'geiser-doc-symbol-at-point) - - (evil-collection-define-key 'normal 'geiser-mode-map - "gd" 'geiser-edit-symbol-at-point - (kbd "C-t") 'geiser-pop-symbol-stack - "gZ" 'geiser-mode-switch-to-repl-and-enter - "gz" 'geiser-mode-switch-to-repl - "K" 'geiser-doc-symbol-at-point)) - -(provide 'evil-collection-geiser) -;;; evil-collection-geiser.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/ggtags/evil-collection-ggtags.el b/.config/emacs/lisp/evil-collection/modes/ggtags/evil-collection-ggtags.el deleted file mode 100644 index 1414255..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ggtags/evil-collection-ggtags.el +++ /dev/null @@ -1,104 +0,0 @@ -;;; evil-collection-ggtags.el --- Evil bindings for ggtags -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, ggtags, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `ggtags-mode'. - -;;; Code: -(require 'evil-collection) -(require 'ggtags nil t) - -(defvar ggtags-global-mode-map) -(defvar ggtags-mode-map) -(defvar ggtags-view-search-history-mode-map) -(defvar ggtags-view-tag-history-mode-map) -(defvar ggtags-navigation-map) - -(defconst evil-collection-ggtags-maps '(ggtags-mode-map - ggtags-view-search-history-mode-map - ggtags-view-tag-history-mode-map - ggtags-navigation-map)) - -;;;###autoload -(defun evil-collection-ggtags-setup () - "Set up `evil' bindings for `ggtags'." - (evil-set-initial-state 'ggtags-global-mode 'normal) - (evil-set-initial-state 'ggtags-view-search-history-mode 'normal) - (evil-set-initial-state 'ggtags-view-tag-history-mode 'normal) - - ;; `ggtags-navigation-mode' is global and will conflict with other bindings. - ;; https://github.com/leoliu/ggtags/issues/124 - (when (boundp 'ggtags-enable-navigation-keys) - (setq ggtags-enable-navigation-keys nil)) - - (evil-collection-define-key 'normal 'ggtags-mode-map - "gd" 'ggtags-find-tag-dwim - (kbd "C-t") 'ggtags-prev-mark - "gf" 'ggtags-find-file) - - (when evil-collection-want-find-usages-bindings - (evil-collection-define-key 'normal 'ggtags-mode-map - "gr" 'ggtags-find-reference)) - - (evil-collection-define-key 'normal 'ggtags-view-search-history-mode-map - "gj" 'ggtags-view-search-history-next - "gk" 'ggtags-view-search-history-prev - (kbd "C-j") 'ggtags-view-search-history-next - (kbd "C-k") 'ggtags-view-search-history-prev - "]]" 'ggtags-view-search-history-next - "[[" 'ggtags-view-search-history-prev - "x" 'ggtags-view-search-history-kill - "gr" 'ggtags-view-search-history-update - "r" 'ggtags-save-to-register - "R" 'ggtags-view-search-history-action - "q" 'ggtags-kill-window) - - (evil-collection-define-key 'normal 'ggtags-view-tag-history-mode-map - "gj" 'next-error-no-select - (kbd "C-j") 'next-error-no-select - "]]" 'next-error-no-select - "gk" 'previous-error-no-select - (kbd "C-k") 'previous-error-no-select - (kbd "[[") 'previous-error-no-select - "q" 'ggtags-kill-window) - - (evil-collection-define-key 'normal 'ggtags-navigation-map - ;; navigation - "gj" 'next-error - "gk" 'previous-error - (kbd "C-j") 'next-error - (kbd "C-k") 'previous-error - "]]" 'ggtags-navigation-next-file - "[[" 'ggtags-navigation-previous-file - - ;; search - "s" 'ggtags-navigation-isearch-forward - "S" 'ggtags-navigation-isearch-forward - - "go" 'ggtags-navigation-visible-mode ;; FIXME: This can be anything. - (kbd "RET") 'ggtags-navigation-mode-done)) - -(provide 'evil-collection-ggtags) -;;; evil-collection-ggtags.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/git-timemachine/README.org b/.config/emacs/lisp/evil-collection/modes/git-timemachine/README.org deleted file mode 100644 index bfa19ae..0000000 --- a/.config/emacs/lisp/evil-collection/modes/git-timemachine/README.org +++ /dev/null @@ -1,20 +0,0 @@ -* git-timemachine - - Evil bindings for [[https://codeberg.org/pidu/git-timemachine][git-timemachine]]. - - Bindings are installed on =git-timemachine-mode= as minor-mode keys so - they apply in =normal= state in any buffer where the minor mode is - active. - -** Key bindings - - | Command | Original | Evil | - |---------------------------------------------+----------+-------| - | =git-timemachine-show-previous-revision= | =p= | =C-k= | - | =git-timemachine-show-next-revision= | =n= | =C-j= | - | =git-timemachine-quit= | =q= | =q= | - | =git-timemachine-show-nth-revision= | =g= | =gtg= | - | =git-timemachine-show-revision-fuzzy= | =t= | =gtt= | - | =git-timemachine-kill-abbreviated-revision= | =w= | =gty= | - | =git-timemachine-kill-revision= | =W= | =gtY= | - | =git-timemachine-blame= | =b= | =gtb= | diff --git a/.config/emacs/lisp/evil-collection/modes/git-timemachine/evil-collection-git-timemachine.el b/.config/emacs/lisp/evil-collection/modes/git-timemachine/evil-collection-git-timemachine.el deleted file mode 100644 index 3debd22..0000000 --- a/.config/emacs/lisp/evil-collection/modes/git-timemachine/evil-collection-git-timemachine.el +++ /dev/null @@ -1,49 +0,0 @@ -;;; evil-collection-git-timemachine.el --- Bindings for `git-timemachine' -*- lexical-binding: t -*- - -;; Author: William Carroll -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, git, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil keybindings for `git-timemachine' that conform to the principles -;; outlines in evil-collection - -;;; Code: -(require 'evil-collection) -(require 'git-timemachine nil t) - -(defvar git-timemachine-mode-map) -(defconst evil-collection-git-timemachine-map '(git-timemachine-mode-map)) - -;;;###autoload -(defun evil-collection-git-timemachine-setup () - "Setup `evil' keybindings for `git-timemachine'." - (evil-define-minor-mode-key 'normal 'git-timemachine-mode - "\C-k" 'git-timemachine-show-previous-revision - "\C-j" 'git-timemachine-show-next-revision - "q" 'git-timemachine-quit - "gtg" 'git-timemachine-show-nth-revision - "gtt" 'git-timemachine-show-revision-fuzzy - "gty" 'git-timemachine-kill-abbreviated-revision - "gtY" 'git-timemachine-kill-revision - "gtb" 'git-timemachine-blame)) - -(provide 'evil-collection-git-timemachine) -;;; evil-collection-git-timemachine.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/gited/evil-collection-gited.el b/.config/emacs/lisp/evil-collection/modes/gited/evil-collection-gited.el deleted file mode 100644 index c68c48c..0000000 --- a/.config/emacs/lisp/evil-collection/modes/gited/evil-collection-gited.el +++ /dev/null @@ -1,157 +0,0 @@ -;;; evil-collection-gited.el --- Evil bindings for Gited -*- lexical-binding: t -*- - -;; Copyright (C) 2022 Earl Hyatt - -;; Author: Earl Hyatt -;; Maintainer: Earl Hyatt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3") (evil "1.2") (gited "0.6")) -;; Keywords: evil, git, tools, vc - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for Gited. - -;;; Code: -(require 'gited nil t) -(require 'evil-collection) -(declare-function gited-summary "gited") -(declare-function gited-hide-details-mode "gited") - -(defconst evil-collection-gited-maps '(gited-mode-map)) - -;;;###autoload -(defun evil-collection-gited-setup () - "Set up `evil' bindings for `gited'." - (evil-collection-set-readonly-bindings 'gited-mode-map) - (evil-collection-define-key 'normal 'gited-mode-map - "g?" 'gited-summary - "(" 'gited-hide-details-mode - "gr" 'gited-update - (kbd "C-c C-c") 'gited-commit - (kbd "C-c C-b") 'gited-list-branches - - ;; Movement - "j" 'gited-next-line - "k" 'gited-prev-line - (kbd "M-{") 'gited-prev-marked-branch - (kbd "M-}") 'gited-next-marked-branch - "G" 'gited-goto-last-branch - "gg" 'gited-goto-first-branch - "gj" 'gited-next-marked-branch - "gk" 'gited-prev-marked-branch - "gl" 'tabulated-list-next-column - "gh" 'tabulated-list-previous-column - "]]" 'gited-next-marked-branch - "[[" 'gited-prev-marked-branch - "<" 'gited-prev-marked-branch - ">" 'gited-next-marked-branch - " " 'gited-next-line - [?\S-\ ] 'gited-prev-line - [remap next-line] 'gited-next-line - [remap previous-line] 'gited-prev-line - "J" 'gited-goto-branch - - "gA" 'gited-move-to-end-of-author - "ga" 'gited-move-to-author - "gB" 'gited-move-to-end-of-branchname - "gb" 'gited-move-to-branchname - "gD" 'gited-move-to-end-of-date - "gd" 'gited-move-to-date - - ;; Operations on Things at Point - "=" 'gited-diff - "A" 'gited-add-patched-files - "a" 'gited-apply-patch - "B" 'gited-bisect - "C" 'gited-copy-branch - "c" 'gited-checkout-branch - "d" 'gited-flag-branch-deletion - "e" 'gited-extract-patches - "F" 'gited-pull ; Similar to Magit binding. Don't conflict with "f". - "gR" 'gited-change-current-remote-rep - - "gs" 'gited-status ; These "g"-prefixed operations open - "gL" 'gited-log ; new windows. - "gN" 'gited-log-last-n-commits ; - "gO" 'gited-origin ; Use "go" to visit branch source. - "gc" 'gited-show-commit ; - - "M" 'gited-merge-branch - "O" 'tabulated-list-sort - "o" 'tabulated-list-sort - "P" 'gited-push ; Only branches. - "p" 'gited-set-object-upstream ; Pushes branches and tags. - "R" 'gited-rename-branch - "r" 'gited-reset-branch - "s" nil ; Don't conflict with `tabulated-list-sort' on "S". - "ss" 'gited-stash - "sA" 'gited-stash-pop - "sa" 'gited-stash-apply - "sb" 'gited-stash-branch - "sD" 'gited-delete-all-stashes - "sd" 'gited-stash-drop - "Y" 'gited-copy-branchname-as-kill - - (kbd "RET") 'gited-visit-branch-sources - "go" 'gited-visit-branch-sources - - ;; Operations on Marked and Flagged Branches/Tags - "D" 'gited-do-delete - "K" 'gited-do-kill-lines - "T" 'gited-do-sync-with-trunk - "x" 'gited-do-flagged-delete - - ;; Marks - "*" nil - "*%" 'gited-mark-branches-regexp - "*m" 'gited-mark - "*u" 'gited-unmark - "*?" 'gited-unmark-all-branches - "*!" 'gited-unmark-all-marks - (kbd "* ") 'gited-unmark-backward - (kbd "* C-n") 'gited-next-marked-branch - (kbd "* C-p") 'gited-prev-marked-branch - "*t" 'gited-toggle-marks - "*l" 'gited-mark-local-tags - "*N" 'gited-number-marked - - "U" 'gited-unmark-all-marks - "m" 'gited-mark - "t" 'gited-toggle-marks - "~" 'gited-toggle-marks - "u" 'gited-unmark - (kbd "") 'gited-unmark-backward - - ;; Searching for marks - "%" nil - ;; "%d" No flag for deletion. - "%t" 'gited-mark-branches-by-date - "%c" 'gited-mark-branches-containing-commit - "%g" 'gited-mark-branches-containing-regexp - "%m" 'gited-mark-branches-regexp - "%M" 'gited-mark-merged-branches - "%U" 'gited-mark-unmerged-branches - - ;; Tags instead of thumbnails. Only usable when listing tags. Ideally, - ;; these would have a separate map that would be used when displaying tags. - (kbd "C-t a") 'gited-tag-add - (kbd "C-t d") 'gited-tag-delete - (kbd "C-t D") 'gited-remote-tag-delete - (kbd "C-t F") 'gited-fetch-remote-tags)) - -(provide 'evil-collection-gited) -;;; evil-collection-gited.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/gnus/README.org b/.config/emacs/lisp/evil-collection/modes/gnus/README.org deleted file mode 100644 index d9a8ae2..0000000 --- a/.config/emacs/lisp/evil-collection/modes/gnus/README.org +++ /dev/null @@ -1,274 +0,0 @@ -* gnus - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/gnus/index.html][Gnus]]. Initial state is normal in every gnus mode below, - insert state is inhibited, and =zz= is bound to =gnus-recenter= everywhere. - Each map keeps the bulk of its upstream alphabetic prefixes (=A=, =B=, =G=, - =M=, =S=, =W=, =X=, =Y=, =Z=, =/=, etc.); the tables below cover only what - evil-collection relocates or adds. - -** Key bindings - -*** gnus-summary-mode-map - - | Command | Original | Evil | - |-----------------------------------------------+----------------+----------------| - | =gnus-summary-exit= | =q= | =q=, =ZZ= | - | =gnus-summary-exit-no-update= | =Q= | =Q=, =ZQ= | - | =gnus-summary-help-map= | =H= | =g?= | - | =gnus-summary-widget-forward= | n/a | =TAB= | - | =gnus-summary-widget-backward= | n/a | == | - | =gnus-summary-next-page= | =SPC= | =SPC= | - | =gnus-summary-prev-page= | =DEL=, =S-SPC= | =DEL=, =S-SPC= | - | =gnus-summary-scroll-up= | =RET= | =RET= | - | =gnus-summary-prev-unread-article= | =p= | =gk=, =[[= | - | =gnus-summary-next-unread-article= | =n= | =gj=, =]]= | - | =gnus-summary-prev-thread= | =M-b= | ={= | - | =gnus-summary-next-thread= | =M-f= | =}= | - | =gnus-summary-prev-article= | =P= | =C-k= | - | =gnus-summary-next-article= | =N= | =C-j= | - | =gnus-summary-mark-as-processable= | =#= | =m= | - | =gnus-uu-mark-buffer= | (M H b) | =M= | - | =gnus-summary-unmark-as-processable= | =M-#= | =u= | - | =gnus-summary-unmark-all-processable= | (M H U) | =U= | - | =gnus-uu-mark-by-regexp= | (M P r) | =%= | - | =gnus-summary-mail-other-window= | =m= | =C=, =cc= | - | =gnus-summary-news-other-window= | (S i) | =ci= | - | =gnus-summary-followup= | =f= | =f=, =cf= | - | =gnus-summary-followup-with-original= | =F= | =F=, =cF= | - | =gnus-summary-reply= | =r= | =r=, =cr= | - | =gnus-summary-reply-with-original= | =R= | =R=, =cR= | - | =gnus-summary-very-wide-reply= | (S W) | =cw= | - | =gnus-summary-very-wide-reply-with-original= | (S W) | =cW= | - | =gnus-summary-mail-forward= | =C-c C-f= | =C-c C-f= | - | =gnus-summary-first-unread-article= | (G f) | =.= | - | =gnus-summary-best-unread-article= | (G b) | =,= | - | =gnus-summary-mark-as-read-forward= | =d= | =!= | - | =gnus-summary-tick-article-forward= | =u=, =!= | === | - | =gnus-summary-goto-article= | =j= | =J= | - | =gnus-summary-rescan-group= | =M-g= | =gr= | - | =gnus-summary-edit-article= | =e= | =e= | - | =gnus-summary-mark-as-expirable= | =E= | =E= | - | =gnus-summary-limit-map= | =/= | =z/= | - | =gnus-summary-toggle-header= | =t= | =zt= | - | =gnus-summary-limit-to-unread= | =x= | =x= | - | =gnus-summary-browse-url= | =w= | =gX= | - | =gnus-summary-refer-parent-article= | =^= | =^= | - | =gnus-summary-refer-article= | =M-^= | =M-^= | - | =gnus-summary-kill-thread= | (T K) | =Tk= | - | =gnus-summary-lower-thread= | =M-l= | =Tl= | - | =gnus-summary-raise-thread= | (T I) | =Ti= | - | =gnus-uu-mark-thread= | (T #) | =Tm= | - | =gnus-uu-unmark-thread= | (T M-#) | =Tu= | - | =gnus-summary-toggle-threads= | =M-t= | =TT= | - | =gnus-summary-show-thread= | =M-s= | =Ts=, =zo= | - | =gnus-summary-hide-thread= | =M-h= | =Th=, =zc= | - | =gnus-summary-show-all-threads= | (T S) | =TS= | - | =gnus-summary-hide-all-threads= | (T H) | =TH= | - | =gnus-summary-rethread-current= | (T t) | =Tt= | - | =gnus-summary-reparent-thread= | (T ^) | =T^= | - | =gnus-summary-reparent-children= | (T M-^) | =T M-^= | - | =gnus-summary-next-thread= | =M-f= | =Tn= | - | =gnus-summary-prev-thread= | =M-b= | =Tp= | - | =gnus-summary-down-thread= | (T d) | =Td= | - | =gnus-summary-up-thread= | (T u) | =Ta= | - | =gnus-summary-top-thread= | (T o) | =To= | - | =gnus-summary-search-article-forward= | =M-s= | =M-s= | - | =gnus-summary-search-article-backward= | =M-r= | =M-r= | - | =gnus-summary-repeat-search-article-forward= | =M-S= | =M-S= | - | =gnus-summary-repeat-search-article-backward= | =M-R= | =M-R= | - | =gnus-summary-execute-command= | =&= | =&= | - | =gnus-summary-universal-argument= | =M-&= | =M-&= | - | =gnus-cache-enter-article= | =*= | =*= | - | =gnus-cache-remove-article= | =M-*= | =M-*= | - | =gnus-summary-increase-score= | =I= | =I= | - | =gnus-summary-lower-score= | =L= | =L= | - - Grouped relocations: - - - Sort (=o= prefix): =oa= author, =oc= chars, =od= date, =oi= score, =ol= - lines, =omd= most-recent-date, =omm= marks, =omn= most-recent-number, - =on= number, =oo= original, =or= random, =os= subject, =ot= recipient. - - Save (=O= prefix, was upstream =O=): =Oo= article, =Om= mail, =Or= rmail, - =Of= file, =OF= write-article-file, =Ob= body-file, =Oh= folder, =Ov= vm, - =Op= pipe-output, =OP= muttprint. =gnus-summary-pipe-output= is also on - the literal pipe key. - - Decode (=X= prefix): =Xu/XU/Xvu/XvU= uu, =Xs/XS/Xvs/XvS= unshar, - =Xp/XP/Xvp/XvP= postscript, =Xo= save, =Xb= binhex, =XY= yenc. - - Mail-group ops (=B= prefix): =Be= expire, =BE= expire-now, =Bd= delete, - =Bm= move, =Bc= copy, =Bb= crosspost, =Bi= import, =BI= create, =Br= - respool, =Bw= edit, =Bq= respool-query, =Bt= respool-trace, =Bp= - article-posted-p. - -*** gnus-article-mode-map - - Motion-state additions: - - | Command | Original | Evil | - |-----------------------------------------+----------+------| - | =gnus-article-followup-with-original= | =F= | =F= | - | =gnus-article-reply-with-original= | =R= | =R= | - | =gnus-article-wide-reply-with-original= | =W= | =W= | - - Normal-state: - - | Command | Original | Evil | - |-----------------------------------------+----------------+----------------------| - | =evil-window-delete= | n/a | =q=, =Q=, =ZZ=, =ZQ= | - | =forward-button= | =TAB= | =TAB= | - | =backward-button= | == | == | - | =gnus-article-goto-next-page= | =SPC= | =SPC= | - | =gnus-article-goto-prev-page= | =DEL=, =S-SPC= | =DEL=, =S-SPC= | - | =gnus-summary-reply= | =r= | =r=, =cr= | - | =gnus-article-reply-with-original= | =R= | =R= | - | =gnus-article-mail= | =C-c m= | =C=, =cc= | - | =gnus-summary-reply-with-original= | n/a | =cR= | - | =gnus-summary-followup= | n/a | =cf= | - | =gnus-summary-followup-with-original= | n/a | =cF= | - | =gnus-summary-very-wide-reply= | n/a | =cw= | - | =gnus-article-wide-reply-with-original= | n/a | =cW= | - | =gnus-summary-mail-forward= | =C-c C-f= | =C-c C-f= | - | =gnus-article-refer-article= | =C-c ^= | =C-]= | - | =gnus-article-show-summary= | =h=, =s= | =s= | - | =gnus-summary-show-article= | =g= | =gr= | - | =gnus-summary-browse-url= | n/a | =gX= | - - Washing commands move under the =zw= prefix: - - | Command | Original | Evil | - |-------------------------------------------+----------+--------| - | =gnus-summary-stop-page-breaking= | =W l= | =zwl= | - | =gnus-summary-caesar-message= | =W r= | =zwr= | - | =gnus-summary-morse-message= | =W m= | =zwm= | - | =gnus-summary-idna-message= | =W i= | =zwi= | - | =gnus-summary-toggle-header= | =t= | =zwt= | - | =gnus-summary-verbose-headers= | =W v= | =zwv= | - | =gnus-article-treat-overstrike= | =W o= | =zwo= | - | =gnus-article-treat-smartquotes= | =W d= | =zwd= | - | =gnus-article-treat-non-ascii= | =W U= | =zwu= | - | =gnus-article-outlook-deuglify-article= | =W Y f= | =zwyf= | - | =gnus-article-outlook-unwrap-lines= | =W Y u= | =zwyu= | - | =gnus-article-outlook-repair-attribution= | =W Y a= | =zwya= | - | =gnus-article-outlook-rearrange-citation= | =W Y c= | =zwyc= | - | =gnus-article-fill-cited-article= | =W w= | =zww= | - | =gnus-article-fill-long-lines= | =W Q= | =zwq= | - | =gnus-article-capitalize-sentences= | =W C= | =zwc= | - | =gnus-article-de-base64-unreadable= | =W 6= | =zw6= | - | =gnus-article-decode-HZ= | =W Z= | =zwz= | - | =gnus-article-treat-ansi-sequences= | =W A= | =zwa= | - | =gnus-article-add-buttons= | =W b= | =zwb= | - | =gnus-article-add-buttons-to-head= | =W B= | =zwB= | - | =gnus-article-verify-x-pgp-sig= | =W p= | =zwp= | - | =gnus-summary-force-verify-and-decrypt= | =W s= | =zws= | - -*** gnus-group-mode-map - - | Command | Original | Evil | - |------------------------------------------+-------------+------------| - | =gnus-group-exit= | =q= | =q=, =ZZ= | - | =gnus-group-quit= | =Q= | =Q=, =ZQ= | - | =gnus-group-prev-unread-group= | =p= | =gk=, =[[= | - | =gnus-group-next-unread-group= | =n= | =gj=, =]]= | - | =gnus-group-next-group= | =N= | =C-j= | - | =gnus-group-prev-group= | =P= | =C-k= | - | =gnus-group-mail= | =m= | =C=, =cc= | - | =gnus-group-news= | =i= | =ci= | - | =gnus-group-first-unread-group= | =.= | =.= | - | =gnus-group-best-unread-group= | =,= | =,= | - | =gnus-activate-all-groups= | =M-g M-a= | =A= | - | =gnus-group-browse-foreign-server= | =B= | =B= | - | =gnus-group-edit-group= | =M-e= | =E= | - | =gnus-group-find-new-groups= | =F= | =F= | - | =gnus-group-jump-to-group= | =j= | =J= | - | =gnus-group-rename-group= | (G r) | =R= | - | =gnus-group-expunge-group= | (G x) | =X= | - | =gnus-group-select-group= | =RET= | =RET= | - | =gnus-group-read-group= | =SPC= | =SPC= | - | =gnus-group-get-new-news-this-group= | =g= | =gr= | - | =gnus-group-get-new-news= | =g= | =gR= | - | =gnus-group-unsubscribe-current-group= | =u= | =gu= | - | =gnus-group-unsubscribe-group= | =U= | =gU= | - | =gnus-group-catchup-current= | =c= | =gc= | - | =gnus-group-catchup-current-all= | =C= | =gC= | - | =gnus-group-expire-articles= | =C-c M-x= | =ge= | - | =gnus-group-expire-all-groups= | =C-c M-C-x= | =gE= | - | =gnus-group-set-current-level= | (G S l) | =gl= | - | =gnus-group-kill-group= | =C-k= | =dd=, =D= | - | =gnus-group-yank-group= | =C-y= | =p=, =P= | - | =gnus-group-mark-group= | =#= | =m= | - | =gnus-group-unmark-group= | =M-#= | =u= | - | =gnus-group-unmark-all-groups= | (M U) | =U= | - | =gnus-group-mark-buffer= | (M b) | =M=, =*= | - | =gnus-group-mark-regexp= | (M r) | =%= | - | =gnus-group-apropos= | =C-c M-a= | =s= | - | =gnus-group-description-apropos= | =C-c M-A= | =S= | - | =gnus-group-read-ephemeral-search-group= | n/a | =M-s= | - | =gnus-group-enter-server-mode= | =^= | =^= | - | =gnus-group-prev-unread-group= | =DEL= | =DEL= | - | =gnus-group-help-map= | =H= | =g?= | - - Grouped relocations: - - - Sort (=o= prefix): =oa= alphabet, =ol= level, =om= method, =on= - real-name, =or= rank, =os= sort, =ou= unread, =ov= score. - - List (=L= prefix, was upstream =A=): =L!= ticked, =L/= limit-map, =L?= - dormant, =La= active, =Lc= cached, =Lf= flush-map, =Lk= killed, =Ll= - level, =Lm= matching, =LM= all-matching, =Lp= plus-map, =Ls= groups, - =Lu= all-groups, =Lz= zombies. - - Topic (=T= prefix): =Tn= create, =Tj= jump, =Tr= rename, =Td= delete; - =zo= / =zc= show/hide topic. Topic sort under =To{a,u,l,v,r,m,e,s}=. - -*** gnus-server-mode-map - - | Command | Original | Evil | - |--------------------------------------------+----------+----------------------| - | =gnus-server-exit= | =q= | =q=, =Q=, =ZZ=, =ZQ= | - | =gnus-server-read-server= | =RET= | =RET= | - | =gnus-server-read-server-in-server-buffer= | =SPC= | =SPC= | - | =gnus-server-close-server= | =C= | =C= | - | =gnus-server-deny-server= | =D= | =D= | - | =gnus-group-make-nnir-group= | =G= | =G= | - | =gnus-server-set-cloud-method-server= | =I= | =I= | - | =gnus-server-offline-server= | =L= | =L= | - | =gnus-server-open-server= | =O= | =O= | - | =gnus-server-remove-denials= | =R= | =R= | - | =gnus-server-show-server= | =S= | =S= | - | =gnus-server-add-server= | =a= | =a= | - | =gnus-server-copy-server= | =c= | =y= | - | =gnus-server-edit-server= | =e= | =e= | - | =gnus-server-regenerate-server= | =g= | =gr= | - | =gnus-server-toggle-cloud-server= | =i= | =i= | - | =gnus-server-kill-server= | =k= | =d= | - | =gnus-server-list-servers= | =l= | =L= | - | =gnus-server-scan-server= | =s= | =s= | - | =gnus-server-yank-server= | =y= | =p= | - | =gnus-server-compact-server= | =z= | =c= | - | =gnus-server-close-all-servers= | =M-c= | =M-c= | - | =gnus-server-open-all-servers= | =M-o= | =M-o= | - -*** gnus-browse-mode-map - - | Command | Original | Evil | - |-----------------------------------------+----------+----------------------| - | =gnus-browse-exit= | =q=, =l= | =q=, =Q=, =ZZ=, =ZQ= | - | =gnus-browse-unsubscribe-current-group= | =u= | =u= | - | =gnus-browse-read-group= | =SPC= | =SPC= | - | =gnus-browse-select-group= | =RET= | =RET= | - -*** gnus-bookmark-bmenu-mode-map - - | Command | Original | Evil | - |--------------------------------------------+----------+----------------------| - | =quit-window= | =q= | =q=, =Q=, =ZZ=, =ZQ= | - | =gnus-bookmark-bmenu-mark= | =m= | =m= | - | =gnus-bookmark-bmenu-unmark= | =u= | =u= | - | =gnus-bookmark-bmenu-backup-unmark= | =DEL= | =DEL= | - | =gnus-bookmark-bmenu-delete= | =d=, =k= | =d= | - | =gnus-bookmark-bmenu-execute-deletions= | =x= | =x= | - | =gnus-bookmark-bmenu-select= | =RET= | =RET= | - | =gnus-bookmark-bmenu-load= | =l= | =L= | - | =gnus-bookmark-bmenu-save= | =s= | =s= | - | =gnus-bookmark-bmenu-toggle-infos= | =t= | =t= | - | =gnus-bookmark-bmenu-show-details= | =a= | =a= | - | =gnus-bookmark-bmenu-show-all-annotations= | n/a | =A= | - | =gnus-bookmark-bmenu-edit-annotation= | n/a | =E= | - | =gnus-bookmark-bmenu-rename= | n/a | =R= | diff --git a/.config/emacs/lisp/evil-collection/modes/gnus/evil-collection-gnus.el b/.config/emacs/lisp/evil-collection/modes/gnus/evil-collection-gnus.el deleted file mode 100644 index cc6b413..0000000 --- a/.config/emacs/lisp/evil-collection/modes/gnus/evil-collection-gnus.el +++ /dev/null @@ -1,491 +0,0 @@ -;;; evil-collection-gnus.el --- Bindings for `gnus' -*- lexical-binding: t -*- - -;; Copyright (C) 2019 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: emacs, tools, evil - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `gnus'. - -;;; Code: -(require 'gnus nil t) -(require 'evil-collection) - -(defconst evil-collection-gnus-maps '(gnus-article-mode-map - gnus-bookmark-bmenu-mode-map - gnus-browse-mode-map - gnus-group-mode-map - gnus-server-mode-map - gnus-summary-mode-map)) - -(defvar evil-collection-gnus-common-normal-bindings - '("zz" gnus-recenter) - "Keybindings added to all gnus normal mode-maps. -Note that there is no gnus-common-mode-map") - -;;;###autoload -(defun evil-collection-gnus-setup () - "Set up `evil' bindings for `gnus'." - - ;; For all gnus modes: - ;; - Set the initial state to 'normal - ;; - Inhibit insert - ;; - Use `evil-collection-gnus-common-normal-bindings' - (dolist (map evil-collection-gnus-maps) - (let* ((map-string (symbol-name map)) - (mode-string (string-trim-right map-string "-map")) - (mode (intern mode-string))) - (evil-set-initial-state mode 'normal) - (evil-collection-inhibit-insert-state map) - (apply #'evil-collection-define-key 'normal map - evil-collection-gnus-common-normal-bindings))) - - (evil-collection-define-key 'normal 'gnus-summary-mode-map - ;; quit - "Q" 'gnus-summary-exit-no-update - "ZQ" 'gnus-summary-exit-no-update - "q" 'gnus-summary-exit - "ZZ" 'gnus-summary-exit - - "g?" 'gnus-summary-help-map - - ;; motion - (kbd "") 'gnus-summary-widget-forward - (kbd "") 'gnus-summary-widget-backward - (kbd "") 'gnus-summary-prev-page - (kbd "S-SPC") 'gnus-summary-prev-page - (kbd "SPC") 'gnus-summary-next-page - (kbd "RET") 'gnus-summary-scroll-up - "gk" 'gnus-summary-prev-unread-article - "gj" 'gnus-summary-next-unread-article - "[[" 'gnus-summary-prev-unread-article - "]]" 'gnus-summary-next-unread-article - "{" 'gnus-summary-prev-thread - "}" 'gnus-summary-next-thread - (kbd "C-j") 'gnus-summary-next-article - (kbd "C-k") 'gnus-summary-prev-article - - ;; Marking - "m" 'gnus-summary-mark-as-processable - "M" 'gnus-uu-mark-buffer - "u" 'gnus-summary-unmark-as-processable - "U" 'gnus-summary-unmark-all-processable - "%" 'gnus-uu-mark-by-regexp - - ;; Composing - "C" 'gnus-summary-mail-other-window - "cc" 'gnus-summary-mail-other-window - "ci" 'gnus-summary-news-other-window - "f" 'gnus-summary-followup - "F" 'gnus-summary-followup-with-original - "cf" 'gnus-summary-followup - "cF" 'gnus-summary-followup-with-original - - ;; Reply - "r" 'gnus-summary-reply - "R" 'gnus-summary-reply-with-original - "cr" 'gnus-summary-reply - "cR" 'gnus-summary-reply-with-original - "cw" 'gnus-summary-very-wide-reply - "cW" 'gnus-summary-very-wide-reply-with-original - (kbd "C-c C-f") 'gnus-summary-mail-forward - - ;; Actions, like mu4e - ;; Keep the following two bindings consistent with group's - "." 'gnus-summary-first-unread-article - "," 'gnus-summary-best-unread-article - "!" 'gnus-summary-mark-as-read-forward - "=" 'gnus-summary-tick-article-forward - "J" 'gnus-summary-goto-article - "gr" 'gnus-summary-rescan-group - "e" 'gnus-summary-edit-article - "E" 'gnus-summary-mark-as-expirable - "z/" 'gnus-summary-limit-map - "zt" 'gnus-summary-toggle-header - "x" 'gnus-summary-limit-to-unread - "gX" 'gnus-summary-browse-url - - ;; Finding the parent - "^" 'gnus-summary-refer-parent-article - (kbd "M-^") 'gnus-summary-refer-article - - ;; Sorting - "oa" 'gnus-summary-sort-by-author - "oc" 'gnus-summary-sort-by-chars - "od" 'gnus-summary-sort-by-date - "oi" 'gnus-summary-sort-by-score - "ol" 'gnus-summary-sort-by-lines - "omd" 'gnus-summary-sort-by-most-recent-date - "omm" 'gnus-summary-sort-by-marks - "omn" 'gnus-summary-sort-by-most-recent-number - "on" 'gnus-summary-sort-by-number - "oo" 'gnus-summary-sort-by-original - "or" 'gnus-summary-sort-by-random - "os" 'gnus-summary-sort-by-subject - "ot" 'gnus-summary-sort-by-recipient - - ;; Threads commands - "Tk" 'gnus-summary-kill-thread - "Tl" 'gnus-summary-lower-thread - "Ti" 'gnus-summary-raise-thread - "Tm" 'gnus-uu-mark-thread ;; was T # - "Tu" 'gnus-uu-unmark-thread ;; was T M-# - "TT" 'gnus-summary-toggle-threads - "Ts" 'gnus-summary-show-thread - "Th" 'gnus-summary-hide-thread - ;; show/hide can be mapped to zo/zc - "zo" 'gnus-summary-show-thread - "zc" 'gnus-summary-hide-thread - "TS" 'gnus-summary-show-all-threads - "TH" 'gnus-summary-hide-all-threads - "Tt" 'gnus-summary-rethread-current - "T^" 'gnus-summary-reparent-thread - (kbd "T M-^") 'gnus-summary-reparent-children - "Tn" 'gnus-summary-next-thread - "Tp" 'gnus-summary-prev-thread - "Td" 'gnus-summary-down-thread ;; descend - "Ta" 'gnus-summary-up-thread ;; was T u, ascend also makes sense - "To" 'gnus-summary-top-thread - - ;; Saving - "Oo" 'gnus-summary-save-article - "Om" 'gnus-summary-save-article-mail - "Or" 'gnus-summary-save-article-rmail - "Of" 'gnus-summary-save-article-file - "OF" 'gnus-summary-write-article-file - "Ob" 'gnus-summary-save-article-body-file - "Oh" 'gnus-summary-save-article-folder - "Ov" 'gnus-summary-save-article-vm - "Op" 'gnus-summary-pipe-output - "|" 'gnus-summary-pipe-output - "OP" 'gnus-summary-muttprint - - ;; Decoding with marked articles - "Xu" 'gnus-uu-decode-uu - "XU" 'gnus-uu-decode-uu-and-save - "Xvu" 'gnus-uu-decode-uu-view - "XvU" 'gnus-uu-decode-uu-and-save-view - ;; Shell archives - "Xs" 'gnus-uu-decode-unshar - "XS" 'gnus-uu-decode-unshar-and-save - "Xvs" 'gnus-uu-decode-unshar-view - "XvS" 'gnus-uu-decode-unshar-and-save-view - ;; PostScript files - "Xp" 'gnus-uu-decode-postscript - "XP" 'gnus-uu-decode-postscript-and-save - "Xvp" 'gnus-uu-decode-postscript-view - "XvP" 'gnus-uu-decode-postscript-and-save-view - ;; Other files - "Xo" 'gnus-uu-decode-save - "Xb" 'gnus-uu-decode-binhex - "XY" 'gnus-uu-decode-yenc - - ;; Mail group commands - "Be" 'gnus-summary-expire-articles - "BE" 'gnus-summary-expire-articles-now ;; was B C-M-e - "Bd" 'gnus-summary-delete-article ;; was B DEL - "Bm" 'gnus-summary-move-article - "Bc" 'gnus-summary-copy-article - "Bb" 'gnus-summary-crosspost-article ;; was B B - "Bi" 'gnus-summary-import-article - "BI" 'gnus-summary-create-article - "Br" 'gnus-summary-respool-article - "Bw" 'gnus-summary-edit-article - "Bq" 'gnus-summary-respool-query - "Bt" 'gnus-summary-respool-trace - "Bp" 'gnus-summary-article-posted-p - - ;; Searching - (kbd "M-s") 'gnus-summary-search-article-forward - (kbd "M-r") 'gnus-summary-search-article-backward - (kbd "M-S") 'gnus-summary-repeat-search-article-forward - (kbd "M-R") 'gnus-summary-repeat-search-article-backward - "&" 'gnus-summary-execute-command - (kbd "M-&") 'gnus-summary-universal-argument - - [mouse-2] 'gnus-mouse-pick-article - [follow-link] 'mouse-face - - ;; Rest of the bindings "as is". - "*" 'gnus-cache-enter-article - (kbd "M-*") 'gnus-cache-remove-article - (kbd "M-i") 'gnus-symbolic-argument - "I" 'gnus-summary-increase-score - "L" 'gnus-summary-lower-score) - - (evil-collection-define-key 'motion 'gnus-article-mode-map - "F" 'gnus-article-followup-with-original - "R" 'gnus-article-reply-with-original - "W" 'gnus-article-wide-reply-with-original) - (evil-collection-define-key 'normal 'gnus-article-mode-map - ;; quit - "Q" 'evil-window-delete - "ZQ" 'evil-window-delete - "q" 'evil-window-delete - "ZZ" 'evil-window-delete - - ;; Movement - (kbd "TAB") 'forward-button - (kbd "") 'backward-button - (kbd "SPC") 'gnus-article-goto-next-page - (kbd "DEL") 'gnus-article-goto-prev-page - (kbd "S-SPC") 'gnus-article-goto-prev-page - - ;; Reply - "r" 'gnus-summary-reply - "R" 'gnus-article-reply-with-original ;; override `evil-replace-state' - - ;; Composing - "C" 'gnus-article-mail - "cc" 'gnus-article-mail - "cr" 'gnus-summary-reply - "cR" 'gnus-summary-reply-with-original - "cf" 'gnus-summary-followup - "cF" 'gnus-summary-followup-with-original - "cw" 'gnus-summary-very-wide-reply - "cW" 'gnus-article-wide-reply-with-original - (kbd "C-c C-f") 'gnus-summary-mail-forward - - ;; Washing - ;; - ;; List of unbound commands: - ;; - `gnus-article-remove-cr' - ;; - `gnus-article-de-quoted-unreadable' - ;; - `gnus-article-unsplit-urls' - ;; - `gnus-article-wash-html' - ;; - `gnus-article-strip-leading-blank-lines' - ;; - `gnus-article-strip-multiple-blank-lines' - ;; - `gnus-article-remove-trailing-blank-lines' - ;; - `gnus-article-strip-blank-lines' - ;; - `gnus-article-strip-all-blank-lines' - ;; - `gnus-article-strip-leading-space' - ;; - `gnus-article-strip-trailing-space' - "zwl" 'gnus-summary-stop-page-breaking - "zwr" 'gnus-summary-caesar-message - "zwm" 'gnus-summary-morse-message - "zwi" 'gnus-summary-idna-message - "zwt" 'gnus-summary-toggle-header - "zwv" 'gnus-summary-verbose-headers - "zwo" 'gnus-article-treat-overstrike - "zwd" 'gnus-article-treat-smartquotes - "zwu" 'gnus-article-treat-non-ascii ;; was W U - "zwyf" 'gnus-article-outlook-deuglify-article - "zwyu" 'gnus-article-outlook-unwrap-lines - "zwya" 'gnus-article-outlook-repair-attribution - "zwyc" 'gnus-article-outlook-rearrange-citation - "zww" 'gnus-article-fill-cited-article - "zwq" 'gnus-article-fill-long-lines ;; was W Q - "zwc" 'gnus-article-capitalize-sentences ;; was W C - "zw6" 'gnus-article-de-base64-unreadable - "zwz" 'gnus-article-decode-HZ ;; was W Z - "zwa" 'gnus-article-treat-ansi-sequences ;; was W A - "zwb" 'gnus-article-add-buttons - "zwB" 'gnus-article-add-buttons-to-head - "zwp" 'gnus-article-verify-x-pgp-sig - "zws" 'gnus-summary-force-verify-and-decrypt - - ;; Actions - (kbd "C-]") 'gnus-article-refer-article - "s" 'gnus-article-show-summary - "gr" 'gnus-summary-show-article - "gX" 'gnus-summary-browse-url) - - (evil-collection-define-key 'normal 'gnus-group-mode-map - ;; quit - "Q" 'gnus-group-quit - "ZQ" 'gnus-group-quit - "q" 'gnus-group-exit - "ZZ" 'gnus-group-exit - - ;; Movement - "[[" 'gnus-group-prev-unread-group - "]]" 'gnus-group-next-unread-group - "gk" 'gnus-group-prev-unread-group - "gj" 'gnus-group-next-unread-group - (kbd "C-j") 'gnus-group-next-group - (kbd "C-k") 'gnus-group-prev-group - - ;; Composing, like mu4e - "C" 'gnus-group-mail - "cc" 'gnus-group-mail - "ci" 'gnus-group-news - - ;; Actions - "." 'gnus-group-first-unread-group - "," 'gnus-group-best-unread-group - "A" 'gnus-activate-all-groups - "B" 'gnus-group-browse-foreign-server - "E" 'gnus-group-edit-group - "F" 'gnus-group-find-new-groups - "J" 'gnus-group-jump-to-group - "R" 'gnus-group-rename-group - "X" 'gnus-group-expunge-group - (kbd "RET") 'gnus-group-select-group - (kbd "SPC") 'gnus-group-read-group - "gr" 'gnus-group-get-new-news-this-group - "gR" 'gnus-group-get-new-news - "gu" 'gnus-group-unsubscribe-current-group - "gU" 'gnus-group-unsubscribe-group - "gc" 'gnus-group-catchup-current - "gC" 'gnus-group-catchup-current-all - "ge" 'gnus-group-expire-articles - "gE" 'gnus-group-expire-all-groups - "gl" 'gnus-group-set-current-level - - ;; Deleting & Pasting - "dd" 'gnus-group-kill-group - "D" 'gnus-group-kill-group - "p" 'gnus-group-yank-group - "P" 'gnus-group-yank-group - - ;; Marking - "m" 'gnus-group-mark-group - "u" 'gnus-group-unmark-group - "U" 'gnus-group-unmark-all-groups - "M" 'gnus-group-mark-buffer - "*" 'gnus-group-mark-buffer - "%" 'gnus-group-mark-regexp - - ;; Searching - "s" 'gnus-group-apropos - "S" 'gnus-group-description-apropos - (kbd "M-s") 'gnus-group-read-ephemeral-search-group - - ;; Sorting - "oa" 'gnus-group-sort-groups-by-alphabet - "ol" 'gnus-group-sort-groups-by-level - "om" 'gnus-group-sort-groups-by-method - "on" 'gnus-group-sort-groups-by-real-name - "or" 'gnus-group-sort-groups-by-rank - "os" 'gnus-group-sort-groups - "ou" 'gnus-group-sort-groups-by-unread - "ov" 'gnus-group-sort-groups-by-score - - ;; Listing - "L!" 'gnus-group-list-ticked - "L/" 'gnus-group-list-limit-map - "L?" 'gnus-group-list-dormant - "La" 'gnus-group-list-active ;; was A A - "Lc" 'gnus-group-list-cached - "Lf" 'gnus-group-list-flush-map - "Lk" 'gnus-group-list-killed - "Ll" 'gnus-group-list-level - "Lm" 'gnus-group-list-matching - "LM" 'gnus-group-list-all-matching - "Lp" 'gnus-group-list-plus-map - "Ls" 'gnus-group-list-groups - "Lu" 'gnus-group-list-all-groups - "Lz" 'gnus-group-list-zombies - - ;; Topic commands - ;; `gnus-topic-move-group' can be done through dd then p - "Tn" 'gnus-topic-create-topic - "Tj" 'gnus-topic-jump-to-topic - "Tr" 'gnus-topic-rename - "Td" 'gnus-topic-delete - "zc" 'gnus-topic-hide-topic - "zo" 'gnus-topic-show-topic - - ;; Topic sorting - "Toa" 'gnus-topic-sort-groups-by-alphabet - "Tou" 'gnus-topic-sort-groups-by-unread - "Tol" 'gnus-topic-sort-groups-by-level - "Tov" 'gnus-topic-sort-groups-by-score - "Tor" 'gnus-topic-sort-groups-by-rank - "Tom" 'gnus-topic-sort-groups-by-method - "Toe" 'gnus-group-sort-groups-by-server - "Tos" 'gnus-group-sort-groups - - "^" 'gnus-group-enter-server-mode - - (kbd "DEL") 'gnus-group-prev-unread-group - [mouse-2] 'gnus-mouse-pick-group - "g?" 'gnus-group-help-map) - - (evil-collection-define-key 'normal 'gnus-server-mode-map - ;; quit - "Q" 'gnus-server-exit - "ZQ" 'gnus-server-exit - "q" 'gnus-server-exit - "ZZ" 'gnus-server-exit - - (kbd "RET") 'gnus-server-read-server - (kbd "SPC") 'gnus-server-read-server-in-server-buffer - "C" 'gnus-server-close-server - "D" 'gnus-server-deny-server - "G" 'gnus-group-make-nnir-group - "I" 'gnus-server-set-cloud-method-server - "L" 'gnus-server-offline-server - "O" 'gnus-server-open-server - "R" 'gnus-server-remove-denials - "S" 'gnus-server-show-server - "a" 'gnus-server-add-server - "y" 'gnus-server-copy-server - "e" 'gnus-server-edit-server - "gr" 'gnus-server-regenerate-server - "i" 'gnus-server-toggle-cloud-server - "d" 'gnus-server-kill-server - "L" 'gnus-server-list-servers - "s" 'gnus-server-scan-server - "p" 'gnus-server-yank-server - "c" 'gnus-server-compact-server - "M-c" 'gnus-server-close-all-servers - "M-o" 'gnus-server-open-all-servers) - - (evil-collection-define-key 'normal 'gnus-browse-mode-map - ;; quit - "Q" 'gnus-browse-exit - "ZQ" 'gnus-browse-exit - "q" 'gnus-browse-exit - "ZZ" 'gnus-browse-exit - - "u" 'gnus-browse-unsubscribe-current-group - (kbd "SPC") 'gnus-browse-read-group - (kbd "RET") 'gnus-browse-select-group) - - (evil-collection-define-key 'normal 'gnus-bookmark-bmenu-mode-map - ;; quit - "Q" 'quit-window - "ZQ" 'quit-window - "q" 'quit-window - "ZZ" 'quit-window - - ;; mark and execution - "m" 'gnus-bookmark-bmenu-mark - "u" 'gnus-bookmark-bmenu-unmark - (kbd "DEL") 'gnus-bookmark-bmenu-backup-unmark - "d" 'gnus-bookmark-bmenu-delete - "x" 'gnus-bookmark-bmenu-execute-deletions - - (kbd "RET") 'gnus-bookmark-bmenu-select - [mouse-2] 'gnus-bookmark-bmenu-select-by-mouse - "L" 'gnus-bookmark-bmenu-load - "s" 'gnus-bookmark-bmenu-save - "t" 'gnus-bookmark-bmenu-toggle-infos - "a" 'gnus-bookmark-bmenu-show-details - ;; not implemented yet - "A" 'gnus-bookmark-bmenu-show-all-annotations - "E" 'gnus-bookmark-bmenu-edit-annotation - "R" 'gnus-bookmark-bmenu-rename)) - -(provide 'evil-collection-gnus) -;;; evil-collection-gnus.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/go-mode/README.org b/.config/emacs/lisp/evil-collection/modes/go-mode/README.org deleted file mode 100644 index 2b102d6..0000000 --- a/.config/emacs/lisp/evil-collection/modes/go-mode/README.org +++ /dev/null @@ -1,19 +0,0 @@ -* go-mode - - Evil bindings for [[https://github.com/dominikh/go-mode.el][go-mode]] and =godoc-mode=. - -** Key bindings - -*** go-mode-map - - | Command | Original | Evil | - |------------------+-----------+------| - | =godef-jump= | =C-c C-j= | =gd= | - | =godef-describe= | =C-c C-d= | =K= | - -*** godoc-mode-map - - | Command | Original | Evil | - |-----------------+----------+------| - | =quit-window= | =q= | =q= | - | =describe-mode= | =h m= | =g?= | diff --git a/.config/emacs/lisp/evil-collection/modes/go-mode/evil-collection-go-mode.el b/.config/emacs/lisp/evil-collection/modes/go-mode/evil-collection-go-mode.el deleted file mode 100644 index b423f7b..0000000 --- a/.config/emacs/lisp/evil-collection/modes/go-mode/evil-collection-go-mode.el +++ /dev/null @@ -1,47 +0,0 @@ -;;; evil-collection-go-mode.el --- Bindings for `go-mode' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools, golang - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `go-mode'. - -;;; Code: -(require 'evil-collection) -(require 'go-mode nil t) - -(defconst evil-collection-go-mode-maps '(go-mode-map - godoc-mode-map)) - -;;;###autoload -(defun evil-collection-go-mode-setup () - "Set up `evil' bindings for `go-mode'." - (evil-collection-define-key 'normal 'go-mode-map - "gd" 'godef-jump - "K" 'godef-describe) - (evil-collection-define-key 'normal 'godoc-mode-map - "q" 'quit-window - "g?" 'describe-mode)) - -(provide 'evil-collection-go-mode) -;;; evil-collection-go-mode.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/gptel/README.org b/.config/emacs/lisp/evil-collection/modes/gptel/README.org deleted file mode 100644 index 903e622..0000000 --- a/.config/emacs/lisp/evil-collection/modes/gptel/README.org +++ /dev/null @@ -1,47 +0,0 @@ -* gptel - - Evil bindings for [[https://github.com/karthink/gptel][gptel]]. - - =RET= submission follows =evil-collection-repl-submit-state=: in the submit - state, =RET= sends; in the other state (insert when submit is normal, normal - when submit is insert), =RET= inserts a newline. =S-RET= behavior is - controlled by two customs. - -** Key bindings - -*** gptel-mode-map - - Upstream only binds =C-c RET= to =gptel-send=; =RET= itself is unchanged - on the buffer's major mode. Evil-collection layers state-aware =RET= / - =S-RET= behavior on top. - - | Command | Original | Evil | - |--------------+-----------+------------------------------------------------------------------| - | =gptel-send= | =C-c RET= | =C-c RET= | - | =gptel-send= | n/a | =RET=, == in submit state | - | =newline= | n/a | =S-RET=, =S-= in submit state; all four in newline state | - | =gptel-menu= | n/a | =S-RET=, == in normal / visual (default) | - | =gptel-send= | =C-c RET= | =S-RET=, == in normal / visual (when menu custom nil) | - -*** gptel-context-buffer-mode-map (normal state) - - | Command | Original | Evil | - |-------------------------------+-----------+-----------| - | =gptel-context-next= | =n= | =j= | - | =gptel-context-previous= | =p= | =k= | - | =gptel-context-flag-deletion= | =d= | =d= | - | =gptel-context-quit= | =C-c C-k= | =q=, =ZQ= | - | =gptel-context-confirm= | =C-c C-c= | =ZZ= | - | =gptel-context-visit= | =RET= | =RET= | - -** Customization - - | Variable | Default | Purpose | - |------------------------------------------------+---------+-----------------------------------------------------------------------------| - | =evil-collection-gptel-want-shift-ret-to-send= | =t= | Bind =S-RET= in normal / visual to =gptel-send=. | - | =evil-collection-gptel-want-shift-ret-menu= | =t= | Bind =S-RET= in normal / visual to =gptel-menu=. Wins over the send custom. | - -** Integrations - - =gptel-context=: bindings for the context buffer (above) are wired via - =with-eval-after-load 'gptel-context=. diff --git a/.config/emacs/lisp/evil-collection/modes/gptel/evil-collection-gptel.el b/.config/emacs/lisp/evil-collection/modes/gptel/evil-collection-gptel.el deleted file mode 100644 index 6be9535..0000000 --- a/.config/emacs/lisp/evil-collection/modes/gptel/evil-collection-gptel.el +++ /dev/null @@ -1,82 +0,0 @@ -;;; evil-collection-gptel.el --- Bindings for gptel -*- lexical-binding: t -*- - -;; Copyright (C) 2024 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen , Zhiwei Chen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: emacs - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for gptel. - -;;; Code: -(require 'evil-collection) -(require 'gptel nil t) - - -(defconst evil-collection-gptel-maps - '(gptel-mode-map gptel-context-buffer-mode-map)) - -(defcustom evil-collection-gptel-want-shift-ret-to-send t - "When non nil, S-RET sends query to LLM." - :group 'evil-collection - :type 'boolean) - -(defcustom evil-collection-gptel-want-shift-ret-menu t - "When non nil, S-RET opens calls `gptel-menu'. This takes priority over - `evil-collection-gptel-want-shift-ret-to-send'." - :group 'evil-collection - :type 'boolean) - -;;;###autoload -(defun evil-collection-gptel-setup () - "Set up `evil' bindings for gptel." - (let* ((submit evil-collection-repl-submit-state) - (newline-state (if (eq submit 'normal) 'insert 'normal))) - (evil-collection-define-key submit 'gptel-mode-map - (kbd "RET") 'gptel-send - (kbd "") 'gptel-send - (kbd "S-RET") 'newline - (kbd "S-") 'newline) - (evil-collection-define-key newline-state 'gptel-mode-map - (kbd "RET") 'newline - (kbd "") 'newline - (kbd "S-RET") 'newline - (kbd "S-") 'newline)) - (if evil-collection-gptel-want-shift-ret-menu - (evil-collection-define-key '(normal visual) 'gptel-mode-map - (kbd "S-RET") 'gptel-menu - (kbd "") 'gptel-menu) - (when evil-collection-gptel-want-shift-ret-to-send - (evil-collection-define-key '(normal visual) 'gptel-mode-map - (kbd "S-RET") 'gptel-send - (kbd "") 'gptel-send))) - - (with-eval-after-load 'gptel-context - (evil-collection-define-key 'normal 'gptel-context-buffer-mode-map - "j" 'gptel-context-next - "k" 'gptel-context-previous - "d" 'gptel-context-flag-deletion - "q" 'gptel-context-quit - "ZQ" 'gptel-context-quit - "ZZ" 'gptel-context-confirm - (kbd "RET") 'gptel-context-visit))) - -(provide 'evil-collection-gptel) -;;; evil-collection-gptel.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/grep/README.org b/.config/emacs/lisp/evil-collection/modes/grep/README.org deleted file mode 100644 index cc8cc0c..0000000 --- a/.config/emacs/lisp/evil-collection/modes/grep/README.org +++ /dev/null @@ -1,15 +0,0 @@ -* grep - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Grep-Searching.html][grep]]. - -** Key bindings - - | Command | Original | Evil | - |----------------------------+----------+-------| - | =evil-search-next= | n/a | =n= | - | =next-error-no-select= | =n= | =C-j= | - | =previous-error-no-select= | =p= | =C-k= | - -** Integrations - - - wgrep: =i= → =wgrep-change-to-wgrep-mode= when =wgrep= is available. diff --git a/.config/emacs/lisp/evil-collection/modes/grep/evil-collection-grep.el b/.config/emacs/lisp/evil-collection/modes/grep/evil-collection-grep.el deleted file mode 100644 index bfd3eff..0000000 --- a/.config/emacs/lisp/evil-collection/modes/grep/evil-collection-grep.el +++ /dev/null @@ -1,49 +0,0 @@ -;;; evil-collection-grep.el --- Bindings for `grep' -*- lexical-binding: t -*- - -;; Copyright (C) 2018 James Nguyen - -;; Author: Fredrik Bergroth -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `grep'. - -;;; Code: -(require 'evil-collection) -(require 'grep) - -(defconst evil-collection-grep-maps '(grep-mode-map)) - -;;;###autoload -(defun evil-collection-grep-setup () - "Set up `evil' bindings for `grep'." - (evil-collection-define-key 'normal 'grep-mode-map - "n" 'evil-search-next - "\C-j" 'next-error-no-select - "\C-k" 'previous-error-no-select) - - ;; `wgrep' integration - (when (fboundp 'wgrep-setup) - (evil-collection-define-key 'normal 'grep-mode-map - "i" 'wgrep-change-to-wgrep-mode))) - -(provide 'evil-collection-grep) -;;; evil-collection-grep.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/guix/evil-collection-guix.el b/.config/emacs/lisp/evil-collection/modes/guix/evil-collection-guix.el deleted file mode 100644 index a18b2ac..0000000 --- a/.config/emacs/lisp/evil-collection/modes/guix/evil-collection-guix.el +++ /dev/null @@ -1,217 +0,0 @@ -;;; evil-collection-guix.el --- Evil bindings for Guix -*- lexical-binding: t -*- - -;; Copyright (C) 2018 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, guix, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `guix'. - -;;; Code: -(require 'evil-collection) -(require 'guix nil t) - -(defconst evil-collection-guix-maps '(guix-output-list-mode-map - guix-package-info-mode-map - guix-profile-list-mode-map - guix-profile-info-mode-map - guix-generation-list-mode-map - guix-generation-info-mode-map - guix-license-list-mode-map - guix-license-info-mode-map - guix-location-list-mode-map - guix-hydra-build-list-mode-map - guix-hydra-build-info-mode-map - guix-build-log-mode-map - guix-service-list-mode-map)) - -(defmacro evil-collection-guix-set (map) - "Set common bindings in MAP." - `(progn - (evil-collection-set-readonly-bindings ',map) - (evil-collection-define-key 'normal ',map - ;; motion - (kbd "SPC") 'scroll-up-command - (kbd "S-SPC") 'scroll-down-command - (kbd "") 'forward-button - (kbd "") 'backward-button - - "gm" 'guix-apply-manifest - - ;; sort - "o" 'bui-list-sort - - ;; filter - "ss" 'bui-enable-filter - "sd" 'bui-disable-filter - - ;; mark - "m" 'bui-list-mark - "M" 'bui-list-mark-all - "u" 'bui-list-unmark - "U" 'bui-list-unmark-all - - (kbd "C-o") 'bui-history-back - (kbd "C-i") 'bui-history-forward - - "g?" 'bui-show-hint - "gr" 'revert-buffer - "gR" 'bui-redisplay - - ;; repl - "gz" 'guix-switch-to-repl))) - -;;;###autoload -(defun evil-collection-guix-setup () - "Set up `evil' bindings for `guix'." - (evil-collection-guix-set guix-ui-map) ; Covers output-list and generation-list. - - (evil-collection-define-key 'normal 'guix-output-list-mode-map - (kbd "RET") 'bui-list-describe - - "gb" 'guix-package-list-latest-builds - "gG" 'guix-output-list-graph - "gl" 'guix-output-list-lint - "gs" 'guix-package-list-size - - "a" 'guix-output-list-mark-upgrade - "A" 'guix-output-list-mark-upgrades - "d" 'guix-output-list-mark-delete - "gd" 'guix-output-list-edit - "i" 'guix-output-list-mark-install - - ;; mark - "x" 'guix-output-list-execute) - - (evil-collection-guix-set guix-package-info-mode-map) - (evil-collection-define-key 'normal 'guix-package-info-mode-map - "gG" 'guix-package-info-graph - "gl" 'guix-package-info-lint - "gs" 'guix-package-info-size - - "a" 'guix-package-info-upgrade - "d" 'guix-package-info-delete - "gd" 'guix-package-info-edit - "i" 'guix-package-info-install) - - (evil-collection-guix-set guix-profile-list-mode-map) - (evil-collection-define-key 'normal 'guix-profile-list-mode-map - (kbd "RET") 'bui-list-describe - - "c" 'guix-profile-list-set-current ; TODO: Bind to "." as per the rationale? - "p" 'guix-profile-list-show-packages - "a" 'guix-profile-list-show-generations - "P" 'guix-profile-list-show-search-paths) - - (evil-collection-guix-set guix-profile-info-mode-map) - (evil-collection-define-key 'normal 'guix-profile-info-mode-map - "gm" 'guix-profile-info-apply-manifest - - "p" 'guix-profile-info-show-packages - "a" 'guix-profile-info-show-generations - "P" 'guix-profile-info-show-search-paths - "c" 'guix-profile-info-set-current) - - (evil-collection-define-key 'normal 'guix-generation-list-mode-map - (kbd "RET") 'bui-list-describe - - "p" 'guix-generation-list-show-packages - "D" 'guix-generation-list-mark-delete - "P" 'guix-generation-list-show-search-paths - "c" 'guix-generation-list-set-current - "d" 'guix-generation-list-ediff - - "+" 'guix-generation-list-show-added-packages - "-" 'guix-generation-list-show-removed-packages - "=" 'guix-generation-list-diff - - ;; mark - "x" 'guix-generation-list-execute) - - (evil-collection-guix-set guix-license-list-mode-map) - (evil-collection-define-key 'normal 'guix-license-list-mode-map - (kbd "") 'forward-button ; Why isn't this binding inhibited? - (kbd "RET") 'bui-list-describe - - "p" 'guix-license-list-show-packages - "gd" 'guix-license-list-edit) - - (evil-collection-guix-set guix-license-info-mode-map) - - (evil-collection-guix-set guix-location-list-mode-map) - (evil-collection-define-key 'normal 'guix-location-list-mode-map - (kbd "RET") 'guix-location-list-show-packages ; In Emacs state, it seems to be overriden by `push-button'. - - "p" 'guix-location-list-show-packages - "gd" 'guix-location-list-edit) - - (evil-collection-guix-set guix-store-item-list-mode-map) - (evil-collection-define-key 'normal 'guix-store-item-list-mode-map - (kbd "RET") 'bui-list-describe - "d" 'guix-store-item-list-mark-delete - "gd" 'guix-store-item-list-edit - "x" 'guix-store-item-list-execute) - - (evil-collection-guix-set guix-store-item-info-mode-map) - - (evil-collection-guix-set guix-hydra-build-list-mode-map) - (evil-collection-define-key 'normal 'guix-hydra-build-list-mode-map - (kbd "RET") 'bui-list-describe - - "gb" 'guix-hydra-build-list-latest-builds - "gl" 'guix-hydra-build-list-view-log) - - (evil-collection-guix-set guix-hydra-build-info-mode-map) - - (evil-collection-set-readonly-bindings 'guix-build-log-mode-map) - (evil-collection-define-key 'normal 'guix-build-log-mode-map - ;; motion - (kbd "SPC") 'scroll-up-command - (kbd "S-SPC") 'scroll-down-command - (kbd "") 'guix-build-log-phase-toggle - (kbd "") 'guix-build-log-phase-toggle-all - - "gk" 'guix-build-log-previous-phase - "gj" 'guix-build-log-next-phase - "[[" 'guix-build-log-previous-phase - "]]" 'guix-build-log-next-phase - (kbd "C-k") 'guix-build-log-previous-phase - (kbd "C-j") 'guix-build-log-next-phase - - "gr" 'revert-buffer - - ;; repl - "gz" 'guix-switch-to-repl) - - (evil-collection-guix-set guix-service-list-mode-map) - (evil-collection-define-key 'normal 'guix-service-list-mode-map - (kbd "") 'forward-button - (kbd "RET") 'bui-list-describe - - "gd" 'guix-service-list-edit) - - (evil-collection-define-key 'normal 'guix-devel-mode-map - ;; repl - "gz" 'guix-switch-to-repl)) - -(provide 'evil-collection-guix) -;;; evil-collection-guix.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/hackernews/evil-collection-hackernews.el b/.config/emacs/lisp/evil-collection/modes/hackernews/evil-collection-hackernews.el deleted file mode 100644 index 2be994b..0000000 --- a/.config/emacs/lisp/evil-collection/modes/hackernews/evil-collection-hackernews.el +++ /dev/null @@ -1,63 +0,0 @@ -;;; evil-collection-hackernews.el --- Evil bindings for hackernews-mode -*- lexical-binding: t -*- - -;; Copyright (C) 2018 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, news, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for hackernews. - -;;; Code: -(require 'evil-collection) -(require 'hackernews nil t) - -(defconst evil-collection-hackernews-maps '(hackernews-mode-map - hackernews-button-map)) - -;;;###autoload -(defun evil-collection-hackernews-setup () - "Set up `evil' bindings for `hackernews-mode'." - (evil-collection-set-readonly-bindings 'hackernews-mode-map) - (evil-collection-define-key 'normal 'hackernews-mode-map - "]]" 'hackernews-next-item - "[[" 'hackernews-previous-item - "gj" 'hackernews-next-item - "gk" 'hackernews-previous-item - (kbd "C-j") 'hackernews-next-item - (kbd "C-k") 'hackernews-previous-item - - "+" 'hackernews-load-more-stories - - "gr" 'hackernews-reload - "gf" 'hackernews-switch-feed - - (kbd "") 'hackernews-next-comment - (kbd "S-") 'hackernews-previous-comment - - "!" 'hackernews-button-mark-as-visited ; like mu4e - "?" 'hackernews-button-mark-as-unvisited - - (kbd "RET") 'hackernews-button-browse-internal - (kbd "S-") 'push-button)) - -(provide 'evil-collection-hackernews) -;;; evil-collection-hackernews.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/helm/README.org b/.config/emacs/lisp/evil-collection/modes/helm/README.org deleted file mode 100644 index 95a3946..0000000 --- a/.config/emacs/lisp/evil-collection/modes/helm/README.org +++ /dev/null @@ -1,107 +0,0 @@ -* helm - - Evil bindings for [[https://emacs-helm.github.io/helm/][helm]]. - - =M-= modifiers are preferred over =C-= so the help prefix (=C-h=) is left - alone. =h= and =l= are reserved for minibuffer editing in =helm-find-files= - and =helm-read-file-map=. - -** Key bindings - -*** helm-map (insert and normal state unless noted) - - | Command | Original | Evil | - |----------------------------------+----------+--------------| - | =helm-previous-source= | =C-o= | =M-[= | - | =helm-next-source= | =C-o= | =M-]=, =C-o= | - | =helm-execute-persistent-action= | =C-j= | =M-l= | - | =helm-next-line= | =C-n= | =M-j=, =C-n= | - | =helm-previous-line= | =C-p= | =M-k=, =C-p= | - | =helm-next-page= | =C-v= | =C-f=, =C-v= | - | =helm-previous-page= | =M-v= | =C-b=, =M-v= | - | =helm-maybe-exit-minibuffer= | =RET= | =RET= | - -*** helm-map (normal state only) - - | Command | Original | Evil | - |--------------------------------+-----------+-------------------------------------| - | =helm-select-action= | =TAB= | == | - | =helm-previous-source= | =C-o= | =[[=, =gk= | - | =helm-next-source= | =C-o= | =]]=, =gj= | - | =helm-prev-visible-mark= | =M-(= | =(= | - | =helm-next-visible-mark= | =M-)= | =)= | - | =helm-next-line= | =C-n= | =j= | - | =helm-previous-line= | =C-p= | =k= | - | =helm-beginning-of-buffer= | =M-<= | =gg= | - | =helm-end-of-buffer= | =M->= | =G= | - | =helm-quit-and-find-file= | =C-x C-f= | =/= | - | =helm-refresh= | =C-c C-u= | =gr= | - | =helm-yank-selection= | =C-c C-y= | =yp= | - | =helm-copy-to-buffer= | n/a | =yP= | - | =helm-kill-selection-and-quit= | =C-c C-k= | =yy= | - | =helm-toggle-visible-mark= | =C-SPC= | =SPC= | - | =helm-previous-page= | =M-v= | =C-u= (when =evil-want-C-u-scroll=) | - | =helm-next-page= | =C-v= | =C-d= (when =evil-want-C-d-scroll=) | - -*** helm-find-files-map / helm-read-file-map - - | Command | State | Original | Evil | - |-----------------------------------+----------------+----------+--------------| - | =helm-ff-run-switch-other-window= | normal | =C-c o= | =go= | - | =helm-ff-run-switch-other-window= | insert, normal | =C-c o= | =S-= | - | =helm-ff-run-find-sh-command= | normal | =C-c /= | =/= | - | =helm-find-files-up-one-level= | insert, normal | =C-l= | =M-h= | - -*** helm-find-files-map (normal state) - - | Command | Original | Evil | - |------------------------------------+----------+------| - | =helm-ff-run-ediff-file= | =C-c = | === | - | =helm-ff-run-query-replace-regexp= | =M-%= | =%= | - | =helm-ff-run-delete-file= | =M-D= | =D= | - -*** helm-generic-files-map - - | Command | State | Original | Evil | - |-----------------------------------+----------------+----------+--------------| - | =helm-ff-run-switch-other-window= | insert, normal | =C-c o= | =S-= | - | =helm-ff-run-switch-other-window= | normal | =C-c o= | =go= | - -*** helm-buffer-map - - | Command | State | Original | Evil | - |----------------------------------------+----------------+----------+--------------| - | =helm-buffer-switch-other-window= | insert, normal | =C-c o= | =S-= | - | =display-buffer= | insert, normal | n/a | =M-= | - | =helm-buffer-switch-other-window= | normal | =C-c o= | =go= | - | =display-buffer= | normal | n/a | =gO= | - | =helm-buffer-run-ediff= | normal | =C-c = | === | - | =helm-buffer-run-query-replace-regexp= | normal | =M-%= | =%= | - | =helm-buffer-run-kill-persistent= | normal | =C-c d= | =D= | - -*** helm-occur-map / helm-grep-map - - | Command | State | Original | Evil | - |---------------------------------------------------------------------+----------------+----------+--------------| - | =helm-occur-run-goto-line-ow= / =helm-grep-run-other-window-action= | insert, normal | =C-c o= | =S-= | - | same as above | normal | =C-c o= | =go= | - -*** helm-occur-mode-map / helm-grep-mode-map (normal state) - - | Command | Original | Evil | - |-----------------------------------------------------+----------+-------------| - | =helm-occur-mode-goto-line= / =helm-grep-mode-jump= | =RET= | =RET= | - | =...-goto-line-ow= / =...-jump-other-window= | =C-o= | =C-o=, =go= | - | =...-forward= variant | =M-n= | =M-n=, =gj= | - | =...-backward= variant | =M-p= | =M-p=, =gk= | - | =helm-gm-next-file= | =M-N= | =M-N= | - | =helm-gm-precedent-file= | =M-P= | =M-P= | - -** Notes - - - =helm-minibuffer-history-key= is set to =M-p= via =custom-set-variables=. - - =helm-default-prompt-display-function= is set so the evil cursor renders - correctly in helm's header line when =helm-echo-input-in-header-line= is - non-nil. - - =evil-collection-helm-hide-minibuffer-maybe= is added to - =helm-minibuffer-set-up-hook= to hide the minibuffer cursor in that case. diff --git a/.config/emacs/lisp/evil-collection/modes/helm/evil-collection-helm.el b/.config/emacs/lisp/evil-collection/modes/helm/evil-collection-helm.el deleted file mode 100644 index 0e82ee8..0000000 --- a/.config/emacs/lisp/evil-collection/modes/helm/evil-collection-helm.el +++ /dev/null @@ -1,238 +0,0 @@ -;;; evil-collection-helm.el --- Evil bindings for Helm -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, helm, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for Helm. - -;;; Code: -(require 'evil-collection) -(require 'helm-files nil t) ; TODO: Check if this is the ideal requirement and if we are not loading too much. - -;; To navigate Helm entries with in insert state, we need a modifier. -;; Using the C- modifier would conflict with the help prefix "C-h". So we use -;; M- prefixed bindings instead. - -;; Helm-find-files: We cannot use "h" and "l" in normal state to navigate up and -;; down the file system hierarchy since we need them to use it to edit the -;; minibuffer content. - -(defvar helm-map) -(defvar helm-find-files-map) -(defvar helm-generic-files-map) -(defvar helm-buffer-map) -(defvar helm-occur-map) -(defvar helm-grep-map) -(defvar helm-read-file-map) -(defvar helm-occur-mode-map) -(defvar helm-grep-mode-map) -(defvar helm-echo-input-in-header-line) -(defvar helm--prompt) -(defvar helm--action-prompt) -(defvar helm-header-line-space-before-prompt) -(defvar helm-default-prompt-display-function) - -(declare-function helm-window "helm-lib") - -(defconst evil-collection-helm-maps '(help-map - help-find-files-map - helm-read-file-map - helm-generic-files-map - helm-buffer-map - helm-occur-map - helm-grep-map)) - -;; From https://github.com/emacs-helm/helm/issues/362. -;; Also see https://emacs.stackexchange.com/questions/17058/change-cursor-type-in-helm-header-line#17097. -;; TODO: With Evil, the cursor type is not right in the header line and the evil -;; cursor remains in the minibuffer. Visual selections also reveal overlayed -;; text. -(with-no-warnings - (defun evil-collection-helm-hide-minibuffer-maybe () - "Hide text in minibuffer when `helm-echo-input-in-header-line' is non-nil." - (when (with-current-buffer (helm-buffer-get) helm-echo-input-in-header-line) - (let ((ov (make-overlay (point-min) (point-max) nil nil t))) - (overlay-put ov 'window (selected-window)) - (overlay-put ov 'face (let ((bg-color (face-background 'default nil))) - `(:background ,bg-color :foreground ,bg-color))) - (setq-local cursor-type nil))))) - -(defun evil-collection-helm--set-prompt-display (pos) - (let (beg state region-active m) - (with-selected-window (minibuffer-window) - (setq beg (save-excursion (vertical-motion 0 (helm-window)) (point)) - state evil-state - region-active (region-active-p) - m (mark t))) - (when region-active - (setq m (- m beg)) - ;; Increment pos to handle the space before prompt (i.e `pref'). - (put-text-property (1+ (min m pos)) (+ 2 (max m pos)) - 'face - (list :background (face-background 'region)) - header-line-format)) - (put-text-property - ;; Increment pos to handle the space before prompt (i.e `pref'). - (+ 1 pos) (+ 2 pos) - 'face - (if (eq state 'insert) - 'underline - ;; Don't just use 'cursor, this can hide the current character. - (list :inverse-video t - :foreground (face-background 'cursor) - :background (face-background 'default))) - header-line-format))) - - -;;;###autoload -(defun evil-collection-helm-setup () - "Set up `evil' bindings for `helm'." - (add-hook 'helm-minibuffer-set-up-hook 'evil-collection-helm-hide-minibuffer-maybe) - (setq helm-default-prompt-display-function 'evil-collection-helm--set-prompt-display) - (custom-set-variables - '(helm-minibuffer-history-key "M-p")) - - (evil-collection-define-key '(insert normal) 'helm-map - (kbd "M-[") 'helm-previous-source - (kbd "M-]") 'helm-next-source - (kbd "M-l") 'helm-execute-persistent-action - (kbd "M-j") 'helm-next-line - (kbd "M-k") 'helm-previous-line - (kbd "C-f") 'helm-next-page - (kbd "C-b") 'helm-previous-page) - - (dolist (map '(helm-find-files-map helm-read-file-map)) - (evil-collection-define-key 'normal map - "go" 'helm-ff-run-switch-other-window - "/" 'helm-ff-run-find-sh-command) - (evil-collection-define-key '(insert normal) map - (kbd "S-") 'helm-ff-run-switch-other-window - (kbd "M-h") 'helm-find-files-up-one-level)) - - ;; TODO: Change the Helm header to display "M-l" instead of "C-l". We don't - ;; want to modify the Emacs Helm map. - - (evil-collection-define-key '(insert normal) 'helm-generic-files-map - (kbd "S-") 'helm-ff-run-switch-other-window) - - (evil-collection-define-key '(insert normal) 'helm-buffer-map - (kbd "S-") 'helm-buffer-switch-other-window - (kbd "M-") 'display-buffer) - - (evil-collection-define-key '(insert normal) 'helm-occur-map - (kbd "S-") 'helm-occur-run-goto-line-ow) - - (evil-collection-define-key '(insert normal) 'helm-grep-map - (kbd "S-") 'helm-grep-run-other-window-action) - - (evil-collection-define-key 'normal 'helm-generic-files-map - "go" 'helm-ff-run-switch-other-window) - - (evil-collection-define-key 'normal 'helm-buffer-map - "go" 'helm-buffer-switch-other-window - "gO" 'display-buffer - "=" 'helm-buffer-run-ediff - "%" 'helm-buffer-run-query-replace-regexp - "D" 'helm-buffer-run-kill-persistent ; Ivy has "D". - ) - - (evil-collection-define-key 'normal 'helm-occur-map - "go" 'helm-occur-run-goto-line-ow) - - (evil-collection-define-key 'normal 'helm-grep-map - "go" 'helm-grep-run-other-window-action) - - (evil-collection-define-key 'normal 'helm-find-files-map - "=" 'helm-ff-run-ediff-file - "%" 'helm-ff-run-query-replace-regexp - "D" 'helm-ff-run-delete-file) ; Ivy has "D". - - ;; These helm bindings should always exist, the evil equivalents do - ;; nothing useful in the minibuffer (error or pure failure). - ;; RET can't do a second line in the minibuffer. - ;; The C-n/C-p completions error with 'helm in helm' session. - ;; C-o switches to evil state (again, not useful). - (evil-collection-define-key '(insert normal) 'helm-map - (kbd "RET") 'helm-maybe-exit-minibuffer - (kbd "M-v") 'helm-previous-page - (kbd "C-v") 'helm-next-page - (kbd "C-p") 'helm-previous-line - (kbd "C-n") 'helm-next-line - (kbd "C-o") 'helm-next-source) - - (when evil-want-C-u-scroll - (evil-collection-define-key 'normal 'helm-map - (kbd "C-u") 'helm-previous-page)) - - (when evil-want-C-d-scroll - (evil-collection-define-key 'normal 'helm-map - (kbd "C-d") 'helm-next-page)) - - (evil-collection-define-key 'normal 'helm-map - (kbd "") 'helm-select-action ; TODO: Ivy has "ga". - (kbd "[[") 'helm-previous-source - (kbd "]]") 'helm-next-source - "gk" 'helm-previous-source - "gj" 'helm-next-source - (kbd "(") 'helm-prev-visible-mark - (kbd ")") 'helm-next-visible-mark - "j" 'helm-next-line - "k" 'helm-previous-line - "gg" 'helm-beginning-of-buffer - "G" 'helm-end-of-buffer - - "/" 'helm-quit-and-find-file - - ;; refresh - "gr" 'helm-refresh - - "yp" 'helm-yank-selection - "yP" 'helm-copy-to-buffer - "yy" 'helm-kill-selection-and-quit - (kbd "SPC") 'helm-toggle-visible-mark) - - (evil-collection-define-key 'normal 'helm-occur-mode-map - (kbd "RET") 'helm-occur-mode-goto-line - (kbd "C-o") 'helm-occur-mode-goto-line-ow - (kbd "M-n") 'helm-occur-mode-goto-line-ow-forward - (kbd "M-p") 'helm-occur-mode-goto-line-ow-backward - "go" 'helm-occur-mode-goto-line-ow - "gj" 'helm-occur-mode-goto-line-ow-forward - "gk" 'helm-occur-mode-goto-line-ow-backward - (kbd "M-N") 'helm-gm-next-file - (kbd "M-P") 'helm-gm-precedent-file) - - (evil-collection-define-key 'normal 'helm-grep-mode-map - (kbd "RET") 'helm-grep-mode-jump - (kbd "C-o") 'helm-grep-mode-jump-other-window - (kbd "M-n") 'helm-grep-mode-jump-other-window-forward - (kbd "M-p") 'helm-grep-mode-jump-other-window-backward - "go" 'helm-grep-mode-jump-other-window - "gj" 'helm-grep-mode-jump-other-window-forward - "gk" 'helm-grep-mode-jump-other-window-backward - (kbd "M-N") 'helm-gm-next-file - (kbd "M-P") 'helm-gm-precedent-file)) - -(provide 'evil-collection-helm) -;;; evil-collection-helm.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/help/README.org b/.config/emacs/lisp/evil-collection/modes/help/README.org deleted file mode 100644 index ab65337..0000000 --- a/.config/emacs/lisp/evil-collection/modes/help/README.org +++ /dev/null @@ -1,23 +0,0 @@ -* help - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Help-Mode.html][help-mode]]. - -** Key bindings - - | Command | Original | Evil | - |-----------------------+----------------+----------------------| - | =scroll-up-command= | =SPC= | =SPC=, =C-f= | - | =scroll-down-command= | =S-SPC=, =DEL= | =S-SPC=, =C-b= | - | =forward-button= | =TAB= | =TAB=, =g TAB=, =g]= | - | =backward-button= | =S-TAB= | =S-TAB=, =g[= | - | =help-go-back= | =l= | =C-o=, =<= | - | =help-go-forward= | =r= | =C-i=, =>= | - | =push-button= | n/a | =go=, =gO= | - | =describe-mode= | =h=, =?= | =g?= | - | =revert-buffer= | =g= | =gr= | - | =help-follow= | n/a | =r= | - | =help-view-source= | =s= | =s= | - | =help-goto-info= | =i= | =i= | - | =help-customize= | =c= | =c= | - - The last three require Emacs 28+. diff --git a/.config/emacs/lisp/evil-collection/modes/help/evil-collection-help.el b/.config/emacs/lisp/evil-collection/modes/help/evil-collection-help.el deleted file mode 100644 index 6616bac..0000000 --- a/.config/emacs/lisp/evil-collection/modes/help/evil-collection-help.el +++ /dev/null @@ -1,80 +0,0 @@ -;;; evil-collection-help.el --- Evil bindings for help-mode -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, help, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `help-mode'. - -;;; Code: -(require 'evil-collection) -(require 'help-mode) - -(defconst evil-collection-help-maps '(help-mode-map)) - -;;;###autoload -(defun evil-collection-help-setup () - "Set up `evil' bindings for `help'." - (evil-set-initial-state 'help-mode 'normal) - (evil-collection-set-readonly-bindings 'help-mode-map) - (evil-collection-define-key 'normal 'help-mode-map - ;; motion - (kbd "SPC") 'scroll-up-command - (kbd "S-SPC") 'scroll-down-command - (kbd "C-f") 'scroll-up-command - (kbd "C-b") 'scroll-down-command - (kbd "") 'forward-button - (kbd "") 'backward-button - ;; This exists because is recognized as C-i on terminals. - (kbd "g TAB") 'forward-button - "g]" 'forward-button - "g[" 'backward-button - - (kbd "C-o") 'help-go-back - (kbd "C-i") 'help-go-forward - - ;; TODO: Enable more help-go-* bindings? - ;; "gj" 'help-go-forward - ;; "gk" 'help-go-back - ;; "\C-j" 'help-go-forward - ;; "\C-k" 'help-go-back - - ;; The following bindings don't do what they are supposed to. "go" should open - ;; in the same window and "gO" should open in a different one. - "go" 'push-button - "gO" 'push-button - - "g?" 'describe-mode - "gr" 'revert-buffer - "<" 'help-go-back - ">" 'help-go-forward - "r" 'help-follow) - - (when (>= emacs-major-version 28) - (evil-collection-define-key 'normal 'help-mode-map - "s" 'help-view-source - "i" 'help-goto-info - "c" 'help-customize))) - -(provide 'evil-collection-help) -;;; evil-collection-help.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/helpful/README.org b/.config/emacs/lisp/evil-collection/modes/helpful/README.org deleted file mode 100644 index 8d41b3d..0000000 --- a/.config/emacs/lisp/evil-collection/modes/helpful/README.org +++ /dev/null @@ -1,19 +0,0 @@ -* helpful - - Evil bindings for [[https://github.com/Wilfred/helpful][helpful]]. - - Standard motion / quit bindings come from =evil-collection-set-readonly-bindings= - and are not repeated below. - -** Key bindings - -*** helpful-mode-map (normal state) - - | Command | Original | Evil | - |---------------------------+-------------+-------------| - | =forward-button= | =TAB=, =n= | == | - | =backward-button= | == | == | - | =helpful-visit-reference= | =RET= | =RET= | - | =push-button= | n/a | =go=, =gO= | - | =describe-mode= | n/a | =g?= | - | =helpful-update= | =g= | =gr= | diff --git a/.config/emacs/lisp/evil-collection/modes/helpful/evil-collection-helpful.el b/.config/emacs/lisp/evil-collection/modes/helpful/evil-collection-helpful.el deleted file mode 100644 index 58b8af7..0000000 --- a/.config/emacs/lisp/evil-collection/modes/helpful/evil-collection-helpful.el +++ /dev/null @@ -1,54 +0,0 @@ -;;; evil-collection-helpful.el --- Evil bindings for helpful-mode -*- lexical-binding: t -*- - -;; Copyright (C) 2018 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, help, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `helpful-mode'. - -;;; Code: -(require 'evil-collection) -(require 'helpful nil t) - -(defconst evil-collection-helpful-maps '(helpful-mode-map)) - -;;;###autoload -(defun evil-collection-helpful-setup () - "Set up `evil' bindings for `helpful'." - (evil-collection-set-readonly-bindings 'helpful-mode-map) - (evil-collection-define-key 'normal 'helpful-mode-map - ;; motion - (kbd "") 'forward-button - (kbd "") 'backward-button - (kbd "RET") 'helpful-visit-reference - - ;; The following bindings don't do what they are supposed to. "go" should open - ;; in the same window and "gO" should open in a different one. - "go" 'push-button - "gO" 'push-button - - "g?" 'describe-mode - "gr" 'helpful-update)) - -(provide 'evil-collection-helpful) -;;; evil-collection-helpful.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/hg-histedit/evil-collection-hg-histedit.el b/.config/emacs/lisp/evil-collection/modes/hg-histedit/evil-collection-hg-histedit.el deleted file mode 100644 index 6ee6f74..0000000 --- a/.config/emacs/lisp/evil-collection/modes/hg-histedit/evil-collection-hg-histedit.el +++ /dev/null @@ -1,49 +0,0 @@ -;;; evil-collection-hg-histedit.el --- Bindings for `hg-histedit' -*- lexical-binding: t -*- - -;; Copyright (C) 2019 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `hg-histedit'. - -;;; Code: -(require 'evil-collection) -(require 'hg-histedit nil t) - -(defconst evil-collection-hg-histedit-maps '(hg-histedit-mode-map)) - -;;;###autoload -(defun evil-collection-hg-histedit-setup () - "Set up `evil' bindings for `hg-histedit'." - (evil-collection-define-key 'normal 'hg-histedit-mode-map - "e" 'hg-histedit-modify-commit-with-edit - "m" 'hg-histedit-modify-commit-with-mess - "p" 'hg-histedit-modify-commit-with-pick - "b" 'hg-histedit-modify-commit-with-base - "d" 'hg-histedit-modify-commit-with-drop - "f" 'hg-histedit-modify-commit-with-fold - "r" 'hg-histedit-modify-commit-with-roll - "u" 'hg-histedit-undo)) - -(provide 'evil-collection-hg-histedit) -;;; evil-collection-hg-histedit.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/hideshow/README.org b/.config/emacs/lisp/evil-collection/modes/hideshow/README.org deleted file mode 100644 index 5599606..0000000 --- a/.config/emacs/lisp/evil-collection/modes/hideshow/README.org +++ /dev/null @@ -1,11 +0,0 @@ -* hideshow - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Hideshow.html][hideshow]] (=hs-minor-mode=). Standard fold operations - (=zo=, =zc=, =zr=, =zm=, =zR=, =zM=, =za=) are provided by evil itself via - =evil-fold-list=; this module adds the missing level-hide binding. - -** Key bindings - - | Command | Original | Evil | - |-----------------+-------------+------| - | =hs-hide-level= | =C-c @ C-l= | =zL= | diff --git a/.config/emacs/lisp/evil-collection/modes/hideshow/evil-collection-hideshow.el b/.config/emacs/lisp/evil-collection/modes/hideshow/evil-collection-hideshow.el deleted file mode 100644 index ba27d84..0000000 --- a/.config/emacs/lisp/evil-collection/modes/hideshow/evil-collection-hideshow.el +++ /dev/null @@ -1,45 +0,0 @@ -;;; evil-collection-hideshow --- Bindings for `hideshow' -*- lexical-binding: t; -*- - -;; Copyright (C) 2025 Julian Hoch - -;; Author: Julian Hoch -;; Maintainer: Julian Hoch -;; Created: 2025-09-27 -;; Keywords: evil, emacs, tools -;; URL: https://github.com/emacs-evil/evil-collection - -;; This file is not part of GNU Emacs. - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `hideshow'. - -;;; Code: -(require 'evil-collection) -(require 'hideshow nil t) - -(declare-function hs-hide-level "hideshow") -(defvar hs-minor-mode-map) -(defconst evil-collection-hideshow-maps '(hs-minor-mode-map)) - -;;;###autoload -(defun evil-collection-hideshow-setup () - "Set up `evil' bindings for `hideshow'." - (evil-set-initial-state 'hs-minor-mode 'normal) - (evil-collection-define-key 'normal 'hs-minor-mode-map - "zL" 'hs-hide-level)) - -(provide 'evil-collection-hideshow) -;;; evil-collection-hideshow.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/hungry-delete/evil-collection-hungry-delete.el b/.config/emacs/lisp/evil-collection/modes/hungry-delete/evil-collection-hungry-delete.el deleted file mode 100644 index 10b9b4c..0000000 --- a/.config/emacs/lisp/evil-collection/modes/hungry-delete/evil-collection-hungry-delete.el +++ /dev/null @@ -1,60 +0,0 @@ -;;; evil-collection-hungry-delete.el --- Bindings for `hungry-delete' -*- lexical-binding: t -*- - -;; Copyright (C) 2019 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, hungry-delete, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `hungry-delete'. - -;;; Code: -(require 'evil-collection) -(require 'hungry-delete nil t) - -(defconst evil-collection-hungry-delete-maps '(hungry-delete-mode-map)) - -(defun evil-collection-hungry-delete (f &rest args) - "Wrapper function to run `hungry-delete-backward' if -`hungry-delete-mode' is on." - (if (and (bound-and-true-p hungry-delete-mode) - (fboundp 'hungry-delete-backward)) - (hungry-delete-backward 1) - (apply f args))) - -(defun evil-collection-hungry-delete-for-join (f &rest args) - "Wrapper function to run `hungry-delete-backward' if -`hungry-delete-mode' is on." - (if (and (bound-and-true-p hungry-delete-mode) - (fboundp 'hungry-delete-backward)) - (hungry-delete-backward 1) - (funcall f args))) - -;;;###autoload -(defun evil-collection-hungry-delete-setup () - "Set up `evil' bindings for `hungry-delete'." - (advice-add 'evil-delete-backward-char - :around #'evil-collection-hungry-delete) - (advice-add 'evil-delete-backward-char-and-join - :around #'evil-collection-hungry-delete-for-join)) - -(provide 'evil-collection-hungry-delete) -;;; evil-collection-hungry-delete.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/hyrolo/evil-collection-hyrolo.el b/.config/emacs/lisp/evil-collection/modes/hyrolo/evil-collection-hyrolo.el deleted file mode 100644 index 2dd0033..0000000 --- a/.config/emacs/lisp/evil-collection/modes/hyrolo/evil-collection-hyrolo.el +++ /dev/null @@ -1,32 +0,0 @@ -;;; evil-collection-hyrolo.el --- Bindings for `hyrolo' -*- lexical-binding: t -*- - -;;; Commentary: -;;; Bindings for hyrolo. - -;;; Code: -(require 'evil-collection) -(require 'hyperbole nil t) - -(defvar hyrolo-mode-map) -(defconst evil-collection-hyrolo-maps '(hyrolo-mode-map)) - -(declare-function hyrolo-to-previous-loc "hyrolo") -(declare-function hyrolo-to-next-loc "hyrolo") -(declare-function hyrolo-overview "hyrolo") -(declare-function hyrolo-outline-show-all "hyrolo") - -(defun evil-collection-hyrolo-setup () - "Set up `evil' bindings for hyrolo." - (evil-collection-define-key 'normal 'hyrolo-mode-map - (kbd "[[") #'hyrolo-to-previous-loc - (kbd "]]") #'hyrolo-to-next-loc - (kbd "C-k") #'hyrolo-to-previous-loc - (kbd "C-j") #'hyrolo-to-next-loc - (kbd "gk") #'hyrolo-to-previous-loc - (kbd "gj") #'hyrolo-to-next-loc - (kbd "zo") #'hyrolo-outline-show-all - (kbd "zc") #'hyrolo-overview) - (evil-set-initial-state 'hyrolo-mode 'normal)) - -(provide 'evil-collection-hyrolo) -;;; evil-collection-hyrolo.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/ibuffer/README.org b/.config/emacs/lisp/evil-collection/modes/ibuffer/README.org deleted file mode 100644 index b4f7fc5..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ibuffer/README.org +++ /dev/null @@ -1,60 +0,0 @@ -* ibuffer - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Ibuffer.html][IBuffer]]. - -** Key bindings - - Most marking, filtering, and operate-on-marked commands keep their default - ibuffer keys. The table below covers what evil-collection relocates. - - | Command | Original | Evil | - |----------------------------------------------+-----------------+--------------------------------------------| - | =ibuffer-forward-line= | =n= | (default) | - | =ibuffer-backward-line= | =p= | (default) | - | =ibuffer-forward-line= (g-prefix) | n/a | =gj= | - | =ibuffer-backward-line= (g-prefix) | n/a | =gk= | - | =ibuffer-update= | =g= | =gr= | - | =ibuffer-redisplay= | =l= | =gR= | - | =ibuffer-jump-to-buffer= | =j=, =M-g= | =J=, =M-g= | - | =ibuffer-visit-buffer= | =RET=, =e=, =f= | =RET= | - | =ibuffer-visit-buffer-other-window= | =o= | =go= | - | =ibuffer-visit-buffer-other-window-noselect= | =C-o= | =C-o= | - | =ibuffer-visit-buffer-1-window= | =M-o= | =M-o= | - | =ibuffer-do-view= | =A=, =v= | =A=, =gv= | - | =ibuffer-do-view-horizontally= | =C-x v= | =gV= | - | =ibuffer-mark-forward= | =m= | =m= | - | =ibuffer-unmark-forward= | =u= | =u= | - | =ibuffer-unmark-backward= | =DEL= | =DEL= | - | =ibuffer-toggle-marks= | =t= | =t=, =~= | - | =ibuffer-unmark-all-marks= | =U= | =U= | - | =ibuffer-unmark-all= | =M-DEL= | =M-DEL= | - | =ibuffer-mark-for-delete= | =d= | =d= | - | =ibuffer-mark-for-delete-backwards= | =C-d= | =C-d= (when =evil-want-C-d-scroll= is nil) | - | =ibuffer-do-kill-on-deletion-marks= | =x= | =x= | - | =ibuffer-do-kill-lines= | =k= | =K= | - | =ibuffer-bury-buffer= | =b= | =X= | - | =ibuffer-kill-line= | =C-k= | =gx= | - | =ibuffer-yank= | =C-y= | =C-y= | - | =ibuffer-copy-filename-as-kill= | =w= | =yf= | - | =ibuffer-copy-buffername-as-kill= | =B= | =yb= | - | =ibuffer-diff-with-file= | === | === | - | =ibuffer-toggle-sorting-mode= | =,= | =,= | - | =ibuffer-invert-sorting= | =s i= | =o i= | - | =ibuffer-do-sort-by-alphabetic= | =s a= | =o a= | - | =ibuffer-do-sort-by-recency= | =s v= | =o v= | - | =ibuffer-do-sort-by-size= | =s s= | =o s= | - | =ibuffer-do-sort-by-filename/process= | =s f= | =o f= | - | =ibuffer-do-sort-by-major-mode= | =s m= | =o m= | - | =ibuffer-forward-filter-group= | =M-n=, =TAB= | =C-j=, =M-n=, =]]=, =TAB= | - | =ibuffer-backward-filter-group= | =M-p=, =S-TAB= | =C-k=, =M-p=, =[[=, =S-TAB= | - | =ibuffer-jump-to-filter-group= | =M-j= | =M-j= | - | =ibuffer-forward-next-marked= | =M-}= | =}=, =M-}= | - | =ibuffer-backwards-next-marked= | =M-{= | ={=, =M-{= | - | =ibuffer-switch-format= | =`= | =`= | - | =ibuffer-add-to-tmp-show= | =+= | =+= | - | =ibuffer-add-to-tmp-hide= | =-= | =-= | - | =quit-window= | =q= | =q=, =ZZ=, =ZQ= | - - Operate-on-marked uppercase keys (=D=, =E=, =F=, =H=, =I=, =M=, =N=, =O=, - =P=, =Q=, =R=, =S=, =T=, =V=, =W=), the =% =, =* =, =s = (filter) and - =/ = prefixes keep their default ibuffer behavior. diff --git a/.config/emacs/lisp/evil-collection/modes/ibuffer/evil-collection-ibuffer.el b/.config/emacs/lisp/evil-collection/modes/ibuffer/evil-collection-ibuffer.el deleted file mode 100644 index ccca359..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ibuffer/evil-collection-ibuffer.el +++ /dev/null @@ -1,197 +0,0 @@ -;;; evil-collection-ibuffer.el --- Evil bindings for IBuffer -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, ibuffer, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for IBuffer. - -;;; Code: -(require 'evil-collection) -(require 'ibuffer) - -(defconst evil-collection-ibuffer-maps '(ibuffer-mode-map)) - -;;;###autoload -(defun evil-collection-ibuffer-setup () - "Set up `evil' bindings for `ibuffer'." - (evil-set-initial-state 'ibuffer-mode 'normal) - - (evil-collection-define-key 'normal 'ibuffer-mode-map - (kbd "C-d") (if evil-want-C-d-scroll - 'evil-scroll-down - 'ibuffer-mark-for-delete-backwards)) - - (evil-collection-define-key 'normal 'ibuffer-mode-map - (kbd "=") 'ibuffer-diff-with-file - (kbd "J") 'ibuffer-jump-to-buffer - (kbd "M-g") 'ibuffer-jump-to-buffer - (kbd "M-s a C-s") 'ibuffer-do-isearch - (kbd "M-s a M-C-s") 'ibuffer-do-isearch-regexp - (kbd "M-s a C-o") 'ibuffer-do-occur - - ;; mark - (kbd "m") 'ibuffer-mark-forward - (kbd "~") 'ibuffer-toggle-marks - (kbd "u") 'ibuffer-unmark-forward - (kbd "DEL") 'ibuffer-unmark-backward - (kbd "M-DEL") 'ibuffer-unmark-all - (kbd "* *") 'ibuffer-mark-special-buffers - (kbd "* c") 'ibuffer-change-marks - (kbd "U") 'ibuffer-unmark-all-marks - (kbd "* M") 'ibuffer-mark-by-mode - (kbd "* m") 'ibuffer-mark-modified-buffers - (kbd "* u") 'ibuffer-mark-unsaved-buffers - (kbd "* s") 'ibuffer-mark-special-buffers - (kbd "* r") 'ibuffer-mark-read-only-buffers - (kbd "* /") 'ibuffer-mark-dired-buffers - (kbd "* e") 'ibuffer-mark-dissociated-buffers - (kbd "* h") 'ibuffer-mark-help-buffers - (kbd "* z") 'ibuffer-mark-compressed-file-buffers - (kbd ".") 'ibuffer-mark-old-buffers - - (kbd "d") 'ibuffer-mark-for-delete - (kbd "x") 'ibuffer-do-kill-on-deletion-marks - - ;; immediate operations - (kbd "gj") 'ibuffer-forward-line - (kbd "gk") 'ibuffer-backward-line - - (kbd "}") 'ibuffer-forward-next-marked - (kbd "{") 'ibuffer-backwards-next-marked - (kbd "M-}") 'ibuffer-forward-next-marked - (kbd "M-{") 'ibuffer-backwards-next-marked - - (kbd "gR") 'ibuffer-redisplay - (kbd "gr") 'ibuffer-update - - "`" 'ibuffer-switch-format - "-" 'ibuffer-add-to-tmp-hide - "+" 'ibuffer-add-to-tmp-show - "X" 'ibuffer-bury-buffer - (kbd ",") 'ibuffer-toggle-sorting-mode - (kbd "o i") 'ibuffer-invert-sorting - (kbd "o a") 'ibuffer-do-sort-by-alphabetic - (kbd "o v") 'ibuffer-do-sort-by-recency - (kbd "o s") 'ibuffer-do-sort-by-size - (kbd "o f") 'ibuffer-do-sort-by-filename/process - (kbd "o m") 'ibuffer-do-sort-by-major-mode - - (kbd "s RET") 'ibuffer-filter-by-mode - (kbd "s m") 'ibuffer-filter-by-used-mode - (kbd "s M") 'ibuffer-filter-by-derived-mode - (kbd "s n") 'ibuffer-filter-by-name - (kbd "s *") 'ibuffer-filter-by-starred-name - (kbd "s f") 'ibuffer-filter-by-filename - (kbd "s b") 'ibuffer-filter-by-basename - (kbd "s .") 'ibuffer-filter-by-file-extension - (kbd "s <") 'ibuffer-filter-by-size-lt - (kbd "s >") 'ibuffer-filter-by-size-gt - (kbd "s i") 'ibuffer-filter-by-modified - (kbd "s v") 'ibuffer-filter-by-visiting-file - (kbd "s c") 'ibuffer-filter-by-content - (kbd "s e") 'ibuffer-filter-by-predicate - - (kbd "s r") 'ibuffer-switch-to-saved-filters - (kbd "s a") 'ibuffer-add-saved-filters - (kbd "s x") 'ibuffer-delete-saved-filters - (kbd "s d") 'ibuffer-decompose-filter - (kbd "s s") 'ibuffer-save-filters - (kbd "s p") 'ibuffer-pop-filter - (kbd "s ") 'ibuffer-pop-filter - (kbd "s !") 'ibuffer-negate-filter - (kbd "s t") 'ibuffer-exchange-filters - (kbd "s TAB") 'ibuffer-exchange-filters - (kbd "s o") 'ibuffer-or-filter - (kbd "s |") 'ibuffer-or-filter - (kbd "s &") 'ibuffer-and-filter - (kbd "s g") 'ibuffer-filters-to-filter-group - (kbd "s P") 'ibuffer-pop-filter-group - (kbd "s S-") 'ibuffer-pop-filter-group - (kbd "s D") 'ibuffer-decompose-filter-group - (kbd "s /") 'ibuffer-filter-disable - - (kbd "C-j") 'ibuffer-forward-filter-group - (kbd "M-n") 'ibuffer-forward-filter-group - (kbd "]]") 'ibuffer-forward-filter-group - "\t" 'ibuffer-forward-filter-group - (kbd "M-p") 'ibuffer-backward-filter-group - (kbd "C-k") 'ibuffer-backward-filter-group - (kbd "[[") 'ibuffer-backward-filter-group - [backtab] 'ibuffer-backward-filter-group - (kbd "M-j") 'ibuffer-jump-to-filter-group - (kbd "gx") 'ibuffer-kill-line - (kbd "C-y") 'ibuffer-yank - (kbd "s S") 'ibuffer-save-filter-groups - (kbd "s R") 'ibuffer-switch-to-saved-filter-groups - (kbd "s X") 'ibuffer-delete-saved-filter-groups - (kbd "s \\") 'ibuffer-clear-filter-groups - - (kbd "% n") 'ibuffer-mark-by-name-regexp - (kbd "% m") 'ibuffer-mark-by-mode-regexp - (kbd "% f") 'ibuffer-mark-by-file-name-regexp - (kbd "% g") 'ibuffer-mark-by-content-regexp - (kbd "% L") 'ibuffer-mark-by-locked - - (kbd "C-t") 'ibuffer-visit-tags-table - - (kbd "|") 'ibuffer-do-shell-command-pipe - (kbd "!") 'ibuffer-do-shell-command-file - (kbd "t") 'ibuffer-toggle-marks - ;; marked operations - (kbd "A") 'ibuffer-do-view - (kbd "D") 'ibuffer-do-delete - (kbd "E") 'ibuffer-do-eval - (kbd "F") 'ibuffer-do-shell-command-file - (kbd "I") 'ibuffer-do-query-replace-regexp - (kbd "H") 'ibuffer-do-view-other-frame - (kbd "N") 'ibuffer-do-shell-command-pipe-replace - (kbd "M") 'ibuffer-do-toggle-modified - (kbd "O") 'ibuffer-do-occur - (kbd "P") 'ibuffer-do-print - (kbd "Q") 'ibuffer-do-query-replace - (kbd "R") 'ibuffer-do-rename-uniquely - (kbd "S") 'ibuffer-do-save - (kbd "T") 'ibuffer-do-toggle-read-only - (kbd "r") 'ibuffer-do-replace-regexp - (kbd "V") 'ibuffer-do-revert - (kbd "W") 'ibuffer-do-view-and-eval - - (kbd "K") 'ibuffer-do-kill-lines - (kbd "yf") 'ibuffer-copy-filename-as-kill - (kbd "yb") 'ibuffer-copy-buffername-as-kill - - (kbd "RET") 'ibuffer-visit-buffer - (kbd "go") 'ibuffer-visit-buffer-other-window - (kbd "C-o") 'ibuffer-visit-buffer-other-window-noselect - (kbd "M-o") 'ibuffer-visit-buffer-1-window - (kbd "gv") 'ibuffer-do-view - (kbd "gV") 'ibuffer-do-view-horizontally - - ;; Quit - "q" 'quit-window - "ZZ" 'quit-window - "ZQ" 'quit-window)) - -(provide 'evil-collection-ibuffer) -;;; evil-collection-ibuffer.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/ielm/README.org b/.config/emacs/lisp/evil-collection/modes/ielm/README.org deleted file mode 100644 index f7ce241..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ielm/README.org +++ /dev/null @@ -1,22 +0,0 @@ -* ielm - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Lisp-Interaction.html][IELM]] (Inferior Emacs Lisp Mode). - - Initial state is =insert=. =RET= sends input in the state named by - =evil-collection-repl-submit-state=. - -** Key bindings - - | Command | Original | Evil | - |---------------+----------+----------------------| - | =ielm-return= | =RET= | =RET= (submit state) | - -** Customization - - | Variable | Default | Purpose | - |-----------------------------------------+---------+--------------------------------------------------------| - | =evil-collection-ielm-move-cursor-back= | =nil= | Move cursor back one column when leaving insert state. | - -** Notes - - - On entering normal state, point stays put (no Vim-style backward step). diff --git a/.config/emacs/lisp/evil-collection/modes/ielm/evil-collection-ielm.el b/.config/emacs/lisp/evil-collection/modes/ielm/evil-collection-ielm.el deleted file mode 100644 index 0883bb6..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ielm/evil-collection-ielm.el +++ /dev/null @@ -1,60 +0,0 @@ -;;; evil-collection-ielm.el --- Bindings for `ielm' -*- lexical-binding: t -*- - -;; Copyright (C) 2026 Ian Pan - -;; Author: Ian Pan -;; Maintainer: Ian Pan -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, ielm, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `ielm' (Inferior Emacs Lisp Mode). - -;;; Code: -(require 'evil-collection) -(require 'ielm nil t) - -(defvar inferior-emacs-lisp-mode-map) -(defconst evil-collection-ielm-maps '(inferior-emacs-lisp-mode-map)) - -(defcustom evil-collection-ielm-move-cursor-back nil - "Whether the cursor is moved backwards when exiting insert state." - :type 'boolean - :group 'ielm) - -(defun evil-collection-ielm-escape-stay () - "Go back to normal state but don't move cursor backwards. -Moving cursor backwards is the default vim behavior but -it is not intuitive for some cases like REPL buffers." - (setq-local evil-move-cursor-back - evil-collection-ielm-move-cursor-back)) - -;;;###autoload -(defun evil-collection-ielm-setup () - "Set up `evil' bindings for `ielm'." - (evil-set-initial-state 'inferior-emacs-lisp-mode 'insert) - - (add-hook 'ielm-mode-hook #'evil-collection-ielm-escape-stay) - - (let* ((submit evil-collection-repl-submit-state)) - (evil-collection-define-key submit 'inferior-emacs-lisp-mode-map - (kbd "RET") #'ielm-return - (kbd "") #'ielm-return))) - -(provide 'evil-collection-ielm) -;;; evil-collection-ielm.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/image+/evil-collection-image+.el b/.config/emacs/lisp/evil-collection/modes/image+/evil-collection-image+.el deleted file mode 100644 index 2ff9511..0000000 --- a/.config/emacs/lisp/evil-collection/modes/image+/evil-collection-image+.el +++ /dev/null @@ -1,54 +0,0 @@ -;;; evil-collection-image+.el --- Evil bindings for image-mode with image+ -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, image, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for image-mode with image+. - -;;; Code: -(require 'evil-collection) -(require 'image+ nil t) - -(defconst evil-collection-image+-maps '(image-mode-map)) - -;;;###autoload -(defun evil-collection-image+-setup () - "Set up `evil' bindings for `image+'." - (evil-collection-define-key 'normal 'image-mode-map - ;; zoom - "+" 'imagex-sticky-zoom-in - "=" 'imagex-sticky-zoom-in - "-" 'imagex-sticky-zoom-out - "O" 'imagex-sticky-restore-original - - "M" 'imagex-sticky-maximize - "m" 'imagex-auto-adjust-mode - "S" 'imagex-sticky-save-image - "r" 'imagex-sticky-rotate-right - "R" 'imagex-sticky-rotate-left - "<" 'imagex-sticky-rotate-left ; like sxiv - ">" 'imagex-sticky-rotate-right)) ; like sxiv - -(provide 'evil-collection-image+) -;;; evil-collection-image+.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/image-dired/README.org b/.config/emacs/lisp/evil-collection/modes/image-dired/README.org deleted file mode 100644 index e9f6a05..0000000 --- a/.config/emacs/lisp/evil-collection/modes/image-dired/README.org +++ /dev/null @@ -1,31 +0,0 @@ -* image-dired - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Image_002dDired.html][image-dired-thumbnail-mode]]. - -** Key bindings - - | Command | Original | Evil | - |---------------------------------------------------+-----------+-----------| - | =image-dired-backward-image= | == | =h= | - | =image-dired-forward-image= | == | =l= | - | =image-dired-next-line= | == | =j= | - | =image-dired-previous-line= | == | =k= | - | =image-dired-display-next-thumbnail-original= | =SPC= | =SPC= | - | =image-dired-display-previous-thumbnail-original= | =DEL= | =S-SPC= | - | =image-dired-display-thumbnail-original-image= | =RET= | =RET= | - | =image-dired-comment-thumbnail= | =c= | =c= | - | =image-dired-thumbnail-set-image-description= | =D= | =d= | - | =image-dired-mark-thumb-original-file= | =m= | =m= | - | =image-dired-unmark-thumb-original-file= | =u= | =u= | - | =image-dired-delete-char= | =C-d= | =D= | - | =image-dired-rotate-thumbnail-right= | n/a | =r= | - | =image-dired-rotate-thumbnail-left= | n/a | =R= | - | =image-dired-rotate-original-left= | =L= | =<= | - | =image-dired-rotate-original-right= | =R= | =>= | - | =image-dired-tag-thumbnail= | =t t= | =tt= | - | =image-dired-tag-thumbnail-remove= | =t r= | =tr= | - | =image-dired-line-up= | =g f= | =ff= | - | =image-dired-line-up-dynamic= | =g g= | =fd= | - | =image-dired-line-up-interactive= | =g i= | =fi= | - | =quit-window= | =q= | =q=, =ZZ= | - | =evil-quit= | n/a | =ZQ= | diff --git a/.config/emacs/lisp/evil-collection/modes/image-dired/evil-collection-image-dired.el b/.config/emacs/lisp/evil-collection/modes/image-dired/evil-collection-image-dired.el deleted file mode 100644 index 4e009ac..0000000 --- a/.config/emacs/lisp/evil-collection/modes/image-dired/evil-collection-image-dired.el +++ /dev/null @@ -1,74 +0,0 @@ -;;; evil-collection-image-dired.el --- Evil bindings for image-dired-thumbnail-mode -*- lexical-binding: t -*- - -;; Copyright (C) 2018 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, dired, image, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for `image-dired-thumbnail-mode'. - -;;; Code: -(require 'evil-collection) -(require 'image-dired) - -(defconst evil-collection-image-dired-maps '(image-dired-thumbnail-mode-map)) - -;;;###autoload -(defun evil-collection-image-dired-setup () - "Set up `evil' bindings for `image-dired-thumbnail-mode'." - (evil-collection-define-key 'normal 'image-dired-thumbnail-mode-map - ;; motion - "h" 'image-dired-backward-image - "l" 'image-dired-forward-image - "j" 'image-dired-next-line - "k" 'image-dired-previous-line - - (kbd "SPC") 'image-dired-display-next-thumbnail-original - (kbd "S-SPC") 'image-dired-display-previous-thumbnail-original - (kbd "RET") 'image-dired-display-thumbnail-original-image - - "c" 'image-dired-comment-thumbnail - "d" 'image-dired-thumbnail-set-image-description - "m" 'image-dired-mark-thumb-original-file - "u" 'image-dired-unmark-thumb-original-file - "D" 'image-dired-delete-char - - ;; See image+. - "r" 'image-dired-rotate-thumbnail-right - "R" 'image-dired-rotate-thumbnail-left - "<" 'image-dired-rotate-original-left ; like sxiv - ">" 'image-dired-rotate-original-right ; like sxiv - - "tr" 'image-dired-tag-thumbnail-remove - "tt" 'image-dired-tag-thumbnail - - "ff" 'image-dired-line-up - "fd" 'image-dired-line-up-dynamic - "fi" 'image-dired-line-up-interactive - - ;; quit - "q" 'quit-window - "ZQ" 'evil-quit - "ZZ" 'quit-window)) - -(provide 'evil-collection-image-dired) -;;; evil-collection-image-dired.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/image/README.org b/.config/emacs/lisp/evil-collection/modes/image/README.org deleted file mode 100644 index 7824491..0000000 --- a/.config/emacs/lisp/evil-collection/modes/image/README.org +++ /dev/null @@ -1,36 +0,0 @@ -* image - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Image-Mode.html][image-mode]]. - -** Key bindings - - | Command | Original | Evil | - |------------------------------------+------------------+---------------------| - | =image-bob= | =<= | =gg= | - | =image-eob= | =>= | =G= | - | =image-forward-hscroll= | =C-f=, == | =l= | - | =image-backward-hscroll= | =C-b=, == | =h= | - | =image-next-line= | =C-n=, == | =j= | - | =image-previous-line= | =C-p=, == | =k= | - | =image-bol= | =C-a= | =0=, =^= | - | =image-eol= | =C-e= | =$= | - | =image-scroll-up= | =SPC= | =SPC=, =C-d= | - | =image-scroll-down= | =S-SPC=, =DEL= | =S-SPC=, == | - | =image-scroll-down= (=C-u-scroll=) | n/a | =C-u= | - | =image-toggle-animation= | =RET= | =RET= | - | =image-reset-speed= | =a 0= | =a0= | - | =image-reverse-speed= | =a r= | =ar= | - | =image-goto-frame= | =F= | =F= | - | =image-previous-frame= | =b= | =,= | - | =image-next-frame= | =f= | =.=, =;= | - | =image-decrease-speed= | n/a | ={= | - | =image-increase-speed= | n/a | =}= | - | =image-transform-fit-to-height= | =s h= | =H= | - | =image-transform-fit-to-width= | =s i= | =W= | - | =image-increase-size= | =i += | =+=, === | - | =image-decrease-size= | =i -= | =-= | - | =image-previous-file= | =p= | =[[=, =gk=, =C-k= | - | =image-next-file= | =n= | =]]=, =gj=, =C-j= | - | =image-toggle-display= | =C-c C-c= | =C-c C-c= | - | =quit-window= | =q= | =q=, =ZZ= | - | =evil-quit= | n/a | =ZQ= | diff --git a/.config/emacs/lisp/evil-collection/modes/image/evil-collection-image.el b/.config/emacs/lisp/evil-collection/modes/image/evil-collection-image.el deleted file mode 100644 index c8da183..0000000 --- a/.config/emacs/lisp/evil-collection/modes/image/evil-collection-image.el +++ /dev/null @@ -1,93 +0,0 @@ -;;; evil-collection-image.el --- Evil bindings for Image -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, bookmark, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for `image-mode'. - -;;; Code: -(require 'evil-collection) -(require 'image-mode) - -(defconst evil-collection-image-maps '(image-mode-map)) - -;;;###autoload -(defun evil-collection-image-setup () - "Set up `evil' bindings for `image-mode'." - (evil-set-initial-state 'image-mode 'normal) - - (evil-collection-define-key 'normal 'image-mode-map - ;; motion - "gg" 'image-bob - "G" 'image-eob - [remap evil-forward-char] 'image-forward-hscroll - [remap evil-backward-char] 'image-backward-hscroll - [remap evil-next-line] 'image-next-line - [remap evil-previous-line] 'image-previous-line - "0" 'image-bol - "^" 'image-bol - "$" 'image-eol - (kbd "C-d") 'image-scroll-up - (kbd "SPC") 'image-scroll-up - (kbd "S-SPC") 'image-scroll-down - (kbd "") 'image-scroll-down - ;; animation - (kbd "RET") 'image-toggle-animation - "a0" 'image-reset-speed - "ar" 'image-reverse-speed - "F" 'image-goto-frame - "," 'image-previous-frame ; mplayer/mpv style - "." 'image-next-frame ; mplayer/mpv style - ";" 'image-next-frame ; Evil style - "{" 'image-decrease-speed ; mplayer/mpv style - "}" 'image-increase-speed ; mplayer/mpv style - - "H" 'image-transform-fit-to-height - "W" 'image-transform-fit-to-width - - "+" 'image-increase-size - "=" 'image-increase-size - "-" 'image-decrease-size - - "[[" 'image-previous-file - "]]" 'image-next-file - "gk" 'image-previous-file - "gj" 'image-next-file - (kbd "C-k") 'image-previous-file - (kbd "C-j") 'image-next-file - - (kbd "C-c C-c") 'image-toggle-display - - ;; quit - "q" 'quit-window - "ZQ" 'evil-quit - "ZZ" 'quit-window) - - ;; TODO: What if the user changes `evil-want-C-u-scroll' after this is run? - (when evil-want-C-u-scroll - (evil-collection-define-key 'normal 'image-mode-map - (kbd "C-u") 'image-scroll-down))) - -(provide 'evil-collection-image) -;;; evil-collection-image.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/imenu-list/evil-collection-imenu-list.el b/.config/emacs/lisp/evil-collection/modes/imenu-list/evil-collection-imenu-list.el deleted file mode 100644 index 21a54e3..0000000 --- a/.config/emacs/lisp/evil-collection/modes/imenu-list/evil-collection-imenu-list.el +++ /dev/null @@ -1,47 +0,0 @@ -;;; evil-collection-imenu-list.el --- Bindings for `imenu-list' -*- lexical-binding: t -*- - -;; Copyright (C) 2018 James Nguyen - -;; Author: Fredrik Bergroth -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `imenu-list'. - -;;; Code: -(require 'evil-collection) -(require 'imenu-list nil t) - -(defconst evil-collection-imenu-list-maps '(imenu-list-major-mode-map)) - -;;;###autoload -(defun evil-collection-imenu-list-setup () - "Set up `evil' bindings for `imenu-list'." - (evil-collection-define-key 'normal 'imenu-list-major-mode-map - (kbd "RET") 'imenu-list-goto-entry - (kbd "TAB") 'hs-toggle-hiding - "d" 'imenu-list-display-entry - "gr" 'imenu-list-refresh - "q" 'imenu-list-quit-window)) - - -(provide 'evil-collection-imenu-list) -;;; evil-collection-imenu-list.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/imenu/README.org b/.config/emacs/lisp/evil-collection/modes/imenu/README.org deleted file mode 100644 index b34a65d..0000000 --- a/.config/emacs/lisp/evil-collection/modes/imenu/README.org +++ /dev/null @@ -1,11 +0,0 @@ -* imenu - - Evil integration for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Imenu.html][imenu]]. No keymap is touched; the setup only marks - =imenu= as a non-repeatable jump command for evil's jump list and dot-repeat - machinery. - -** Notes - - - =imenu= is declared with =evil-declare-not-repeat=. - - =imenu= is given the =:jump t= command property so it integrates with - =C-o= / =C-i= and =evil-set-jump=. diff --git a/.config/emacs/lisp/evil-collection/modes/imenu/evil-collection-imenu.el b/.config/emacs/lisp/evil-collection/modes/imenu/evil-collection-imenu.el deleted file mode 100644 index ac3e905..0000000 --- a/.config/emacs/lisp/evil-collection/modes/imenu/evil-collection-imenu.el +++ /dev/null @@ -1,39 +0,0 @@ -;;; evil-collection-imenu.el --- Evil integration for `imenu' -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Jacob First - -;; Author: Jacob First -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil conveniences for `imenu'. - -;;; Code: -(require 'imenu) -(require 'evil-collection) - -;;;###autoload -(defun evil-collection-imenu-setup () - "Set up Evil integration for `imenu'." - (evil-declare-not-repeat 'imenu) - (evil-add-command-properties 'imenu :jump t)) - -(provide 'evil-collection-imenu) -;;; evil-collection-imenu.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/indent/README.org b/.config/emacs/lisp/evil-collection/modes/indent/README.org deleted file mode 100644 index 480e6d9..0000000 --- a/.config/emacs/lisp/evil-collection/modes/indent/README.org +++ /dev/null @@ -1,15 +0,0 @@ -* indent - - Evil bindings for the transient =indent-rigidly-map= used after - =indent-rigidly= (=C-x TAB=). - -** Key bindings - - | Command | Original | Evil | - |------------------------------------+-------------+------| - | =indent-rigidly-left= | == | =h= | - | =indent-rigidly-right= | == | =l= | - | =indent-rigidly-left-to-tab-stop= | =S-= | =H= | - | =indent-rigidly-right-to-tab-stop= | =S-= | =L= | - - The arrow-key bindings remain available alongside the hjkl additions. diff --git a/.config/emacs/lisp/evil-collection/modes/indent/evil-collection-indent.el b/.config/emacs/lisp/evil-collection/modes/indent/evil-collection-indent.el deleted file mode 100644 index 87a8e00..0000000 --- a/.config/emacs/lisp/evil-collection/modes/indent/evil-collection-indent.el +++ /dev/null @@ -1,48 +0,0 @@ -;;; evil-collection-indent.el --- Evil bindings for indentation -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for indentation. - -;;; Commentary: -;; - -;;; Code: -(require 'evil-collection) - -(defconst evil-collection-indent-maps '(indent-rigidly-map)) - -;;;###autoload -(defun evil-collection-indent-setup () - "Set up `evil' bindings for autoloaded files." - (evil-collection-define-key nil 'indent-rigidly-map - "h" 'indent-rigidly-left - "l" 'indent-rigidly-right - "H" 'indent-rigidly-left-to-tab-stop - "L" 'indent-rigidly-right-to-tab-stop)) - - -(provide 'evil-collection-indent) -;;; evil-collection-indent.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/indium/evil-collection-indium.el b/.config/emacs/lisp/evil-collection/modes/indium/evil-collection-indium.el deleted file mode 100644 index 943fd40..0000000 --- a/.config/emacs/lisp/evil-collection/modes/indium/evil-collection-indium.el +++ /dev/null @@ -1,110 +0,0 @@ -;;; evil-collection-indium.el --- Bindings for `indium' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: emacs, indium, javascript, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `indium'. - -;;; Code: -(require 'evil-collection) -(require 'indium nil t) - -(defconst evil-collection-indium-maps '(indium-debugger-mode-map - indium-inspector-mode-map - indium-debugger-locals-mode-map - indium-debugger-frames-mode-map - indium-interaction-mode-map - indium-repl-mode-map)) - -;;;###autoload -(defun evil-collection-indium-setup () - "Set up `evil' bindings for `indium'." - (when evil-collection-setup-debugger-keys - (evil-collection-define-key 'normal 'indium-debugger-mode-map - "n" 'indium-debugger-step-over - "i" 'indium-debugger-step-into - "o" 'indium-debugger-step-out - "c" 'indium-debugger-resume - "L" 'indium-debugger-locals - "s" 'indium-debugger-stack-frames - "q" 'indium-debugger-resume - "H" 'indium-debugger-here - "e" 'indium-debugger-evaluate - ">" 'indium-debugger-next-frame - "<" 'indium-debugger-previous-frame) - - (add-hook 'indium-debugger-mode-hook #'evil-normalize-keymaps)) - - (evil-collection-define-key 'normal 'indium-inspector-mode-map - "q" 'quit-window - (kbd "RET") 'indium-follow-link - [mouse-1] 'indium-follow-link - "L" 'indium-inspector-pop - "gr" 'indium-inspector-refresh - "gj" 'indium-inspector-next-reference - "gk" 'indium-inspector-previous-reference - (kbd "C-j") 'indium-inspector-next-reference - (kbd "C-k") 'indium-inspector-previous-reference - [tab] 'indium-inspector-next-reference - [backtab] 'indium-inspector-previous-reference) - - (evil-collection-define-key 'normal 'indium-debugger-locals-mode-map - "q" 'quit-window - "L" nil - "gr" nil) - - (evil-collection-define-key 'normal 'indium-debugger-frames-mode-map - "q" 'quit-window - [return] 'indium-follow-link - (kbd "RET") 'indium-follow-link - (kbd "gj") 'indium-debugger-frames-next-frame - (kbd "gk") 'indium-debugger-frames-previous-frame - (kbd "C-j") 'indium-debugger-frames-next-frame - (kbd "C-k") 'indium-debugger-frames-previous-frame - [tab] 'indium-debugger-frames-next-frame - [backtab] 'indium-debugger-frames-previous-frame) - - (evil-collection-define-key 'normal 'indium-interaction-mode-map - "gr" 'indium-update-script-source - "gz" 'indium-switch-to-repl-buffer) - - (when evil-collection-setup-debugger-keys - (evil-collection-define-key 'normal 'indium-interaction-mode-map - [left-fringe mouse-1] 'indium-mouse-toggle-breakpoint - [left-margin mouse-1] 'indium-mouse-toggle-breakpoint - [f5] 'indium-debugger-resume - [S-f5] 'indium-debugger-resume - [f9] 'indium-toggle-breakpoint - [f10] 'indium-debugger-step-over - [f11] 'indium-debugger-step-into - [S-f11] 'indium-debugger-step-out)) - - (evil-collection-define-key 'normal 'indium-repl-mode-map - (kbd "gj") 'indium-repl-next-input - (kbd "gk") 'indium-repl-previous-input - (kbd "C-j") 'indium-repl-next-input - (kbd "C-k") 'indium-repl-previous-input)) - -(provide 'evil-collection-indium) -;;; evil-collection-indium.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/info/README.org b/.config/emacs/lisp/evil-collection/modes/info/README.org deleted file mode 100644 index f8d168b..0000000 --- a/.config/emacs/lisp/evil-collection/modes/info/README.org +++ /dev/null @@ -1,40 +0,0 @@ -* info - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/info/index.html][Info]]. - - Uses normal state instead of motion state and rebinds movement to standard - evil keys. - -** Key bindings - - | Command | Original | Evil | - |----------------------------------------------+----------------+----------------------| - | =Info-next-reference= | =TAB= | =TAB=, =g TAB=, =g]= | - | =Info-prev-reference= | =S-TAB= | =S-TAB=, =g[= | - | =Info-help= | =h= | =M-h= | - | =Info-history-back= | =l= | =C-t=, =C-o= | - | =Info-history-forward= | =r= | =C-i= | - | =Info-scroll-up= | =SPC= | =SPC= | - | =Info-scroll-down= | =DEL=, =S-SPC= | =DEL= | - | =Info-follow-nearest-node= | =RET= | =RET=, =C-]= | - | =Info-directory= | =d= | =d= | - | =Info-up= | =^=, =u= | =u= | - | =Info-history= | =L= | =gL= | - | =Info-search= | =s= | =s= | - | =Info-search-case-sensitively= | =S= | =S= | - | =Info-index= | =i= | =i= | - | =Info-virtual-index= | =I= | =I= | - | =info-apropos= | n/a | =a= | - | =Info-nth-menu-item= | =1..9= | =g1..g9= | - | =Info-menu= | =m= | =J=, =gm= | - | =Info-goto-node= | =g= | =gG= | - | =Info-top-node= | =t=, =<= | =gt= | - | =Info-toc= | =T= | =gT= | - | =Info-follow-reference= | =f= | =gf= | - | =Info-forward-node= | =]= | =C-j= | - | =Info-backward-node= | =[= | =C-k= | - | =Info-next= | =n= | =gj= | - | =Info-prev= | =p= | =gk= | - | =Info-index-next= | =,= | =g,= | - | =Info-summary= | =?= | =g?= | - | =Info-copy-current-node-name= (=y= operator) | =c=, =w= | =yu= | diff --git a/.config/emacs/lisp/evil-collection/modes/info/evil-collection-info.el b/.config/emacs/lisp/evil-collection/modes/info/evil-collection-info.el deleted file mode 100644 index 5f4332e..0000000 --- a/.config/emacs/lisp/evil-collection/modes/info/evil-collection-info.el +++ /dev/null @@ -1,110 +0,0 @@ -;;; evil-collection-info.el --- Evil bindings for Info-mode -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, info, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; The default bindings in motion state override the standard movement keys. -;; This package uses normal state and redefines everything. - -;;; Code: -(require 'evil-collection) -(require 'info) - -(defconst evil-collection-info-maps '(Info-mode-map)) - -;;;###autoload -(defun evil-collection-info-setup () - "Set up `evil' bindings for `info-mode'." - (evil-collection-set-readonly-bindings 'Info-mode-map) - (evil-set-initial-state 'Info-mode 'normal) - (evil-collection-define-key 'normal 'Info-mode-map - (kbd "") 'Info-next-reference - (kbd "S-") 'Info-prev-reference - ;; This exists because is recognized as C-i on terminals. - (kbd "g TAB") 'Info-next-reference - "g]" 'Info-next-reference - "g[" 'Info-prev-reference - - ;; From evil-integration.el. - (kbd "M-h") 'Info-help ; "h" - (kbd "C-t") 'Info-history-back ; "l" - (kbd "C-o") 'Info-history-back - " " 'Info-scroll-up - (kbd "RET") 'Info-follow-nearest-node - (kbd "C-]") 'Info-follow-nearest-node - (kbd "DEL") 'Info-scroll-down - (kbd "C-i") 'Info-history-forward - - "d" 'Info-directory - "u" 'Info-up - "gL" 'Info-history ; "L" - "s" 'Info-search - "S" 'Info-search-case-sensitively - "i" 'Info-index - "I" 'Info-virtual-index - "a" 'info-apropos - - ;; mouse integration - [mouse-2] 'Info-mouse-follow-nearest-node - [follow-link] 'mouse-face - ;; make mac user happy - [double-wheel-left] 'Info-history-back - [double-wheel-right] 'Info-history-forward - - ;; digit arguments - "g1" 'Info-nth-menu-item - "g2" 'Info-nth-menu-item - "g3" 'Info-nth-menu-item - "g4" 'Info-nth-menu-item - "g5" 'Info-nth-menu-item - "g6" 'Info-nth-menu-item - "g7" 'Info-nth-menu-item - "g8" 'Info-nth-menu-item - "g9" 'Info-nth-menu-item - - ;; goto - "J" 'Info-menu - - "gG" 'Info-goto-node - "gm" 'Info-menu - "gt" 'Info-top-node - "gT" 'Info-toc - "gf" 'Info-follow-reference - ;; TODO: "[" and "]" are Emacs default for fine-grained browsing. - ;; We usually use "C-j"/"C-k" for that. - (kbd "C-j") 'Info-forward-node - (kbd "C-k") 'Info-backward-node - "gj" 'Info-next - "gk" 'Info-prev - - "g," 'Info-index-next - - "g?" 'Info-summary) - - ;; yu, Like eww. - (evil-collection-define-operator-key 'yank 'Info-mode-map - "u" 'Info-copy-current-node-name)) - -(provide 'evil-collection-info) -;;; evil-collection-info.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/ivy/README.org b/.config/emacs/lisp/evil-collection/modes/ivy/README.org deleted file mode 100644 index e6b0bea..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ivy/README.org +++ /dev/null @@ -1,51 +0,0 @@ -* ivy - - Evil bindings for [[https://github.com/abo-abo/swiper][ivy]]. - -** Key bindings - -*** ivy-minibuffer-map - - Minibuffer bindings only take effect when =evil-collection-setup-minibuffer= - is non-nil (the global == → =minibuffer-keyboard-quit= always applies). - - | Command | Original | Evil | - |----------------------------+----------+------------------------------| - | =minibuffer-keyboard-quit= | =C-g= | == (any) | - | =abort-recursive-edit= | n/a | == (normal) | - | =exit-minibuffer= | =RET= | =RET= (normal) | - | =ivy-done= | =RET= | =C-m= (normal) | - | =ivy-next-line= | =C-n= | =j= (normal), =C-n= (insert) | - | =ivy-previous-line= | =C-p= | =k= (normal), =C-p= (insert) | - | =ivy-backward-delete-char= | =DEL= | =DEL= (insert) | - | =ivy-reverse-i-search= | =C-r= | =C-r= (insert) | - -*** ivy-occur-mode-map (normal state) - - | Command | Original | Evil | - |------------------------------+------------+-----------| - | =ivy-occur-next-line= | =n= | =j= | - | =ivy-occur-previous-line= | =p= | =k= | - | =evil-backward-char= | n/a | =h= | - | =evil-forward-char= | n/a | =l= | - | =evil-goto-first-line= | n/a | =gg= | - | =ivy-occur-press= | =RET=, =f= | =gf= | - | =ivy-occur-press-and-switch= | =o= | =RET= | - | =ivy-occur-read-action= | =M-o= | =ga= | - | =ivy-occur-dispatch= | =C-c C-o= | =go= | - | =ivy-occur-toggle-calling= | =C-c C-p= | =gc= | - | =ivy-occur-revert-buffer= | =g= | =gr= | - | =ivy-occur-click= | =mouse-1= | =mouse-1= | - | =quit-window= | =q= | =q= | - -*** ivy-occur-grep-mode-map (normal state) - - Inherits the above plus: - - | Command | Original | Evil | - |--------------------------------------------+-----------+-------------------------------------| - | =ivy-occur-delete-candidate= | =C-d= | =d=, =gd= | - | =ivy-occur-delete-candidate= | =C-d= | =D= (when =evil-want-C-d-scroll=) | - | =evil-scroll-down= | n/a | =C-d= (when =evil-want-C-d-scroll=) | - | =ivy-wgrep-change-to-wgrep-mode= | =C-x C-q= | =i=, =C-x C-q= | - | =evil-digit-argument-or-beginning-of-line= | n/a | =0= | diff --git a/.config/emacs/lisp/evil-collection/modes/ivy/evil-collection-ivy.el b/.config/emacs/lisp/evil-collection/modes/ivy/evil-collection-ivy.el deleted file mode 100644 index 95334ff..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ivy/evil-collection-ivy.el +++ /dev/null @@ -1,111 +0,0 @@ -;;; evil-collection-ivy.el --- Evil bindings for ivy -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, ivy, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `ivy-mode'. - -;;; Code: -(require 'evil-collection) -(require 'ivy nil t) - -(defconst evil-collection-ivy-maps '(ivy-occur-mode-map - ivy-occur-grep-mode-map - ivy-minibuffer-map)) - -;;;###autoload -(defun evil-collection-ivy-setup () - "Set up `evil' bindings for `ivy-mode'." - (evil-collection-define-key nil 'ivy-minibuffer-map - (kbd "") 'minibuffer-keyboard-quit) - (evil-collection-define-key 'normal 'ivy-occur-mode-map - [mouse-1] 'ivy-occur-click - (kbd "RET") 'ivy-occur-press-and-switch - "j" 'ivy-occur-next-line - "k" 'ivy-occur-previous-line - "h" 'evil-backward-char - "l" 'evil-forward-char - "g" nil - "gg" 'evil-goto-first-line - "gf" 'ivy-occur-press - "ga" 'ivy-occur-read-action - "go" 'ivy-occur-dispatch - "gc" 'ivy-occur-toggle-calling - - ;; refresh - "gr" 'ivy-occur-revert-buffer - - ;; quit - "q" 'quit-window) - - (when evil-want-C-d-scroll - (evil-collection-define-key 'normal 'ivy-occur-grep-mode-map - "D" 'ivy-occur-delete-candidate - (kbd "C-d") 'evil-scroll-down)) - - (evil-collection-define-key 'visual 'ivy-occur-grep-mode-map - "j" 'evil-next-line - "k" 'evil-previous-line) - - (evil-collection-define-key 'normal 'ivy-occur-grep-mode-map - "d" 'ivy-occur-delete-candidate - (kbd "C-x C-q") 'ivy-wgrep-change-to-wgrep-mode - "i" 'ivy-wgrep-change-to-wgrep-mode - "gd" 'ivy-occur-delete-candidate - [mouse-1] 'ivy-occur-click - (kbd "RET") 'ivy-occur-press-and-switch - "j" 'ivy-occur-next-line - "k" 'ivy-occur-previous-line - "h" 'evil-backward-char - "l" 'evil-forward-char - "g" nil - "gg" 'evil-goto-first-line - "gf" 'ivy-occur-press - "gr" 'ivy-occur-revert-buffer - "ga" 'ivy-occur-read-action - "go" 'ivy-occur-dispatch - "gc" 'ivy-occur-toggle-calling - - "0" 'evil-digit-argument-or-evil-beginning-of-line - - ;; quit - "q" 'quit-window) - - (defvar evil-collection-setup-minibuffer) - (when evil-collection-setup-minibuffer - (evil-collection-define-key 'normal 'ivy-minibuffer-map - (kbd "") 'abort-recursive-edit - (kbd "RET") 'exit-minibuffer - (kbd "C-m") 'ivy-done - "j" 'ivy-next-line - "k" 'ivy-previous-line) - - (evil-collection-define-key 'insert 'ivy-minibuffer-map - (kbd "DEL") 'ivy-backward-delete-char - (kbd "C-r") 'ivy-reverse-i-search - (kbd "C-n") 'ivy-next-line - (kbd "C-p") 'ivy-previous-line))) - -(provide 'evil-collection-ivy) -;;; evil-collection-ivy.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/js2-mode/README.org b/.config/emacs/lisp/evil-collection/modes/js2-mode/README.org deleted file mode 100644 index 3639801..0000000 --- a/.config/emacs/lisp/evil-collection/modes/js2-mode/README.org +++ /dev/null @@ -1,12 +0,0 @@ -* js2-mode - - Evil compatibility for [[https://github.com/mooz/js2-mode][js2-mode]]. No key bindings. - - Adds a hook to =js2-mode-hook= and =js2-jsx-mode-hook= that sets the - buffer-local =evil-shift-width= to match =js-indent-level=, so =>>= and - =<<= indent by the same amount js2-mode does. - -** New commands - - - =evil-collection-js2-set-evil-shift-width= - Sync =evil-shift-width= - with =js-indent-level= in the current buffer. diff --git a/.config/emacs/lisp/evil-collection/modes/js2-mode/evil-collection-js2-mode.el b/.config/emacs/lisp/evil-collection/modes/js2-mode/evil-collection-js2-mode.el deleted file mode 100644 index fe29237..0000000 --- a/.config/emacs/lisp/evil-collection/modes/js2-mode/evil-collection-js2-mode.el +++ /dev/null @@ -1,46 +0,0 @@ -;;; evil-collection-js2-mode.el --- Bindings for `js2-mode' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `js2-mode' - -;;; Code: -(require 'evil-collection) -(require 'js2-mode nil t) - -(defvar js-indent-level) - -(defun evil-collection-js2-set-evil-shift-width () - "Set `evil-shift-width' according to `js-indent-level'." - (setq-local evil-shift-width js-indent-level)) - -;;;###autoload -(defun evil-collection-js2-mode-setup () - "Set up `evil' bindings for `js2-mode'." - (add-hook 'js2-mode-hook #'evil-collection-js2-set-evil-shift-width) - (add-hook 'js2-jsx-mode-hook #'evil-collection-js2-set-evil-shift-width)) - -(provide 'evil-collection-js2-mode) -;;; evil-collection-js2-mode.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/kmacro/README.org b/.config/emacs/lisp/evil-collection/modes/kmacro/README.org deleted file mode 100644 index 5c05d82..0000000 --- a/.config/emacs/lisp/evil-collection/modes/kmacro/README.org +++ /dev/null @@ -1,22 +0,0 @@ -* kmacro - - Evil bindings for the [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Keyboard-Macros.html][kmacro]] menu. - -** Key bindings - - Bindings applied to =kmacro-menu-mode-map=. Initial state is normal. - - | Command | Original | Evil | - |---------------------------------+----------+-------| - | =kmacro-menu-edit-column= | =RET= | =RET= | - | =kmacro-menu-edit-position= | =#= | =#= | - | =kmacro-menu-edit-counter= | =c= | =c= | - | =kmacro-menu-edit-format= | =f= | =f= | - | =kmacro-menu-edit-keys= | =e= | =e= | - | =kmacro-menu-flag-for-deletion= | =d= | =d= | - | =kmacro-menu-mark= | =m= | =m= | - | =kmacro-menu-unmark= | =u= | =u= | - | =kmacro-menu-unmark-all= | =U= | =U= | - | =kmacro-menu-do-flagged-delete= | =x= | =x= | - | =kmacro-menu-do-copy= | =C= | =C= | - | =kmacro-menu-do-delete= | =D= | =D= | diff --git a/.config/emacs/lisp/evil-collection/modes/kmacro/evil-collection-kmacro.el b/.config/emacs/lisp/evil-collection/modes/kmacro/evil-collection-kmacro.el deleted file mode 100644 index b7c7aff..0000000 --- a/.config/emacs/lisp/evil-collection/modes/kmacro/evil-collection-kmacro.el +++ /dev/null @@ -1,58 +0,0 @@ -;;; evil-collection-kmacro.el --- Evil bindings for kmacro menu -*- lexical-binding: t -*- - -;; Copyright (C) 2024 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "30")) -;; Keywords: evil, kmacro, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for kmacro menu. - -;;; Code: - -(require 'evil-collection) -(require 'kmacro) - -(defconst evil-collection-kmacro-maps '(kmacro-menu-mode-map)) - -(defun evil-collection-kmacro-setup () - "Set up `evil' bindings to `tab-bar'." - (evil-set-initial-state 'kmacro-menu-mode 'normal) - (evil-collection-define-key 'normal 'kmacro-menu-mode-map - ;; Edit - (kbd "RET") 'kmacro-menu-edit-column - "#" 'kmacro-menu-edit-position - "c" 'kmacro-menu-edit-counter - "f" 'kmacro-menu-edit-format - "e" 'kmacro-menu-edit-keys - - ;; Mark - "d" 'kmacro-menu-flag-for-deletion - "m" 'kmacro-menu-mark - "u" 'kmacro-menu-unmark - "U" 'kmacro-menu-unmark-all - - "x" 'kmacro-menu-do-flagged-delete - "C" 'kmacro-menu-do-copy - "D" 'kmacro-menu-do-delete)) - -(provide 'evil-collection-kmacro) -;;; evil-collection-kmacro.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/kotlin-mode/evil-collection-kotlin-mode.el b/.config/emacs/lisp/evil-collection/modes/kotlin-mode/evil-collection-kotlin-mode.el deleted file mode 100644 index 8d8d454..0000000 --- a/.config/emacs/lisp/evil-collection/modes/kotlin-mode/evil-collection-kotlin-mode.el +++ /dev/null @@ -1,42 +0,0 @@ -;;; evil-collection-kotlin-mode.el --- Bindings for `kotlin-mode' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: emacs, evil, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `kotlin-mode'. - -;;; Code: -(require 'evil-collection) -(require 'kotlin-mode nil t) - -(defconst evil-collection-kotlin-maps '(kotlin-mode-map)) - -;;;###autoload -(defun evil-collection-kotlin-mode-setup () - "Set up `evil' bindings for `kotlin-mode'." - (evil-collection-define-key 'normal 'kotlin-mode-map - "gz" 'kotlin-repl)) - -(provide 'evil-collection-kotlin-mode) -;;; evil-collection-kotlin-mode.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/leetcode/evil-collection-leetcode.el b/.config/emacs/lisp/evil-collection/modes/leetcode/evil-collection-leetcode.el deleted file mode 100644 index e198f63..0000000 --- a/.config/emacs/lisp/evil-collection/modes/leetcode/evil-collection-leetcode.el +++ /dev/null @@ -1,46 +0,0 @@ -;;; evil-collection-leetcode.el --- Bindings for `leetcode' -*- lexical-binding: t -*- - -;; Copyright (C) 2019 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `leetcode'. - -;;; Code: -(require 'evil-collection) -(require 'leetcode nil t) - -(defconst evil-collection-leetcode-maps - '(leetcode--problems-mode-map - leetcode--problem-description-mode-map)) - -;;;###autoload -(defun evil-collection-leetcode-setup () - "Set up `evil' bindings for `leetcode'." - (evil-collection-define-key 'normal 'leetcode--problems-mode-map - (kbd "RET") 'leetcode-show-current-problem - "gr" 'leetcode-problems-refresh - "q" 'quit-window)) - -(provide 'evil-collection-leetcode) -;;; evil-collection-leetcode.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/lispy/README.org b/.config/emacs/lisp/evil-collection/modes/lispy/README.org deleted file mode 100644 index 1123fc2..0000000 --- a/.config/emacs/lisp/evil-collection/modes/lispy/README.org +++ /dev/null @@ -1,140 +0,0 @@ -* lispy - - Evil bindings for [[https://github.com/abo-abo/lispy][lispy]], the short-key mode for editing s-expressions. - - Installs two additional themes into =lispy-set-key-theme=: ='special-evil' - and ='evil'. The setup function applies both, advising - =lispy-set-key-theme= so the original themes (=special=, =paredit=, etc.) - are bypassed in favour of the evil-flavored variants. - -** Key bindings - -*** Special state (point on a paren) - - Lispy's "special" state is rebound to mirror vim motions. Keys come from - =evil-collection-lispy-mode-map-special=. - - | Command | Original (lispy) | Evil | - |-----------------------------------------------------+------------------+----------| - | =lispy-right= | =l= | =l= | - | =lispy-left= | =h= | =h= | - | =lispy-down= | =j= | =j= | - | =lispy-up= | =k= | =k= | - | =lispy-different= | =o= | =o= | - | =lispy-ace-paren= | =f= | =f= | - | =lispy-flow= | =n= | =n= | - | =lispy-ace-char= | =t= | =t= | - | =lispy-teleport= | =T= | =T= | - | =lispy-new-copy= | =y= | =y= | - | =lispy-paste= | =P= | =p= | - | =lispy-eval-other-window= | =P= | =P= | - | =lispy-mark-list= | =v= | =v= | - | =lispy-view= | =V= | =z= | - | =lispy-x= | =x= | =q= | - | =lispy-other-mode= | =Q= | =Q= | - | =lispy-occur= | =/= | =/= | - | =lispy-splice= | =/= | =x= | - | =lispy-comment= | =;= | =;= | - | =evil-collection-lispy-delete= | n/a | =d= | - | =lispy-join= | =+= | =+=, =J= | - | =lispy-describe= | =h= | =K= | - | =lispy-outline-goto-child= | =L= | =L= | - | =lispy-slurp-or-barf-right= | =>= | =>= | - | =lispy-slurp-or-barf-left= | =<= | =<= | - | =lispy-raise= | =r= | =r= | - | =lispy-raise-some= | =R= | =R= | - | =lispy-convolute= | =C= | =C= | - | =lispy-convolute-left= | =X= | =X= | - | =lispy-move-up= | =w= | =w= | - | =lispy-move-down= | =s= | =s= | - | =lispy-oneline= | =O= | =O= | - | =lispy-alt-multiline= | =M= | =M= | - | =lispy-stringify= | =S= | =S= | - | =lispy-ace-symbol= | =a= | =a= | - | =lispy-ace-symbol-replace= | =H= | =H= | - | =lispy-eval= | =e= | =e= | - | =lispy-eval-and-insert= | =E= | =E= | - | =end-of-defun= | n/a | =G= | - | =g-knight/body= | n/a | =g= | - | =evil-collection-lispy-insert-at-end-of-list= | n/a | =A= | - | =evil-collection-lispy-insert-at-beginning-of-list= | n/a | =I= | - | =lispy-follow= | =F= | =F= | - | =pop-tag-mark= | =D= | =D= | - | =lispy-underscore= | =_= | =_= | - | =lispy-space= | =SPC= | =SPC= | - | =lispy-tab-hydra/body= | n/a | =TAB= | - | =lispy-narrow= | =N= | =N= | - | =lispy-widen= | =W= | =W= | - | =lispy-clone= | =c= | =c= | - | =lispy-undo= | =u= | =u= | - | =lispy-back= | =b= | =b= | - | =lispy-ediff-regions= | =B= | =B= | - | =lispy-edebug-stop= | =Z= | =Z= | - | =lispy-visit= | =V= | =V= | - | =lispy-ace-subword= | =-= | =-= | - | =lispy-repeat= | =.= | =.= | - | =lispy-tilde= | =~= | =~= | - | =lispy-forward= | =]= | =]= | - | =lispy-backward= | =[= | =[= | - | =lispy-brackets= | ={= | ={= | - | =lispy-outline-next= | =J= | =C-J= | - | =lispy-outline-prev= | =K= | =C-K= | - | =lispy-splice-sexp-killing-backward= | =^= | =^= | - | =lispy-splice-sexp-killing-forward= | =$= | =$= | - | =lispy-move-down= | =M-j= | =M-j= | - | =lispy-move-up= | =M-k= | =M-k= | - -*** Evil normal state - - These bindings live in =evil-collection-lispy-mode-map= and are active in - evil normal state. - - | Command | Original | Evil | - |--------------------------------------+------------+--------------| - | =lispy-left= | =C-M-u= | =M-n= | - | =lispy-kill-word= | =M-d= | =M-d= | - | =lispy-backward-kill-word= | =M-DEL= | =M-DEL= | - | =lispy-parens= | =(= | =(= | - | =lispy-comment= | =;= | =;= | - | =lispy-goto-symbol= | =M-.= | =gd= | - | =pop-tag-mark= | =M-,= | =C-t= | - | =lispy-wrap-round= | =M-(= | =M-(=, =M-)= | - | =lispy-wrap-braces= | =M-{= | =M-{=, =M-}= | - | =lispy-splice= | =M-s= | =M-s= | - | =lispy-splice-sexp-killing-backward= | =M-= | =M-= | - | =lispy-splice-sexp-killing-forward= | =M-= | =M-= | - | =lispy-raise-sexp= | =M-r= | =M-r= | - | =lispy-raise-some= | =M-R= | =M-R= | - | =lispy-convolute-sexp= | =M-C= | =M-C= | - | =lispy-split= | =M-S= | =M-S= | - | =lispy-join= | =M-J= | =M-J= | - | =lispy-forward= | =C-M-n= | =]= | - | =lispy-backward= | =C-M-p= | =[= | - | =lispy-slurp-or-barf-left= | n/a | =<= | - | =lispy-slurp-or-barf-right= | n/a | =>= | - | =lispy-new-copy= | =M-y= | =M-y= | - | =lispy-open-line= | =C-RET= | =C-RET= | - | =lispy-meta-return= | =M-RET= | =M-RET= | - | =lispy-move-up= | =M-k= | =M-k= | - | =lispy-move-down= | =M-j= | =M-j= | - | =lispy-string-oneline= | =M-o= | =M-o= | - | =lispy-clone= | =M-p= | =M-p= | - | =evil-collection-lispy-delete= | n/a | =M-d= | - -** New commands - - | Command | Notes | - |-----------------------------------------------------+--------------------------------------------------| - | =evil-collection-lispy-insert-at-beginning-of-list= | Enter insert/emacs state at start of list (=I=). | - | =evil-collection-lispy-insert-at-end-of-list= | Enter insert/emacs state at end of list (=A=). | - | =evil-collection-lispy-delete= | Copy and delete the current sexp. | - | =evil-collection-lispy-action-then-next-sexp= | Helper to wrap a lispy action with =lispy-down=. | - | =evil-collection-lispy--out-forward= | Helper around =lispy--out-forward=. | - | =evil-collection-lispy-set-key-theme= | Replacement for =lispy-set-key-theme= adding the | - | | ='special-evil' and ='evil' themes. | - -** Customization - - - =evil-collection-lispy-preferred-lispy-state= - The evil state - (=insert= or =emacs=) entered by =A= and =I= for using lispy. Defaults - to =insert=. diff --git a/.config/emacs/lisp/evil-collection/modes/lispy/evil-collection-lispy.el b/.config/emacs/lisp/evil-collection/modes/lispy/evil-collection-lispy.el deleted file mode 100644 index 895137e..0000000 --- a/.config/emacs/lisp/evil-collection/modes/lispy/evil-collection-lispy.el +++ /dev/null @@ -1,659 +0,0 @@ -;;; evil-collection-lispy.el --- Evil Bindings for Lispy -*- lexical-binding: t; -*- - -;; Copyright (C) 2019 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, lispy, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `lispy-mode'. - -;;; Code: -(require 'lispy nil t) -(require 'evil-collection) - -(defconst evil-collection-lispy-maps '(lispy-mode-map - evil-collection-lispy-mode-map)) - -(defvar lispy-mode-map-base) -(defvar lispy-mode-map-special) -(defvar lispy-mode-map-lispy) -(defvar lispy-mode-map-paredit) -(defvar lispy-mode-map-parinfer) -(defvar lispy-mode-map-evilcp) -(defvar lispy-mode-map-c-digits) -(defvar lispy-mode-map-oleh) -(defvar lispy-mode-map) -(defvar lispy-outline) -(defvar lispy-outline-header) -(defvar hydra-curr-body-fn) - -(declare-function lispy--out-backward "lispy") -(declare-function lispy--out-forward "lispy") -(declare-function hydra-default-pre "lispy") -(declare-function hydra-keyboard-quit "lispy") -(declare-function hydra--call-interactively-remap-maybe "lispy") -(declare-function lispy-knight-down "lispy") -(declare-function lispy-knight-up "lispy") -(declare-function lispy-beginning-of-defun "lispy") -(declare-function lispy-goto "lispy") -(declare-function lispy-goto-local "lispy") -(declare-function hydra-idle-message "lispy") -(declare-function hydra-set-transient-map "lispy") -(declare-function lispy-tab "lispy") -(declare-function lispy-shifttab "lispy") -(declare-function lispy-left-p "lispy") -(declare-function lispy-right-p "lispy") -(declare-function lispy-bolp "lispy") -(declare-function lispy-down "lispy") -(declare-function lispy-new-copy "lispy") -(declare-function lispy-delete "lispy") -(declare-function lispy-delete-backward "lispy") -(declare-function lispy-define-key "lispy") -(declare-function lispy-set-key-theme "lispy") - -;; ------------------------------- LISPYVILLE ---------------------------------- -;; Copied from `lispyville'. -;; -> `lispyville-preferred-lispy-state' -(defcustom evil-collection-lispy-preferred-lispy-state 'insert - "The preferred evil state for insertion and using lispy. -This is used by any command that should enter special to determine the correct -state." - :type '(choice - (const :tag "Use insert state to get into special." insert) - (const :tag "Use emacs state to get into special." emacs)) - :group 'evil-collection) - -;; -> `lispyville-insert-at-beginning-of-list' -(evil-define-command evil-collection-lispy-insert-at-beginning-of-list (count) - "Enter `evil-collection-lispy-preferred-lispy-state' at the start of the list. - -With COUNT, move backward/out COUNT lists first. This is the -lispyville equivalent of `evil-cp-insert-at-beginning-of-form' except for lists -only." - (interactive "") - (when (lispy--out-backward (or count 1)) - (forward-char) - (evil-change-state evil-collection-lispy-preferred-lispy-state))) - -;; -> `lispyville-insert-at-end-of-list' -(evil-define-command evil-collection-lispy-insert-at-end-of-list (count) - "Enter `lispyville-preferred-state' at the end of the list. -With COUNT, move forward/out COUNT lists first. This is the lispyville -equivalent of `evil-cp-insert-at-end-of-form' except for lists only." - (interactive "") - (when (evil-collection-lispy--out-forward (or count 1)) - (backward-char) - (evil-change-state evil-collection-lispy-preferred-lispy-state))) - -;; -> `lispyville--out-forward' -(defun evil-collection-lispy--out-forward (count) - "Like `lispyville--out-forward' but don't return nil if move at least once. -COUNT is passed to `lispy--out-forward'." - (let ((orig-pos (point))) - (lispy--out-forward count) - (not (= (point) orig-pos)))) - -;; ------------------------------- LISPYVILLE ---------------------------------- - -;; ------------------------------- HYDRA --------------------------------------- -(when (featurep 'hydra) - ;; (defhydra g-knight (:color blue :hint nil :idle .3 :columns 3) - ;; "g knight" - ;; ("j" lispy-knight-down "Down") - ;; ("k" lispy-knight-up "Up") - ;; ("g" lispy-beginning-of-defun "Beginning") - ;; ("d" lispy-goto "Goto") - ;; ("l" lispy-goto-local "Goto Local")) - - ;; Macroexpanded from g-knight hydra. - (progn - (set - (defvar g-knight/params nil "Params of g-knight.") - '(nil nil :columns 3 :exit t :foreign-keys nil :hint nil :idle 0.3)) - (set - (defvar g-knight/docstring nil "Docstring of g-knight.") - "g knight") - (set - (defvar g-knight/heads nil "Heads for g-knight.") - '(("j" lispy-knight-down "Down" :exit t) - ("k" lispy-knight-up "Up" :exit t) - ("g" lispy-beginning-of-defun "Beginning" :exit t) - ("d" lispy-goto "Goto" :exit t) - ("l" lispy-goto-local "Goto Local" :exit t))) - (set - (defvar g-knight/keymap nil "Keymap for g-knight.") - '(keymap - (108 . g-knight/lispy-goto-local-and-exit) - (100 . g-knight/lispy-goto-and-exit) - (103 . g-knight/lispy-beginning-of-defun-and-exit) - (107 . g-knight/lispy-knight-up-and-exit) - (106 . g-knight/lispy-knight-down-and-exit) - (kp-subtract . hydra--negative-argument) - (kp-9 . hydra--digit-argument) - (kp-8 . hydra--digit-argument) - (kp-7 . hydra--digit-argument) - (kp-6 . hydra--digit-argument) - (kp-5 . hydra--digit-argument) - (kp-4 . hydra--digit-argument) - (kp-3 . hydra--digit-argument) - (kp-2 . hydra--digit-argument) - (kp-1 . hydra--digit-argument) - (kp-0 . hydra--digit-argument) - (57 . hydra--digit-argument) - (56 . hydra--digit-argument) - (55 . hydra--digit-argument) - (54 . hydra--digit-argument) - (53 . hydra--digit-argument) - (52 . hydra--digit-argument) - (51 . hydra--digit-argument) - (50 . hydra--digit-argument) - (49 . hydra--digit-argument) - (48 . hydra--digit-argument) - (45 . hydra--negative-argument) - (21 . hydra--universal-argument))) - (set - (defvar g-knight/hint nil "Dynamic hint for g-knight.") - '(format - #("g knight: -j: Down k: Up g: Beginning -d: Goto l: Goto Local" 10 11 -(face hydra-face-blue) -24 25 -(face hydra-face-blue) -38 39 -(face hydra-face-blue) -51 52 -(face hydra-face-blue) -65 66 -(face hydra-face-blue)))) - (defun g-knight/lispy-knight-down-and-exit nil "Call the head `lispy-knight-down' in the \"g-knight\" hydra. - -The heads for the associated hydra are: - -\"j\": `lispy-knight-down', -\"k\": `lispy-knight-up', -\"g\": `lispy-beginning-of-defun', -\"d\": `lispy-goto', -\"l\": `lispy-goto-local' - -The body can be accessed via `g-knight/body'." - (interactive) - (require 'hydra) - (hydra-default-pre) - (hydra-keyboard-quit) - (setq hydra-curr-body-fn 'g-knight/body) - (progn - (setq this-command 'lispy-knight-down) - (hydra--call-interactively-remap-maybe - (function lispy-knight-down)))) - (defun g-knight/lispy-knight-up-and-exit nil "Call the head `lispy-knight-up' in the \"g-knight\" hydra. - -The heads for the associated hydra are: - -\"j\": `lispy-knight-down', -\"k\": `lispy-knight-up', -\"g\": `lispy-beginning-of-defun', -\"d\": `lispy-goto', -\"l\": `lispy-goto-local' - -The body can be accessed via `g-knight/body'." - (interactive) - (require 'hydra) - (hydra-default-pre) - (hydra-keyboard-quit) - (setq hydra-curr-body-fn 'g-knight/body) - (progn - (setq this-command 'lispy-knight-up) - (hydra--call-interactively-remap-maybe - (function lispy-knight-up)))) - (defun g-knight/lispy-beginning-of-defun-and-exit nil "Call the head `lispy-beginning-of-defun' in the \"g-knight\" hydra. - -The heads for the associated hydra are: - -\"j\": `lispy-knight-down', -\"k\": `lispy-knight-up', -\"g\": `lispy-beginning-of-defun', -\"d\": `lispy-goto', -\"l\": `lispy-goto-local' - -The body can be accessed via `g-knight/body'." - (interactive) - (require 'hydra) - (hydra-default-pre) - (hydra-keyboard-quit) - (setq hydra-curr-body-fn 'g-knight/body) - (progn - (setq this-command 'lispy-beginning-of-defun) - (hydra--call-interactively-remap-maybe - (function lispy-beginning-of-defun)))) - (defun g-knight/lispy-goto-and-exit nil "Call the head `lispy-goto' in the \"g-knight\" hydra. - -The heads for the associated hydra are: - -\"j\": `lispy-knight-down', -\"k\": `lispy-knight-up', -\"g\": `lispy-beginning-of-defun', -\"d\": `lispy-goto', -\"l\": `lispy-goto-local' - -The body can be accessed via `g-knight/body'." - (interactive) - (require 'hydra) - (hydra-default-pre) - (hydra-keyboard-quit) - (setq hydra-curr-body-fn 'g-knight/body) - (progn - (setq this-command 'lispy-goto) - (hydra--call-interactively-remap-maybe - (function lispy-goto)))) - (defun g-knight/lispy-goto-local-and-exit nil "Call the head `lispy-goto-local' in the \"g-knight\" hydra. - -The heads for the associated hydra are: - -\"j\": `lispy-knight-down', -\"k\": `lispy-knight-up', -\"g\": `lispy-beginning-of-defun', -\"d\": `lispy-goto', -\"l\": `lispy-goto-local' - -The body can be accessed via `g-knight/body'." - (interactive) - (require 'hydra) - (hydra-default-pre) - (hydra-keyboard-quit) - (setq hydra-curr-body-fn 'g-knight/body) - (progn - (setq this-command 'lispy-goto-local) - (hydra--call-interactively-remap-maybe - (function lispy-goto-local)))) - (defun g-knight/body nil "Call the body in the \"g-knight\" hydra. - -The heads for the associated hydra are: - -\"j\": `lispy-knight-down', -\"k\": `lispy-knight-up', -\"g\": `lispy-beginning-of-defun', -\"d\": `lispy-goto', -\"l\": `lispy-goto-local' - -The body can be accessed via `g-knight/body'." - (interactive) - (require 'hydra) - (hydra-default-pre) - (let - ((hydra--ignore nil)) - ;; Unfortunate, but this ignore has to be manually placed here - ;; after macroexpanding. - (ignore hydra--ignore) - (hydra-keyboard-quit) - (setq hydra-curr-body-fn 'g-knight/body)) - (hydra-idle-message 0.3 g-knight/hint 'g-knight) - (hydra-set-transient-map g-knight/keymap - (lambda nil - (hydra-keyboard-quit) - nil) - nil) - (setq prefix-arg current-prefix-arg))) - - ;; (defhydra lispy-tab-hydra (:color blue :hint nil :idle .3) - ;; "Tab" - ;; ("i" lispy-tab "Tab") - ;; ("s" lispy-shifttab "Shifttab")) - - ;; Macroexpanded from lispy-tab-hydra. - (progn - (set - (defvar lispy-tab-hydra/params nil "Params of lispy-tab-hydra.") - '(nil nil :exit t :foreign-keys nil :hint nil :idle 0.3)) - (set - (defvar lispy-tab-hydra/docstring nil "Docstring of lispy-tab-hydra.") - "Tab") - (set - (defvar lispy-tab-hydra/heads nil "Heads for lispy-tab-hydra.") - '(("i" lispy-tab "Tab" :exit t) - ("s" lispy-shifttab "Shifttab" :exit t))) - (set - (defvar lispy-tab-hydra/keymap nil "Keymap for lispy-tab-hydra.") - '(keymap - (115 . lispy-tab-hydra/lispy-shifttab-and-exit) - (105 . lispy-tab-hydra/lispy-tab-and-exit) - (kp-subtract . hydra--negative-argument) - (kp-9 . hydra--digit-argument) - (kp-8 . hydra--digit-argument) - (kp-7 . hydra--digit-argument) - (kp-6 . hydra--digit-argument) - (kp-5 . hydra--digit-argument) - (kp-4 . hydra--digit-argument) - (kp-3 . hydra--digit-argument) - (kp-2 . hydra--digit-argument) - (kp-1 . hydra--digit-argument) - (kp-0 . hydra--digit-argument) - (57 . hydra--digit-argument) - (56 . hydra--digit-argument) - (55 . hydra--digit-argument) - (54 . hydra--digit-argument) - (53 . hydra--digit-argument) - (52 . hydra--digit-argument) - (51 . hydra--digit-argument) - (50 . hydra--digit-argument) - (49 . hydra--digit-argument) - (48 . hydra--digit-argument) - (45 . hydra--negative-argument) - (21 . hydra--universal-argument))) - (set - (defvar lispy-tab-hydra/hint nil "Dynamic hint for lispy-tab-hydra.") - '(format - #("Tab: [i]: Tab, [s]: Shifttab." 6 7 - (face hydra-face-blue) - 16 17 - (face hydra-face-blue)))) - (defun lispy-tab-hydra/lispy-tab-and-exit nil "Call the head `lispy-tab' in the \"lispy-tab-hydra\" hydra. - -The heads for the associated hydra are: - -\"i\": `lispy-tab', -\"s\": `lispy-shifttab' - -The body can be accessed via `lispy-tab-hydra/body'." - (interactive) - (require 'hydra) - (hydra-default-pre) - (hydra-keyboard-quit) - (setq hydra-curr-body-fn 'lispy-tab-hydra/body) - (progn - (setq this-command 'lispy-tab) - (hydra--call-interactively-remap-maybe - (function lispy-tab)))) - (defun lispy-tab-hydra/lispy-shifttab-and-exit nil "Call the head `lispy-shifttab' in the \"lispy-tab-hydra\" hydra. - -The heads for the associated hydra are: - -\"i\": `lispy-tab', -\"s\": `lispy-shifttab' - -The body can be accessed via `lispy-tab-hydra/body'." - (interactive) - (require 'hydra) - (hydra-default-pre) - (hydra-keyboard-quit) - (setq hydra-curr-body-fn 'lispy-tab-hydra/body) - (progn - (setq this-command 'lispy-shifttab) - (hydra--call-interactively-remap-maybe - (function lispy-shifttab)))) - (defun lispy-tab-hydra/body nil "Call the body in the \"lispy-tab-hydra\" hydra. - -The heads for the associated hydra are: - -\"i\": `lispy-tab', -\"s\": `lispy-shifttab' - -The body can be accessed via `lispy-tab-hydra/body'." - (interactive) - (require 'hydra) - (hydra-default-pre) - (let - ((hydra--ignore nil)) - ;; Unfortunate, but this ignore has to be manually placed here - ;; after macroexpanding. - (ignore hydra--ignore) - (hydra-keyboard-quit) - (setq hydra-curr-body-fn 'lispy-tab-hydra/body)) - (hydra-idle-message 0.3 lispy-tab-hydra/hint 'lispy-tab-hydra) - (hydra-set-transient-map lispy-tab-hydra/keymap - (lambda nil - (hydra-keyboard-quit) - nil) - nil) - (setq prefix-arg current-prefix-arg)))) - -;; ------------------------------- HYDRA --------------------------------------- - -(defun evil-collection-lispy-action-then-next-sexp (lispy-action) - "Return function that triggers LISPY-ACTION and then moves to next sexp." - (defalias (intern (format "%S-then-next-sexp" lispy-action)) - (lambda () - (interactive) - (call-interactively lispy-action) - (unless (or (lispy-left-p) - (lispy-right-p) - (and (lispy-bolp) - (or (looking-at lispy-outline-header) - (looking-at lispy-outline)))) - (call-interactively #'lispy-down))))) - -(defun evil-collection-lispy-delete (arg) - "Copy and delete current sexp. -Passes ARG to `lispy-delete' or `lispy-delete-back'. - -Copy of `noc:lispy-delete'." - (interactive "p") - (cond ((or (lispy-left-p) - (region-active-p)) - (lispy-new-copy) - (lispy-delete arg)) - ((lispy-right-p) - (lispy-new-copy) - (lispy-delete-backward arg)))) - -(defvar evil-collection-lispy-mode-map-special - (let ((map (make-sparse-keymap))) - (lispy-define-key map - ";" (evil-collection-lispy-action-then-next-sexp - 'lispy-comment)) - - ;; navigation - (lispy-define-key map "l" 'lispy-right) - (lispy-define-key map "h" 'lispy-left) - (lispy-define-key map "f" 'lispy-ace-paren - :override '(cond ((bound-and-true-p view-mode) - (View-quit)))) ;; `lispy-flow' -> w - (lispy-define-key map "j" 'lispy-down) - (lispy-define-key map "k" 'lispy-up) - - (lispy-define-key map - "d" (evil-collection-lispy-action-then-next-sexp - 'evil-collection-lispy-delete)) ;; `lispy-different' -> o - - (lispy-define-key map "o" 'lispy-different) ;; `lispy-other-mode' -> Q - (lispy-define-key map "p" 'lispy-paste) ;; `lispy-eval-other-window' -> P - (lispy-define-key map "P" 'lispy-eval-other-window) ;; `lispy-paste' -> p - (lispy-define-key map "y" 'lispy-new-copy) ;; `lispy-occur' -> / - (lispy-define-key map "z" 'lispy-view) ;; `lispy-mark-list' -> v - - ;; outline - (lispy-define-key map "J" 'lispy-join) ;; `lispy-outline-next' - (lispy-define-key map "K" 'lispy-describe) ;; `lispy-outline-prev' - (lispy-define-key map "L" 'lispy-outline-goto-child) - - ;; Paredit transformations - (lispy-define-key map ">" 'lispy-slurp-or-barf-right) ;; `lispy-slurp' - (lispy-define-key map "<" 'lispy-slurp-or-barf-left) ;; `lispy-barf' - - ;; FIXME: This doesn't work for me for some reason... - (lispy-define-key map "/" 'lispy-occur) ;; `lispy-x' -> q - - (lispy-define-key map "r" 'lispy-raise) - (lispy-define-key map "R" 'lispy-raise-some) - - (lispy-define-key map "+" 'lispy-join) ;; Hmnn this can be something else. - - ;; more transformations - (lispy-define-key map "C" 'lispy-convolute) - (lispy-define-key map "X" 'lispy-convolute-left) - (lispy-define-key map "w" 'lispy-move-up) - (lispy-define-key map "s" 'lispy-move-down) - (lispy-define-key map "O" 'lispy-oneline) - (lispy-define-key map "M" 'lispy-alt-multiline) - (lispy-define-key map "S" 'lispy-stringify) - - ;; marking - (lispy-define-key map "a" 'lispy-ace-symbol - :override '(cond ((looking-at lispy-outline) - (lispy-meta-return)))) - (lispy-define-key map "H" 'lispy-ace-symbol-replace) - - ;; dialect-specific - (lispy-define-key map "e" 'lispy-eval) - (lispy-define-key map "E" 'lispy-eval-and-insert) - - ;; Hmnn, not sure why there's no `lispy-end-of-defun'. - ;; `end-of-defun' doesn't work quite right yet. It exits the list - ;; which would exit lispy state. - (lispy-define-key map "G" 'end-of-defun) ;; `lispy-goto-local' -> gl - (lispy-define-key map "g" 'g-knight/body) ;; `lispy-goto' -> gd - - (lispy-define-key map "A" 'evil-collection-lispy-insert-at-end-of-list) ;; `lispy-beginning-of-defun' -> gg - (lispy-define-key map "I" 'evil-collection-lispy-insert-at-beginning-of-list) ;; `lispy-shifttab' -> zs - - (lispy-define-key map "F" 'lispy-follow t) - (lispy-define-key map "D" 'pop-tag-mark) - (lispy-define-key map "_" 'lispy-underscore) - - ;; miscellanea - (define-key map (kbd "SPC") 'lispy-space) - (lispy-define-key map "TAB" 'lispy-tab-hydra/body) ;; `lh-knight/body' -> g - - (lispy-define-key map "N" 'lispy-narrow) - (lispy-define-key map "W" 'lispy-widen) - (lispy-define-key map "c" 'lispy-clone) - (lispy-define-key map "u" 'lispy-undo) - - (lispy-define-key map "q" 'lispy-x) ;; `lispy-ace-paren' -> f - (lispy-define-key map "Q" 'lispy-other-mode) ;; `lispy-ace-char' -> t - (lispy-define-key map "v" 'lispy-mark-list) ;; `lispy-view' -> z - (lispy-define-key map "t" 'lispy-ace-char) ;; `lispy-teleport' -> T - (lispy-define-key map "n" 'lispy-flow) ;; `lispy-new-copy' -> y - (lispy-define-key map "b" 'lispy-back) - - (lispy-define-key map "B" 'lispy-ediff-regions) - (lispy-define-key map "x" 'lispy-splice) ;; `lispy-x' -> q - - (lispy-define-key map "Z" 'lispy-edebug-stop) - (lispy-define-key map "V" 'lispy-visit) - (lispy-define-key map "-" 'lispy-ace-subword) - (lispy-define-key map "." 'lispy-repeat) - (lispy-define-key map "~" 'lispy-tilde) - ;; digit argument - (mapc (lambda (x) (lispy-define-key map (format "%d" x) 'digit-argument)) - (number-sequence 0 9)) - - ;; additional - (lispy-define-key map "T" 'lispy-teleport - :override '(cond ((looking-at lispy-outline) - (end-of-line)))) - (lispy-define-key map "]" 'lispy-forward) - (lispy-define-key map "[" 'lispy-backward) - (lispy-define-key map "{" 'lispy-brackets) - - ;; Experimental - (lispy-define-key map "C-J" 'lispy-outline-next) - (lispy-define-key map "C-K" 'lispy-outline-prev) - (lispy-define-key map "^" 'lispy-splice-sexp-killing-backward) - (lispy-define-key map "$" 'lispy-splice-sexp-killing-forward) - (lispy-define-key map "M-j" 'lispy-move-down) ;; `lispy-split' - (lispy-define-key map "M-k" 'lispy-move-up) ;; `lispy-kill-sentence' - map) - "`evil' flavored `lispy' bindings when in special state.") - -(defvar evil-collection-lispy-mode-map (make-sparse-keymap) - "`evil' flavored `lispy-mode' bindings.") - -(defun evil-collection-lispy-set-key-theme (theme) - "Set `lispy-mode-map' for according to THEME. -THEME is a list of choices: \='special', \='lispy', \='paredit', \='evilcp', - \='c-digits', \='special-evil', \='evil'. - -This is an exact copy of `lispy-set-key-theme' except with the additions of - \='special-evil' and \='evil' themes." - (setq lispy-mode-map - (make-composed-keymap - (delq nil - (list - (when (memq 'special-evil theme) evil-collection-lispy-mode-map-special) - (when (memq 'evil theme) evil-collection-lispy-mode-map) - (when (memq 'special theme) lispy-mode-map-special) - (when (memq 'lispy theme) lispy-mode-map-lispy) - (when (memq 'paredit theme) lispy-mode-map-paredit) - (when (memq 'parinfer theme) lispy-mode-map-parinfer) - (when (memq 'evilcp theme) lispy-mode-map-evilcp) - (when (memq 'c-digits theme) lispy-mode-map-c-digits) - (when (memq 'oleh theme) lispy-mode-map-oleh))))) - (setcdr - (assq 'lispy-mode minor-mode-map-alist) - lispy-mode-map)) - -;;;###autoload -(defun evil-collection-lispy-setup () - "Set up `evil' bindings for `lispy'." - (advice-add 'lispy-set-key-theme :override 'evil-collection-lispy-set-key-theme) - (lispy-set-key-theme '(special-evil evil)) - (evil-collection-define-key 'normal 'evil-collection-lispy-mode-map - ;; Instead of inheriting, explicitly define keys from `lispy-mode-map-base'. - ;; navigation. - ;; Commented out define-keys are from the original map that we're not using. - ;; -- Begin Inheritance - ;; (define-key map (kbd "C-a") 'lispy-move-beginning-of-line) - ;; (define-key map (kbd "C-e") 'lispy-move-end-of-line) - (kbd "M-n") 'lispy-left - ;; killing - ;; (define-key map (kbd "C-k") 'lispy-kill) - (kbd "M-d") 'lispy-kill-word - (kbd "M-DEL") 'lispy-backward-kill-word - ;; misc - "(" 'lispy-parens - ";" 'lispy-comment - ;; (kbd "M-q") 'lispy-fill - ;; (define-key map (kbd "C-j") 'lispy-newline-and-indent) - ;; (define-key map (kbd "RET") 'lispy-newline-and-indent-plain) - ;; tags - "gd" 'lispy-goto-symbol - (kbd "C-t") 'pop-tag-mark - ;; -- End Inheritance. - - (kbd "M-)") 'lispy-wrap-round - (kbd "M-s") 'lispy-splice - (kbd "M-") 'lispy-splice-sexp-killing-backward - (kbd "M-") 'lispy-splice-sexp-killing-forward - (kbd "M-r") 'lispy-raise-sexp - (kbd "M-R") 'lispy-raise-some - (kbd "M-C") 'lispy-convolute-sexp - (kbd "M-S") 'lispy-split - (kbd "M-J") 'lispy-join - "]" 'lispy-forward - "[" 'lispy-backward - (kbd "M-(") 'lispy-wrap-round - (kbd "M-{") 'lispy-wrap-braces - (kbd "M-}") 'lispy-wrap-braces - "<" 'lispy-slurp-or-barf-left - ">" 'lispy-slurp-or-barf-right - (kbd "M-y") 'lispy-new-copy - (kbd "") 'lispy-open-line - (kbd "") 'lispy-meta-return - (kbd "M-k") 'lispy-move-up - (kbd "M-j") 'lispy-move-down - (kbd "M-o") 'lispy-string-oneline - (kbd "M-p") 'lispy-clone - (kbd "M-d") 'evil-collection-lispy-delete)) - -(provide 'evil-collection-lispy) -;;; evil-collection-lispy.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/lms/evil-collection-lms.el b/.config/emacs/lisp/evil-collection/modes/lms/evil-collection-lms.el deleted file mode 100644 index 19ebf37..0000000 --- a/.config/emacs/lisp/evil-collection/modes/lms/evil-collection-lms.el +++ /dev/null @@ -1,404 +0,0 @@ -;;; evil-collection-lms.el --- Evil bindings for lms.el -*- lexical-binding: t -*- -;; Copyright (C) 2021-2023 Edgar Vincent - -;; Author: Edgar Vincent -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "25.1")) -;; Keywords: evil, multimedia, music, logitechmediaserver, squeezebox - -;; This file is not part of GNU Emacs. -;; -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for lms.el. -;; -;;; Code: -(require 'lms nil t) -(require 'evil-collection) - -(defvar lms-ui-docs) -(defvar lms-ui-playing-now-mode-map) -(defvar lms-ui-players-mode-map) -(defvar lms-ui-playlist-mode-map) -(defvar lms-ui-track-info-mode-map) -(defvar lms-ui-tracks-list-mode-map) -(defvar lms--ui-editing-p) -(defvar lms--ui-pl-tracks) - -(declare-function lms-ui-playing-now-refresh "lms") - -(defconst evil-collection-lms-maps '(lms-ui-players-mode-map - lms-ui-playing-now-mode-map - lms-ui-playlist-mode-map - lms-ui-track-info-mode-map - lms-ui-tracks-list-mode-map - lms-ui-year-album-artist-list-mode-map)) - -(defconst evil-collection-lms-modes '(lms-players-mode - lms-ui-playing-now-mode - lms-ui-track-info-mode - lms-ui-players-mode - lms-ui-playlist-mode - lms-ui-tracks-list-mode - lms-ui-year-album-artist-list-mode)) - -(defun evil-collection-lms-ui-track-info-mode-quit () - "Exit `lms-ui-track-info-mode'." - (interactive) - (kill-buffer "*LMS: Track Information*") - (lms-ui-playing-now-refresh)) - -(defun evil-collection-lms-ui-players-mode-quit () - "Exit `lms-ui-players-mode'." - (interactive) - (kill-buffer (format "*LMS: Players*")) - (lms-ui-playing-now-refresh)) - -(defun evil-collection-lms-ui-playlist-mode-quit () - "Exit `lms-ui-playlist-mode'." - (interactive) - (kill-buffer (format "*LMS: Playlist [%d tracks]*" (length lms--ui-pl-tracks))) - (lms-ui-playing-now-refresh)) - -(defun evil-collection-lms-ui-tracks-list-mode-quit () - "Exit `lms-ui-tracks-list-mode'." - (interactive) - (kill-buffer) - (lms-ui-playing-now-refresh)) - -(defalias 'evil-collection-lms-ui-year-album-artist-list-mode-quit - 'evil-collection-lms-ui-tracks-list-mode-quit - "Exit lms-ui-tracks-list-mode.") - -(defun evil-collection-lms-goto-line (count) - "Move the point to line COUNT. By default the penultimate line." - (interactive "P") - (evil-goto-line count) - (unless count - (forward-line -1))) - -(defun evil-collection-lms-next-line () - "Move the point to the next line, except if it is at the end of the buffer." - (interactive) - (forward-line 1) - (when (eobp) (forward-line -1))) - -(defun evil-collection-lms-ui-playing-now () - "Modify the *LMS: Playing Now* buffer to reflect evil keybinding changes." - (setq-local buffer-read-only nil) - (setq lms--ui-editing-p t) - (while (search-forward-regexp "Press 'h' for help" nil 'noerror) - (replace-match "") - (insert (propertize "Press 'gh' or 'g?' for help" 'face '(variable-pitch (:height 0.85 :slant italic :foreground "gray40"))))) - (setq-local buffer-read-only t) - (setq lms--ui-editing-p nil)) - -(defvar evil-collection-lms-ui-docs - "#+TITLE: lms.el Documentation -#+AUTHOR: Iñigo Serna -#+DATE: 2020/06/14 - -* Introduction -This is an *emacs* frontend to interact with Squeezebox Server / Logitech Media Server. -Released under GPL version 3 license or later. - -It requires emacs version 25 or higher. - -More information on what a *squeezebox controller* is at https://inigo.katxi.org/blog/2017/07/31/lms_el.html. - -Quick instructions: customize some basic parameters such as 'lms-url' and run it with *lms* or *lms-ui*. -From there, you could read complete documentation after pressing *gh* or *g?*. -You can also run 'emacsclient -e \"(lms-float)\"' to display an independent small frame. - -Package should appear in [[https://melpa.org][MELPA repository]], and the code is in [[https://hg.serna.eu/emacs/lms][the code repository]] as well. - -* Features -This is Squeezebox controller, i.e. a program which can handle your local music library. - -Some of the features: -- Display song: title, artist, album, year, cover… -- Play, pause, stop, select next / previous song -- Control players: select player, power on/off, volume, repeat and shuffle modes -- Playlist control: list, select song, delete track, clear -- Show track information and change rating - -It is not aimed to be a complete controller, as it can't - and won't - manage external sources such us BBC, Deezer, Pandora, Spotify, or TuneIn Radio. - -* Configuration -There are some parameters you could customize: -|--------------------------+-----------------------------------------------+------------------------------------| -| Parameter | Description | Default | -|--------------------------+-----------------------------------------------+------------------------------------| -| lms-url | Logitech Media Server hostname or ip and port | http://lms_server:9000 | -| lms-default-player | Name of default player | nil (1) | -| lms-ui-cover-width | Cover image width | 500 (2) | -| lms-ui-update-interval | Time in seconds between UI updates | 1 (3) | -| lms-number-recent-albums | Number of recent albums to show | 25 | -| lms-number-random-albums | Number of random albums to show | 25 | -| lms-number-random-songs | Number of random songs to show | 50 | -| lms-set-rating-function | Function to use to set song rating | lms--set-rating-with-trackstat (4) | -|--------------------------+-----------------------------------------------+------------------------------------| -Notes: -(1) If *lms-default-player* is not defined or a player with that name does not exist, it will ask for one at start. -(2) It's recomendable not to change *lms-ui-cover-width*. -(3) Note that small values in *lms-ui-update-interval* could freeze your Emacs use while refreshing window. -(4) LMS does not have any means to set the rating of a song by itself, so it depends on an external plugin. - TrackStat (function *lms--set-rating-with-trackstat*) is a popular one, and RatingsLight (function *lms--set-rating-with-ratingslight*) is another option. -** Faces -The colors and font attributes of text can be customized in some views: -|----------------------------+-------------------------------+---------------------| -| Face name | Description | Default | -|----------------------------+-------------------------------+---------------------| -| lms-playing-face | Playing symbol | DarkTurquoise, bold | -| lms-title-face | Song title | SlateGray, italic | -| lms-artist-face | Artist | RosyBrown, bold | -| lms-year-face | Song year | SteelBlue | -| lms-album-face | Album | CadetBlue | -| lms-tracknum-face | Track number | gray40 | -| lms-duration-face | Song duration | gray60 | -| lms-players-selected-face | Selected icon in players list | SteelBlue | -| lms-players-isplaying-face | Isplaying in players list | RosyBrown | -| lms-players-name-face | Player name in players list | CadetBlue | -| lms-players-model-face | Player model in players list | SlateGray | -| lms-players-playerid-face | Player id in players list | gray60 | -| lms-players-ip-face | Player IP in players list | gray40 | -| lms-players-power-face | Ispower in players list | Maroon | -|----------------------------+-------------------------------+---------------------| - -* Playing now -Main window showing information about current track and player status. -The actions triggered by pressing keys refer to the current track. -** Key bindings -|-----------------+--------------------------------| -| Ctrl-p | select player | -| t | change player power state | -| R | change track rating | -| Ctrl-= | set volume | -| x, | toggle play/pause | -| p | play | -| s | stop playing | -| Ctrl-k, | play previous song in playlist | -| Ctrl-j, | play next song in playlist | -| m | toggle mute volume | -| +, = | volume up +5 | -| - | volume down -5 | -| r | cycle repeat mode | -| S | cycle shuffle mode | -| gr | update window contents | -| i | display track information | -| P | display playlist | -| T | show all albums by artist | -| L | show all tracks of album | -| Y | show all albums of this year | -| M | browse music libray | -| gh, g? | show this documentation | -| q | quit LMS | -|-----------------+--------------------------------| - -* Track information -Display track information. -Previous/next track only works when *Track information* window was called from a list, but not from *Playing now*. -** Key bindings -|-----------------+-------------------------| -| R | change track rating | -| Ctrl-k, | show previous track | -| Ctrl-j, | show next track | -| gh, g? | show this documentation | -| q | close window | -|-----------------+-------------------------| - -* Players list -Players list. -** Key bindings -|--------------------+--------------------------------| -| k, , j, | move cursor | -| | select player and close window | -| x | toggle player play/pause | -| t | toggle player power state | -| gh, g? | show this documentation | -| q | close window | -|--------------------+--------------------------------| - -* Playlist -Playlist view. -The actions triggered by pressing keys refer to the track under cursor. -** Key bindings -|--------------------+------------------------------------| -| k, , j, | move cursor | -| | play track | -| i | show track information | -| C | jump to current track | -| d, | remove track from playlist | -| c c | clear playlist | -| c u | remove tracks from start to cursor | -| c f | remove tracks from cursor to end | -| u | update window contents | -| A | show all albums by artist | -| T | show all tracks of album | -| Y | show all albums of this year | -| gh, g? | show this documentation | -| q | close window | -|--------------------+------------------------------------| - -* Year - Album - Artist list -View all albums of an artist, sorted by date/year. -The actions triggered by pressing keys refer to the album under cursor. -** Key bindings -|--------------------+------------------------------| -| k, , j, | move cursor | -| , a | show all tracks of album | -| A | show all albums by artist | -| Y | show all albums of this year | -| p | add album to playlist | -| gh, g? | show this documentation | -| q | close window | -|--------------------+------------------------------| - -* Tracks list -View list of tracks. -The actions triggered by pressing keys refer to the track under cursor. -** Key bindings -|--------------------+------------------------------| -| j, , k, | move cursor | -| , i | display track information | -| A | show all albums by artist | -| Y | show all albums of this year | -| p | add song to playlist | -| P | add all songs to playlist | -| gh, g? | show this documentation | -| q | close window | -|--------------------+------------------------------| -" - "LMS documentation.") - -;;;###autoload -(defun evil-collection-lms-setup () - "Set up `evil' bindings for `lms'." - - (dolist (map evil-collection-lms-maps) - (evil-collection-inhibit-insert-state map)) - - (dolist (mode evil-collection-lms-modes) - (evil-set-initial-state mode 'normal)) - - (evil-collection-define-key 'normal 'lms-ui-playing-now-mode-map - "t" 'lms-ui-playing-now-change-player-power-state - (kbd "C-p") 'lms-ui-playing-now-players-list - "R" 'lms-ui-playing-now-change-rating - (kbd "C-=") 'lms-ui-playing-now-set-volume - (kbd "RET") 'lms-ui-playing-now-play-pause - "x" 'lms-ui-playing-now-play-pause - "p" 'lms-ui-playing-now-play - "s" 'lms-ui-playing-now-stop - (kbd "C-j") 'lms-ui-playing-now-next - (kbd "") 'lms-ui-playing-now-next - (kbd "C-k") 'lms-ui-playing-now-prev - (kbd "") 'lms-ui-playing-now-prev - "+" 'lms-ui-playing-now-volume-up - "=" 'lms-ui-playing-now-volume-up - "-" 'lms-ui-playing-now-volume-down - "m" 'lms-ui-playing-now-volume-mute - "r" 'lms-ui-playing-now-cycle-repeat - "S" 'lms-ui-playing-now-cycle-shuffle - "gr" 'lms-ui-playing-now-refresh - "i" 'lms-ui-playing-now-show-track-info - "P" 'lms-ui-playing-now-show-playlist - "T" 'lms-ui-playing-now-album-tracks-list - "A" 'lms-ui-playing-now-artist-albums-list - "Y" 'lms-ui-playing-now-year-albums-list - "M" 'lms-ui-playing-now-browse-music-library - "g?" 'lms-ui-playing-now-help - "gh" 'lms-ui-playing-now-help - "q" 'lms-ui-playing-now-quit) - - (evil-collection-define-key 'normal 'lms-ui-track-info-mode-map - "R" 'lms-ui-track-info-change-rating - (kbd "C-k") 'lms-ui-track-info-prev - (kbd "") 'lms-ui-track-info-prev - (kbd "C-j") 'lms-ui-track-info-next - (kbd "") 'lms-ui-track-info-next - "g?" 'lms-ui-playing-now-help - "gh" 'lms-ui-playing-now-help - "q" 'evil-collection-lms-ui-track-info-mode-quit) - - (evil-collection-define-key 'normal 'lms-ui-players-mode-map - [remap evil-goto-line] 'evil-collection-lms-goto-line - [remap end-of-defun] 'evil-collection-lms-goto-line - [remap evil-forward-paragraph] 'evil-collection-lms-goto-line - [remap evil-next-line] 'evil-collection-lms-next-line - (kbd "RET") 'lms-ui-players-select - "x" 'lms-ui-players-playpause - "t" 'lms-ui-players-toggle-power - "g?" 'lms-ui-playing-now-help - "gh" 'lms-ui-playing-now-help - "q" 'evil-collection-lms-ui-players-mode-quit) - - (evil-collection-define-key 'normal 'lms-ui-playlist-mode-map - [remap evil-goto-line] 'evil-collection-lms-goto-line - [remap end-of-defun] 'evil-collection-lms-goto-line - [remap evil-forward-paragraph] 'evil-collection-lms-goto-line - [remap evil-next-line] 'evil-collection-lms-next-line - (kbd "RET") 'lms-ui-playlist-play - "i" 'lms-ui-playlist-track-info - "C" 'lms-ui-playlist-jump-to-current - "d" 'lms-ui-playlist-delete-track - (kbd "") 'lms-ui-playlist-delete-track - "cc" 'lms-ui-playlist-clear - "ct" 'lms-ui-playlist-clear-until-track - "cf" 'lms-ui-playlist-clear-from-track - "u" 'lms-ui-playlist - "A" 'lms-ui-playlist-artist-albums-list - "T" 'lms-ui-playlist-album-tracks-list - "Y" 'lms-ui-playlist-year-albums-list - "g?" 'lms-ui-playing-now-help - "gh" 'lms-ui-playing-now-help - "q" 'evil-collection-lms-ui-playlist-mode-quit) - - (evil-collection-define-key 'normal 'lms-ui-tracks-list-mode-map - [remap evil-goto-line] 'evil-collection-lms-goto-line - [remap end-of-defun] 'evil-collection-lms-goto-line - [remap evil-forward-paragraph] 'evil-collection-lms-goto-line - [remap evil-next-line] 'evil-collection-lms-next-line - "i" 'lms-ui-tl-track-info - (kbd "RET") 'lms-ui-tl-track-info - "p" 'lms-ui-tl-to-playlist - "P" 'lms-ui-tl-all-to-playlist - "Y" 'lms-ui-tl-by-year - "A" 'lms-ui-tl-by-artist - "g?" 'lms-ui-playing-now-help - "gh" 'lms-ui-playing-now-help - "q" 'evil-collection-lms-ui-tracks-list-mode-quit) - - (evil-collection-define-key 'normal 'lms-ui-year-album-artist-list-mode-map - [remap evil-goto-line] 'evil-collection-lms-goto-line - [remap end-of-defun] 'evil-collection-lms-goto-line - [remap evil-forward-paragraph] 'evil-collection-lms-goto-line - [remap evil-next-line] 'evil-collection-lms-next-line - "Y" 'lms-ui-yaal-by-year - "A" 'lms-ui-yaal-by-artist - (kbd "RET") 'lms-ui-yaal-by-album - "a" 'lms-ui-yaal-by-album - "p" 'lms-ui-yaal-to-playlist - "g?" 'lms-ui-playing-now-help - "gh" 'lms-ui-playing-now-help - "q" 'evil-collection-lms-ui-year-album-artist-list-mode-quit) - - ;; Reflect help keybinding changes in the lms.el UI. - (advice-add 'lms-ui-playing-now :after 'evil-collection-lms-ui-playing-now) - (setq lms-ui-docs evil-collection-lms-ui-docs)) - -(provide 'evil-collection-lms) -;;; evil-collection-lms.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/log-edit/README.org b/.config/emacs/lisp/evil-collection/modes/log-edit/README.org deleted file mode 100644 index 6046f21..0000000 --- a/.config/emacs/lisp/evil-collection/modes/log-edit/README.org +++ /dev/null @@ -1,17 +0,0 @@ -* log-edit - - Evil bindings for =log-edit-mode=, the VC commit-message buffer. - -** Key bindings - - | Command | Original | Evil | - |-----------------------------+-----------+-------------------| - | =log-edit-done= | =C-c C-c= | =ZZ= (remap) | - | =log-edit-kill-buffer= | =C-c C-k= | =ZQ= (remap) | - | =log-edit-mode-help= | =C-c ?= | =g?= | - | =log-edit-next-comment= | =M-n= | =]]=, =gj=, =C-j= | - | =log-edit-previous-comment= | =M-p= | =[[=, =gk= | - | =quit-window= | n/a | =ZZ=, =ZQ= | - - The remaps target =evil-save-and-close=, =evil-save-modified-and-close=, - and =evil-quit= so =:wq= / =:q= behave correctly. diff --git a/.config/emacs/lisp/evil-collection/modes/log-edit/evil-collection-log-edit.el b/.config/emacs/lisp/evil-collection/modes/log-edit/evil-collection-log-edit.el deleted file mode 100644 index 3d774c0..0000000 --- a/.config/emacs/lisp/evil-collection/modes/log-edit/evil-collection-log-edit.el +++ /dev/null @@ -1,57 +0,0 @@ -;;; evil-collection-log-edit.el --- Evil bindings for log-edit -*- lexical-binding: t -*- - -;; Copyright (C) 2019 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen , Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, log-edit, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for log-edit. - -;;; Code: -(require 'evil-collection) -(require 'log-edit nil t) - -(defvar log-edit-mode-map) - -(defconst evil-collection-log-edit-maps '(log-edit-mode-map)) - -;;;###autoload -(defun evil-collection-log-edit-setup () - "Set up `evil' bindings for `log-edit'." - (evil-collection-define-key nil 'log-edit-mode-map - [remap evil-save-and-close] 'log-edit-done - [remap evil-save-modified-and-close] 'log-edit-done - [remap evil-quit] 'log-edit-kill-buffer) - - (evil-collection-define-key 'normal 'log-edit-mode-map - "g?" 'log-edit-mode-help - "]]" 'log-edit-next-comment - "[[" 'log-edit-previous-comment - "gj" 'log-edit-next-comment - "gk" 'log-edit-previous-comment - (kbd "C-j") 'log-edit-next-comment - (kbd "C-k") 'log-edit-next-comment - - "ZQ" 'quit-window - "ZZ" 'quit-window)) - -(provide 'evil-collection-log-edit) -;;; evil-collection-log-edit.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/log-view/README.org b/.config/emacs/lisp/evil-collection/modes/log-view/README.org deleted file mode 100644 index c8363f4..0000000 --- a/.config/emacs/lisp/evil-collection/modes/log-view/README.org +++ /dev/null @@ -1,20 +0,0 @@ -* log-view - - Evil bindings for =log-view-mode= (VC log buffers for git, hg, svn, etc.). - -** Key bindings - - | Command | Original | Evil | - |----------------------------------+--------------+-----------------| - | =log-view-toggle-entry-display= | =RET=, =TAB= | =TAB= | - | =log-view-diff= | =d=, === | =RET=, =d=, === | - | =log-view-diff-changeset= | =D= | =D= | - | =log-view-toggle-mark-entry= | =m= | =m= | - | =log-view-modify-change-comment= | =e= | =c= | - | =log-view-annotate-version= | =a= | =a= | - | =log-view-find-revision= | =f= | =F= | - | =log-view-msg-next= | =n=, =TAB= | =gj=, =]]= | - | =log-view-msg-prev= | =p= | =gk=, =[[= | - | =log-view-file-next= | n/a | =C-j= | - | =log-view-file-prev= | n/a | =C-k= | - | =quit-window= | =q= | =q= | diff --git a/.config/emacs/lisp/evil-collection/modes/log-view/evil-collection-log-view.el b/.config/emacs/lisp/evil-collection/modes/log-view/evil-collection-log-view.el deleted file mode 100644 index fbd7520..0000000 --- a/.config/emacs/lisp/evil-collection/modes/log-view/evil-collection-log-view.el +++ /dev/null @@ -1,63 +0,0 @@ -;;; evil-collection-log-view.el --- Bindings for `log-view' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `log-view'. - -;;; Code: -(require 'evil-collection) -(require 'log-view) - -(defconst evil-collection-log-view-maps '(log-view-mode-map)) - -;;;###autoload -(defun evil-collection-log-view-setup () - "Set up `evil' bindings for `log-view'." - - ;; Currently vc has these various log-view modes - (evil-set-initial-state 'vc-hg-log-view-mode 'normal) - (evil-set-initial-state 'vc-git-log-view-mode 'normal) - (evil-set-initial-state 'vc-svn-log-view-mode 'normal) - - (evil-collection-define-key 'normal 'log-view-mode-map - "q" 'quit-window - (kbd "TAB") 'log-view-toggle-entry-display - "m" 'log-view-toggle-mark-entry - "c" 'log-view-modify-change-comment - (kbd "RET") 'log-view-diff - "d" 'log-view-diff - "=" 'log-view-diff - "D" 'log-view-diff-changeset - "a" 'log-view-annotate-version - "F" 'log-view-find-revision - "gj" 'log-view-msg-next - "gk" 'log-view-msg-prev - "]]" 'log-view-msg-next - "[[" 'log-view-msg-prev - (kbd "C-j") 'log-view-file-next - (kbd "C-k") 'log-view-file-prev)) - -(provide 'evil-collection-log-view) -;;; evil-collection-log-view.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/lsp-ui-imenu/evil-collection-lsp-ui-imenu.el b/.config/emacs/lisp/evil-collection/modes/lsp-ui-imenu/evil-collection-lsp-ui-imenu.el deleted file mode 100644 index 473169a..0000000 --- a/.config/emacs/lisp/evil-collection/modes/lsp-ui-imenu/evil-collection-lsp-ui-imenu.el +++ /dev/null @@ -1,47 +0,0 @@ -;;; evil-collection-lsp-ui-imenu.el --- Bindings for `lsp-ui-imenu-mode' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: Felix Dick -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, lsp-ui-imenu, convenience - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `lsp-ui-imenu-mode'. - -;;; Code: -(require 'lsp-ui-imenu nil t) -(require 'evil-collection) - -(defconst evil-collection-lsp-ui-imenu-mode-maps '(lsp-ui-imenu-mode-map)) - -;;;###autoload -(defun evil-collection-lsp-ui-imenu-setup () - "Set up `evil' bindings for `lsp-ui-imenu'." - (evil-set-initial-state 'lsp-ui-imenu-mode 'normal) - (evil-collection-define-key 'normal 'lsp-ui-imenu-mode-map - (kbd "C-k") 'lsp-ui-imenu--prev-kind - (kbd "C-j") 'lsp-ui-imenu--next-kind - (kbd "q") 'lsp-ui-imenu--kill - (kbd "RET") 'lsp-ui-imenu--view - (kbd "") 'lsp-ui-imenu--visit)) - -(provide 'evil-collection-lsp-ui-imenu) -;;; evil-collection-lsp-ui-imenu.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/lua-mode/README.org b/.config/emacs/lisp/evil-collection/modes/lua-mode/README.org deleted file mode 100644 index 922ca73..0000000 --- a/.config/emacs/lisp/evil-collection/modes/lua-mode/README.org +++ /dev/null @@ -1,18 +0,0 @@ -* lua-mode - - Evil bindings for [[https://github.com/immerrr/lua-mode][lua-mode]]. - -** Key bindings - - | Command | Original | Evil | - |----------------------------+-----------+------| - | =lua-search-documentation= | =C-c C-f= | =K= | - | =run-lua= | | =gz= | - - Also installs a hook that sets =evil-shift-width= to =lua-indent-level= - in =lua-mode= buffers. - -** New commands - - - =evil-collection-lua-mode-set-evil-shift-width= — sync - =evil-shift-width= with =lua-indent-level= (added to =lua-mode-hook=). diff --git a/.config/emacs/lisp/evil-collection/modes/lua-mode/evil-collection-lua-mode.el b/.config/emacs/lisp/evil-collection/modes/lua-mode/evil-collection-lua-mode.el deleted file mode 100644 index 1345fe7..0000000 --- a/.config/emacs/lisp/evil-collection/modes/lua-mode/evil-collection-lua-mode.el +++ /dev/null @@ -1,50 +0,0 @@ -;;; evil-collection-lua-mode.el --- Bindings for `lua-mode' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `lua-mode'. - -;;; Code: -(require 'evil-collection) -(require 'lua-mode nil t) - -(defvar lua-indent-level) -(defconst evil-collection-lua-mode-maps '(lua-mode-map)) - -(defun evil-collection-lua-mode-set-evil-shift-width () - "Set `evil-shift-width' according to `lua-indent-level'." - (setq-local evil-shift-width lua-indent-level)) - -;;;###autoload -(defun evil-collection-lua-mode-setup () - "Set up `evil' bindings for `lua-mode'." - (add-hook 'lua-mode-hook #'evil-collection-lua-mode-set-evil-shift-width) - - (evil-collection-define-key 'normal 'lua-mode-map - "K" 'lua-search-documentation - "gz" 'run-lua)) - -(provide 'evil-collection-lua-mode) -;;; evil-collection-lua-mode.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/macrostep/README.org b/.config/emacs/lisp/evil-collection/modes/macrostep/README.org deleted file mode 100644 index 0a0f543..0000000 --- a/.config/emacs/lisp/evil-collection/modes/macrostep/README.org +++ /dev/null @@ -1,13 +0,0 @@ -* macrostep - - Evil bindings for [[https://github.com/emacsorphanage/macrostep][macrostep]], the interactive macro expander. - -** Key bindings - - | Command | Original | Evil | - |--------------------------+--------------+-------------| - | =macrostep-expand= | =e= | =e= | - | =macrostep-collapse= | =c= | =u= | - | =macrostep-collapse-all= | =C-c C-c= | =q= | - | =macrostep-next-macro= | =n=, =TAB= | =gj=, =C-j= | - | =macrostep-prev-macro= | =p=, =M-TAB= | =gk=, =C-k= | diff --git a/.config/emacs/lisp/evil-collection/modes/macrostep/evil-collection-macrostep.el b/.config/emacs/lisp/evil-collection/modes/macrostep/evil-collection-macrostep.el deleted file mode 100644 index 58ff339..0000000 --- a/.config/emacs/lisp/evil-collection/modes/macrostep/evil-collection-macrostep.el +++ /dev/null @@ -1,52 +0,0 @@ -;;; evil-collection-macrostep.el --- Evil Integration for Macrostep -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, macrostep, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `macrostep-mode'. - -;;; Code: -(require 'evil-collection) -(require 'macrostep nil t) - -(defconst evil-collection-macrostep-maps '(macrostep-keymap)) - -;;;###autoload -(defun evil-collection-macrostep-setup () - "Set up `evil' bindings for `macrostep'." - ;; Keymaps don't seem to be populated on first try. - ;; Force `evil' to normalize keymaps. - (add-hook 'macrostep-mode-hook #'evil-normalize-keymaps) - - (evil-collection-define-key 'normal 'macrostep-keymap - "q" 'macrostep-collapse-all - "e" 'macrostep-expand - "u" 'macrostep-collapse - "gj" 'macrostep-next-macro - "gk" 'macrostep-prev-macro - (kbd "C-j") 'macrostep-next-macro - (kbd "C-k") 'macrostep-prev-macro)) - -(provide 'evil-collection-macrostep) -;;; evil-collection-macrostep.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/magit-repos/README.org b/.config/emacs/lisp/evil-collection/modes/magit-repos/README.org deleted file mode 100644 index babd311..0000000 --- a/.config/emacs/lisp/evil-collection/modes/magit-repos/README.org +++ /dev/null @@ -1,17 +0,0 @@ -* magit-repos - - Evil bindings for [[https://magit.vc/][magit-repos]] (=magit-list-repositories=). - - Initial state for =magit-repolist-mode= is set to =normal=. - -** Key bindings - -*** magit-repolist-mode-map (normal state) - - | Command | Original | Evil | - |---------------------------+----------+-------| - | =magit-repolist-mark= | =m= | =m= | - | =magit-repolist-unmark= | =u= | =u= | - | =magit-repolist-fetch= | =f= | =f= | - | =magit-repolist-status= | =RET= | =RET= | - | =magit-list-repositories= | =g= | =gr= | diff --git a/.config/emacs/lisp/evil-collection/modes/magit-repos/evil-collection-magit-repos.el b/.config/emacs/lisp/evil-collection/modes/magit-repos/evil-collection-magit-repos.el deleted file mode 100644 index 6bd91ec..0000000 --- a/.config/emacs/lisp/evil-collection/modes/magit-repos/evil-collection-magit-repos.el +++ /dev/null @@ -1,49 +0,0 @@ -;;; evil-collection-magit-repos.el --- Bindings for magit-repos -*- lexical-binding: t -*- - -;; Copyright (C) 2015-2016, 2021 Justin Burkett - -;; Author: Justin Burkett -;; Maintainer: Justin Burkett -;; James Nguyen -;; Pierre Neidhardt -;; Package-Requires: ((emacs "26.3") (evil "1.2.3") (magit "2.6.0")) -;; Homepage: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;;; Bindings for magit-repos. - -;;; Code: -(require 'evil-collection) -(require 'magit-repos nil t) - -(defvar magit-repolist-mode-map) -(defconst evil-collection-magit-repos-maps '(magit-repolist-mode-map)) - -;;;###autoload -(defun evil-collection-magit-repos-setup () - "Set up `evil' bindings for `magit-repos'." - (evil-set-initial-state 'magit-repolist-mode 'normal) - (evil-collection-define-key 'normal 'magit-repolist-mode-map - "m" 'magit-repolist-mark - "u" 'magit-repolist-unmark - "f" 'magit-repolist-fetch - (kbd "RET") 'magit-repolist-status - (kbd "gr") 'magit-list-repositories) - (add-hook 'magit-repolist-mode-hook 'evil-normalize-keymaps)) - -(provide 'evil-collection-magit-repos) -;;; evil-collection-magit-repos.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/magit-section/README.org b/.config/emacs/lisp/evil-collection/modes/magit-section/README.org deleted file mode 100644 index 807238d..0000000 --- a/.config/emacs/lisp/evil-collection/modes/magit-section/README.org +++ /dev/null @@ -1,47 +0,0 @@ -* magit-section - - Evil bindings for [[https://github.com/magit/magit][magit-section]], the foldable section UI used by magit, forge, - and several other packages. - -** Key bindings - - | Command | Original | Evil | - |----------------------------------+-----------+-----------| - | =magit-section-toggle= | =TAB= | =TAB= | - | =magit-section-cycle= | =C-= | =C-= | - | =magit-section-cycle= | =M-= | =M-= | - | =magit-section-cycle-global= | =backtab= | =backtab= | - | =magit-section-up= | =^= | =gh= | - | =magit-section-backward= | =p= | =C-k= | - | =magit-section-forward= | =n= | =C-j= | - | =magit-section-backward-sibling= | =M-p= | =gk=, =[= | - | =magit-section-forward-sibling= | =M-n= | =gj=, =]= | - | =magit-section-show-level-1= | =1= | =1= | - | =magit-section-show-level-2= | =2= | =2= | - | =magit-section-show-level-3= | =3= | =3= | - | =magit-section-show-level-4= | =4= | =4= | - | =magit-section-show-level-1-all= | =M-1= | =M-1= | - | =magit-section-show-level-2-all= | =M-2= | =M-2= | - | =magit-section-show-level-3-all= | =M-3= | =M-3= | - | =magit-section-show-level-4-all= | =M-4= | =M-4= | - - When =evil-collection-magit-section-use-z-for-folds= is non-nil, the - following vim-style fold bindings replace the =M-= variants: - - | Command | Evil | - |----------------------------------+------| - | =magit-section-show-level-1-all= | =z1= | - | =magit-section-show-level-2-all= | =z2= | - | =magit-section-show-level-3-all= | =z3= | - | =magit-section-show-level-4-all= | =z4= | - | =magit-section-show-level-4-all= | =zr= | - | =magit-section-toggle= | =za= | - | =magit-section-show= | =zo= | - | =magit-section-show-children= | =zO= | - | =magit-section-hide= | =zc= | - | =magit-section-hide-children= | =zC= | - -** Customization - - - =evil-collection-magit-section-use-z-for-folds= - When non-nil, use =z= as - a prefix for vim-style fold commands. The stash popup then moves to =Z=. diff --git a/.config/emacs/lisp/evil-collection/modes/magit-section/evil-collection-magit-section.el b/.config/emacs/lisp/evil-collection/modes/magit-section/evil-collection-magit-section.el deleted file mode 100644 index 2310393..0000000 --- a/.config/emacs/lisp/evil-collection/modes/magit-section/evil-collection-magit-section.el +++ /dev/null @@ -1,91 +0,0 @@ -;;; evil-collection-magit-section.el --- Bindings for magit-section -*- lexical-binding: t -*- - -;; Copyright (C) 2022 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.2 -;; Package-Requires: ((emacs "27.1")) -;; Keywords: evil, emacs, convenience, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for magit-section. - -;;; Code: -(require 'evil-collection) -(require 'magit-section nil t) - -(defvar magit-section-mode-map) -(defconst evil-collection-magit-section-maps '(magit-section-mode-map)) - -(defcustom evil-collection-magit-section-use-z-for-folds nil - "When non nil, use \"z\" as a prefix for common vim fold commands, such as - - z1 Reset visibility to level 1 for all sections - - z2 Reset visibility to level 2 for all sections - - z3 Reset visibility to level 3 for all sections - - z4 Reset visibility to level 4 for all sections - - za Toggle a section - - zo Show section - - zO Show sections recursively - - zc Hide section - - zC Hide sections recursively - - zr Same as z4. - -When this option is enabled, the stash popup is available on \"Z\"." - :group 'magit - :type 'boolean) - -(defun evil-collection-magit-section-setup () - "Set up `evil' bindings for magit-section." - (if evil-collection-magit-section-use-z-for-folds - (evil-collection-define-key 'normal 'magit-section-mode-map - "z1" 'magit-section-show-level-1-all - "z2" 'magit-section-show-level-2-all - "z3" 'magit-section-show-level-3-all - "z4" 'magit-section-show-level-4-all - "za" 'magit-section-toggle - "zc" 'magit-section-hide - "zC" 'magit-section-hide-children - "zo" 'magit-section-show - "zO" 'magit-section-show-children - "zr" 'magit-section-show-level-4-all) - (evil-collection-define-key 'normal 'magit-section-mode-map - (kbd "M-1") 'magit-section-show-level-1-all - (kbd "M-2") 'magit-section-show-level-2-all - (kbd "M-3") 'magit-section-show-level-3-all - (kbd "M-4") 'magit-section-show-level-4-all)) - - (evil-collection-define-key 'normal 'magit-section-mode-map - (kbd "TAB") 'magit-section-toggle - [C-tab] 'magit-section-cycle - [M-tab] 'magit-section-cycle - ;; [backtab] is the most portable binding for Shift+Tab. - [backtab] 'magit-section-cycle-global - "gh" 'magit-section-up - (kbd "C-k") 'magit-section-backward - (kbd "C-j") 'magit-section-forward - "gk" 'magit-section-backward-sibling - "[" 'magit-section-backward-sibling - "gj" 'magit-section-forward-sibling - "]" 'magit-section-forward-sibling - (kbd "1") 'magit-section-show-level-1 - (kbd "2") 'magit-section-show-level-2 - (kbd "3") 'magit-section-show-level-3 - (kbd "4") 'magit-section-show-level-4)) - -(provide 'evil-collection-magit-section) -;;; evil-collection-magit-section.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/magit-todos/README.org b/.config/emacs/lisp/evil-collection/modes/magit-todos/README.org deleted file mode 100644 index 17a94d1..0000000 --- a/.config/emacs/lisp/evil-collection/modes/magit-todos/README.org +++ /dev/null @@ -1,32 +0,0 @@ -* magit-todos - - Evil bindings for [[https://github.com/alphapapa/magit-todos][magit-todos]]. - - Setup clears =j= and =k= on the todos section maps (older =magit-todos= - versions bound them, blocking evil's vertical motion through todos - sections) and adds a jump key on =magit-status=. - -** Key bindings - -*** magit-todos-section-map / magit-todos-item-section-map - - | Key | Original | Evil | - |-----+------------------------------------+---------| - | =j= | =magit-todos-...= (older versions) | unbound | - | =k= | =magit-todos-...= (older versions) | unbound | - - The current upstream uses =B= / =b= on these maps (branch list set - commit / toggle); those are untouched. - -*** magit-status-mode-map (normal state) - - | Command | Original | Evil | - |-----------------------------+----------+------| - | =magit-todos-jump-to-todos= | =j T= | =gT= | - - Bound only when =magit-todos-mode= is enabled. - -** Notes - - =magit-todos-mode= emits a warning about the =jT= key when these - rebindings take effect. Setup advises the mode to silence that warning. diff --git a/.config/emacs/lisp/evil-collection/modes/magit-todos/evil-collection-magit-todos.el b/.config/emacs/lisp/evil-collection/modes/magit-todos/evil-collection-magit-todos.el deleted file mode 100644 index 891904b..0000000 --- a/.config/emacs/lisp/evil-collection/modes/magit-todos/evil-collection-magit-todos.el +++ /dev/null @@ -1,62 +0,0 @@ -;;; evil-collection-magit-todos.el --- Bindings for `magit-todos' -*- lexical-binding: t -*- - -;; Copyright (C) 2018 James Nguyen - -;; Author: Fredrik Bergroth -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `magit-todos'. - -;;; Code: -(require 'evil-collection) -(require 'magit-todos nil t) - -(defconst evil-collection-magit-todos-maps '(magit-todos-section-map - magit-todos-item-section-map - magit-status-mode-map)) - -(defun evil-collection-magit-todos-setup-jump-key () - "Add keybinding to jump to todos section." - (evil-collection-define-key 'normal 'magit-status-mode-map - "gT" (and (bound-and-true-p magit-todos-mode) 'magit-todos-jump-to-todos))) - -(defun evil-collection-magit-todos-supress-warning (func &rest args) - "Supress the jT keybinding warning." - (cl-letf* (((symbol-function 'message) #'ignore)) - (apply func args))) - -;;;###autoload -(defun evil-collection-magit-todos-setup () - "Set up `evil' bindings for `magit-todos'." - ;; magit-todos binds jT and k which prevents evil users from stepping into the section - (dolist (key '("j" "k")) - (evil-collection-define-key nil 'magit-todos-section-map key nil) - (evil-collection-define-key nil 'magit-todos-item-section-map key nil)) - - ;; No need to tell me that jT isn't bound - (advice-add 'magit-todos-mode :around 'evil-collection-magit-todos-supress-warning) - - (add-hook 'magit-todos-mode-hook 'evil-collection-magit-todos-setup-jump-key)) - - -(provide 'evil-collection-magit-todos) -;;; evil-collection-magit-todos.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/magit/README.org b/.config/emacs/lisp/evil-collection/modes/magit/README.org deleted file mode 100644 index c20db58..0000000 --- a/.config/emacs/lisp/evil-collection/modes/magit/README.org +++ /dev/null @@ -1,212 +0,0 @@ -* Black magic - - This library configures Magit and Evil to play well with each other. For some - background see [[https://github.com/justbur/evil-magit/issues/1][Issue #1]]. - - *Note*: I intend to track the latest commits to the master branch of the [[https://github.com/magit/magit][magit - repo]], meaning the keybindings here are potentially ahead of the last stable - release of magit. Once the code in evil-collection-magit stabilizes, I may switch to - primarily tracking the stable release of magit and secondarily track the latest - commits to master. Any help is welcomed. - -* Recent Changes (most recent first) - - 1. [2019-09-04] Don't use =evil-next-visual-line= and - =evil=previous-visual-line=. See [[https://github.com/emacs-evil/evil-magit/issues/70][Issue #70]]. - 1. [2019-06-16] Added =evil-collection-magit-stage-untracked-file-with-intent= at - =I=. See [[https://github.com/emacs-evil/evil-magit/issues/67][Issue #67]]. - 2. [2019-02-15] Added =forge-dispatch= at =@=. - 3. [2018-05-22] Added =evil-collection-magit-use-z-for-folds=. See docstring for more - information. - 4. [2018-03-13] Added basic evil support for =magit-list-repositories=. - 5. [2016-07-27] Moved submodules popup to ' and added the new subtree popup at - ". This is not mnemonic in any way but easy to reach and keeps the two keys - together. - 6. [2016-03-24] Moved =magit-diff-less-context= to = to fix conflict with - moved revert. - 7. [2016-03-21] Moved revert commands from =o= and =O= to =-= and - =_=. Rationale is that you are subtracting a commit. This makes room for - =o= and =O= to be reset and the new reset popup command. Think of resetting - to an "old" state. =¯\_(ツ)_/¯= - 8. Added =evil-collection-magit-want-horizontal-movement=. Use =h= and =l= for movement - like vim, moving =h= to =H=, =l= to =L=, and =L= to =C-l=. - 9. Added =evil-collection-magit-toggle-text-mode= on =C-t=. This is a quick way to enter - text mode in a magit buffer, which allows arbitrary movement, copying, etc. - Use =C-t= to return to the previous magit mode. - 10. When =evil-collection-magit-use-y-for-yank= is non nil, =C-w= will prefix the evil - window switching functions from magit buffers. - 11. =evil-collection-magit-use-y-for-yank= is now the default. It has worked well for me so - far, and I've had good feedback, but please let me know if you see issues. - You can use the original behavior with =(setq evil-collection-magit-use-y-for-yank - nil)=. See the table below for a summary of differences. - - -* Installation and Use - - Evil and Magit are both required. After requiring those packages, the following - will setup the new key bindings for you. - - #+BEGIN_SRC emacs-lisp - ;; optional: this is the evil state that evil-collection-magit will use - ;; (setq evil-collection-magit-state 'normal) - ;; optional: disable additional bindings for yanking text - ;; (setq evil-collection-magit-use-y-for-yank nil) - (evil-collection-init) - #+END_SRC emacs-lisp - -** Note on Evil usage - - This package assumes that you either use the global variant of evil mode (e.g., - through =(evil-mode 1)=), or at least have =evil-local-mode= (the local variant) - enabled in the magit buffers you want these bindings to take effect in. When - evil is disabled in a magit buffer, this package will not affect the default key - bindings (with one minor exception). - -** Note on =evil-collection-magit-use-y-for-yank= - - =evil-collection-magit-use-y-for-yank= enables evil's visual state for linewise selection, - and as a consequnce =y= will yank text from the buffer. - - With this enabled which it is by default evil-collection-magit uses =v= and =V= to select - by line. Selection in magit occurs linewise, so this choice is to avoid - confusion that might arise if someone thought they could stage part of a line - with =v= for example. - -** Text mode - - Text mode can be toggled with =evil-collection-magit-toggle-text-mode= (triggered with - =C-t= or =\=). This takes nearly any magit buffer out of the related magit mode - and puts it into =text-mode=. This allows free movement in the buffer using the - standard evil movement and selection commands, making it easy to for example - copy arbitrary text in the buffer. It also effectively prevents magit keys from - shadowing evil ones, so =f= runs =evil-find-char= instead of - =magit-fetch-popup=, allowing all vim related movement commands to be used in - magit buffers. You can think of this if you like as another state for evil-collection-magit - to be in. - - Several requests have been made to allow selecting and copying arbitrary text in - the magit buffers, but there are many conflicts between evil bindings and magit - bindings and there is no elegant solution to this problem in my opinion. Text - mode is the best that I have come up with. - -* Key Bindings - - The basic key binding scheme for evil-collection-magit (EM) is described in the following - tables. Blank columns indicate that the key is carried over from the left. - - | Category | Default | EM w/o yank opt | w/ yank opt (default) | w/ horiz move | w/ folds | - |------------------------+---------+------------------------+-----------------------+---------------+----------| - | cherry pick | =a/A= | | | | | - | branch | =b= | | | | | - | bisect | =B= | | | | | - | commit | =c= | | | | | - | diff | =d/D= | | | | | - | ediff | =e/E= | | | | | - | fetch | =f= | | | | | - | pull | =F= | | | | | - | refresh | =g= | =gr/gR= (=g= in popup) | | | | - | help | =h/?= | | | =H/?= | | - | ignore | =i/I= | | | | | - | intent to stage | =I= | | | | | - | jump | =j= | =g= | | | | - | delete | =k= | =x= | | | | - | untrack | =K= | =X= | | | | - | log | =l/L= | | | =L/C-l= | | - | merge | =m= | | | | | - | remote | =M= | | | | | - | next section | =n= | =C-j= | | | | - | next section sibling | =M-n= | =M-j=, =gj=, or =]= | | | | - | submodule | =o= | ' | | | | - | subtree | =O= | " | | | | - | prev section | =p= | =C-k= | | | | - | prev section sibling | =M-p= | =M-k=, =gk=, or =[= | | | | - | push | =P= | =P= or =p= | | | | - | quit | =q= | =q= or =ESC= | | | | - | rebase | =r= | | | | | - | rename | =R= | | | | | - | stage | =s/S= | | | | | - | tag | =t= | | | | | - | notes | =T= | | | | | - | unstage | =u/U= | | | | | - | revert | =v/V= | =-/_= | | | | - | am | =w= | | | | | - | patch | =W= | | | | | - | reset | =x/X= | =o/O= | | | | - | show-refs | =y= | | =yr= (=y= in popup) | | | - | cherry | =Y= | | | | | - | worktree | =Z/%= | | | | =%= | - | stash | =z/Z= | | | | =Z= | - | git-cmd | =:= | =¦= | | | | - | run | =!= | | | | | - | forge | =@= | | | | | - | diff less/more context | =-/+= | = / + | | | | - | copy section info | =C-w= | | =ys= | | | - | copy buffer info | =M-w= | | =yb= | | | - -** New Commands - - | Command | EM w/o yank opt | EM w/ yank opt (default) | w/ horiz move | - |----------------------------------------+--------------------------+--------------------------+---------------| - | evil-goto-line | =G= | | | - | evil-next-visual-line | =j= | | | - | evil-previous-visual-line | =k= | | | - | evil-backward-char | under =M-x= | | =h= | - | evil-forward-char | under =M-x= | | =l= | - | evil-search-next | =n= | | | - | evil-search-previous | =N= | | | - | set-mark-command | =v= or =V= | =C-SPC= | | - | evil-visual-line | under =M-x= | =v= or =V= | | - | evil-ex | =:= | | | - | evil-search-forward | =/= | | | - | evil-scroll-page-up | =C-b= | | | - | evil-scroll-down | =C-d= | | | - | evil-scroll-page-down | =C-f= | | | - | evil-scroll-up | =C-u= (if =C-u= scrolls) | | | - | evil-emacs-state | =C-z= | | | - | evil-yank-line | under =M-x= | =yy= | | - | evil-window-map | under =M-x= | =C-w= | | - | evil-collection-magit-toggle-text-mode | =C-t/\= | | | - - - Any other bindings are meant to be consistent with these. - - Use =evil-collection-magit-revert= to revert changes made by evil-collection-magit to the default - evil+magit behavior. - -** To add other common evil commands - - Some may want =?= to search backward instead of launching the popup which is - also bound to =h=. To get this behavior, add the following line after - =(evil-collection-init)= in your configuration. - - #+BEGIN_SRC emacs-lisp -(evil-define-key evil-collection-magit-state magit-mode-map "?" 'evil-search-backward) - #+END_SRC - - Most (but not all) magit bindings are in =magit-mode-map=, so other commands can - be bound in this way too. - -** To remove commands - - Typically, to prevent evil-collection-magit from overriding the default behavior with evil - and magit loaded, you should bind the respective key to =nil= after loading - evil-collection-magit. For example, to make =escape= behave as default: - - #+BEGIN_SRC emacs-lisp -(evil-define-key* evil-collection-magit-state magit-mode-map [escape] nil) - #+END_SRC - -* Known Conflicts - - These are the third-party packages that conflict with these bindings and will - probably need to be disabled in magit buffers for evil-collection-magit to work properly. - - 1. [[https://github.com/hlissner/evil-snipe][evil-snipe]] - 2. [[https://github.com/syl20bnr/evil-escape][evil-escape]] with [[https://github.com/justbur/evil-magit/issues/4][certain escape sequences]] - -* Disclaimer - - Given the complexity of magit key bindings combined with the complexity of git - itself, it is possible that there are some rough edges where the current binding - is not the expected one in a buffer. It will be very helpful for you to report - any such instances. diff --git a/.config/emacs/lisp/evil-collection/modes/magit/evil-collection-magit.el b/.config/emacs/lisp/evil-collection/modes/magit/evil-collection-magit.el deleted file mode 100644 index 533eae0..0000000 --- a/.config/emacs/lisp/evil-collection/modes/magit/evil-collection-magit.el +++ /dev/null @@ -1,747 +0,0 @@ -;;; evil-collection-magit.el --- Evil-based key bindings for magit -*- lexical-binding: t; -*- - -;; Copyright (C) 2015-2016, 2021 Justin Burkett - -;; Author: Justin Burkett -;; Maintainer: Justin Burkett -;; James Nguyen -;; Pierre Neidhardt -;; Package-Requires: ((emacs "26.3") (evil "1.2.3") (magit "2.6.0")) -;; Homepage: https://github.com/emacs-evil/evil-collection -;; Version: 0.4.1 - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: - -;; This library configures Magit and Evil to play well with each -;; other. For some background see https://github.com/magit/evil-magit/issues/1. - -;; See the README at -;; https://github.com/emacs-evil/evil-collection/tree/master/modes/magit -;; for a table describing the key binding changes. - -;;; Code: - -(require 'evil-collection) -(require 'magit nil t) - -(defvar magit-blame-mode-map) -(defvar magit-blame-read-only-mode-map) -(defvar magit-blob-mode-map) -(defvar magit-cherry-mode-map) -(defvar magit-diff-mode-map) -(defvar magit-file-section-map) -(defvar magit-hunk-section-map) -(defvar magit-log-mode-map) -(defvar magit-log-read-revs-map) -(defvar magit-log-select-mode-map) -(defvar magit-process-mode-map) -(defvar magit-reflog-mode-map) -(defvar magit-refs-mode-map) -(defvar magit-status-mode-map) -(defvar magit-submodule-list-mode-map) - -(defconst evil-collection-magit-maps - '(evil-collection-magit-toggle-text-minor-mode-map - magit-log-mode-map ; -> parent: `magit-mode-map' - magit-status-mode-map ; -> parent: `magit-mode-map' - magit-blame-mode-map - magit-blame-read-only-mode-map - magit-blob-mode-map - magit-submodule-list-mode-map ; -> parent: `magit-repolist-mode-map' - magit-mode-map)) - -(defcustom evil-collection-magit-use-y-for-yank t - "When non nil (Default is t), -replace \"y\" for `magit-show-refs' with -\"yy\" for `evil-collection-magit-yank-whole-line', -\"ys\" for `magit-copy-section-value', -\"yb\" for `magit-copy-buffer-revision' and -\"yr\" for `magit-show-refs'. -This keeps \"y\" for `magit-show-refs', -in the help popup (`magit-dispatch')." - :group 'magit - :type 'boolean) - -(defcustom evil-collection-magit-want-horizontal-movement nil - "When non nil, use \"h\" and \"l\" for horizontal movement in -most magit buffers. The old \"h\" for help is moved to \"H\" and -similarly for the old \"l\" for the log popup. The old \"L\" is -then put on \"C-l\"." - :group 'magit - :type 'boolean) - -(defcustom evil-collection-magit-use-z-for-folds nil - "When non nil, use \"z\" as a prefix for common vim fold commands, such as - - z1 Reset visibility to level 1 for all sections - - z2 Reset visibility to level 2 for all sections - - z3 Reset visibility to level 3 for all sections - - z4 Reset visibility to level 4 for all sections - - za Toggle a section - - zo Show section - - zO Show sections recursively - - zc Hide section - - zC Hide sections recursively - - zr Same as z4. - -When this option is enabled, the stash popup is available on \"Z\"." - :group 'magit - :type 'boolean) - -(defcustom evil-collection-magit-use-v-for-visual-line nil - "When non nil, use \"v\" for `evil-visual-line' (old behavior). -When nil (default), \"v\" uses `evil-visual-char'." - :group 'magit - :type 'boolean) - -(defcustom evil-collection-magit-use-$-for-end-of-line t - "When non nil, use \"$\" for `evil-end-of-line'. - -Move `magit-process-buffer' to \"`\"." - :group 'magit - :type 'boolean) - -(defcustom evil-collection-magit-use-0-for-beginning-of-line t - "When non nil, use \"0\" for `evil-beginning-of-line'. - -Move `magit-diff-default-context' to \"~\"." - :group 'magit - :type 'boolean) - -(defcustom evil-collection-magit-state (if evil-collection-magit-use-y-for-yank 'normal 'motion) - "State to use for most magit buffers." - :group 'magit - :type 'symbol) - -;; without this set-mark-command activates visual-state which is just annoying -;; and introduces possible bugs -(defun evil-collection-magit-remove-visual-activate-hook () - (when (derived-mode-p 'magit-mode) - (remove-hook 'activate-mark-hook 'evil-visual-activate-hook t))) -(add-hook 'evil-local-mode-hook 'evil-collection-magit-remove-visual-activate-hook) - -(defun evil-collection-magit-maybe-deactivate-mark () - "Deactivate mark if region is active. Used for ESC binding." - (interactive) - (when (region-active-p) (deactivate-mark))) - -(defvar evil-collection-magit-emacs-to-default-state-modes - '(git-commit-mode) - "Modes that should be in the default evil state.") - -(defvar evil-collection-magit-emacs-to-evil-collection-magit-state-modes - '(git-rebase-mode - magit-mode - magit-cherry-mode - magit-diff-mode - magit-log-mode - magit-log-select-mode - magit-process-mode - magit-reflog-mode - magit-refs-mode - magit-revision-mode - magit-stash-mode - magit-stashes-mode - magit-status-mode) - "Modes that switch from Emacs state to `evil-collection-magit-state'.") - -(defvar evil-collection-magit-default-to-evil-collection-magit-state-modes - '(magit-blob-mode - magit-gitflow-mode) - "Modes that switch from default state to `evil-collection-magit-state'.") - -(defvar evil-collection-magit-untouched-modes - ;; TODO do something here - '(git-popup-mode - magit-blame-mode - magit-blame-read-only-mode) - "Modes whose evil states are unchanged.") - -(defvar evil-collection-magit-ignored-modes - '(git-commit-major-mode - magit-auto-revert-mode - magit-blame-put-keymap-before-view-mode - magit-diff-mode - magit-merge-preview-mode - transient-resume-mode - magit-rebase-mode - magit-wip-after-save-mode - magit-wip-after-save-local-mode-major-mode - magit-wip-after-save-local-mode - magit-wip-after-apply-mode - magit-wip-before-change-mode - magit-wip-initial-backup-mode - magit-wip-mode - ;; gh - magit-gh-pulls-mode - ;; git-gutter - git-gutter-mode - git-gutter-mode-major-mode - git-gutter+-commit-mode - git-gutter+-mode - git-gutter+-enable-fringe-display-mode - git-gutter+-enable-default-display-mode) - "Currently ignored modes. They are collected here for testing purposes.") - -(defun evil-collection-magit-set-initial-states () - "Set the initial state for relevant modes." - (dolist (mode (append evil-collection-magit-emacs-to-evil-collection-magit-state-modes - evil-collection-magit-default-to-evil-collection-magit-state-modes)) - (evil-set-initial-state mode evil-collection-magit-state)) - (dolist (mode evil-collection-magit-emacs-to-default-state-modes) - (evil-set-initial-state mode evil-default-state))) - -(defun evil-collection-magit-revert-initial-states () - "Revert the initial state for modes to their values before -evil-collection-magit was loaded." - (dolist (mode (append evil-collection-magit-emacs-to-evil-collection-magit-state-modes - evil-collection-magit-emacs-to-default-state-modes)) - (evil-set-initial-state mode 'emacs)) - (dolist (mode evil-collection-magit-default-to-evil-collection-magit-state-modes) - (evil-set-initial-state mode evil-default-state))) - -(defvar evil-collection-magit-section-maps - '(magit-branch-section-map - magit-commit-section-map - magit-commit-message-section-map - magit-error-section-map - magit-file-section-map - magit-hunk-section-map - magit-module-commit-section-map - magit-remote-section-map - magit-staged-section-map - magit-stash-section-map - magit-stashes-section-map - magit-tag-section-map - magit-unpulled-section-map - magit-unpushed-section-map - magit-unstaged-section-map - magit-untracked-section-map - - ;; new ones that I haven't looked at yet - magit-button-section-map - magit-commitbuf-section-map - magit-diff-section-map - magit-diffbuf-section-map - magit-diffstat-section-map - magit-headers-section-map - magit-log-section-map - magit-message-section-map - ;; FIXME: deal with new bindings in this one - magit-module-section-map - magit-modules-section-map - magit-processbuf-section-map - magit-process-section-map - magit-pulls-section-map - magit-unmerged-section-map - magit-status-section-map - magit-worktree-section-map) - "All magit section maps. For testing purposes only at the moment.") - -;; Old way of excluding newlines -;; (when evil-collection-magit-use-y-for-yank -;; (dolist (map evil-collection-magit-section-maps) -;; (when (and map (keymapp (symbol-value map))) -;; (map-keymap -;; (lambda (_ def) -;; (when (commandp def) -;; (evil-set-command-property def :exclude-newline t))) -;; (symbol-value map))))) - -(defvar evil-collection-magit-in-visual-pre-command) - -(defun evil-collection-magit--around-visual-pre-command (orig-func &rest args) - (let ((evil-collection-magit-in-visual-pre-command t)) - (apply orig-func args))) - -(defun evil-collection-magit--filter-args-visual-expand-region (arglist) - ;; pretend that the command has the :exclude-newline property by rewriting the - ;; EXCLUDE-NEWLINE arg to this function - (cons (or (car arglist) - (and (bound-and-true-p evil-collection-magit-in-visual-pre-command) - (eq (evil-visual-type) 'line) - (derived-mode-p 'magit-mode))) - ;; shouldn't be necessary, but this will prevent it from failing if an - ;; arg is added. - (cdr arglist))) - -(when (and (fboundp 'advice-add) evil-collection-magit-use-y-for-yank) - (advice-add 'evil-visual-pre-command - :around #'evil-collection-magit--around-visual-pre-command) - (advice-add 'evil-visual-expand-region - :filter-args #'evil-collection-magit--filter-args-visual-expand-region)) - -;; keep visual state for magit-section movement commands -(dolist (cmd '(magit-section-forward-sibling - magit-section-forward - magit-section-backward-sibling - magit-section-backward - magit-section-up)) - (evil-set-command-property cmd :keep-visual t)) - -(defvar evil-collection-magit-mode-map-bindings - (let ((states (if evil-collection-magit-use-y-for-yank - `(,evil-collection-magit-state visual) - `(,evil-collection-magit-state)))) - (append - `((,states magit-mode-map "g") - (,states magit-mode-map "\C-j" magit-section-forward "n") - (,states magit-mode-map "\M-j" magit-section-forward-sibling "M-n") - (,states magit-mode-map "gj" magit-section-forward-sibling "M-n") - (,states magit-mode-map "]" magit-section-forward-sibling "M-n") - (,states magit-mode-map "\C-k" magit-section-backward "p") - (,states magit-mode-map "\M-k" magit-section-backward-sibling "M-p") - (,states magit-mode-map "gk" magit-section-backward-sibling "M-p") - (,states magit-mode-map "[" magit-section-backward-sibling "M-p") - (,states magit-mode-map "gr" magit-refresh "g") - (,states magit-mode-map "gR" magit-refresh-all "G") - (,states magit-mode-map "x" magit-delete-thing "k") - (,states magit-mode-map "X" magit-file-untrack "K") - (,states magit-mode-map "-" magit-revert-no-commit "v") - (,states magit-mode-map "_" magit-revert "V") - (,states magit-mode-map "p" magit-push "P") - (,states magit-mode-map "o" magit-reset-quickly "x") - (,states magit-mode-map "O" magit-reset "X") - (,states magit-mode-map "|" magit-git-command ":") - (,states magit-mode-map "'" magit-submodule "o") - (,states magit-mode-map "\"" magit-subtree "O") - (,states magit-mode-map "=" magit-diff-less-context "-") - (,states magit-mode-map "j" evil-next-line) - (,states magit-mode-map "k" evil-previous-line) - (,states magit-mode-map "gg" evil-goto-first-line) - (,states magit-mode-map "G" evil-goto-line) - (,states magit-mode-map "\C-d" evil-scroll-down) - (,states magit-mode-map "\C-f" evil-scroll-page-down) - (,states magit-mode-map "\C-b" evil-scroll-page-up) - (,states magit-mode-map ":" evil-ex) - (,states magit-mode-map "q" magit-mode-bury-buffer) - - ;; these are to fix the priority of the log mode map and the magit mode map - ;; FIXME: Conflict between this and revert. Revert seems more important here - ;; (,states magit-log-mode-map "-" magit-log-half-commit-limit "-") - (,states magit-log-mode-map "=" magit-log-toggle-commit-limit "=") - - ;; https://github.com/emacs-evil/evil-collection/issues/406 - ;; Use kbd here for S-SPC and S-DEL so evil-collection-define-key can - ;; parse definition correctly;. - (,states magit-mode-map ,(kbd "S-SPC") magit-diff-show-or-scroll-up "SPC") - (,states magit-mode-map ,(kbd "S-DEL") magit-diff-show-or-scroll-down "DEL") - - ((,evil-collection-magit-state) magit-mode-map ,(kbd evil-toggle-key) evil-emacs-state)) - - (if (eq evil-search-module 'evil-search) - `((,states magit-mode-map "/" evil-ex-search-forward) - (,states magit-mode-map "n" evil-ex-search-next) - (,states magit-mode-map "N" evil-ex-search-previous) - (,states magit-blame-read-only-mode-map "n" evil-ex-search-next) - (,states magit-blame-read-only-mode-map "N" evil-ex-search-previous)) - `((,states magit-mode-map "/" evil-search-forward) - (,states magit-mode-map "n" evil-search-next) - (,states magit-mode-map "N" evil-search-previous) - (,states magit-blame-read-only-mode-map "n" evil-search-next) - (,states magit-blame-read-only-mode-map "N" evil-search-previous))) - - `((,states magit-status-mode-map "gz" magit-jump-to-stashes) - (,states magit-status-mode-map "gt" magit-jump-to-tracked) - (,states magit-status-mode-map "gn" magit-jump-to-untracked) - (,states magit-status-mode-map "gu" magit-jump-to-unstaged) - (,states magit-status-mode-map "gs" magit-jump-to-staged) - (,states magit-status-mode-map "gfu" magit-jump-to-unpulled-from-upstream) - (,states magit-status-mode-map "gfp" magit-jump-to-unpulled-from-pushremote) - (,states magit-status-mode-map "gpu" magit-jump-to-unpushed-to-upstream) - (,states magit-status-mode-map "gpp" magit-jump-to-unpushed-to-pushremote) - (,states magit-status-mode-map "gh" magit-section-up "^") - (,states magit-diff-mode-map "gd" magit-jump-to-diffstat-or-diff "j") - ((visual) magit-diff-mode-map "y" magit-copy-section-value) - ;; NOTE This is now transient-map and the binding is C-g. - ;; ((emacs) magit-popup-mode-map "" "q") - ) - - (when evil-collection-magit-want-horizontal-movement - `((,states magit-mode-map "H" magit-dispatch "h") - (,states magit-mode-map "L" magit-log "l") - (,states magit-mode-map "\C-l" magit-log-refresh "L") - (,states magit-mode-map "h" evil-backward-char) - (,states magit-mode-map "l" evil-forward-char))) - - (when evil-want-C-u-scroll - `((,states magit-mode-map "\C-u" evil-scroll-up))) - - (if evil-collection-magit-use-y-for-yank - `((,states magit-mode-map "v" ,(if evil-collection-magit-use-v-for-visual-line - 'evil-visual-line - 'evil-visual-char)) - (,states magit-mode-map "V" evil-visual-line) - (,states magit-mode-map "\C-w" evil-window-map) - (,states magit-mode-map "y") - (,states magit-mode-map "yy" evil-collection-magit-yank-whole-line) - (,states magit-mode-map "yr" magit-show-refs "y") - (,states magit-mode-map "ys" magit-copy-section-value "C-w") - (,states magit-mode-map "yb" magit-copy-buffer-revision "M-w") - ((visual) magit-mode-map "y" magit-copy-section-value)) - `((,states magit-mode-map "v" set-mark-command) - (,states magit-mode-map "V" set-mark-command) - (,states magit-mode-map ,(kbd "") evil-collection-magit-maybe-deactivate-mark))) - - (when evil-collection-magit-use-$-for-end-of-line - `((,states magit-mode-map "$" evil-end-of-line) - (,states magit-mode-map "`" magit-process-buffer))) - - (when evil-collection-magit-use-0-for-beginning-of-line - `((,states magit-mode-map "0" evil-beginning-of-line) - (,states magit-mode-map "~" magit-diff-default-context))) - - (when evil-collection-magit-use-z-for-folds - `((,states magit-mode-map "Z" magit-stash) - (,states magit-mode-map "z") - (,states magit-mode-map "z1" magit-section-show-level-1-all) - (,states magit-mode-map "z2" magit-section-show-level-2-all) - (,states magit-mode-map "z3" magit-section-show-level-3-all) - (,states magit-mode-map "z4" magit-section-show-level-4-all) - (,states magit-mode-map "za" magit-section-toggle) - (,states magit-mode-map "zc" magit-section-hide) - (,states magit-mode-map "zC" magit-section-hide-children) - (,states magit-mode-map "zo" magit-section-show) - (,states magit-mode-map "zO" magit-section-show-children) - (,states magit-mode-map "zr" magit-section-show-level-4-all))))) - "evil-collection-magit bindings for major modes. Each element of this list -takes the form - -\(EVIL-STATE MAGIT-MAP NEW-KEY DEF ORIG-KEY\). - -ORIG-KEY is only used for testing purposes, and -denotes the original magit key for this command.") - -(dolist (binding evil-collection-magit-mode-map-bindings) - (when binding - (dolist (state (nth 0 binding)) - (evil-collection-define-key - state (nth 1 binding) (nth 2 binding) (nth 3 binding))))) - -(defvar evil-collection-magit-minor-mode-map-bindings - `(((,evil-collection-magit-state visual) magit-blob-mode-map "gj" magit-blob-next "n") - ((,evil-collection-magit-state visual) magit-blob-mode-map "gk" magit-blob-previous "p") - ((,evil-collection-magit-state visual) git-commit-mode-map "\M-k" git-commit-prev-message "M-p") - ((,evil-collection-magit-state visual) git-commit-mode-map "gk" git-commit-prev-message "M-p") - ((,evil-collection-magit-state visual) git-commit-mode-map "\M-j" git-commit-next-message "M-n") - ((,evil-collection-magit-state visual) git-commit-mode-map "gj" git-commit-next-message "M-n") - ((normal) magit-blame-read-only-mode-map "j" evil-next-line) - ((normal) magit-blame-read-only-mode-map "\C-j" magit-blame-next-chunk "n") - ((normal) magit-blame-read-only-mode-map "gj" magit-blame-next-chunk "n") - ((normal) magit-blame-read-only-mode-map "gJ" magit-blame-next-chunk-same-commit "N") - ((normal) magit-blame-read-only-mode-map "k" evil-previous-line) - ((normal) magit-blame-read-only-mode-map "\C-k" magit-blame-previous-chunk "p") - ((normal) magit-blame-read-only-mode-map "gk" magit-blame-previous-chunk "p") - ((normal) magit-blame-read-only-mode-map "gK" magit-blame-previous-chunk-same-commit "P")) - "evil-collection-magit bindings for minor modes. Each element of -this list takes the form - -\(EVIL-STATE MAGIT-MAP NEW-KEY DEF ORIG-KEY)\. - -ORIG-KEY is only used for testing purposes, and -denotes the original magit key for this command.") - -(dolist (binding evil-collection-magit-minor-mode-map-bindings) - (when binding - (dolist (state (nth 0 binding)) - ;; TODO: Maybe switch to `evil-define-minor-mode-key' - (evil-collection-define-key - state (nth 1 binding) (nth 2 binding) (nth 3 binding))))) - -;; Make relevant maps into overriding maps so that they shadow the global evil -;; maps by default -(dolist (map (list magit-mode-map - magit-cherry-mode-map - magit-mode-map - magit-blob-mode-map - magit-diff-mode-map - magit-log-mode-map - magit-log-select-mode-map - magit-reflog-mode-map - magit-status-mode-map - magit-log-read-revs-map - magit-process-mode-map - magit-refs-mode-map)) - (evil-make-overriding-map map (if evil-collection-magit-use-y-for-yank - 'all - evil-collection-magit-state))) - -(evil-make-overriding-map magit-blame-read-only-mode-map 'normal) - -(eval-after-load 'magit-gh-pulls - `(evil-make-overriding-map magit-gh-pulls-mode-map ',evil-collection-magit-state)) - -;; Need to refresh evil keymaps when blame/blob mode is entered. -(add-hook 'magit-blame-mode-hook 'evil-normalize-keymaps) -(add-hook 'magit-blob-mode-hook 'evil-normalize-keymaps) - - -(evil-set-initial-state 'magit-submodule-list-mode 'normal) -(evil-collection-define-key 'normal 'magit-submodule-list-mode-map - (kbd "RET") 'magit-repolist-status - (kbd "gr") 'magit-list-submodules) -(add-hook 'magit-submodule-list-mode-hook 'evil-normalize-keymaps) - - -(eval-after-load 'git-rebase - `(progn - ;; for the compiler - (defvar git-rebase-mode-map) - (defvar evil-collection-magit-rebase-commands-w-descriptions - ;; nil in the first element means don't bind here - '(("p" git-rebase-pick "pick = use commit") - ("r" git-rebase-reword "reword = use commit, but edit the commit message") - ("e" git-rebase-edit "edit = use commit, but stop for amending") - ("s" git-rebase-squash "squash = use commit, but meld into previous commit") - ("f" git-rebase-fixup "fixup = like \"squash\", but discard this commit's log message") - ("x" git-rebase-exec "exec = run command (the rest of the line) using shell") - ("d" git-rebase-kill-line "drop = remove commit" "k") - ("u" git-rebase-undo "undo last change") - ("ZZ" with-editor-finish "tell Git to make it happen") - ("ZQ" with-editor-cancel "tell Git that you changed your mind, i.e. abort") - ("k" evil-previous-line "move point to previous line" "p") - ("j" evil-next-line "move point to next line" "n") - ("M-k" git-rebase-move-line-up "move the commit at point up" "\M-p") - ("M-j" git-rebase-move-line-down "move the commit at point down" "\M-n") - (nil git-rebase-show-commit "show the commit at point in another buffer"))) - - (dolist (cmd evil-collection-magit-rebase-commands-w-descriptions) - (when (car cmd) - (evil-collection-define-key evil-collection-magit-state 'git-rebase-mode-map - (kbd (car cmd)) (nth 1 cmd)))) - - (evil-make-overriding-map git-rebase-mode-map evil-collection-magit-state) - - (defun evil-collection-magit-add-rebase-messages () - "Remove evil-state annotations and reformat git-rebase buffer." - (goto-char (point-min)) - (let ((inhibit-read-only t) - (state-regexp (format "<%s-state> " evil-collection-magit-state)) - (aux-map (evil-get-auxiliary-keymap git-rebase-mode-map evil-collection-magit-state))) - (save-excursion - (save-match-data - (goto-char (point-min)) - (when (and (boundp 'git-rebase-show-instructions) - git-rebase-show-instructions - (re-search-forward - (concat "^" (regexp-quote comment-start) "\\s-+p, pick") nil t)) - (goto-char (line-beginning-position)) - (flush-lines (concat "^" (regexp-quote comment-start) ".+ = ")) - (dolist (cmd evil-collection-magit-rebase-commands-w-descriptions) - (insert - (format "%s %-8s %s\n" - comment-start - (if (and (car cmd) - (eq (nth 1 cmd) - (lookup-key aux-map (kbd (car cmd))))) - (car cmd) - (replace-regexp-in-string - state-regexp "" - (substitute-command-keys - (format "\\[%s]" (nth 1 cmd))))) - (nth 2 cmd))))))))) - (remove-hook 'git-rebase-mode-hook 'git-rebase-mode-show-keybindings) - (add-hook 'git-rebase-mode-hook 'evil-collection-magit-add-rebase-messages t))) - -;; section maps: evil's auxiliary maps don't work here, because these maps are -;; text overlays - -(defun evil-collection-magit-stage-untracked-file-with-intent () - "Call `magit-stage-untracked' with optional arg." - (interactive) - (when (and (derived-mode-p 'magit-mode) - (magit-apply--get-selection) - (eq (magit-diff-type) 'untracked)) - (magit-stage-untracked t))) - -(defcustom evil-collection-magit-visit-worktree-file-on-return t - "When non-nil (default), RET visits the file in the worktree -\(`magit-diff-visit-worktree-file') and S- visits the file -in the current diff context (`magit-diff-visit-file'). - -When nil, the bindings are swapped: RET uses `magit-diff-visit-file' -and S- uses `magit-diff-visit-worktree-file'." - :group 'magit - :type 'boolean) - -(defvar evil-collection-magit-original-section-bindings - `((,(copy-keymap magit-file-section-map) "\C-j" magit-diff-visit-worktree-file) - (,(copy-keymap magit-hunk-section-map) "\C-j" magit-diff-visit-worktree-file)) - "For testing purposes only. The original magit keybindings that -evil-collection-magit affects.") - -(defun evil-collection-magit-adjust-section-bindings () - "Adjust bindings in section maps for evil-collection-magit." - (define-key magit-file-section-map "I" - 'evil-collection-magit-stage-untracked-file-with-intent) - (define-key magit-file-section-map "\C-j" nil) ; breaking change - (define-key magit-hunk-section-map "\C-j" nil) ; breaking change - (let ((return-cmd (if evil-collection-magit-visit-worktree-file-on-return - 'magit-diff-visit-worktree-file - 'magit-diff-visit-file)) - (s-return-cmd (if evil-collection-magit-visit-worktree-file-on-return - 'magit-diff-visit-file - 'magit-diff-visit-worktree-file))) - (define-key magit-file-section-map (kbd "RET") return-cmd) - (define-key magit-hunk-section-map (kbd "RET") return-cmd) - (define-key magit-file-section-map (kbd "S-") s-return-cmd) - (define-key magit-hunk-section-map (kbd "S-") s-return-cmd))) - -(defun evil-collection-magit-revert-section-bindings () - "Revert changed bindings in section maps generated by evil-collection-magit." - (define-key magit-file-section-map "I" nil) - (define-key magit-file-section-map "\C-j" 'magit-diff-visit-file-worktree) - (define-key magit-hunk-section-map "\C-j" 'magit-diff-visit-file-worktree) - (define-key magit-file-section-map (kbd "RET") 'magit-diff-visit-file) - (define-key magit-hunk-section-map (kbd "RET") 'magit-diff-visit-file) - (define-key magit-file-section-map (kbd "S-") nil) - (define-key magit-hunk-section-map (kbd "S-") nil)) - -;; Popups - -(defvar evil-collection-magit-dispatch-popup-backup - (copy-tree (get 'magit-dispatch 'transient--layout) t)) -(defvar evil-collection-magit-popup-keys-changed nil) - -(defvar evil-collection-magit-popup-changes - (append - (when evil-collection-magit-use-z-for-folds - '((magit-dispatch "Z" "%" magit-worktree) - (magit-dispatch "z" "Z" magit-stash))) - (when evil-collection-magit-want-horizontal-movement - '((magit-dispatch "L" "C-l" magit-log-refresh) - (magit-dispatch "l" "L" magit-log))) - '((magit-branch "x" "X" magit-branch-reset) - (magit-branch "k" "x" magit-branch-delete) - (magit-dispatch "o" "'" magit-submodule) - (magit-dispatch "O" "\"" magit-subtree) - (magit-dispatch "V" "_" magit-revert) - (magit-dispatch "X" "O" magit-reset) - (magit-dispatch "v" "-" magit-reverse) - (magit-dispatch "k" "x" magit-discard) - (magit-remote "k" "x" magit-remote-remove) - ;; FIXME: how to properly handle a popup with a key that appears twice (in - ;; `transient-define-prefix' definition)? Currently we rely on: - ;; 1. first call to `evil-collection-magit-change-popup-key' changes the first "V" - ;; entry of `magit-revert' (the first entry in `transient-define-prefix' - ;; definition of `magit-revert'), second call changes the second "V". - ;; 2. the remapping here are in the same order as in `magit-revert' - ;; definition - (magit-revert "V" "_" magit-revert-and-commit) - (magit-revert "V" "_" magit-sequencer-continue) - (magit-tag "k" "x" magit-tag-delete))) - "Changes to popup keys") - -(defun evil-collection-magit-change-popup-key (popup from to &rest _args) - "Wrap `magit-change-popup-key'." - (transient-suffix-put popup from :key to)) - -(defun evil-collection-magit-adjust-popups () - "Adjust popup keys to match evil-collection-magit." - (unless evil-collection-magit-popup-keys-changed - (dolist (change evil-collection-magit-popup-changes) - (apply #'evil-collection-magit-change-popup-key change)) - (setq evil-collection-magit-popup-keys-changed t))) - -(defun evil-collection-magit-revert-popups () - "Revert popup keys changed by evil-collection-magit." - (put 'magit-dispatch 'transient--layout evil-collection-magit-dispatch-popup-backup) - (setq evil-collection-magit-popup-keys-changed nil)) - -;;;###autoload -(defun evil-collection-magit-init () - "This function completes the setup of evil-collection-magit. It is called -automatically when evil-collection-magit-setup is called.. The only reason to -use this function is if you've called `evil-collection-magit-revert' and wish -to go back to evil-collection-magit behavior." - (interactive) - (evil-collection-magit-adjust-section-bindings) - (evil-collection-magit-adjust-popups) - (evil-collection-magit-set-initial-states)) - -;;;###autoload -(defun evil-collection-magit-revert () - "Revert changes by evil-collection-magit that affect default evil+magit behavior." - (interactive) - (evil-collection-magit-revert-section-bindings) - (evil-collection-magit-revert-popups) - (evil-collection-magit-revert-initial-states) - (message "evil-collection-magit reverted")) - -(define-minor-mode evil-collection-magit-toggle-text-minor-mode - "Minor mode used to enabled toggle key in `text-mode' after -using `evil-collection-magit-toggle-text-mode'" - :keymap (make-sparse-keymap)) - -(evil-collection-define-key 'normal - 'evil-collection-magit-toggle-text-minor-mode-map - "\C-t" 'evil-collection-magit-toggle-text-mode - "\\" 'evil-collection-magit-toggle-text-mode) -(evil-collection-define-key evil-collection-magit-state 'magit-mode-map - "\C-t" 'evil-collection-magit-toggle-text-mode - "\\" 'evil-collection-magit-toggle-text-mode) -(evil-collection-define-key evil-collection-magit-state 'git-rebase-mode-map - "\C-t" 'evil-collection-magit-toggle-text-mode - "\\" 'evil-collection-magit-toggle-text-mode) - -(defvar evil-collection-magit-last-mode nil - "Used to store last magit mode before entering text mode using -`evil-collection-magit-toggle-text-mode'.") - -(defun evil-collection-magit-toggle-text-mode () - "Switch to `text-mode' and back from magit buffers." - (interactive) - (cond ((derived-mode-p 'magit-mode 'git-rebase-mode) - (setq evil-collection-magit-last-mode major-mode) - (message "Switching to text-mode") - (text-mode) - (read-only-mode -1) - (evil-collection-magit-toggle-text-minor-mode 1) - (evil-normalize-keymaps)) - ((and (eq major-mode 'text-mode) - (functionp evil-collection-magit-last-mode)) - (message "Switching to %s" evil-collection-magit-last-mode) - (evil-collection-magit-toggle-text-minor-mode -1) - (evil-normalize-keymaps) - (funcall evil-collection-magit-last-mode) - (magit-refresh) - (evil-change-state evil-collection-magit-state)) - (t - (user-error "evil-collection-magit-toggle-text-mode unexpected state")))) - -(evil-define-operator evil-collection-magit-yank-whole-line - (beg end type register yank-handler) - "Yank whole line." - :motion evil-line-or-visual-line - (interactive "") - (evil-yank beg end type register yank-handler)) - -;;;###autoload -(defun evil-collection-magit-setup () - "Set up `evil' bindings for `magit'." - - (evil-collection-define-key 'normal 'magit-blame-mode-map - "q" 'magit-blame-quit) - (evil-collection-define-key 'normal 'magit-blame-read-only-mode-map - "q" 'magit-blame-quit) - - (evil-collection-magit-init)) - -;;; evil-collection-magit.el ends soon -(provide 'evil-collection-magit) -;; Local Variables: -;; indent-tabs-mode: nil -;; End: -;;; evil-collection-magit.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/man/README.org b/.config/emacs/lisp/evil-collection/modes/man/README.org deleted file mode 100644 index 70ca48c..0000000 --- a/.config/emacs/lisp/evil-collection/modes/man/README.org +++ /dev/null @@ -1,22 +0,0 @@ -* man - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Man-Page.html][Man]]. - -** Key bindings - - | Command | Original | Evil | - |-------------------------------+----------------+-----------------| - | =scroll-up-command= | =SPC= | =SPC= | - | =scroll-down-command= | =DEL=, =S-SPC= | =S-SPC= | - | =forward-button= | =TAB= | =TAB= | - | =backward-button= | =S-TAB= | =S-TAB= | - | =Man-next-manpage= | =M-n= | =]]=, =gj= | - | =Man-previous-manpage= | =M-p= | =[[=, =gk= | - | =Man-next-section= | =n= | =C-j= | - | =Man-previous-section= | =p= | =C-k= | - | =man= | =m= | =gm= | - | =Man-goto-section= | =g= | =gd= | - | =Man-follow-manual-reference= | =r= | =gR= | - | =Man-goto-see-also-section= | =s= | =gs= | - | =Man-update-manpage= | =u= | =gr= | - | =quit-window= | =q= | =q=, =ZQ=, =ZZ= | diff --git a/.config/emacs/lisp/evil-collection/modes/man/evil-collection-man.el b/.config/emacs/lisp/evil-collection/modes/man/evil-collection-man.el deleted file mode 100644 index a4eddd0..0000000 --- a/.config/emacs/lisp/evil-collection/modes/man/evil-collection-man.el +++ /dev/null @@ -1,68 +0,0 @@ -;;; evil-collection-man.el --- Evil bindings for Man-mode -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, man, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for `man'. - -;;; Code: -(require 'evil-collection) -(require 'man) - -(defconst evil-collection-man-maps '(Man-mode-map)) - -;;;###autoload -(defun evil-collection-man-setup () - "Set up `evil' bindings for `man'." - (evil-set-initial-state 'Man-mode 'normal) - (evil-collection-define-key 'normal 'Man-mode-map - ;; motion - (kbd "SPC") 'scroll-up-command - (kbd "S-SPC") 'scroll-down-command - (kbd "") 'forward-button - (kbd "") 'backward-button - - (kbd "]]") 'Man-next-manpage - (kbd "[[") 'Man-previous-manpage - (kbd "gj") 'Man-next-manpage - (kbd "gk") 'Man-previous-manpage - (kbd "C-j") 'Man-next-section - (kbd "C-k") 'Man-previous-section - - ;; goto - "gm" 'man - "gd" 'Man-goto-section ; TODO: "gd" does not match the rationale of "go to definition". Change? - "gR" 'Man-follow-manual-reference ; TODO: Make this match Info-follow-reference? - "gs" 'Man-goto-see-also-section - - ;; refresh - "gr" 'Man-update-manpage - - ;; quit - "q" 'quit-window - "ZQ" 'quit-window - "ZZ" 'quit-window)) - -(provide 'evil-collection-man) -;;; evil-collection-man.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/markdown-mode/README.org b/.config/emacs/lisp/evil-collection/modes/markdown-mode/README.org deleted file mode 100644 index 8c93de5..0000000 --- a/.config/emacs/lisp/evil-collection/modes/markdown-mode/README.org +++ /dev/null @@ -1,14 +0,0 @@ -* markdown-mode - - Basic evil bindings for [[https://github.com/jrblevin/markdown-mode][markdown-mode]]. Not intended to supersede - [[https://github.com/Somelauw/evil-markdown][evil-markdown]]. - -** Key bindings (normal state) - - | Command | Original | Evil | - |-------------------------------+-------------+-------------| - | =markdown-backward-paragraph= | =M-{= | ={= | - | =markdown-forward-paragraph= | =M-}= | =}= | - | =markdown-cycle= | =TAB= | =TAB= | - | =markdown-shifttab= | == | == | - | =markdown-do= | =C-c C-d= | =RET= | diff --git a/.config/emacs/lisp/evil-collection/modes/markdown-mode/evil-collection-markdown-mode.el b/.config/emacs/lisp/evil-collection/modes/markdown-mode/evil-collection-markdown-mode.el deleted file mode 100644 index 83f24a6..0000000 --- a/.config/emacs/lisp/evil-collection/modes/markdown-mode/evil-collection-markdown-mode.el +++ /dev/null @@ -1,50 +0,0 @@ -;;; evil-collection-markdown-mode.el --- Evil bindings for markdown-mode -*- lexical-binding: t -*- - -;; Copyright (C) 2021 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; -;; Evil basic bindings for markdown-mode. It's NOT intended to supersede -;; `evil-markdown'. -;; - -;;; Code: -(require 'evil-collection) -(require 'markdown-mode nil t) - -(defconst evil-collection-markdown-mode-maps '(markdown-mode-map)) - -;;;###autoload -(defun evil-collection-markdown-mode-setup () - "Set up `evil' bindings for `markdown-mode'." - (evil-collection-define-key 'normal 'markdown-mode-map - "{" 'markdown-backward-paragraph - "}" 'markdown-forward-paragraph - [tab] 'markdown-cycle - [S-tab] 'markdown-shifttab - ;; `evil-markdown' doesn't bind but spacemacs does. - (kbd "RET") 'markdown-do)) - -(provide 'evil-collection-markdown-mode) -;;; evil-collection-markdown-mode.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/message/README.org b/.config/emacs/lisp/evil-collection/modes/message/README.org deleted file mode 100644 index 3ef74ce..0000000 --- a/.config/emacs/lisp/evil-collection/modes/message/README.org +++ /dev/null @@ -1,18 +0,0 @@ -* message - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/message/index.html][message-mode]], the Gnus / mail composition buffer. - - Initial state is insert. Normal-state =Z= bindings provide quick send / kill - without leaving the keyboard home row. - -** Key bindings - - | Command | Original | Evil | - |-------------------------+-----------+------| - | =message-send-and-exit= | =C-c C-c= | =ZZ= | - | =message-kill-buffer= | =C-c C-k= | =ZQ= | - | =message-dont-send= | =C-c C-d= | =ZD= | - | =mml-attach-file= | =C-c C-a= | =ZF= | - - All other =C-c= prefix bindings (goto-field, insert-signature, attach, etc.) - remain at their upstream keys. diff --git a/.config/emacs/lisp/evil-collection/modes/message/evil-collection-message.el b/.config/emacs/lisp/evil-collection/modes/message/evil-collection-message.el deleted file mode 100644 index 3adc543..0000000 --- a/.config/emacs/lisp/evil-collection/modes/message/evil-collection-message.el +++ /dev/null @@ -1,46 +0,0 @@ -;;; evil-collection-message.el --- Bindings for `message' -*- lexical-binding: t -*- - -;; Copyright (C) 2026 jessy836 - -;; Author: jessy836 -;; Maintainer: jessy836 -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, convenience, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for message. - -;;; Code: -(require 'evil-collection) -(require 'message nil t) - -(defvar message-mode-map) -(defconst evil-collection-message-maps '(message-mode-map)) - -;;;###autoload -(defun evil-collection-message-setup () - "Set up `evil' bindings for `message-mode'." - (evil-set-initial-state 'message-mode 'insert) - (evil-collection-define-key 'normal 'message-mode-map - "ZZ" 'message-send-and-exit - "ZQ" 'message-kill-buffer - "ZD" 'message-dont-send - "ZF" 'mml-attach-file)) - -(provide 'evil-collection-message) -;;; evil-collection-message.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/minesweeper/evil-collection-minesweeper.el b/.config/emacs/lisp/evil-collection/modes/minesweeper/evil-collection-minesweeper.el deleted file mode 100644 index 1792948..0000000 --- a/.config/emacs/lisp/evil-collection/modes/minesweeper/evil-collection-minesweeper.el +++ /dev/null @@ -1,53 +0,0 @@ -;;; evil-collection-minesweeper.el --- Bindings for `minesweeper' -*- lexical-binding: t -*- - -;; Copyright (C) 2025 StrawberryTea - -;; Author: StrawberryTea -;; Maintainer: StrawberryTea -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, games - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - - -;;; Commentary: -;; Bindings for `minesweeper'. - -;;; Code: - -(require 'evil-collection) -(require 'minesweeper nil t) - -(defconst evil-collection-minesweeper-maps '(minesweeper-mode-map)) - -;;;###autoload -(defun evil-collection-minesweeper-setup () - "Set up `evil' bindings for `minesweeper'." - (evil-set-initial-state 'minesweeper-mode 'normal) - (evil-collection-define-key 'normal 'minesweeper-mode-map - "RET" 'minesweeper-choose - "m" 'minesweeper-toggle-mark - "c" 'minesweeper-choose-around - "s" 'minesweeper-toggle-show-neighbors - "j" 'minesweeper-next-line - "h" 'minesweeper-backward-char - "l" 'minesweeper-forward-char - "$" 'minesweeper-move-end-of-field - "e" 'minesweeper-move-end-of-field)) - -(provide 'evil-collection-minesweeper) - -;;; evil-collection-minesweeper.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/minibuffer/README.org b/.config/emacs/lisp/evil-collection/modes/minibuffer/README.org deleted file mode 100644 index 30121f6..0000000 --- a/.config/emacs/lisp/evil-collection/modes/minibuffer/README.org +++ /dev/null @@ -1,47 +0,0 @@ -* minibuffer - - Evil bindings for the minibuffer and =evil-ex= prompt. - - The minibuffer has no major mode, so the package hooks =minibuffer-setup-hook= - to enter insert state on open. - -** Affected keymaps - - - =minibuffer-local-map= - - =minibuffer-local-ns-map= - - =minibuffer-local-completion-map= - - =minibuffer-local-must-match-map= - - =minibuffer-local-isearch-map= - - =evil-ex-search-keymap= - - =evil-ex-completion-map= - -** Key bindings - - Normal-state bindings added to every map above. - - | Command | Key | - |----------------------------------------+------------| - | =evil-collection-change-in-minibuffer= | =c= | - | =abort-recursive-edit= | == | - | =exit-minibuffer= | =RET= | - - Extra bindings on =evil-ex-completion-map= for history navigation: - - | Command | State | Key | - |-------------------------------------+--------+------------| - | =previous-complete-history-element= | insert | =C-p= | - | =next-complete-history-element= | insert | =C-n= | - | =previous-history-element= | normal | =C-p= | - | =next-history-element= | normal | =C-n= | - | =abort-recursive-edit= | normal | == | - -** New commands - - | Command | Key | | - |----------------------------------------+-----+--------------------------------------------------------------------------------------| - | =evil-collection-change-in-minibuffer= | =c= | =evil-change= variant that avoids inserting a stray newline when the buffer had none | - -** Notes - - - =evil-echo-state= is locally disabled so the minibuffer prompt is not - overwritten by the state indicator. diff --git a/.config/emacs/lisp/evil-collection/modes/minibuffer/evil-collection-minibuffer.el b/.config/emacs/lisp/evil-collection/modes/minibuffer/evil-collection-minibuffer.el deleted file mode 100644 index ed81b9c..0000000 --- a/.config/emacs/lisp/evil-collection/modes/minibuffer/evil-collection-minibuffer.el +++ /dev/null @@ -1,85 +0,0 @@ -;;; evil-collection-minibuffer.el --- Evil bindings for the minibuffer -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, minibuffer, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for the minibuffer. - -;;; Code: -(require 'evil-collection) - -(defconst evil-collection-minibuffer-maps '(minibuffer-local-map - minibuffer-local-ns-map - minibuffer-local-completion-map - minibuffer-local-must-match-map - minibuffer-local-isearch-map - evil-ex-search-keymap - evil-ex-completion-map)) - -(defun evil-collection-minibuffer-insert () - "Switch to insert state. - -This function is meant to be hooked in the minibuffer: - - (add-hook \='minibuffer-setup-hook \='evil-collection-minibuffer-insert) - -`evil-set-initial-state' can not be used for the minibuffer since -it does not have a mode." - (set (make-local-variable 'evil-echo-state) nil) - ;; (evil-set-initial-state 'mode 'insert) is the evil-proper - ;; way to do this, but the minibuffer doesn't have a mode. - ;; The alternative is to create a minibuffer mode (here), but - ;; then it may conflict with other packages' if they do the same. - (evil-insert 1)) - -(evil-define-operator evil-collection-change-in-minibuffer - (beg end type register yank-handler delete-func) - "A version of `evil-change' that won't insert a new line on buffers without one." - (interactive "") - ;; If there was no new line before the change, there should be none after. - ;; Delete any new line that might have been inserted and ignore an error if - ;; one wasn't. - (let ((new-inserted (and (eq type 'line) (/= ?\n (char-before end))))) - (evil-change beg end type register yank-handler delete-func) - (when new-inserted (ignore-errors (delete-char 1))))) - -;;;###autoload -(defun evil-collection-minibuffer-setup () - "Initialize minibuffer for `evil'." - ;; https://www.gnu.org/software/emacs/manual/html_node/elisp/Text-from-Minibuffer.html - (dolist (map evil-collection-minibuffer-maps) - (evil-collection-define-key 'normal map "c" 'evil-collection-change-in-minibuffer) - (evil-collection-define-key 'normal map (kbd "") 'abort-recursive-edit) - (evil-collection-define-key 'normal map (kbd "RET") 'exit-minibuffer)) - - (add-hook 'minibuffer-setup-hook 'evil-collection-minibuffer-insert) - ;; Because of the above minibuffer-setup-hook, some evil-ex bindings need be reset. - (evil-collection-define-key 'normal 'evil-ex-completion-map (kbd "") 'abort-recursive-edit) - (evil-collection-define-key 'insert 'evil-ex-completion-map (kbd "C-p") 'previous-complete-history-element) - (evil-collection-define-key 'insert 'evil-ex-completion-map (kbd "C-n") 'next-complete-history-element) - (evil-collection-define-key 'normal 'evil-ex-completion-map (kbd "C-p") 'previous-history-element) - (evil-collection-define-key 'normal 'evil-ex-completion-map (kbd "C-n") 'next-history-element)) - -(provide 'evil-collection-minibuffer) -;;; evil-collection-minibuffer.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/monky/evil-collection-monky.el b/.config/emacs/lisp/evil-collection/modes/monky/evil-collection-monky.el deleted file mode 100644 index 5c87d7a..0000000 --- a/.config/emacs/lisp/evil-collection/modes/monky/evil-collection-monky.el +++ /dev/null @@ -1,129 +0,0 @@ -;;; evil-collection-monky.el --- Bindings for `monky' -*- lexical-binding: t -*- - -;; Copyright (C) 2019 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `monky'. - -;;; Code: -(require 'evil-collection) -(require 'monky nil t) - -(defconst evil-collection-monky-maps '(monky-mode-map - monky-status-mode-map - monky-log-mode-map - monky-blame-mode-map - monky-branches-mode-map - monky-commit-mode-map - monky-queue-mode-map - monky-log-edit-mode-map)) - -;;;###autoload -(defun evil-collection-monky-setup () - "Set up `evil' bindings for `monky'." - (evil-set-initial-state 'monky-mode 'normal) - (add-hook 'monky-mode-hook 'evil-normalize-keymaps) - (add-hook 'monky-status-mode-hook 'evil-normalize-keymaps) - - (evil-collection-define-key 'normal 'monky-mode-map - "]]" 'monky-goto-next-section - "gj" 'monky-goto-next-section - (kbd "C-j") 'monky-goto-next-section - "[[" 'monky-goto-previous-section - "gk" 'monky-goto-previous-section - (kbd "C-k") 'monky-goto-previous-section - (kbd "RET") 'monky-visit-item - (kbd "TAB") 'monky-toggle-section - (kbd "SPC") 'monky-show-item-or-scroll-up - (kbd "DEL") 'monky-show-item-or-scroll-down - "gr" 'monky-refresh - "`" 'monky-display-process - "!" 'monky-hg-command - "Ll" 'monky-log-current-branch - "La" 'monky-log-all - "LL" 'monky-log-all - "Lr" 'monky-log-revset - "b" 'monky-branches - "Q" 'monky-queue - "q" 'monky-quit-window) - - (evil-collection-define-key 'normal 'monky-status-mode-map - "s" 'monky-stage-item - "S" 'monky-stage-all - "u" 'monky-unstage-item - "U" 'monky-unstage-all - "a" 'monky-commit-amend - "c" 'monky-log-edit - "e" 'monky-ediff-item - "Y" 'monky-bookmark-create - "C" 'monky-checkout - "M" 'monky-merge - "B" 'monky-backout - "P" 'monky-push - "F" 'monky-pull - "x" 'monky-discard-item - "m" 'monky-resolve-item - "K" 'monky-unresolve-item ;; Not the best... - "o" 'monky-reset-tip - "A" 'monky-addremove-all - "R" 'monky-rollback) - - (evil-collection-define-key 'normal 'monky-log-mode-map - "+" 'monky-log-show-more-entries - "b" 'monky-checkout-item ;; Like `magit-branch'. - "m" 'monky-merge-item ;; Like `magit-merge'. - "B" 'monky-backout-item - "i" 'monky-qimport-item) - - (evil-collection-define-key 'normal 'monky-branches-mode-map - "b" 'monky-checkout-item ;; Like `magit-branch'. - "m" 'monky-merge-item ;; Like `magit-merge'. - ) - - ;; FIXME: Haven't used this mode yet so not sure if these are appropriate... - (evil-collection-define-key 'normal 'monky-queue-mode-map - "u" 'monky-qpop-item - "U" 'monky-qpop-all - "s" 'monky-qpush-item - "S" 'monky-qpush-all - "r" 'monky-qrefresh - "R" 'monky-qrename-item - "k" 'monky-qremove-item - "N" 'monky-qnew - "f" 'monky-qfinish-item - "F" 'monky-qfinish-applied - "d" 'monky-qfold-item - "G" 'monky-qguard-item - "o" 'monky-qreorder - "A" 'monky-addremove-all) - - (evil-collection-define-key 'normal 'monky-log-edit-mode-map - (kbd "C-c C-c") 'monky-log-edit-commit - [remap evil-save-and-close] 'monky-log-edit-commit - [remap evil-save-modified-and-close] 'monky-log-edit-commit - (kbd "C-c C-k") 'monky-log-edit-cancel-log-message - [remap evil-quit] 'monky-log-edit-cancel-log-message)) - -(provide 'evil-collection-monky) -;;; evil-collection-monky.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/mpc/README.org b/.config/emacs/lisp/evil-collection/modes/mpc/README.org deleted file mode 100644 index 8416a2a..0000000 --- a/.config/emacs/lisp/evil-collection/modes/mpc/README.org +++ /dev/null @@ -1,44 +0,0 @@ -* mpc - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Music.html][mpc-mode]], the Emacs front-end to the Music Player Daemon. - -** Key bindings - - Bindings applied to =mpc-mode-map=. - - | Command | Original | Evil | - |---------------------------------+----------+--------------| - | =evil-collection-mpc-move-down= | n/a | =C-j= | - | =evil-collection-mpc-move-up= | n/a | =C-k= | - | =mpc-toggle-play= | =s= | =t= | - | =mpc-stop= | n/a | =T= | - | =mpc-toggle-repeat= | n/a | =r= | - | =mpc-toggle-shuffle= | n/a | =s= | - | =mpc-toggle-consume= | n/a | =c= | - | =mpc-playlist= | n/a | =gp= | - | =mpc-playlist-add= | n/a | =a= | - | =mpc-next= | =>= | =J= | - | =mpc-prev= | =<= | =K= | - | =mpc-play-at-point= | n/a | =x= | - | =mpc-play= | n/a | =X= | - | =mpc-select= | =RET= | =RET= | - | =mpc-select-toggle= | =S-RET= | =S-= | - | =mpc-select-extend= | n/a | =C-= | - | =mpc-goto-playing-song= | =o= | =go= | - | =mpc-describe-song= | n/a | =gd= | - | =mpc-pause= | =p= | =p= | - | =mpc-resume= | n/a | =P= | - | =mpc-seek-current= | =g= | =gs= | - | =mpc-tagbrowser= | n/a | =gb= | - | =mpc-songs-search= | n/a | =g/= | - | =mpc-songs-kill-search= | n/a | =g_= | - | =mpc-update= | n/a | =gR= | - | =mpc-playlist-delete= | n/a | =D= | - | =mpc-quit= | =q= | =q= | - -** New commands - - | Command | Key | | - |---------------------------------+-------+----------------------------------------| - | =evil-collection-mpc-move-down= | =C-j= | move cursor down and call =mpc-select= | - | =evil-collection-mpc-move-up= | =C-k= | move cursor up and call =mpc-select= | diff --git a/.config/emacs/lisp/evil-collection/modes/mpc/evil-collection-mpc.el b/.config/emacs/lisp/evil-collection/modes/mpc/evil-collection-mpc.el deleted file mode 100644 index 94f3a9b..0000000 --- a/.config/emacs/lisp/evil-collection/modes/mpc/evil-collection-mpc.el +++ /dev/null @@ -1,80 +0,0 @@ -;;; evil-collection-mpc.el --- Bindings for `mpc-mode' -*- lexical-binding: t -*- -;; Copyright (C) 2021, 2022 pspiagicw - -;; Author: pspiagicw -;; Maintainer: pspiagicw -;; pspiagicw -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, mpc, processes , mpd - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `mpc-mode'. - -;;; Code: -(require 'mpc) -(require 'evil-collection) - -(defconst evil-collection-mpc-mode-maps '(mpc-mode-map)) - -(defun evil-collection-mpc-move-down () - "Move the cursor down along with selecting the element." - (interactive) - (evil-next-visual-line) - (mpc-select)) - -(defun evil-collection-mpc-move-up () - "Move the cursor up along with selecting the element." - (interactive) - (evil-previous-visual-line) - (mpc-select)) - -;;;###autoload -(defun evil-collection-mpc-setup () - "Setup up `evil' bindings for `mpc-mode'." - (evil-collection-define-key 'normal 'mpc-mode-map - (kbd "C-j") 'evil-collection-mpc-move-down - (kbd "C-k") 'evil-collection-mpc-move-up - "t" 'mpc-toggle-play - "T" 'mpc-stop - "r" 'mpc-toggle-repeat - "s" 'mpc-toggle-shuffle - "c" 'mpc-toggle-consume - "gp" 'mpc-playlist - "a" 'mpc-playlist-add - "J" 'mpc-next - "K" 'mpc-prev - "x" 'mpc-play-at-point - "X" 'mpc-play - (kbd "RET") 'mpc-select - (kbd "S-") 'mpc-select-toggle - (kbd "C-") 'mpc-select-extend - "go" 'mpc-goto-playing-song - "gd" 'mpc-describe-song - "p" 'mpc-pause - "P" 'mpc-resume - "gs" 'mpc-seek-current - "gb" 'mpc-tagbrowser - "g/" 'mpc-songs-search - "g_" 'mpc-songs-kill-search - "gd" 'mpc-songs-jump-to - "gR" 'mpc-update - "D" 'mpc-playlist-delete - "q" 'mpc-quit)) - -(provide 'evil-collection-mpc) -;;; evil-collection-mpc.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/mpdel/evil-collection-mpdel.el b/.config/emacs/lisp/evil-collection/modes/mpdel/evil-collection-mpdel.el deleted file mode 100644 index d842899..0000000 --- a/.config/emacs/lisp/evil-collection/modes/mpdel/evil-collection-mpdel.el +++ /dev/null @@ -1,96 +0,0 @@ -;;; evil-collection-mpdel.el --- Evil bindings for mpdel -*- lexical-binding: t -*- - -;; Copyright (C) 2021 Ruoyu Feng - -;; Author: Ruoyu Feng -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.4 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, tools, mpd - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for mpdel. - -;;; Code: - -(require 'mpdel nil t) -(require 'evil-collection) - -(defvar mpdel-core-map) - -(defconst evil-collection-mpdel-maps '(mpdel-core-map)) - -(defconst evil-collection-mpdel-modes '(mpdel-browser-mode mpdel-playlist-mode - mpdel-song-mode mpdel-browser-mode - mpdel-playlist-current-playlist-mode - mpdel-playlist-stored-playlist-mode)) - -;;;###autoload -(defun evil-collection-mpdel-setup () - "Set up `evil' bindings for `mpdel'." - - (evil-collection-set-readonly-bindings 'mpdel-core-map) - (dolist (mode evil-collection-mpdel-modes) - (evil-set-initial-state mode 'normal)) - (evil-collection-define-key 'normal 'mpdel-core-map - "p" 'libmpdel-playback-play-pause - "{" 'libmpdel-playback-previous - "}" 'libmpdel-playback-next - "a" 'mpdel-core-add-to-current-playlist - "A" 'mpdel-core-add-to-stored-playlist - "r" 'mpdel-core-replace-current-playlist - "R" 'mpdel-core-replace-stored-playlist - "i" 'mpdel-core-insert-current-playlist - "gD" 'mpdel-core-dired - "gA" 'mpdel-core-open-artists - "gL" 'mpdel-core-open-stored-playlists - "ss" 'mpdel-core-search-by-title - "sl" 'mpdel-core-search-by-album - "sr" 'mpdel-core-search-by-artist - "gp" 'navigel-open-parent - "j" 'evil-next-line - "k" 'evil-previous-line - "+" 'mpdel-core-volume-increase - "-" 'mpdel-core-volume-decrease - "C" 'libmpdel-connect-profile - - "gb" 'mpdel-browser-open - - "go" 'mpdel-song-open - "gr" 'mpdel-song-refresh - "I" 'mpdel-song-play - "q" 'mpdel-song-quit-window - - ">s" 'mpdel-song-small-increment - ">n" 'mpdel-song-normal-increment - ">l" 'mpdel-song-large-increment - " -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "29.1")) -;; Keywords: evil, tools, mpd - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for mpdired. - -;;; Code: - -(require 'mpdired nil t) -(require 'evil-collection) - -(defvar mpdired-core-map) - -(defconst evil-collection-mpdired-maps '(mpdired-mode-map)) - -(defconst evil-collection-mpdired-modes '(mpdired-mode-map)) - -;;;###autoload -(defun evil-collection-mpdired-setup () - "Set up `evil' bindings for `mpdired'." - - (evil-collection-set-readonly-bindings 'mpdired-mode-map) - (dolist (mode evil-collection-mpdired-modes) - (evil-set-initial-state mode 'normal)) - - (evil-collection-define-key 'normal 'mpdired-mode-map - "j" 'mpdired-next-line - "k" 'mpdired-previous-line - (kbd "RET") 'mpdired-enter - "^" 'mpdired-goto-parent - "." 'mpdired-goto-current-song - "o" 'mpdired-toggle-view - "gr" 'mpdired-update - "gR" 'mpdired-db-update - "J" 'mpdired-next-internal - "K" 'mpdired-previous-internal - "a" 'mpdired-add - "d" 'mpdired-flag-at-point - "x" 'mpdired-execute - "D" 'mpdired-delete - "p" 'mpdired-pause-internal - (kbd "SPC") 'mpdired-pause-internal - "gv" 'mpdired-set-volume-internal - "ss" 'mpdired-stop - "sR" 'mpdired-toggle-repeat - "sr" 'mpdired-toggle-random - "sS" 'mpdired-toggle-single - "sc" 'mpdired-toggle-consume - "gc" 'mpdired-playlist-create - "ga" 'mpdired-playlist-append - "m" 'mpdired-mark-at-point - "M" 'mpdired-change-marks - "u" 'mpdired-unmark-at-point - "U" 'mpdired-unmark-all-marks - "t" 'mpdired-toggle-marks - "T" 'mpdired-previous-unmark - "%d" 'mpdired-flag-files-regexp - "%m" 'mpdired-mark-files-regexp - "%i" 'mpdired-put-order-at-point - "%r" 'mpdired-reset-order-index)) - -(provide 'evil-collection-mpdired) -;;; evil-collection-mpdired.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/mu4e-conversation/evil-collection-mu4e-conversation.el b/.config/emacs/lisp/evil-collection/modes/mu4e-conversation/evil-collection-mu4e-conversation.el deleted file mode 100644 index 8d72bc1..0000000 --- a/.config/emacs/lisp/evil-collection/modes/mu4e-conversation/evil-collection-mu4e-conversation.el +++ /dev/null @@ -1,75 +0,0 @@ -;;; evil-collection-mu4e-conversation.el --- Evil bindings for mu4e-conversation -*- lexical-binding: t -*- - -;; Copyright (C) 2018 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "24.4") (evil "1.2.10")) -;; Keywords: evil, mu4e, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for mu4e-conversation. - -;;; Code: - -(require 'evil-collection) -(require 'mu4e-conversation nil t) - -(defconst evil-collection-mu4e-conversation-maps '(mu4e-conversation-map - mu4e-conversation-thread-map)) - -(defvar evil-collection-mu4e-conversation--local-map-p nil - "Non-nil if last position was on a local-map property.") - -(defun evil-collection-mu4e-conversation--switch () - "Re-compute the bindings if point has moved between the thread - area and the composition area." - (let ((local-map-here (get-text-property (point) 'local-map))) - (when (or (and evil-collection-mu4e-conversation--local-map-p - (not local-map-here)) - (and (not evil-collection-mu4e-conversation--local-map-p) - local-map-here)) - (evil-normalize-keymaps)) - (setq evil-collection-mu4e-conversation--local-map-p local-map-here))) - -(defun evil-collection-mu4e-conversation--update-local-map () - (setq evil-collection-mu4e-conversation--local-map-p (get-text-property (point) 'local-map)) - (evil-normalize-keymaps) - (add-hook 'post-command-hook 'evil-collection-mu4e-conversation--switch nil t)) - -;;;###autoload -(defun evil-collection-mu4e-conversation-setup () - "Set up `evil' bindings for `mu4e-conversation'." - ;; Evil does not update its current keymap state when it the point hits a - ;; local-map property is used. See - ;; https://github.com/emacs-evil/evil/issues/301. Thus we force the update - ;; with a technique similar to what `org~mu4e-mime-switch-headers-or-body' - ;; does. - (add-hook 'mu4e-conversation-hook 'evil-collection-mu4e-conversation--update-local-map) - (evil-collection-define-key 'normal 'mu4e-conversation-map - " " 'evil-scroll-page-down - (kbd "S-SPC") 'evil-scroll-page-up - "[[" 'mu4e-conversation-previous-message - "]]" 'mu4e-conversation-next-message - "zv" 'mu4e-conversation-toggle-view - "za" 'mu4e-conversation-toggle-hide-cited - "q" 'mu4e-conversation-quit)) - -(provide 'evil-collection-mu4e-conversation) -;;; evil-collection-mu4e-conversation.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/mu4e/evil-collection-mu4e-1.8.el b/.config/emacs/lisp/evil-collection/modes/mu4e/evil-collection-mu4e-1.8.el deleted file mode 100644 index eab3a63..0000000 --- a/.config/emacs/lisp/evil-collection/modes/mu4e/evil-collection-mu4e-1.8.el +++ /dev/null @@ -1,435 +0,0 @@ -;;; evil-collection-mu4e.el --- Evil bindings for mu4e -*- lexical-binding: t -*- - -;; Copyright (C) 2015-2018 Joris Engbers -;; Copyright (C) 2018 Pierre Neidhardt - -;; Author: Joris Engbers -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.9 -;; Package-Requires: ((emacs "24.4") (evil "1.2.10")) -;; Keywords: evil, mu4e, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil keybindings for mu4e that make sense for Evil users. The following -;; keybindings are defined: -;; -;; General commands: -;; | Commmand | evil-mu4e | Alternative | -;; |--------------------------+-----------+-------------| -;; | Jump to maildir | J | | -;; | Update | u | | -;; | Compose message | cc | C | -;; | Kill update mail process | x | | - -;; Commands for header-mode and view-mode: -;; | Command | evil-mu4e | Alternative | -;; |---------------------------------+-----------+-------------| -;; | Next message | C-j | | -;; | Previous message | C-k | | -;; | Mark the current thread as read | T | | -;; | Compose message | cc | C | -;; | Compose edit** | ce | E | -;; | Compose forward** | cf | F | -;; | Compose reply | cr | R | -;; | Change sorting*** | o | O | -;; | Rerun search | gr | | -;; | Toggle include related | zr | | -;; | Toggle threading | zt | | -;; | Toggle hide cited | za | | -;; | Skip duplicates | zd | | -;; | Show log | gl | | -;; | Select other view | gv | | -;; | Save attachement(s) | p | | -;; | Save url | yu | | -;; | Go to url | gx | | -;; | Fetch url | gX | | -;; -;; - * denotes only in header-mode -;; - ** denotes Alternative only in header-mode -;; - *** denotes Alternative only in view-mode -;; -;;; Code: - -(require 'evil-collection) -(require 'mu4e nil t) - -(declare-function mu4e--main-action-str "mu4e-main") -(declare-function mu4e--main-view-queue "mu4e-main") -(declare-function mu4e--longest-of-maildirs-and-bookmarks "mu4e-main") -(declare-function mu4e--longest-of-maildirs-and-bookmarks "mu4e-main") -(declare-function mu4e--maildirs-with-query "mu4e-folders") -(defvar mu4e--server-props) -(defvar mu4e-main-hide-fully-read) - -(defun evil-collection-mu4e--main-action-str (&rest args) - "Wrapper for `mu4e--main-action-str' to maintain compatibility -with older release versions of `mu4e.'" - (apply (if (fboundp 'mu4e~main-action-str) - #'mu4e~main-action-str - #'mu4e--main-action-str) - args)) - -(defun evil-collection-mu4e--main-view-queue (&rest args) - "Wrapper for `mu4e--main-view-queue' to maintain compatibility -with older release versions of `mu4e.'" - (apply (if (fboundp 'mu4e~main-view-queue) - #'mu4e~main-view-queue - #'mu4e--main-view-queue) - args)) - -(defvar smtpmail-send-queued-mail) -(defvar smtpmail-queue-dir) - -(defconst evil-collection-mu4e-maps '(mu4e-main-mode-map - mu4e-headers-mode-map - mu4e-view-mode-map - mu4e-compose-mode-map)) - - - -(defun evil-collection-mu4e-set-state () - "Set the appropriate initial state of all mu4e modes." - (dolist (mode '(mu4e-main-mode - mu4e-headers-mode - mu4e-view-mode - mu4e-org-mode)) - (evil-set-initial-state mode 'normal)) - (evil-set-initial-state 'mu4e-compose-mode 'insert)) - -;; When using org-mu4e, the above leads to an annoying behaviour, because -;; switching from message body to header activates mu4e-compose-mode, thus -;; putting the user into insert-state. The below code, together with the hooks -;; set in evil-collection-mu4e-setup fixes this issue. -(defun evil-collection-mu4e-org-set-header-to-normal-mode () - (evil-set-initial-state 'mu4e-compose-mode 'normal)) - -(defun evil-collection-mu4e-org-set-header-to-insert-mode () - (evil-set-initial-state 'mu4e-compose-mode 'insert)) - - -;;; Define bindings - -;; TODO: Inhibit insert-state functions as per Evil Collection. -(defvar evil-collection-mu4e-mode-normal-map-bindings - `((mu4e-main-mode-map - "J" mu4e~headers-jump-to-maildir - "j" next-line - "k" previous-line - "u" mu4e-update-mail-and-index - "gr" revert-buffer - "b" mu4e-search-bookmark - "B" mu4e-search-bookmark-edit - "N" mu4e-news - ";" mu4e-context-switch - "H" mu4e-display-manual - "C" mu4e-compose-new - "cc" mu4e-compose-new - "x" mu4e-kill-update-mail - "A" mu4e-about - "f" smtpmail-send-queued-mail - "m" mu4e--main-toggle-mail-sending-mode - "s" mu4e-search - "q" mu4e-quit) - - (mu4e-headers-mode-map - "q" mu4e~headers-quit-buffer - "J" mu4e~headers-jump-to-maildir - "C" mu4e-compose-new - "E" mu4e-compose-edit - "F" mu4e-compose-forward - "R" mu4e-compose-reply - "cc" mu4e-compose-new - "ce" mu4e-compose-edit - "cf" mu4e-compose-forward - "cr" mu4e-compose-reply - "o" mu4e-headers-change-sorting - "j" mu4e-headers-next - "k" mu4e-headers-prev - "gr" mu4e-search-rerun - "b" mu4e-search-bookmark - "B" mu4e-search-bookmark-edit - ";" mu4e-context-switch - ,(kbd "RET") mu4e-headers-view-message - "/" mu4e-search-narrow - "s" mu4e-search - "S" mu4e-search-edit - "x" mu4e-mark-execute-all - "a" mu4e-headers-action - "*" mu4e-headers-mark-for-something ; TODO: Don't override evil-seach-word-forward? - "&" mu4e-headers-mark-custom - "A" mu4e-headers-mark-for-action - "m" mu4e-headers-mark-for-move - "r" mu4e-headers-mark-for-refile - "D" mu4e-headers-mark-for-delete - "d" mu4e-headers-mark-for-trash - "=" mu4e-headers-mark-for-untrash - "u" mu4e-headers-mark-for-unmark - "U" mu4e-mark-unmark-all - "?" mu4e-headers-mark-for-unread - "!" mu4e-headers-mark-for-read - "%" mu4e-headers-mark-pattern - "+" mu4e-headers-mark-for-flag - "-" mu4e-headers-mark-for-unflag - "[[" mu4e-headers-prev-unread - "]]" mu4e-headers-next-unread - "gk" mu4e-headers-prev-unread - "gj" mu4e-headers-next-unread - "\C-j" mu4e-headers-next - "\C-k" mu4e-headers-prev - "zr" mu4e-headers-toggle-include-related - "zt" mu4e-headers-toggle-threading - "zd" mu4e-headers-toggle-skip-duplicates - "gl" mu4e-show-log - "gv" mu4e-select-other-view - "T" (lambda () - (interactive) - (mu4e-headers-mark-thread nil '(read)))) - - (mu4e-compose-mode-map - "gg" mu4e-compose-goto-top - "G" mu4e-compose-goto-bottom - "ZD" message-dont-send - "ZF" mml-attach-file - "ZQ" mu4e-message-kill-buffer - "ZZ" message-send-and-exit) - - (mu4e-view-mode-map - " " mu4e-view-scroll-up-or-next - [tab] shr-next-link - [backtab] shr-previous-link - "q" mu4e~view-quit-buffer - "gx" mu4e-view-go-to-url - "gX" mu4e-view-fetch-url - "C" mu4e-compose-new - "H" mu4e-view-toggle-html - ;; "E" mu4e-compose-edit - ;; "F" mu4e-compose-forward - "R" mu4e-compose-reply - "cc" mu4e-compose-new - "ce" mu4e-compose-edit - "cf" mu4e-compose-forward - "cr" mu4e-compose-reply - "p" mu4e-view-save-attachments - "O" mu4e-headers-change-sorting - "A" mu4e-view-mime-part-action ; Since 1.6, uses gnus view by default - "a" mu4e-view-action - "J" mu4e~headers-jump-to-maildir - "[[" mu4e-view-headers-prev-unread - "]]" mu4e-view-headers-next-unread - "gk" mu4e-view-headers-prev-unread - "gj" mu4e-view-headers-next-unread - "\C-j" mu4e-view-headers-next - "\C-k" mu4e-view-headers-prev - "x" mu4e-view-marked-execute - "&" mu4e-view-mark-custom - "*" mu4e-view-mark-for-something ; TODO: Don't override "*". - "m" mu4e-view-mark-for-move - "r" mu4e-view-mark-for-refile - "D" mu4e-view-mark-for-delete - "d" mu4e-view-mark-for-trash - "=" mu4e-view-mark-for-untrash - "u" mu4e-view-unmark - "U" mu4e-view-unmark-all - "?" mu4e-view-mark-for-unread - "!" mu4e-view-mark-for-read - "%" mu4e-view-mark-pattern - "+" mu4e-view-mark-for-flag - "-" mu4e-view-mark-for-unflag - "zr" mu4e-headers-toggle-include-related - "zt" mu4e-headers-toggle-threading - "za" mu4e-view-toggle-hide-cited - "gl" mu4e-show-log - "s" mu4e-view-search-edit - "|" mu4e-view-pipe - "." mu4e-view-raw-message - ,(kbd "C--") mu4e-headers-split-view-shrink - ,(kbd "C-+") mu4e-headers-split-view-grow - "T" (lambda () - (interactive) - (mu4e-headers-mark-thread nil '(read))) - ,@(when evil-want-C-u-scroll - '("\C-u" evil-scroll-up)))) - "All evil-mu4e bindings for evil normal mode.") - - (defvar evil-collection-mu4e-mode-visual-map-bindings - `((mu4e-headers-mode-map - "*" mu4e-headers-mark-for-something - "A" mu4e-headers-mark-for-action - "m" mu4e-headers-mark-for-move - "r" mu4e-headers-mark-for-refile - "D" mu4e-headers-mark-for-delete - "d" mu4e-headers-mark-for-trash - "=" mu4e-headers-mark-for-untrash - "u" mu4e-headers-mark-for-unmark - "?" mu4e-headers-mark-for-unread - "!" mu4e-headers-mark-for-read - "+" mu4e-headers-mark-for-flag - "-" mu4e-headers-mark-for-unflag) - - (mu4e-compose-mode-map - "gg" mu4e-compose-goto-top - "G" mu4e-compose-goto-bottom)) - "All evil-mu4e bindings for evil visual mode.") - -(defun evil-collection-mu4e-set-bindings () - "Set the bindings." - ;; WARNING: With lexical binding, lambdas from `mapc' and `dolist' become - ;; closures in which we must use `evil-define-key*' instead of - ;; `evil-define-key'. - (dolist (binding evil-collection-mu4e-mode-normal-map-bindings) - (apply #'evil-collection-define-key 'normal binding)) - (dolist (binding evil-collection-mu4e-mode-visual-map-bindings) - (apply #'evil-collection-define-key 'visual binding)) - (evil-set-command-property 'mu4e-compose-goto-bottom :keep-visual t) - (evil-set-command-property 'mu4e-compose-goto-top :keep-visual t) - - ;; yu - (evil-collection-define-operator-key 'yank 'mu4e-view-mode-map - "u" 'mu4e-view-save-url)) - - -;;; Update mu4e-main-view -;;; To avoid confusion the main-view is updated to show the keys that are in use -;;; for evil-mu4e. - -(defvar evil-collection-mu4e-begin-region-basic "\n Basics" - "The place where to start overriding Basic section.") - -(defvar evil-collection-mu4e-end-region-basic "a new message\n" - "The place where to end overriding Basic section.") - -(defvar evil-collection-mu4e-new-region-basic - (concat (evil-collection-mu4e--main-action-str "\t* [J]ump to some maildir\n" 'mu4e-jump-to-maildir) - (evil-collection-mu4e--main-action-str "\t* enter a [s]earch query\n" 'mu4e-search) - (evil-collection-mu4e--main-action-str "\t* [C]ompose a new message\n" 'mu4e-compose-new)) - "Define the evil-mu4e Basic region.") - -(defvar evil-collection-mu4e-begin-region-misc "\n Misc" - "The place where to start overriding Misc section.") - -(defvar evil-collection-mu4e-end-region-misc "q]uit" - "The place where to end overriding Misc section.") - -(defun evil-collection-mu4e-new-region-misc () - "Define the evil-mu4e Misc region." - (concat - (evil-collection-mu4e--main-action-str "\t* [;]Switch focus\n" 'mu4e-context-switch) - (evil-collection-mu4e--main-action-str "\t* [u]pdate email & database\n" - 'mu4e-update-mail-and-index) - - ;; show the queue functions if `smtpmail-queue-dir' is defined - (if (file-directory-p smtpmail-queue-dir) - (evil-collection-mu4e--main-view-queue) - "") - "\n" - - (evil-collection-mu4e--main-action-str "\t* [N]ews\n" 'mu4e-news) - (evil-collection-mu4e--main-action-str "\t* [A]bout mu4e\n" 'mu4e-about) - (evil-collection-mu4e--main-action-str "\t* [H]elp\n" 'mu4e-display-manual) - (evil-collection-mu4e--main-action-str "\t* [q]uit\n" 'mu4e-quit))) - -(defvar evil-collection-mu4e-begin-region-maildir "\n Maildirs" - "The place where to end overriding Maildirs section.") - -(defvar evil-collection-mu4e-end-region-maildir "\n\n Misc" - "The place where to end overriding Maildirs section.") - -(defun evil-collection-mu4e-new-region-maildir () - "Define the evil-mu4e Maildirs region." - (concat - ;; minorly edited version of mu4e--main-bookmarks mu4e-main.el - (cl-loop with mds = (mu4e--maildirs-with-query) - with longest = (mu4e--longest-of-maildirs-and-bookmarks) - with queries = (plist-get mu4e--server-props :queries) - for m in mds - for key = (string (plist-get m :key)) - for name = (plist-get m :name) - for query = (plist-get m :query) - for qcounts = (and (stringp query) - (cl-loop for q in queries - when (string= - (decode-coding-string - (plist-get q :query) - 'utf-8 t) - query) - collect q)) - for unread = (and qcounts (plist-get (car qcounts) :unread)) - when (not (plist-get m :hide)) - when (not (and mu4e-main-hide-fully-read (eq unread 0))) - concat (concat - ;; menu entry - (evil-collection-mu4e--main-action-str - (concat "\t* [J" key "] " name) - (concat "J" key)) - ;; append all/unread numbers, if available. - (if qcounts - (let ((unread (plist-get (car qcounts) :unread)) - (count (plist-get (car qcounts) :count))) - (format - "%s (%s/%s)" - (make-string (- longest (string-width name)) ? ) - (propertize (number-to-string unread) - 'face 'mu4e-header-key-face) - count)) - "") - "\n")) -(propertize "\n Misc" 'face 'mu4e-title-face))) - -(defun evil-collection-mu4e-replace-region (new-region start end) - "Replace region between START and END with NEW-REGION. -START end END end are regular expressions." - ;; move to start of region - (goto-char (point-min)) - (re-search-forward start) - - ;; insert new headings - (insert "\n\n") - (insert new-region) - ;; Delete text until end of region. - (let ((start-point (point)) - (end-point (re-search-forward end))) - (delete-region start-point end-point))) - -(defun evil-collection-mu4e-update-main-view () - "Update `Basic', `Maildir', and `Misc' regions to reflect the new keybindings." - (evil-collection-mu4e-replace-region evil-collection-mu4e-new-region-basic - evil-collection-mu4e-begin-region-basic - evil-collection-mu4e-end-region-basic) - (evil-collection-mu4e-replace-region (evil-collection-mu4e-new-region-misc) - evil-collection-mu4e-begin-region-misc - evil-collection-mu4e-end-region-misc) - (evil-collection-mu4e-replace-region (evil-collection-mu4e-new-region-maildir) - evil-collection-mu4e-begin-region-maildir - evil-collection-mu4e-end-region-maildir)) - - -;;; Initialize evil-collection-mu4e - -;;;###autoload -(defun evil-collection-mu4e-setup () - "Initialize evil-mu4e if necessary. -If mu4e-main-mode is in evil-state-motion-modes, initialization -is already done earlier." - (evil-collection-mu4e-set-state) - (evil-collection-mu4e-set-bindings) - (add-hook 'mu4e-main-mode-hook 'evil-collection-mu4e-update-main-view) - (add-hook 'org-mode-hook #'evil-collection-mu4e-org-set-header-to-normal-mode) - (add-hook 'mu4e-compose-pre-hook #'evil-collection-mu4e-org-set-header-to-insert-mode)) - -(provide 'evil-collection-mu4e) -;;; evil-collection-mu4e.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/mu4e/evil-collection-mu4e.el b/.config/emacs/lisp/evil-collection/modes/mu4e/evil-collection-mu4e.el deleted file mode 100644 index 3f22cd2..0000000 --- a/.config/emacs/lisp/evil-collection/modes/mu4e/evil-collection-mu4e.el +++ /dev/null @@ -1,344 +0,0 @@ -;;; evil-collection-mu4e.el --- Evil bindings for mu4e -*- lexical-binding: t -*- - -;; Copyright (C) 2015-2018 Joris Engbers -;; Copyright (C) 2018 Pierre Neidhardt - -;; Author: Joris Engbers -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.9 -;; Package-Requires: ((emacs "24.4") (evil "1.2.10")) -;; Keywords: evil, mu4e, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil keybindings for mu4e that make sense for Evil users. The following -;; keybindings are defined: -;; -;; General commands: -;; | Commmand | evil-mu4e | Alternative | -;; |--------------------------+-----------+-------------| -;; | Jump to maildir | J | | -;; | Update | u | | -;; | Compose message | cc | C | -;; | Kill update mail process | x | | - -;; Commands for header-mode and view-mode: -;; | Command | evil-mu4e | Alternative | -;; |---------------------------------+-----------+-------------| -;; | Next message | C-j | | -;; | Previous message | C-k | | -;; | Mark the current thread as read | T | | -;; | Compose message | cc | C | -;; | Compose edit** | ce | E | -;; | Compose forward** | cf | F | -;; | Compose reply | cr | R | -;; | Change sorting*** | o | O | -;; | Rerun search | gr | | -;; | Toggle include related | zr | | -;; | Toggle threading | zt | | -;; | Toggle hide cited | za | | -;; | Skip duplicates | zd | | -;; | Show log | gl | | -;; | Select other view | gv | | -;; | Save attachement(s) | p | | -;; | Save url | yu | | -;; | Go to url | gx | | -;; | Fetch url | gX | | -;; -;; - * denotes only in header-mode -;; - ** denotes Alternative only in header-mode -;; - *** denotes Alternative only in view-mode -;; -;;; Code: - -(require 'evil-collection) -(require 'message) -(require 'mu4e nil t) - -(defvar mu4e-mu-version) -(declare-function evil-collection-mu4e-set-bindings "evil-collection-mu4e") -(declare-function evil-collection-mu4e-set-state "evil-collection-mu4e") -(declare-function mu4e-headers-mark-thread "mu4e-headers") - -(if (version< mu4e-mu-version "1.10") - (require 'evil-collection-mu4e - (expand-file-name "modes/mu4e/evil-collection-mu4e-1.8" evil-collection-base-dir)) - - - (defconst evil-collection-mu4e-maps '(mu4e-main-mode-map - mu4e-headers-mode-map - mu4e-view-mode-map - mu4e-compose-mode-map - mu4e-search-minor-mode-map - mu4e-thread-mode-map)) - - (defun evil-collection-mu4e-set-state () - "Set the appropriate initial state of all mu4e modes." - (dolist (mode '(mu4e-main-mode - mu4e-headers-mode - mu4e-view-mode - mu4e-org-mode)) - (evil-set-initial-state mode 'normal)) - (evil-set-initial-state 'mu4e-compose-mode 'insert)) - - ;; These functions were removed from mu4e 1.12.0, specifically this commit: - ;; https://github.com/djcb/mu/commit/85bfe763362b95935a3967f6585e14b3f9890a70 - ;; They were also re-added in version 1.12.2. - (when (and (version<= "1.12.0" mu4e-mu-version) - (version< mu4e-mu-version "1.12.2")) - (defun mu4e-compose-goto-top () - "Go to the beginning of the message or buffer. -Go to the beginning of the message or, if already there, go to the -beginning of the buffer." - (interactive) - (let ((old-position (point))) - (message-goto-body) - (when (= (point) old-position) - (goto-char (point-min))))) - - (defun mu4e-compose-goto-bottom () - "Go to the end of the message or buffer. -Go to the end of the message (before signature) or, if already there, go to the -end of the buffer." - (interactive) - (let ((old-position (point)) - (message-position (save-excursion (message-goto-body) (point)))) - (goto-char (point-max)) - (when (re-search-backward message-signature-separator message-position t) - (forward-line -1)) - (when (= (point) old-position) - (goto-char (point-max)))))) - - ;; When using org-mu4e, the above leads to an annoying behaviour, because - ;; switching from message body to header activates mu4e-compose-mode, thus - ;; putting the user into insert-state. The below code, together with the hooks - ;; set in evil-collection-mu4e-setup fixes this issue. - (defun evil-collection-mu4e-org-set-header-to-normal-mode () - "Set initial state in `mu4e-compose-mode' to \='normal." - (evil-set-initial-state 'mu4e-compose-mode 'normal)) - - (defun evil-collection-mu4e-org-set-header-to-insert-mode () - "Set initial state in `mu4e-compose-mode' to \='insert." - (evil-set-initial-state 'mu4e-compose-mode 'insert)) - - (defun evil-collection-mu4e-mark-thread-as-read () - (interactive) - (mu4e-headers-mark-thread nil '(read))) - - (defvar evil-collection-mu4e-mode-normal-map-bindings - `((mu4e-main-mode-map - "J" mu4e~headers-jump-to-maildir - "j" next-line - "k" previous-line - "u" mu4e-update-mail-and-index - "gr" revert-buffer - "b" mu4e-search-bookmark - "B" mu4e-search-bookmark-edit - "N" mu4e-news - ";" mu4e-context-switch - "H" mu4e-display-manual - "C" mu4e-compose-new - "cc" mu4e-compose-new - "x" mu4e-kill-update-mail - "A" mu4e-about - "f" smtpmail-send-queued-mail - "m" mu4e--main-toggle-mail-sending-mode - "s" mu4e-search - "q" mu4e-quit - "Q" mu4e-search-query) - - (mu4e-headers-mode-map - "q" mu4e~headers-quit-buffer - "J" mu4e~headers-jump-to-maildir - "C" mu4e-compose-new - "E" mu4e-compose-edit - "F" mu4e-compose-forward - "R" mu4e-compose-reply - "cc" mu4e-compose-new - "ce" mu4e-compose-edit - "cf" mu4e-compose-forward - "cr" mu4e-compose-reply - "cw" mu4e-compose-wide-reply - "W" mu4e-compose-wide-reply - "o" mu4e-headers-change-sorting - "j" mu4e-headers-next - "k" mu4e-headers-prev - "gr" mu4e-search-rerun - "b" mu4e-search-bookmark - "B" mu4e-search-bookmark-edit - ";" mu4e-context-switch - ,(kbd "RET") mu4e-headers-view-message - "/" mu4e-search-narrow - "s" mu4e-search - "S" mu4e-search-edit - "x" mu4e-mark-execute-all - "a" mu4e-headers-action - "*" mu4e-headers-mark-for-something ; TODO: Don't override evil-seach-word-forward? - "&" mu4e-headers-mark-custom - "A" mu4e-headers-mark-for-action - "m" mu4e-headers-mark-for-move - "r" mu4e-headers-mark-for-refile - "D" mu4e-headers-mark-for-delete - "d" mu4e-headers-mark-for-trash - "=" mu4e-headers-mark-for-untrash - "u" mu4e-headers-mark-for-unmark - "U" mu4e-mark-unmark-all - "?" mu4e-headers-mark-for-unread - "!" mu4e-headers-mark-for-read - "%" mu4e-headers-mark-pattern - "+" mu4e-headers-mark-for-flag - "-" mu4e-headers-mark-for-unflag - "[[" mu4e-headers-prev-unread - "]]" mu4e-headers-next-unread - "}" mu4e-headers-next-thread - "{" mu4e-headers-prev-thread - "gk" mu4e-headers-prev-unread - "gj" mu4e-headers-next-unread - "\C-j" mu4e-headers-next - "\C-k" mu4e-headers-prev - "t" mu4e-headers-toggle-property - "zr" mu4e-headers-toggle-include-related - "zt" mu4e-headers-toggle-threading - "zd" mu4e-headers-toggle-skip-duplicates - "gl" mu4e-show-log - "gv" mu4e-select-other-view - "T" evil-collection-mu4e-mark-thread-as-read - "Q" mu4e-search-query) - - (mu4e-compose-mode-map - "gg" mu4e-compose-goto-top - "G" mu4e-compose-goto-bottom - "ZD" message-dont-send - "ZF" mml-attach-file - "ZQ" ,(function-get 'mu4e-user-agent 'abortfunc) - "ZZ" ,(function-get 'mu4e-user-agent 'sendfunc)) - - (mu4e-search-minor-mode-map - "J" mu4e-search-maildir) - - (mu4e-thread-mode-map - [S-left] mu4e-thread-goto-root - [tab] mu4e-thread-fold-toggle - [C-tab] mu4e-thread-fold-toggle-goto-next - [backtab] mu4e-thread-fold-toggle-all) - - (mu4e-view-mode-map - " " mu4e-view-scroll-up-or-next - [tab] forward-button - [backtab] backward-button - "q" mu4e-view-quit - "gx" mu4e-view-go-to-url - "gX" mu4e-view-fetch-url - "C" mu4e-compose-new - "H" mu4e-view-toggle-html - ;; "E" mu4e-compose-edit - ;; "F" mu4e-compose-forward - "R" mu4e-compose-reply - "cc" mu4e-compose-new - "ce" mu4e-compose-edit - "cf" mu4e-compose-forward - "cr" mu4e-compose-reply - "cw" mu4e-compose-wide-reply - "p" mu4e-view-save-attachments - "O" mu4e-headers-change-sorting - "A" mu4e-view-mime-part-action ; Since 1.6, uses gnus view by default - "a" mu4e-view-action - "J" mu4e~headers-jump-to-maildir - "[[" mu4e-view-headers-prev-unread - "]]" mu4e-view-headers-next-unread - "gk" mu4e-view-headers-prev-unread - "gj" mu4e-view-headers-next-unread - "\C-j" mu4e-view-headers-next - "\C-k" mu4e-view-headers-prev - "x" mu4e-view-marked-execute - "&" mu4e-view-mark-custom - "*" mu4e-view-mark-for-something ; TODO: Don't override "*". - "m" mu4e-view-mark-for-move - "r" mu4e-view-mark-for-refile - "D" mu4e-view-mark-for-delete - "d" mu4e-view-mark-for-trash - "=" mu4e-view-mark-for-untrash - "u" mu4e-view-unmark - "U" mu4e-view-unmark-all - "?" mu4e-view-mark-for-unread - "!" mu4e-view-mark-for-read - "%" mu4e-view-mark-pattern - "+" mu4e-view-mark-for-flag - "-" mu4e-view-mark-for-unflag - "zr" mu4e-headers-toggle-include-related - "zt" mu4e-headers-toggle-threading - "za" mu4e-view-toggle-hide-cited - "gl" mu4e-show-log - "s" mu4e-view-search-edit - "|" mu4e-view-pipe - "." mu4e-view-raw-message - ,(kbd "C--") mu4e-headers-split-view-shrink - ,(kbd "C-+") mu4e-headers-split-view-grow - ,@(when evil-want-C-u-scroll - '("\C-u" evil-scroll-up)))) - "All evil-mu4e bindings for evil normal mode.") - - (defvar evil-collection-mu4e-mode-visual-map-bindings - `((mu4e-headers-mode-map - "*" mu4e-headers-mark-for-something - "A" mu4e-headers-mark-for-action - "m" mu4e-headers-mark-for-move - "r" mu4e-headers-mark-for-refile - "D" mu4e-headers-mark-for-delete - "d" mu4e-headers-mark-for-trash - "=" mu4e-headers-mark-for-untrash - "u" mu4e-headers-mark-for-unmark - "?" mu4e-headers-mark-for-unread - "!" mu4e-headers-mark-for-read - "+" mu4e-headers-mark-for-flag - "-" mu4e-headers-mark-for-unflag) - - (mu4e-compose-mode-map - "gg" mu4e-compose-goto-top - "G" mu4e-compose-goto-bottom)) - "All evil-mu4e bindings for evil visual mode.") - - (defun evil-collection-mu4e-set-bindings () - "Set the bindings." - ;; WARNING: With lexical binding, lambdas from `mapc' and `dolist' become - ;; closures in which we must use `evil-define-key*' instead of - ;; `evil-define-key'. - (dolist (binding evil-collection-mu4e-mode-normal-map-bindings) - (apply #'evil-collection-define-key 'normal binding)) - (dolist (binding evil-collection-mu4e-mode-visual-map-bindings) - (apply #'evil-collection-define-key 'visual binding)) - (evil-set-command-property 'mu4e-compose-goto-bottom :keep-visual t) - (evil-set-command-property 'mu4e-compose-goto-top :keep-visual t) - - ;; yu - (evil-collection-define-operator-key 'yank 'mu4e-view-mode-map - "u" 'mu4e-view-save-url)) - - - - - (defun evil-collection-mu4e-setup () - "Initialize evil-mu4e if necessary. -If `mu4e-main-mode' is in `evil-state-motion-modes', initialization -is already done earlier." - (evil-collection-mu4e-set-state) - (evil-collection-mu4e-set-bindings)) - - (add-hook 'mu4e-thread-mode-hook #'evil-normalize-keymaps) - - (provide 'evil-collection-mu4e)) -;;; evil-collection-mu4e.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/neotree/evil-collection-neotree.el b/.config/emacs/lisp/evil-collection/modes/neotree/evil-collection-neotree.el deleted file mode 100644 index 7961306..0000000 --- a/.config/emacs/lisp/evil-collection/modes/neotree/evil-collection-neotree.el +++ /dev/null @@ -1,101 +0,0 @@ -;;; evil-collection-neotree.el --- Evil bindings for neotree -*- lexical-binding: t; no-byte-compile: t; -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Maximiliano Sandoval -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, neotree, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for `neotree' - -;;; Code: - -(require 'evil-collection) -(require 'neotree nil t) - -(declare-function neotree-make-executor "neotree.el") -(defconst evil-collection-neotree-maps '(neotree-mode-map)) - -;;;###autoload -(defun evil-collection-neotree-setup () - "Set up `evil' bindings for `neotree'." - - (evil-set-initial-state 'neotree-mode 'normal) ;; Neotree start in normal by default. - - (evil-collection-define-key 'normal 'neotree-mode-map - - (kbd "RET") (neotree-make-executor - :file-fn 'neo-open-file - :dir-fn 'neo-open-dir) - (kbd "") (neotree-make-executor - :dir-fn 'neo-open-dir) - "z" (neotree-make-executor - :dir-fn 'neo-open-dir) - "ZZ" 'quit-window - "gd" (neotree-make-executor - :dir-fn 'neo-open-dired) - "gD" (neotree-make-executor - :dir-fn 'neo-open-dired) - "go" (neotree-make-executor - :file-fn 'neo-open-file - :dir-fn 'neo-open-dir) - "gO" 'neotree-quick-look - "gr" 'neotree-refresh - "q" 'neotree-hide - "H" 'neotree-hidden-file-toggle - "gh" 'neotree-hidden-file-toggle - (kbd "C-k") 'neotree-select-up-node - "gk" 'neotree-select-up-node - "[[" 'neotree-select-up-node - (kbd "C-j") 'neotree-select-down-node - "gj" 'neotree-select-down-node - "]]" 'neotree-select-down-node - "gv" 'neotree-open-file-in-system-application - "c" 'neotree-create-node - "y" 'neotree-copy-node - "r" 'neotree-rename-node - "R" 'neotree-change-root - "d" 'neotree-delete-node - "J" 'neotree-dir - "+" 'neotree-stretch-toggle - "=" 'neotree-stretch-toggle - "ge" 'neotree-enter - "j" 'neotree-next-line - "k" 'neotree-previous-line - - ;; Unchanged keybings. - "a" (neotree-make-executor - :file-fn 'neo-open-file-ace-window) - "|" (neotree-make-executor - :file-fn 'neo-open-file-vertical-split) - "-" (neotree-make-executor - :file-fn 'neo-open-file-horizontal-split) - "S" 'neotree-select-previous-sibling-node - "s" 'neotree-select-next-sibling-node - (kbd "C-c C-c") 'neotree-change-root - (kbd "C-x 1") 'neotree-empty-fn - (kbd "C-x 2") 'neotree-empty-fn - (kbd "C-x 3") 'neotree-empty-fn - (kbd "C-x C-f") 'find-file-other-window - (kbd "C-c C-f") 'find-file-other-window)) - -(provide 'evil-collection-neotree) -;;; evil-collection-neotree.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/newsticker/README.org b/.config/emacs/lisp/evil-collection/modes/newsticker/README.org deleted file mode 100644 index 4c73530..0000000 --- a/.config/emacs/lisp/evil-collection/modes/newsticker/README.org +++ /dev/null @@ -1,56 +0,0 @@ -* newsticker - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/newsticker/index.html][newsticker]], the built-in RSS / Atom reader. - -** Key bindings - -*** newsticker-mode-map (plainview) - - | Command | Original | Evil | - |---------------------------------------------+----------+------| - | =newsticker-previous-feed= | =F= | =gk= | - | =newsticker-next-feed= | =f= | =gj= | - | =newsticker-mark-item-at-point-as-read= | =o= | =r= | - | =newsticker-mark-item-at-point-as-immortal= | =i= | =i= | - | =newsticker-show-old-items= | =s O= | =o= | - | =newsticker-hide-old-items= | =h O= | =O= | - | =newsticker-buffer-force-update= | =U= | =gr= | - | =newsticker-get-all-news= | =G= | =gR= | - | =newsticker-close-buffer= | =q= | =q= | - -*** newsticker-treeview-mode-map - - | Command | Original | Evil | - |-------------------------------------------------+--------------+--------------| - | =newsticker-treeview-prev-feed= | =F= | =[[= | - | =newsticker-treeview-next-feed= | =f= | =]]= | - | =newsticker-treeview-next-item= | =n= | =M-j= | - | =newsticker-treeview-prev-item= | =p= | =M-k= | - | =newsticker-treeview-next-new-or-immortal-item= | =N= | =gj= | - | =newsticker-treeview-prev-new-or-immortal-item= | =P= | =gk= | - | =newsticker-treeview-next-page= | =SPC= | =SPC= | - | =newsticker-treeview-jump= | =j= | =J= | - | =newsticker-treeview-mark-item-old= | =o= | =o= | - | =newsticker-treeview-mark-list-items-old= | =O= | =O= | - | =newsticker-treeview-toggle-item-immortal= | =i= | =i= | - | =newsticker-treeview-browse-url-item= | =b= | =b= | - | =newsticker-treeview-browse-url= | =v= | =B= | - | =newsticker-group-add-group= | =M-a= | =A= | - | =newsticker-group-delete-group= | =M-d= | =D= | - | =newsticker-group-rename-group= | =M-r= | =R= | - | =newsticker-treeview-save= | =s= | =S= | - | =newsticker-group-move-feed= | =M-m= | =M-m= | - | =newsticker-group-shift-feed-down= | =M-= | =M-= | - | =newsticker-group-shift-feed-up= | =M-= | =M-= | - | =newsticker-group-shift-group-down= | =M-S-= | =M-S-= | - | =newsticker-group-shift-group-up= | =M-S-= | =M-S-= | - | =newsticker-treeview-update= | =u= | =gr= | - | =newsticker-get-all-news= | =G= | =gR= | - | =newsticker-treeview-quit= | =q= | =q= | - -** Notes - - - In the treeview list buffer, =C-m= / =C-j= are bound to - =newsticker-treeview-show-item= via text-property keymap, which has higher - precedence than the major-mode map. Use =M-j= / =M-k= for next / previous - item navigation. diff --git a/.config/emacs/lisp/evil-collection/modes/newsticker/evil-collection-newsticker.el b/.config/emacs/lisp/evil-collection/modes/newsticker/evil-collection-newsticker.el deleted file mode 100644 index 9397a44..0000000 --- a/.config/emacs/lisp/evil-collection/modes/newsticker/evil-collection-newsticker.el +++ /dev/null @@ -1,116 +0,0 @@ -;;; evil-collection-newsticker.el --- Evil bindings for newsticker -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, newsticker, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for newsticker. - -;;; Code: -(require 'evil-collection) -(require 'newsticker) - -(defconst evil-collection-newsticker-maps '(newsticker-mode-map)) - -;;;###autoload -(defun evil-collection-newsticker-setup () - "Set up `evil' bindings for `newsticker'." - ;; plainview - (evil-set-initial-state 'newsticker-mode 'normal) - (evil-collection-define-key 'normal 'newsticker-mode-map - ;; move - "gk" 'newsticker-previous-feed - "gj" 'newsticker-next-feed - - ;; mark - "r" 'newsticker-mark-item-at-point-as-read - "i" 'newsticker-mark-item-at-point-as-immortal - - ;; show/hide - "o" 'newsticker-show-old-items - "O" 'newsticker-hide-old-items - - ;; refresh - "gr" 'newsticker-buffer-force-update - "gR" 'newsticker-get-all-news - - ;; quit - "q" 'newsticker-close-buffer) - - ;; treeview - (evil-set-initial-state 'newsticker-treeview-list-mode 'normal) - (evil-collection-define-key 'normal 'newsticker-treeview-list-mode-map - [down-mouse-3] 'newsticker-treeview-list-menu) - - (evil-set-initial-state 'newsticker-treeview-item-mode 'normal) - (evil-collection-define-key 'normal 'newsticker-treeview-item-mode-map - [down-mouse-3] 'newsticker-treeview-item-menu) - - (evil-set-initial-state 'newsticker-treeview-mode 'normal) - (evil-collection-define-key 'normal 'newsticker-treeview-mode-map - ;; move - "[[" 'newsticker-treeview-prev-feed - "]]" 'newsticker-treeview-next-feed - ;; The items in Newsticker List buffer has a particular keymap by text - ;; property, where CR (C-m) and LF (C-j) are bound to - ;; `newsticker-treeview-show-item'. According to the keymap precedence page, - ;; the text property based keymap has a higher priority. - ;; - ;; Eval (info "(elisp)Searching Keymaps") if you have interests. - ;; - ;; Use M-j/M-k instead. - (kbd "M-j") 'newsticker-treeview-next-item - (kbd "M-k") 'newsticker-treeview-prev-item - "gj" 'newsticker-treeview-next-new-or-immortal-item - "gk" 'newsticker-treeview-prev-new-or-immortal-item - (kbd "SPC") 'newsticker-treeview-next-page - "J" 'newsticker-treeview-jump - - ;; mark - "o" 'newsticker-treeview-mark-item-old - "O" 'newsticker-treeview-mark-list-items-old - "i" 'newsticker-treeview-toggle-item-immortal - - "b" 'newsticker-treeview-browse-url-item - "B" 'newsticker-treeview-browse-url - - ;; group - "A" 'newsticker-group-add-group - "D" 'newsticker-group-delete-group - "R" 'newsticker-group-rename-group - "S" 'newsticker-treeview-save - (kbd "M-m") 'newsticker-group-move-feed - (kbd "") 'newsticker-group-shift-feed-down - (kbd "") 'newsticker-group-shift-feed-up - (kbd "") 'newsticker-group-shift-group-down - (kbd "") 'newsticker-group-shift-group-up - - ;; refresh - "gr" 'newsticker-treeview-update - "gR" 'newsticker-get-all-news - - ;; quit - "q" 'newsticker-treeview-quit)) - -(provide 'evil-collection-newsticker) -;;; evil-collection-newsticker.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/notmuch/README.org b/.config/emacs/lisp/evil-collection/modes/notmuch/README.org deleted file mode 100644 index ea5fa4e..0000000 --- a/.config/emacs/lisp/evil-collection/modes/notmuch/README.org +++ /dev/null @@ -1,142 +0,0 @@ -* notmuch - - Evil bindings for [[https://notmuchmail.org/][notmuch]]. - -** notmuch-common-keymap - - Inherited by all notmuch buffer maps. Single-letter commands are relocated - under the =g= prefix. - - | Command | Original | Evil | - |----------------------------------------+----------+-----------| - | =notmuch-help= | =?= | =g?= | - | =notmuch-bury-or-kill-this-buffer= | =q= | =q= | - | =notmuch-search= | =s= | =s= | - | =notmuch-tree= | =z= | =S= | - | =notmuch-mua-new-mail= | =m= | =C=, =cc= | - | =notmuch-refresh-this-buffer= | =g=, === | =gr= | - | =notmuch-refresh-all-buffers= | =M-== | =gA= | - | =notmuch-poll-and-refresh-this-buffer= | =G= | =gR= | - | =notmuch-jump-search= | =j= | =J= | - -** notmuch-show-mode-map - - | Command | Original | Evil | - |---------------------------------------------------------+-----------+-------------| - | =notmuch-show-next-open-message= | =n= | =gj= | - | =notmuch-show-previous-open-message= | =p= | =gk= | - | =notmuch-show-next-message= | =N= | =]]=, =C-j= | - | =notmuch-show-previous-message= | =P= | =[[=, =C-k= | - | =notmuch-show-next-thread-show= | =M-n= | =M-j= | - | =notmuch-show-previous-thread-show= | =M-p= | =M-k= | - | =notmuch-show-archive-message-then-next-or-next-thread= | =a= | =a= | - | =notmuch-show-archive-thread-then-next= | =A= | =A= | - | =notmuch-show-archive-thread-then-exit= | =X= | =X= | - | =notmuch-show-archive-message-then-next-or-exit= | =x= | =x= | - | =notmuch-show-reply-sender= | =r= | =cr= | - | =notmuch-show-reply= | =R= | =cR= | - | =notmuch-show-forward-message= | =f= | =cf= | - | =notmuch-show-filter-thread= | =l= | =S= | - | =notmuch-show-save-attachments= | =w= | =p= | - | =notmuch-show-toggle-visibility-headers= | =h= | =H= | - | =notmuch-tag-jump= | =k= | =K= | - | =notmuch-show-tag-all= | =*= | =*= | - | =notmuch-show-add-tag= | =+= | =+= | - | =notmuch-show-remove-tag= | =-= | =-= | - | =notmuch-show-toggle-message= | =RET= | =RET= | - | =notmuch-show-toggle-thread-indentation= | =<= | =<= | - | =notmuch-show-next-button= | =TAB= | =TAB= | - | =notmuch-show-previous-button= | =backtab= | =backtab= | - | =notmuch-show-pipe-message= | =\vert= | =\vert= | - | =notmuch-show-stash-map= | =c= | =ys= | - | =notmuch-show-part-map= | =.= | =.= | - | =notmuch-tree-from-show-current-query= | =Z= | =zv= | - | =goto-address-at-point= | n/a | =gd= | - | =evil-collection-notmuch-show-toggle-delete= | n/a | =d= | - | =evil-collection-notmuch-show-toggle-flagged= | n/a | === | - -** notmuch-tree-mode-map - - | Command | Original | Evil | - |--------------------------------------------------+----------+-----------| - | =notmuch-tree-next-matching-message= | =n= | =gj= | - | =notmuch-tree-prev-matching-message= | =p= | =gk= | - | =notmuch-tree-next-message= | =N= | =]]= | - | =notmuch-tree-prev-message= | =P= | =[[= | - | =notmuch-tree-next-thread= | =M-n= | =C-j= | - | =notmuch-tree-prev-thread= | =M-p= | =C-k= | - | =notmuch-tree-archive-message-then-next= | =a= | =a= | - | =notmuch-tree-archive-thread-then-next= | =A= | =A= | - | =notmuch-tree-archive-thread-then-exit= | =X= | (default) | - | =notmuch-tree-archive-message-then-next-or-exit= | =x= | (default) | - | =notmuch-show-reply-sender= | =r= | =cr= | - | =notmuch-show-reply= | =R= | =cR= | - | =notmuch-tree-filter= | =l= | (default) | - | =notmuch-tree-to-tree= | =z= | =s= | - | =notmuch-search-from-tree-current-query= | =S= | =zv= | - | =notmuch-show-save-attachments= | =w= | (default) | - | =notmuch-tag-jump= | =k= | =K= | - | =notmuch-tree-tag-thread= | =*= | =*= | - | =notmuch-tree-add-tag= | =+= | =+= | - | =notmuch-tree-remove-tag= | =-= | =-= | - | =notmuch-tree-show-message= | =RET= | =RET= | - | =notmuch-tree-resume-message= | =e= | =e= | - | =notmuch-show-pipe-message= | =\vert= | =\vert= | - | =evil-collection-notmuch-tree-toggle-delete= | n/a | =d= | - | =evil-collection-notmuch-tree-toggle-unread= | n/a | =!= | - | =evil-collection-notmuch-tree-toggle-flagged= | n/a | === | - -** notmuch-search-mode-map - - | Command | Original | Evil | - |-------------------------------------------------+----------+------------| - | =notmuch-search-next-thread= | =n= | =j= (evil) | - | =notmuch-search-previous-thread= | =p= | =k= (evil) | - | =notmuch-search-archive-thread= | =a= | =a= | - | =notmuch-search-reply-to-thread-sender= | =r= | =cr= | - | =notmuch-search-reply-to-thread= | =R= | =cR= | - | =notmuch-search-filter= | =l= | =S= | - | =notmuch-search-filter-by-tag= | =t= | =t= | - | =notmuch-search-toggle-order= | =o= | =o= | - | =notmuch-tag-jump= | =k= | =K= | - | =notmuch-search-tag-all= | =*= | =*= | - | =notmuch-search-add-tag= | =+= | =+= | - | =notmuch-search-remove-tag= | =-= | =-= | - | =notmuch-search-show-thread= | =RET= | =RET= | - | =notmuch-tree-from-search-current-query= | =Z= | =zv= | - | =notmuch-bury-or-kill-this-buffer= | =x= | =q= | - | =notmuch-search-stash-map= | =c= | =ys= | - | =compose-mail= | n/a | =cc= | - | =compose-mail-other-frame= | n/a | =cC= | - | =evil-collection-notmuch-search-toggle-delete= | n/a | =d= | - | =evil-collection-notmuch-search-toggle-unread= | n/a | =!= | - | =evil-collection-notmuch-search-toggle-flagged= | n/a | === | - -** notmuch-hello-mode-map - - | Command | Original | Evil | - |-------------------------------------+----------+------------------| - | =notmuch-version= | =v= | =g?= | - | =widget-forward= | =TAB= | =TAB= | - | =widget-backward= | =S-TAB= | =S-TAB=, =C-TAB= | - | =evil-collection-notmuch-hello-ret= | n/a | =RET= | - -** New commands - - | Command | Key | | - |-------------------------------------------------+-------+----------------------------------------------------------------| - | =evil-collection-notmuch-show-toggle-delete= | =d= | toggle =evil-collection-notmuch-delete-tag= on current message | - | =evil-collection-notmuch-tree-toggle-delete= | =d= | tree variant | - | =evil-collection-notmuch-search-toggle-delete= | =d= | search variant | - | =evil-collection-notmuch-show-toggle-flagged= | === | toggle =flagged= tag | - | =evil-collection-notmuch-tree-toggle-flagged= | === | | - | =evil-collection-notmuch-search-toggle-flagged= | === | | - | =evil-collection-notmuch-tree-toggle-unread= | =!= | toggle =unread= tag | - | =evil-collection-notmuch-search-toggle-unread= | =!= | | - | =evil-collection-notmuch-hello-ret= | =RET= | activate widget or button at point | - -** Customization - - | Variable | Default | Purpose | - |--------------------------------------+-------------+------------------------------------------------------------------| - | =evil-collection-notmuch-delete-tag= | ="deleted"= | Tag toggled by =d=. Set to ="trash"= for lieer/Gmail-style sync. | diff --git a/.config/emacs/lisp/evil-collection/modes/notmuch/evil-collection-notmuch.el b/.config/emacs/lisp/evil-collection/modes/notmuch/evil-collection-notmuch.el deleted file mode 100644 index 2256259..0000000 --- a/.config/emacs/lisp/evil-collection/modes/notmuch/evil-collection-notmuch.el +++ /dev/null @@ -1,256 +0,0 @@ -;;; evil-collection-notmuch.el --- Bindings for `notmuch' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: emacs, tools, evil - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `notmuch'. - -;;; Code: -(require 'notmuch nil t) -(require 'evil-collection) - -(defcustom evil-collection-notmuch-delete-tag "deleted" - "Tag toggled by the delete bindings (`d') in notmuch modes. - -Defaults to \"deleted\" for backwards compatibility with the self-hosted -notmuch convention where a cron job removes files matching `tag:deleted'. - -Set to \"trash\" when syncing with services that map a Trash tag/label -back to the server (e.g. lieer/Gmail's TRASH label, or an IMAP setup -that moves trashed messages out of the inbox)." - :type 'string - :group 'evil-collection-notmuch) - -(declare-function notmuch-show-get-tags "notmuch-show") -(declare-function notmuch-show-tag "notmuch-show") -(declare-function notmuch-search-get-tags "notmuch") -(declare-function notmuch-search-tag "notmuch") -(declare-function notmuch-tree-tag "notmuch-tree") - -(declare-function widget-field-at "wid-edit") -(declare-function widget-field-activate "wid-edit") -(declare-function widget-button-press "wid-edit") - -;; Since all the other maps in `evil-collection-notmuch-maps` -;; have notmuch-common-keymap as parent -;; https://git.notmuchmail.org/git?p=notmuch;a=blob;f=emacs/notmuch-hello.el;h=fa31694ff0f79a7f2781849394390a673f75aade;hb=HEAD#l651 -;; -;; When `evil-collection-setup-hook` runs, if it changes keymaps -;; using a `dolist` over `evil-collection-notmuch-maps`, then a binding might -;; see 2 changes at once. To avoid that, notmuch-common-keymap is last -(defconst evil-collection-notmuch-maps '(notmuch-hello-mode-map - notmuch-show-mode-map - notmuch-show-part-map - notmuch-tree-mode-map - notmuch-search-mode-map - notmuch-search-stash-map - notmuch-common-keymap)) - -(defun evil-collection-notmuch-toggle-tag (tag mode &optional next-function) - "Toggle TAG tag for message in MODE." - (let ((get (intern (format "notmuch-%s-get-tags" mode))) - (set (intern (format "notmuch-%s-tag" mode))) - (next (or next-function (intern (format "notmuch-%s-next-message" mode))))) - (funcall set (list (concat (if (member tag (funcall get)) - "-" "+") - tag))) - (funcall next))) - -(defun evil-collection-notmuch-show-toggle-delete () - "Toggle `evil-collection-notmuch-delete-tag' for message." - (interactive) - (evil-collection-notmuch-toggle-tag evil-collection-notmuch-delete-tag "show")) - -(defun evil-collection-notmuch-tree-toggle-delete () - "Toggle `evil-collection-notmuch-delete-tag' for message." - (interactive) - (evil-collection-notmuch-toggle-tag evil-collection-notmuch-delete-tag "tree")) - -(defun evil-collection-notmuch-search-toggle-delete () - "Toggle `evil-collection-notmuch-delete-tag' for message." - (interactive) - (evil-collection-notmuch-toggle-tag evil-collection-notmuch-delete-tag "search" 'notmuch-search-next-thread)) - -(defun evil-collection-notmuch-tree-toggle-unread () - "Toggle unread tag for message." - (interactive) - (evil-collection-notmuch-toggle-tag "unread" "tree")) - -(defun evil-collection-notmuch-search-toggle-unread () - "Toggle unread tag for message." - (interactive) - (evil-collection-notmuch-toggle-tag "unread" "search" 'notmuch-search-next-thread)) - -(defun evil-collection-notmuch-show-toggle-flagged () - "Toggle flagged tag for message." - (interactive) - (evil-collection-notmuch-toggle-tag "flagged" "show")) - -(defun evil-collection-notmuch-tree-toggle-flagged () - "Toggle flagged tag for message." - (interactive) - (evil-collection-notmuch-toggle-tag "flagged" "tree")) - -(defun evil-collection-notmuch-search-toggle-flagged () - "Toggle flagged tag for message." - (interactive) - (evil-collection-notmuch-toggle-tag "flagged" "search" 'notmuch-search-next-thread)) - -(defun evil-collection-notmuch-hello-ret () - (interactive) - (if (widget-field-at (point)) - (call-interactively #'widget-field-activate) - (call-interactively #'widget-button-press))) - -;;;###autoload -(defun evil-collection-notmuch-setup () - "Set up `evil' bindings for `notmuch'." - (evil-collection-inhibit-insert-state 'notmuch-show-mode-map) - (evil-collection-inhibit-insert-state 'notmuch-search-mode-map) - (evil-collection-inhibit-insert-state 'notmuch-tree-mode-map) - - (evil-set-initial-state 'notmuch-show-mode 'normal) - (evil-set-initial-state 'notmuch-search-mode 'normal) - (evil-set-initial-state 'notmuch-hello-mode 'normal) - (evil-set-initial-state 'notmuch-tree-mode 'normal) - - (evil-collection-define-key 'normal 'notmuch-common-keymap - "g?" 'notmuch-help - "q" 'notmuch-bury-or-kill-this-buffer - "s" 'notmuch-search - "S" 'notmuch-tree - "C" 'notmuch-mua-new-mail ; like mu4e - "cc" 'notmuch-mua-new-mail ; like mu4e - "gr" 'notmuch-refresh-this-buffer - "gA" 'notmuch-refresh-all-buffers - "gR" 'notmuch-poll-and-refresh-this-buffer - "J" 'notmuch-jump-search) - - (evil-collection-define-key 'normal 'notmuch-hello-mode-map - "g?" 'notmuch-version - (kbd "TAB") 'widget-forward - (kbd "RET") 'evil-collection-notmuch-hello-ret - (kbd "S-TAB") 'widget-backward - (kbd "") 'widget-backward) - - (evil-collection-define-key 'normal 'notmuch-show-mode-map - "gd" 'goto-address-at-point - "p" 'notmuch-show-save-attachments ; like mu4e - "A" 'notmuch-show-archive-thread-then-next - "S" 'notmuch-show-filter-thread - "K" 'notmuch-tag-jump - "C" 'notmuch-mua-new-mail ; like mu4e - "cc" 'notmuch-mua-new-mail ; like mu4e - "cR" 'notmuch-show-reply - "cf" 'notmuch-show-forward-message - "X" 'notmuch-show-archive-thread-then-exit - "zv" 'notmuch-tree-from-show-current-query ; like mu4e-conversation - "<" 'notmuch-show-toggle-thread-indentation - "a" 'notmuch-show-archive-message-then-next-or-next-thread - "d" 'evil-collection-notmuch-show-toggle-delete - "=" 'evil-collection-notmuch-show-toggle-flagged - "H" 'notmuch-show-toggle-visibility-headers - "gj" 'notmuch-show-next-open-message - "gk" 'notmuch-show-previous-open-message - "]]" 'notmuch-show-next-message - "[[" 'notmuch-show-previous-message - (kbd "C-j") 'notmuch-show-next-message - (kbd "C-k") 'notmuch-show-previous-message - (kbd "M-j") 'notmuch-show-next-thread-show - (kbd "M-k") 'notmuch-show-previous-thread-show - "cr" 'notmuch-show-reply-sender - (kbd "x") 'notmuch-show-archive-message-then-next-or-exit - "|" 'notmuch-show-pipe-message - "*" 'notmuch-show-tag-all - "-" 'notmuch-show-remove-tag - "+" 'notmuch-show-add-tag - (kbd "TAB") 'notmuch-show-next-button - (kbd "") 'notmuch-show-previous-button - (kbd "RET") 'notmuch-show-toggle-message - "." 'notmuch-show-part-map) - - (evil-collection-define-key 'normal 'notmuch-tree-mode-map - "g?" 'notmuch-help - "q" 'notmuch-tree-quit - "S" 'notmuch-tree-to-search - "C" 'notmuch-mua-new-mail ; like mu4e - "cc" 'notmuch-mua-new-mail ; like mu4e - "J" 'notmuch-jump-search - "zv" 'notmuch-search-from-tree-current-query ; like mu4e-conversation - "cr" 'notmuch-show-reply-sender ; like mu4e - "cR" 'notmuch-show-reply - "d" 'evil-collection-notmuch-tree-toggle-delete - "!" 'evil-collection-notmuch-tree-toggle-unread - "=" 'evil-collection-notmuch-tree-toggle-flagged - "K" 'notmuch-tag-jump - (kbd "RET") 'notmuch-tree-show-message - [mouse-1] 'notmuch-tree-show-message - "A" 'notmuch-tree-archive-thread-then-next - "a" 'notmuch-tree-archive-message-then-next - "s" 'notmuch-tree-to-tree - "gj" 'notmuch-tree-next-matching-message - "gk" 'notmuch-tree-prev-matching-message - "]]" 'notmuch-tree-next-message - "[[" 'notmuch-tree-prev-message - (kbd "C-k") 'notmuch-tree-prev-thread - (kbd "C-j") 'notmuch-tree-next-thread - "|" 'notmuch-show-pipe-message - "-" 'notmuch-tree-remove-tag - "+" 'notmuch-tree-add-tag - "*" 'notmuch-tree-tag-thread - "e" 'notmuch-tree-resume-message) - - (dolist (state '(normal visual)) - (evil-collection-define-key state 'notmuch-search-mode-map - "cC" 'compose-mail-other-frame - "J" 'notmuch-jump-search - "S" 'notmuch-search-filter - "K" 'notmuch-tag-jump - "o" 'notmuch-search-toggle-order - "zv" 'notmuch-tree-from-search-current-query - "*" 'notmuch-search-tag-all - "a" 'notmuch-search-archive-thread - "cc" 'compose-mail ; like mu4e - "d" 'evil-collection-notmuch-search-toggle-delete - "!" 'evil-collection-notmuch-search-toggle-unread - "=" 'evil-collection-notmuch-search-toggle-flagged - "q" 'notmuch-bury-or-kill-this-buffer - "cr" 'notmuch-search-reply-to-thread-sender - "cR" 'notmuch-search-reply-to-thread - "t" 'notmuch-search-filter-by-tag - [mouse-1] 'notmuch-search-show-thread - "-" 'notmuch-search-remove-tag - "+" 'notmuch-search-add-tag - (kbd "RET") 'notmuch-search-show-thread)) - - ;; ys - (evil-collection-define-operator-key 'yank 'notmuch-search-mode-map - "s" 'notmuch-search-stash-map) - - ;; ys - (evil-collection-define-operator-key 'yank 'notmuch-show-mode-map - "s" 'notmuch-show-stash-map)) - -(provide 'evil-collection-notmuch) -;;; evil-collection-notmuch.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/nov/evil-collection-nov.el b/.config/emacs/lisp/evil-collection/modes/nov/evil-collection-nov.el deleted file mode 100644 index aa1d86d..0000000 --- a/.config/emacs/lisp/evil-collection/modes/nov/evil-collection-nov.el +++ /dev/null @@ -1,67 +0,0 @@ -;;; evil-collection-nov.el --- Bindings for `nov' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools, epub - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for`nov'. - -;;; Code: -(require 'evil-collection) -(require 'nov nil t) - -(defvar nov-mode-map) - -(defconst evil-collection-nov-maps '(nov-mode-map)) - -;;;###autoload -(defun evil-collection-nov-setup () - "Set up `evil' bindings for `nov'." - (evil-collection-define-key 'normal 'nov-mode-map - "gr" 'nov-render-document - "s" 'nov-view-source - "S" 'nov-view-content-source - "g?" 'nov-display-metadata - "gj" 'nov-next-document - (kbd "C-j") 'nov-next-document - (kbd "M-j") 'nov-next-document - "]]" 'nov-next-document - "gk" 'nov-previous-document - (kbd "C-k") 'nov-previous-document - (kbd "M-k") 'nov-previous-document - "[[" 'nov-previous-document - - "t" 'nov-goto-toc - "i" 'nov-goto-toc - (kbd "RET") 'nov-browse-url - (kbd "") 'mouse-face - (kbd "") 'nov-browse-url - (kbd "TAB") 'shr-next-link - (kbd "M-TAB") 'shr-previous-link - (kbd "") 'shr-previous-link - (kbd "SPC") 'nov-scroll-up - (kbd "S-SPC") 'nov-scroll-down - (kbd "DEL") 'nov-scroll-down)) - -(provide 'evil-collection-nov) -;;; evil-collection-nov.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/omnisharp/evil-collection-omnisharp.el b/.config/emacs/lisp/evil-collection/modes/omnisharp/evil-collection-omnisharp.el deleted file mode 100644 index e032782..0000000 --- a/.config/emacs/lisp/evil-collection/modes/omnisharp/evil-collection-omnisharp.el +++ /dev/null @@ -1,44 +0,0 @@ -;;; evil-collection-omnisharp.el --- Evil bindings for omnisharp -*- lexical-binding: t -*- - -;; Copyright (C) 2019 Omair Majid - -;; Author: Omair Majid -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, omnisharp, convenience - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for Omnisharp. - -;;; Code: -(require 'omnisharp nil t) -(require 'evil-collection) - -(defconst evil-collection-omnisharp-maps '(omnisharp-mode-map)) - -;;;###autoload -(defun evil-collection-omnisharp-setup () - "Set up `evil' bindings for `omnisharp'." - (evil-collection-define-key '(normal visual) 'omnisharp-mode-map - "gd" 'omnisharp-go-to-definition - "gR" 'omnisharp-reload-solution - "K" 'omnisharp-current-type-documentation)) - -(provide 'evil-collection-omnisharp) -;;; evil-collection-omnisharp.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/org-agenda/evil-collection-org-agenda.el b/.config/emacs/lisp/evil-collection/modes/org-agenda/evil-collection-org-agenda.el deleted file mode 100644 index 8d17f22..0000000 --- a/.config/emacs/lisp/evil-collection/modes/org-agenda/evil-collection-org-agenda.el +++ /dev/null @@ -1,147 +0,0 @@ -;;; evil-collection-org-agenda.el --- Evil bindings for org-agenda -*- lexical-binding: t -*- - -;; Copyright (C) 2026 Ashish Panigrahi - -;; Author: Ashish Panigrahi -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, org, org-agenda, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil basic bindings for `org-agenda-mode'. - -;;; Code: -(require 'evil-collection) -(require 'org-agenda nil t) - -(defconst evil-collection-org-agenda-maps '(org-agenda-mode-map)) - -(declare-function org-agenda-next-line "org-agenda") -(declare-function org-agenda-previous-line "org-agenda") -(declare-function org-agenda-next-item "org-agenda") -(declare-function org-agenda-previous-item "org-agenda") -(declare-function org-agenda-forward-block "org-agenda") -(declare-function org-agenda-backward-block "org-agenda") -(declare-function org-agenda-goto "org-agenda") -(declare-function org-agenda-switch-to "org-agenda") -(declare-function org-agenda-show "org-agenda") -(declare-function org-agenda-quit "org-agenda") -(declare-function org-agenda-exit "org-agenda") -(declare-function org-agenda-redo "org-agenda") -(declare-function org-agenda-redo-all "org-agenda") -(declare-function org-agenda-later "org-agenda") -(declare-function org-agenda-earlier "org-agenda") -(declare-function org-agenda-goto-today "org-agenda") -(declare-function org-agenda-goto-date "org-agenda") -(declare-function org-agenda-day-view "org-agenda") -(declare-function org-agenda-week-view "org-agenda") -(declare-function org-agenda-month-view "org-agenda") -(declare-function org-agenda-year-view "org-agenda") -(declare-function org-agenda-todo "org-agenda") -(declare-function org-agenda-schedule "org-agenda") -(declare-function org-agenda-deadline "org-agenda") -(declare-function org-agenda-set-tags "org-agenda") -(declare-function org-agenda-priority "org-agenda") -(declare-function org-agenda-refile "org-agenda") -(declare-function org-agenda-archive "org-agenda") -(declare-function org-agenda-kill "org-agenda") -(declare-function org-agenda-add-note "org-agenda") -(declare-function org-agenda-open-link "org-agenda") -(declare-function org-agenda-filter-by-tag "org-agenda") -(declare-function org-agenda-filter-remove-all "org-agenda") -(declare-function org-agenda-clock-in "org-agenda") -(declare-function org-agenda-clock-out "org-agenda") -(declare-function org-agenda-clock-cancel "org-agenda") -(declare-function org-agenda-clock-goto "org-agenda") -(declare-function org-agenda-bulk-mark "org-agenda") -(declare-function org-agenda-bulk-unmark "org-agenda") -(declare-function org-agenda-bulk-action "org-agenda") -(declare-function org-save-all-org-buffers "org") - -;;;###autoload -(defun evil-collection-org-agenda-setup () - "Set up `evil' bindings for `org-agenda'." - (evil-set-initial-state 'org-agenda-mode 'normal) - (evil-collection-set-readonly-bindings 'org-agenda-mode-map) - - (evil-collection-define-key 'normal 'org-agenda-mode-map - ;; Motion - "j" 'org-agenda-next-line - "k" 'org-agenda-previous-line - "gj" 'org-agenda-next-item - "gk" 'org-agenda-previous-item - (kbd "C-j") 'org-agenda-next-item - (kbd "C-k") 'org-agenda-previous-item - "]]" 'org-agenda-forward-block - "[[" 'org-agenda-backward-block - - ;; Open / visit - (kbd "RET") 'org-agenda-switch-to - [tab] 'org-agenda-goto - (kbd "TAB") 'org-agenda-goto - (kbd "SPC") 'org-agenda-show - "go" 'org-agenda-open-link - - ;; Quit / refresh - "q" 'org-agenda-quit - "ZZ" 'org-agenda-quit - "ZQ" 'org-agenda-exit - "x" 'org-agenda-exit - "gr" 'org-agenda-redo - "gR" 'org-agenda-redo-all - "S" 'org-save-all-org-buffers - - ;; Date navigation - "L" 'org-agenda-later - "H" 'org-agenda-earlier - "." 'org-agenda-goto-today - "J" 'org-agenda-goto-date - "vd" 'org-agenda-day-view - "vw" 'org-agenda-week-view - "vm" 'org-agenda-month-view - "vy" 'org-agenda-year-view - - ;; Entry actions - "t" 'org-agenda-todo - "s" 'org-agenda-schedule - "d" 'org-agenda-deadline - "T" 'org-agenda-set-tags - "p" 'org-agenda-priority - "r" 'org-agenda-refile - "A" 'org-agenda-archive - "D" 'org-agenda-kill - "n" 'org-agenda-add-note - - ;; Filtering - "f" 'org-agenda-filter-by-tag - "F" 'org-agenda-filter-remove-all - - ;; Clocking - "I" 'org-agenda-clock-in - "O" 'org-agenda-clock-out - "X" 'org-agenda-clock-cancel - "gJ" 'org-agenda-clock-goto - - ;; Bulk actions - "m" 'org-agenda-bulk-mark - "u" 'org-agenda-bulk-unmark - "B" 'org-agenda-bulk-action)) - -(provide 'evil-collection-org-agenda) -;;; evil-collection-org-agenda.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/org-present/evil-collection-org-present.el b/.config/emacs/lisp/evil-collection/modes/org-present/evil-collection-org-present.el deleted file mode 100644 index 745db01..0000000 --- a/.config/emacs/lisp/evil-collection/modes/org-present/evil-collection-org-present.el +++ /dev/null @@ -1,65 +0,0 @@ -;;; evil-collection-org-present.el --- Bindings for `org-present' -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Carla Cao - -;; Author: Carla Cao -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools, minimalist, presentation - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for`org-present'. - -;;; Code: -(require 'evil-collection) -(require 'org-present nil t) - -(defconst evil-collection-org-present-maps '(org-present-mode-keymap)) - -;;;###autoload -(defun evil-collection-org-present-setup () - "Set up `evil' bindings for `org-present'." - (evil-collection-define-key 'normal 'org-present-mode-keymap - "J" 'org-present-next - "K" 'org-present-prev - "gj" 'org-present-next - "gk" 'org-present-prev - "]]" 'org-present-next - "[[" 'org-present-prev - (kbd "SPC") 'org-present-next - (kbd "S-SPC") 'org-present-prev - (kbd "C-j") 'org-present-next - (kbd "M-j") 'org-present-next - (kbd "C-k") 'org-present-prev - (kbd "M-k") 'org-present-prev - "zi" 'org-present-big - "zo" 'org-present-small - "+" 'org-present-big - "=" 'org-present-big - "-" 'org-present-small - "q" 'org-present-quit - "ZQ" 'org-present-quit - "ZZ" 'org-present-quit - "r" 'org-present-read-only - "gw" 'org-present-read-write - "gg" 'org-present-beginning - "G" 'org-present-end)) - -(provide 'evil-collection-org-present) -;;; evil-collection-org-present.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/org-roam/evil-collection-org-roam.el b/.config/emacs/lisp/evil-collection/modes/org-roam/evil-collection-org-roam.el deleted file mode 100644 index 11acb38..0000000 --- a/.config/emacs/lisp/evil-collection/modes/org-roam/evil-collection-org-roam.el +++ /dev/null @@ -1,56 +0,0 @@ -;;; evil-collection-org-roam.el --- Bindings for `org-roam' -*- lexical-binding: t -*- - -;; Copyright (C) 2022 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.2 -;; Package-Requires: ((emacs "27.1")) -;; Keywords: evil, emacs, convenience, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for org-roam. - -;;; Code: -(require 'evil-collection) -(require 'org-roam nil t) - -(defvar org-roam-mode-map) -(defconst evil-collection-org-roam-maps '(org-roam-grep-map - org-roam-mode-map - org-roam-node-map - org-roam-preview-map)) - -(defun evil-collection-org-roam-setup () - "Set up `evil' bindings for org-roam." - (evil-collection-define-key 'normal 'org-roam-mode-map - [C-return] 'org-roam-buffer-visit-thing - (kbd "C-m") 'org-roam-buffer-visit-thing - [remap revert-buffer] 'org-roam-buffer-refresh - "gr" 'org-roam-buffer-refresh) - - (evil-collection-define-key 'normal 'org-roam-node-map - [remap org-roam-buffer-visit-thing] 'org-roam-node-visit) - - (evil-collection-define-key 'normal 'org-roam-preview-map - [remap org-roam-buffer-visit-thing] 'org-roam-preview-visit) - - (evil-collection-define-key 'normal 'org-roam-grep-map - [remap org-roam-buffer-visit-thing] 'org-roam-grep-visit)) - -(provide 'evil-collection-org-roam) -;;; evil-collection-org-roam.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/org/README.org b/.config/emacs/lisp/evil-collection/modes/org/README.org deleted file mode 100644 index 42f9b25..0000000 --- a/.config/emacs/lisp/evil-collection/modes/org/README.org +++ /dev/null @@ -1,46 +0,0 @@ -* org - - Basic Evil bindings for [[https://orgmode.org/][org-mode]]. Not intended to supersede - [[https://github.com/Somelauw/evil-org-mode][evil-org-mode]] — only a handful of - overrides that align Org with Evil motion idioms. - -** Key bindings - -*** org-mode-map (normal) - - | Command | Original | Evil | - |----------------+----------+-----------| - | =org-cycle= | =TAB= | == | - | =org-shifttab= | =S-TAB= | == | - -*** org-mode-map (motion) - - | Command | Original | Evil | - |--------------------------+----------+------| - | =org-backward-paragraph= | n/a | ={= | - | =org-forward-paragraph= | n/a | =}= | - | =org-backward-sentence= | n/a | =(= | - | =org-forward-sentence= | n/a | =)= | - -*** org-capture-mode-map (normal) - - | Command | Original | Evil | - |------------------------+-----------+------| - | =org-capture-finalize= | =C-c C-c= | =ZZ= | - | =org-capture-kill= | =C-c C-k= | =ZQ= | - | =org-capture-refile= | =C-c C-w= | =ZR= | - -*** org-read-date-minibuffer-local-map - - Calendar navigation in the date prompt: - - | Command | Key | - |-------------------------------+-------| - | =org-calendar-backward-day= | =M-h= | - | =org-calendar-forward-day= | =M-l= | - | =org-calendar-backward-week= | =M-k= | - | =org-calendar-forward-week= | =M-j= | - | =org-calendar-backward-month= | =M-H= | - | =org-calendar-forward-month= | =M-L= | - | =org-calendar-backward-year= | =M-K= | - | =org-calendar-forward-year= | =M-J= | diff --git a/.config/emacs/lisp/evil-collection/modes/org/evil-collection-org.el b/.config/emacs/lisp/evil-collection/modes/org/evil-collection-org.el deleted file mode 100644 index 5973bb2..0000000 --- a/.config/emacs/lisp/evil-collection/modes/org/evil-collection-org.el +++ /dev/null @@ -1,87 +0,0 @@ -;;; evil-collection-org.el --- Evil bindings for org -*- lexical-binding: t -*- - -;; Copyright (C) 2021 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, org, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil basic bindings for org-mode. It's NOT intended to supersede -;; `evil-org-mode'. -;; - -;;; Code: -(require 'evil-collection) -(require 'org nil t) - - -(defconst evil-collection-org-maps '(org-mode-map - org-capture-mode-map - org-read-date-minibuffer-local-map)) - -(declare-function org-shifttab "org") -(declare-function org-backward-paragraph "org") -(declare-function org-forward-paragraph "org") -(declare-function org-backward-sentence "org") -(declare-function org-forward-sentence "org") -(declare-function org-capture-finalize "org-capture") -(declare-function org-capture-kill "org-capture") -(declare-function org-capture-refile "org-capture") - -(declare-function org-calendar-forward-day "org") -(declare-function org-calendar-backward-day "org") -(declare-function org-calendar-forward-week "org") -(declare-function org-calendar-backward-week "org") -(declare-function org-calendar-forward-month "org") -(declare-function org-calendar-backward-month "org") -(declare-function org-calendar-forward-year "org") -(declare-function org-calendar-backward-year "org") -(declare-function org-defkey "org") - -;;;###autoload -(defun evil-collection-org-setup () - "Set up `evil' bindings for `org'." - (evil-collection-define-key 'normal 'org-mode-map - [tab] 'org-cycle - [S-tab] 'org-shifttab) - - (evil-collection-define-key 'motion 'org-mode-map - "{" 'org-backward-paragraph - "}" 'org-forward-paragraph - "(" 'org-backward-sentence - ")" 'org-forward-sentence) - - (evil-collection-define-key 'normal 'org-capture-mode-map - "ZZ" 'org-capture-finalize - "ZQ" 'org-capture-kill - "ZR" 'org-capture-refile) - - (org-defkey org-read-date-minibuffer-local-map (kbd "M-l") #'org-calendar-forward-day) - (org-defkey org-read-date-minibuffer-local-map (kbd "M-h") #'org-calendar-backward-day) - (org-defkey org-read-date-minibuffer-local-map (kbd "M-j") #'org-calendar-forward-week) - (org-defkey org-read-date-minibuffer-local-map (kbd "M-k") #'org-calendar-backward-week) - (org-defkey org-read-date-minibuffer-local-map (kbd "M-L") #'org-calendar-forward-month) - (org-defkey org-read-date-minibuffer-local-map (kbd "M-H") #'org-calendar-backward-month) - (org-defkey org-read-date-minibuffer-local-map (kbd "M-J") #'org-calendar-forward-year) - (org-defkey org-read-date-minibuffer-local-map (kbd "M-K") #'org-calendar-backward-year)) - -(provide 'evil-collection-org) -;;; evil-collection-org.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/osx-dictionary/evil-collection-osx-dictionary.el b/.config/emacs/lisp/evil-collection/modes/osx-dictionary/evil-collection-osx-dictionary.el deleted file mode 100644 index 8c18ef2..0000000 --- a/.config/emacs/lisp/evil-collection/modes/osx-dictionary/evil-collection-osx-dictionary.el +++ /dev/null @@ -1,47 +0,0 @@ -;;; evil-collection-osx-dictionary.el --- Evil bindings for osx-dictionary -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, osx-dictionary, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for osx-dictionary. - -;;; Code: -(require 'evil-collection) -(require 'osx-dictionary nil t) - -(defconst evil-collection-osx-dictionary-maps '(osx-dictionary-mode-map)) - -;;;###autoload -(defun evil-collection-osx-dictionary-setup () - "Set up `evil' bindings for `osx-dictionary'." - (evil-set-initial-state 'osx-dictionary-mode 'normal) - - (evil-collection-define-key 'normal 'osx-dictionary-mode-map - "q" 'osx-dictionary-quit - "s" 'osx-dictionary-search-input - "o" 'osx-dictionary-open-dictionary.app - "r" 'osx-dictionary-read-word)) - -(provide 'evil-collection-osx-dictionary) -;;; evil-collection-osx-dictionary.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/outline/README.org b/.config/emacs/lisp/evil-collection/modes/outline/README.org deleted file mode 100644 index e79174b..0000000 --- a/.config/emacs/lisp/evil-collection/modes/outline/README.org +++ /dev/null @@ -1,39 +0,0 @@ -* outline - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Outline-Mode.html][outline-mode]]. - - Folding sticks to Evil's =z= namespace, augmenting the defaults =zO=, =za=, - =zc=, =zm=, =zo=, =zr= with outline-specific commands. - -** Key bindings - - Bindings applied to =outline-mode-map= in normal state. - - | Command | Original | Evil | - |------------------------------------+-----------+--------------------| - | =outline-hide-body= | =C-c C-t= | =zB= | - | =outline-hide-entry= | =C-c C-c= | =zE= | - | =outline-show-entry= | =C-c C-e= | =ze= | - | =outline-hide-leaves= | =C-c C-l= | =zl= | - | =outline-show-branches= | =C-c C-k= | =zK= | - | =outline-show-children= | =C-c TAB= | =zk= | - | =outline-hide-other= | =C-c C-o= | =zp= | - | =outline-up-heading= | =C-c C-u= | =zu= | - | =outline-previous-visible-heading= | =C-c C-p= | =[[= | - | =outline-next-visible-heading= | =C-c C-n= | =]]= | - | =outline-backward-same-level= | =C-c C-b= | =C-k=, =gk= | - | =outline-forward-same-level= | =C-c C-f= | =C-j=, =gj= | - | =outline-promote= | =C-c C-<= | =M-h= | - | =outline-demote= | =C-c C->= | =M-l= | - | =outline-move-subtree-up= | =C-c C-^= | =M-k= | - | =outline-move-subtree-down= | =C-c C-v= | =M-j= | - | =outline-insert-heading= | =C-c RET= | =M-= | - | =outline-show-all= | =C-c C-a= | == (opt.) | - | =outline-toggle-children= | =C-c TAB= | == (opt.) | - -** Customization - - | Variable | Default | Purpose | - |--------------------------------------------------+---------+--------------------------------------------------------------------------------------------| - | =evil-collection-outline-bind-tab-p= | =nil= | Bind == / == to outline cycling (off by default to avoid clashing with Org). | - | =evil-collection-outline-enable-in-minor-mode-p= | =t= | Inherit the same bindings in =outline-minor-mode= via auxiliary keymap parenting. | diff --git a/.config/emacs/lisp/evil-collection/modes/outline/evil-collection-outline.el b/.config/emacs/lisp/evil-collection/modes/outline/evil-collection-outline.el deleted file mode 100644 index 856387e..0000000 --- a/.config/emacs/lisp/evil-collection/modes/outline/evil-collection-outline.el +++ /dev/null @@ -1,116 +0,0 @@ -;;; evil-collection-outline.el --- Evil bindings for outline-mode -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, outline, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for outline-mode. - -;;; Code: -(require 'evil-collection) -(require 'outline) - -(defcustom evil-collection-outline-bind-tab-p nil - "Enable -based bindings in Outline mode. - -Unless you have Evil bindings set up for Org mode, Org will -preserve the Emacs-state keys in Org mode. Set this option -to t if you want to inherit the -based bindings from Outline -mode." - :group 'evil-collection-outline - :type 'boolean) - -(defcustom evil-collection-outline-enable-in-minor-mode-p t - "Enable Outline mode bindings in Outline minor mode. - -To override individual bindings, modify the minor mode keymap. -For example, \"zB\" is bound to `outline-hide-body' in Outline -mode. To turn off this specific binding in Outline minor mode, -you can do: - - (evil-define-minor-mode-key \='normal \='outline-minor-mode \"zB\" nil)" - :group 'evil-collection-outline - :type 'boolean) - -(defconst evil-collection-outline-maps '(outline-mode-map)) - -;;;###autoload -(defun evil-collection-outline-setup () - "Set up `evil' bindings for `outline'." - (evil-set-initial-state 'outline-mode 'normal) - (when evil-collection-outline-bind-tab-p - (evil-collection-define-key 'normal 'outline-mode-map - (kbd "") 'outline-show-all ; Also "z r" by default - (kbd "") 'outline-toggle-children)) ; Also "z a" by default - (evil-collection-define-key 'normal 'outline-mode-map - ;; folding - ;; Evil default keys: - ;; zO: Show recursively for current branch only. - ;; za: Toggle first level like outline-toggle-children. - ;; zc: Hide complete subtree. - ;; zm: Show only root notes. - ;; zo: Show current node like "za". - ;; zr: Show everything. - ;; "ze" 'outline-hide-entry - ;; "zE" 'outline-show-entry - ;; "zl" 'outline-hide-leaves - ;; "zb" 'outline-show-branches - ;; "zo" 'outline-hide-other - "zB" 'outline-hide-body ; Hide all bodies, Emacs has "C-c C-t". - "zE" 'outline-hide-entry ; Hide current body, Emacs has "C-c C-c". - "ze" 'outline-show-entry ; Show current body only, not subtree, reverse of outline-hide-entry, Emacs has "C-c C-e". - "zl" 'outline-hide-leaves ; Like `outline-hide-body' but for current subtree only, Emacs has "C-c C-l". - "zK" 'outline-show-branches ; Show all children recursively but no body. Emacs has "C-c C-k". - "zk" 'outline-show-children ; Direct children only unlike `outline-show-branches', and no content unlike `outline-show-entry' and `outline-toggle-children'. Emacs has "C-c TAB". - "zu" 'outline-up-heading - - "zp" 'outline-hide-other ; Hide all nodes and bodies except current body. Emacs has "C-c C-o". - ;; outline-hide-sublevels ; q ; Is it any different from `outline-hide-body'? - ;; outline-hide-subtree ; Emacs has "C-c C-d", Evil has default "zc". - ;; outline-show-subtree ; Emacs has "C-c C-s", Evil has default "zO". - - ;; TODO: To mark subtree ("C-c @"), we would need to define a tree object. - - ;; motion - "[[" 'outline-previous-visible-heading - "]]" 'outline-next-visible-heading - (kbd "C-k") 'outline-backward-same-level - (kbd "C-j") 'outline-forward-same-level - "gk" 'outline-backward-same-level - "gj" 'outline-forward-same-level - - (kbd "M-h") 'outline-promote ; Org-mode has "M-", Evil-org has "M-h" - (kbd "M-j") 'outline-move-subtree-down ; Org-mode has "M-", Evil-org has "M-j" - (kbd "M-k") 'outline-move-subtree-up ; Org-mode has "M-", Evil-org has "M-k" - (kbd "M-l") 'outline-demote ; Org-mode has "M-", Evil-org has "M-l" - - (kbd "M-") 'outline-insert-heading) ; Org-mode has "M-" - - ;; Enable bindings in Outline minor mode if requested - (when evil-collection-outline-enable-in-minor-mode-p - (let* ((minor-map (evil-get-minor-mode-keymap 'normal 'outline-minor-mode)) - (major-map (evil-get-auxiliary-keymap outline-mode-map 'normal))) - (set-keymap-parent minor-map major-map)))) - -(provide 'evil-collection-outline) -;;; evil-collection-outline.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/ovpn-mode/evil-collection-ovpn-mode.el b/.config/emacs/lisp/evil-collection/modes/ovpn-mode/evil-collection-ovpn-mode.el deleted file mode 100644 index ca6ec04..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ovpn-mode/evil-collection-ovpn-mode.el +++ /dev/null @@ -1,56 +0,0 @@ -;;; evil-collection-ovpn-mode.el --- Bindings for `ovpn-mode' -*- lexical-binding: t -*- - -;; Copyright (C) 2025 Vitor Leal - -;; Author: Vitor Leal -;; Maintainer: Vitor Leal -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, convenience, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for ovpn-mode. - -;;; Code: -(require 'evil-collection) -(require 'ovpn-mode nil t) - -(defvar ovpn-mode-map) -(defconst evil-collection-ovpn-mode-maps '(ovpn-mode-map)) - -;;;###autoload -(defun evil-collection-ovpn-mode-setup () - "Set up `evil' bindings for `ovpn-mode'." - (evil-collection-define-key 'normal 'ovpn-mode-map - "s" 'ovpn-mode-start-vpn - "n" 'ovpn-mode-start-vpn-with-namespace - "q" 'ovpn-mode-stop-vpn - "r" 'ovpn-mode-restart-vpn - "i" 'ovpn-mode-info-vpn - "$" 'ovpn-mode-buffer-vpn - "o" 'ovpn-mode-edit-vpn - "~" 'ovpn-mode-dir-filter - "d" 'ovpn-mode-dir-set - "a" 'ovpn-mode-active - "J" 'ovpn-mode-ipv6-linux-toggle - "T" 'ovpn-mode-spawn-term-in-namespace - "B" 'ovpn-mode-spawn-browser-in-namespace - "ZZ" 'quit-window - "ZQ" 'evil-quit)) - -(provide 'evil-collection-ovpn-mode) -;;; evil-collection-ovpn-mode.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/p-search/evil-collection-p-search.el b/.config/emacs/lisp/evil-collection/modes/p-search/evil-collection-p-search.el deleted file mode 100644 index 346a5ed..0000000 --- a/.config/emacs/lisp/evil-collection/modes/p-search/evil-collection-p-search.el +++ /dev/null @@ -1,85 +0,0 @@ -;;; evil-collection-p-search.el --- Bindings for `p-search' -*- lexical-binding: t -*- - -;; Copyright (C) 2024 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.2 -;; Package-Requires: ((emacs "29.1")) -;; Keywords: evil, emacs, convenience, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for p-search. - -;;; Code: -(require 'evil-collection) -(require 'p-search nil t) - -(defvar p-search-mode-map) -(defconst evil-collection-p-search-maps '(p-search-mode-map)) - -(defvar evil-collection-p-search-mode-map (make-sparse-keymap)) - -;; The normal `p-search-mode-map' calls (suppress-keymap map t) -;; which makes some of the evil bindings get to to 'ignore too -;; for some reason. Use a separate minor mode to avoid all of that. -(define-minor-mode evil-collection-p-search-mode - "A minor mode to attach to `p-search' results" - :group 'evil-collection-p-search-mode - :keymap evil-collection-p-search-mode-map - :lighter nil) - -(defun evil-collection-p-search-setup () - "Set up `evil' bindings for p-search." - (add-hook 'p-search-mode-hook 'evil-collection-p-search-mode) - - (evil-collection-define-key 'normal 'evil-collection-p-search-mode-map - "a" 'p-search-add-dwim - "E" 'p-search-edit-dwim - "C" 'p-search-add-candidate-generator - "gr" 'p-search-refresh-buffer - "gR" 'p-search-hard-refresh-buffer - ;; (keymap-set map "i" #'p-search-importance) - "x" 'p-search-kill-entity-at-point - "gj" 'p-search-next-item - (kbd "C-j") 'p-search-next-item - "]]" 'p-search-next-item - "o" 'p-search-observe - "gk" 'p-search-prev-item - (kbd "C-k") 'p-search-prev-item - "[[" 'p-search-prev-item - ;; (keymap-set map "r" #'p-search-reinstantiate-prior) - "P" 'p-search-add-prior - "+" 'p-search-increase-preview-size - "-" 'p-search-decrease-preview-size - (kbd "") 'p-search-toggle-section - (kbd "") 'p-search-find-document - "gv" 'p-search-view-document - "go" 'p-search-view-document - (kbd "C-o") 'p-search-display-document - "gO" 'p-search-display-document - "q" 'p-search-quit - ;; (keymap-set map "C-o" #'p-search-display-file) - ;; (keymap-set map "1" #'p-search-show-level-1) - ;; (keymap-set map "2" #'p-search-show-level-2) - ;; (keymap-set map "3" #'p-search-show-level-3) - "Jg" 'p-search-jump-candidate-generators - "Jp" 'p-search-jump-priors - "Jr" 'p-search-jump-results)) - -(provide 'evil-collection-p-search) -;;; evil-collection-p-search.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/p4/evil-collection-p4.el b/.config/emacs/lisp/evil-collection/modes/p4/evil-collection-p4.el deleted file mode 100644 index 69d7892..0000000 --- a/.config/emacs/lisp/evil-collection/modes/p4/evil-collection-p4.el +++ /dev/null @@ -1,123 +0,0 @@ -;;; evil-collection-p4.el --- Evil bindings for P4 -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, p4, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for P4. - -;;; Code: -(require 'p4 nil t) -(require 'evil-collection) - -(defvar p4-basic-mode-map) -(defvar p4-basic-list-mode-map) -(defvar p4-opened-list-mode-map) -(defvar p4-status-list-mode-map) -(defvar p4-filelog-mode-map) -(defvar p4-diff-mode-map) -(defvar p4-annotate-mode-map) - -(defconst evil-collection-p4-maps '(p4-basic-mode-map - p4-basic-list-mode-map - p4-opened-list-mode-map - p4-status-list-mode-map - p4-filelog-mode-map - p4-diff-mode-map - p4-annotate-mode-map)) - -;;;###autoload -(defun evil-collection-p4-setup () - "Set up `evil' bindings for `p4'." - (evil-set-initial-state 'p4-basic-mode 'normal) - (evil-set-initial-state 'p4-basic-list-mode 'normal) - (evil-set-initial-state 'p4-opened-list-mode-map 'normal) - (evil-set-initial-state 'p4-status-list-mode-map 'normal) - (evil-set-initial-state 'p4-filelog-mode-map 'normal) - (evil-set-initial-state 'p4-diff-mode-map 'normal) - (evil-set-initial-state 'p4-annotate-mode-map 'normal) - - (evil-collection-define-key 'normal 'p4-basic-mode-map - [mouse-1] 'p4-buffer-mouse-clicked - "k" 'evil-previous-line - "j" 'evil-next-line - (kbd "C-j") 'p4-forward-active-link - (kbd "C-k") 'p4-backward-active-link - (kbd "RET") 'p4-buffer-commands - "q" 'quit-window - "gr" 'revert-buffer - "]]" 'p4-scroll-down-1-window - "[[" 'p4-scroll-up-1-window - "gg" 'p4-top-of-buffer - "G" 'p4-bottom-of-buffer - "=" 'delete-other-windows) - - (evil-collection-define-key 'normal 'p4-basic-list-mode-map - (kbd "RET") 'p4-basic-list-activate) - - (evil-collection-define-key 'normal 'p4-opened-list-mode-map - "R" 'p4-revert - "T" 'p4-opened-list-type - "C" 'p4-opened-list-change) - - (evil-collection-define-key 'normal 'p4-status-list-mode-map - (kbd "RET") 'p4-status-list-activate) - - (evil-collection-define-key 'normal 'p4-filelog-mode-map - "d" 'p4-diff2 - "gf" 'p4-find-file-other-window - "S" 'p4-filelog-short-format - "L" 'p4-filelog-long-format - " " 'p4-scroll-up-1-window - "gg" 'p4-top-of-buffer - "G" 'p4-bottom-of-buffer - "=" 'p4-delete-other-windows - "]]" 'p4-goto-next-change - "[[" 'p4-goto-prev-change - (kbd "C-j") 'p4-goto-next-change - (kbd "C-k") 'p4-goto-prev-change) - - (evil-collection-define-key 'normal 'p4-diff-mode-map - "]]" 'diff-hunk-next - (kbd "C-j") 'diff-hunk-next - (kbd "M-j") 'diff-file-next - "[[" 'diff-hunk-prev - (kbd "C-k") 'diff-hunk-prev - (kbd "M-k") 'diff-file-prev - "\t" 'diff-hunk-next - [backtab] 'diff-hunk-prev - "}" 'diff-file-next - "{" 'diff-file-prev - "\C-m" 'p4-buffer-commands - [mouse-2] 'p4-buffer-commands - "gb" 'p4-buffer-commands) - - (evil-collection-define-key 'normal 'p4-annotate-mode-map - "]]" 'p4-next-change-rev-line - "[[" 'p4-prev-change-rev-line - (kbd "C-j") 'p4-next-change-rev-line - (kbd "C-k") 'p4-prev-change-rev-line - "L" 'p4-toggle-line-wrap)) - -(provide 'evil-collection-p4) -;;; evil-collection-p4.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/package-menu/README.org b/.config/emacs/lisp/evil-collection/modes/package-menu/README.org deleted file mode 100644 index c001fc5..0000000 --- a/.config/emacs/lisp/evil-collection/modes/package-menu/README.org +++ /dev/null @@ -1,22 +0,0 @@ -* package-menu - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Package-Menu.html][package-menu-mode]]. - - Standard read-only motion bindings are installed via - =evil-collection-set-readonly-bindings=. - -** Key bindings - - | Command | Original | Evil | - |----------------------------------+----------+------| - | =package-menu-mark-install= | =i= | =i= | - | =package-menu-mark-upgrades= | =U= | =U= | - | =package-menu-mark-delete= | =d= | =d= | - | =package-menu-mark-unmark= | =u= | =u= | - | =package-menu-execute= | =x= | =x= | - | =package-menu-describe-package= | =RET= | =g?= | - | =revert-buffer= | =g=, =r= | =gr= | - | =package-browse-url= (Emacs 28+) | =w= | =B= | - - The =/=-prefixed filter commands, =H= (hide), =(= (toggle-hiding), =~=, =b= - (report-bug), =S= (sort), and other defaults remain at their upstream keys. diff --git a/.config/emacs/lisp/evil-collection/modes/package-menu/evil-collection-package-menu.el b/.config/emacs/lisp/evil-collection/modes/package-menu/evil-collection-package-menu.el deleted file mode 100644 index 40a8f38..0000000 --- a/.config/emacs/lisp/evil-collection/modes/package-menu/evil-collection-package-menu.el +++ /dev/null @@ -1,60 +0,0 @@ -;;; evil-collection-package-menu.el --- Evil bindings for package-menu -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, package-menu, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil integration for `package-menu-mode'. - -;;; Code: -(require 'evil-collection) -(require 'package) - -(defconst evil-collection-package-menu-maps '(package-menu-mode-map)) - -;;;###autoload -(defun evil-collection-package-menu-setup () - "Set up `evil' bindings for `package-menu'." - (evil-set-initial-state 'package-menu-mode 'normal) - (evil-collection-set-readonly-bindings 'package-menu-mode-map) - (evil-collection-define-key 'normal 'package-menu-mode-map - "i" 'package-menu-mark-install - "U" 'package-menu-mark-upgrades - "d" 'package-menu-mark-delete - "gr" 'revert-buffer - - ;; undo - "u" 'package-menu-mark-unmark - - ;; execute - "x" 'package-menu-execute - - "g?" 'package-menu-describe-package) - - ;; It's introduced since Emacs 28. - (when (fboundp 'package-browse-url) - (evil-collection-define-key 'normal 'package-menu-mode-map - "B" 'package-browse-url))) - -(provide 'evil-collection-package-menu) -;;; evil-collection-package-menu.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/pass/evil-collection-pass.el b/.config/emacs/lisp/evil-collection/modes/pass/evil-collection-pass.el deleted file mode 100644 index 02457d3..0000000 --- a/.config/emacs/lisp/evil-collection/modes/pass/evil-collection-pass.el +++ /dev/null @@ -1,102 +0,0 @@ -;;; evil-collection-pass.el --- Evil bindings for pass-mode -*- lexical-binding: t -*- - -;; Copyright (C) 2021 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, pass, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `pass-mode'. - -;;; Code: -(require 'evil-collection) -(require 'pass nil t) - -(defvar pass-mode-map) - -(declare-function pass--display-keybinding "pass") - -(defconst evil-collection-pass-maps '(pass-mode-map)) - -(defvar evil-collection-pass-command-to-label - '((pass-copy-field . "yf") - (pass-copy-username . "yn") - (pass-copy-url . "yu")) - "Alist holding labels to be used in `pass' header.") - -(defun evil-collection-pass-display-keybinding (f &rest args) - "A version of `pass--display-keybinding' that handles displaying -keybindings listed in `evil-collection-pass-command-to-label'." - (if (alist-get (car args) evil-collection-pass-command-to-label) - (insert - (format - "%8s %-13s \t " - (format "%s" - (propertize - (format - "<%s>" - (alist-get (car args) - evil-collection-pass-command-to-label)) - 'face 'font-lock-constant-face)) - (cadr args))) - (apply f args))) - -;;;###autoload -(defun evil-collection-pass-setup () - "Set up `evil' bindings for `pass-mode'." - - (advice-add 'pass--display-keybinding - :around 'evil-collection-pass-display-keybinding) - - (evil-collection-define-operator-key 'yank 'pass-mode-map - "f" 'pass-copy-field - "n" 'pass-copy-username - "u" 'pass-copy-url) - - ;; https://github.com/NicolasPetton/pass/pull/47 - (when (fboundp 'pass-edit) - (evil-collection-define-key 'normal 'pass-mode-map - "E" 'pass-edit)) - - (evil-collection-define-key 'normal 'pass-mode-map - "gj" 'pass-next-entry - "gk" 'pass-prev-entry - (kbd "C-j") 'pass-next-entry - (kbd "C-k") 'pass-prev-entry - (kbd "]]") 'pass-next-directory - (kbd "[[") 'pass-prev-directory - "d" 'pass-kill - "x" 'pass-kill - "s" 'isearch-forward - "J" 'pass-goto-entry - "g?" 'describe-mode - "gr" 'pass-update-buffer - "i" 'pass-insert - "I" 'pass-insert-generated - "Y" 'pass-copy - "r" 'pass-rename - "R" 'pass-rename - "o" 'pass-otp-options - (kbd "RET") 'pass-view - "q" 'pass-quit)) - -(provide 'evil-collection-pass) -;;; evil-collection-pass.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/pdf/evil-collection-pdf.el b/.config/emacs/lisp/evil-collection/modes/pdf/evil-collection-pdf.el deleted file mode 100644 index 8555e43..0000000 --- a/.config/emacs/lisp/evil-collection/modes/pdf/evil-collection-pdf.el +++ /dev/null @@ -1,320 +0,0 @@ -;;; evil-collection-pdf.el --- Evil bindings for pdf-tools -*- lexical-binding: t -*- - -;; Copyright (C) 2017, 2024 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, pdf, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for pdf-tools. - -;;; Code: -(require 'evil-collection) -(require 'pdf-tools nil t) -(require 'pdf-view nil t) -(require 'pdf-history nil t) - -(defconst evil-collection-pdf-maps '(pdf-view-mode-map - pdf-history-minor-mode-map - pdf-outline-buffer-mode-map - pdf-occur-buffer-mode-map)) - -(declare-function pdf-view-last-page "pdf-view") -(declare-function pdf-view-first-page "pdf-view") -(declare-function pdf-view-goto-page "pdf-view") -(declare-function pdf-view-previous-line-or-previous-page "pdf-view") -(declare-function pdf-view-next-line-or-next-page "pdf-view") -(declare-function pdf-view-assert-active-region "pdf-view") -(declare-function pdf-view-active-region-text "pdf-view") -(declare-function pdf-view-deactivate-region "pdf-view") -(declare-function pdf-history-forward "pdf-history") -(declare-function pdf-history-backward "pdf-history") - -(defvar pdf-view-mode-map) -(defvar pdf-history-minor-mode-map) -(defvar pdf-outline-buffer-mode-map) -(defvar pdf-occur-buffer-mode-map) - -(defun evil-collection-pdf-view-goto-page (&optional page) - "`evil' wrapper around `pdf-view-last-page'." - (interactive "P") - (if page - (pdf-view-goto-page page) - (let ((hscroll (window-hscroll))) - (pdf-view-last-page) - (image-eob) - (image-set-window-hscroll hscroll)))) - -(defun evil-collection-pdf-view-goto-first-page (&optional page) - "`evil' wrapper around `pdf-view-first-page'." - (interactive "P") - (if page - (pdf-view-goto-page page) - (let ((hscroll (window-hscroll))) - (pdf-view-first-page) - (image-bob) - (image-set-window-hscroll hscroll)))) - -(defun evil-collection-pdf-jump-forward (&optional count) - "Wrap `pdf-history-forward' with `evil'. - -Consider COUNT." - (interactive "P") - (pdf-history-forward (or count 1))) - -(defun evil-collection-pdf-jump-backward (&optional count) - "Wrap `pdf-history-backward' with `evil'. - -Consider COUNT." - (interactive "P") - (pdf-history-backward (or count 1))) - -(defun evil-collection-pdf-yank () - "Save the text of the active region into the currently selected register." - (interactive) - (pdf-view-assert-active-region) - (let ((txt (pdf-view-active-region-text)) - (reg evil-this-register)) - (pdf-view-deactivate-region) - (evil-set-register - (or reg ?\") - (mapconcat #'identity txt nil)))) - -(defun evil-collection-pdf-disable-visual-mode () - "Don't enter visual-mode when the mark is activated. -Rationale: pdf-view allows using the region to select text within the pdf, -but evil-mode does not know how to do this. It selects entire pdf images -instead, which is useless and counterintuitive." - (add-hook 'evil-local-mode-hook - (lambda () (remove-hook - 'activate-mark-hook - 'evil-visual-activate-hook - t)) - nil t)) - -;;;###autoload -(defun evil-collection-pdf-setup () - "Set up `evil' bindings for `pdf-view'." - (evil-collection-inhibit-insert-state 'pdf-view-mode-map) - (evil-set-initial-state 'pdf-view-mode 'normal) - (evil-collection-define-key 'normal 'pdf-view-mode-map - ;; motion - (kbd "RET") 'image-next-line - "j" 'pdf-view-next-line-or-next-page - "k" 'pdf-view-previous-line-or-previous-page - (kbd "SPC") 'pdf-view-scroll-up-or-next-page - (kbd "S-SPC") 'pdf-view-scroll-down-or-previous-page - (kbd "") 'pdf-view-scroll-down-or-previous-page - (kbd "C-f") 'pdf-view-scroll-up-or-next-page - (kbd "C-b") 'pdf-view-scroll-down-or-previous-page - "]]" 'pdf-view-next-page-command - "[[" 'pdf-view-previous-page-command - (kbd "C-j") 'pdf-view-next-page-command - (kbd "C-k") 'pdf-view-previous-page-command - "gj" 'pdf-view-next-page-command - "gk" 'pdf-view-previous-page-command - (kbd "") 'forward-page - (kbd "") 'backward-page - (kbd "") 'pdf-view-next-line-or-next-page - (kbd "") 'pdf-view-previous-line-or-previous-page - "gg" 'evil-collection-pdf-view-goto-first-page - "G" 'evil-collection-pdf-view-goto-page - - ;; mark - "'" 'pdf-view-jump-to-register - "m" 'pdf-view-position-to-register - - ;; zoom - "+" 'pdf-view-enlarge - "zi" 'pdf-view-enlarge - "=" 'pdf-view-enlarge - "-" 'pdf-view-shrink - "zo" 'pdf-view-shrink - "0" 'pdf-view-scale-reset - "z0" 'pdf-view-scale-reset - - "f" 'pdf-links-isearch-link - "F" 'pdf-links-action-perform - "h" 'image-backward-hscroll - "^" 'image-bol - "$" 'image-eol - "l" 'image-forward-hscroll - - "H" 'pdf-view-fit-height-to-window ; evil-image has "H" - "P" 'pdf-view-fit-page-to-window - "W" 'pdf-view-fit-width-to-window ; evil-image has "W" - - ;; refresh - "gr" 'revert-buffer - - (kbd "") 'pdf-view-mouse-extend-region - (kbd "") 'pdf-view-mouse-set-region-rectangle - (kbd "") 'pdf-view-mouse-set-region - - (kbd "C-c C-c") 'doc-view-mode - (kbd "C-c ") 'pdf-view-extract-region-image - - "sb" 'pdf-view-set-slice-from-bounding-box - "sm" 'pdf-view-set-slice-using-mouse - "sr" 'pdf-view-reset-slice - - ;; goto - "gl" 'pdf-view-goto-label - - ;; search - (kbd "M-s o") 'pdf-occur ; TODO: More Evil bindings? - - "/" 'isearch-forward - "?" 'isearch-backward - "n" 'isearch-repeat-forward - "N" 'isearch-repeat-backward - - "zd" 'pdf-view-dark-minor-mode - "zm" 'pdf-view-midnight-minor-mode - "zp" 'pdf-view-printer-minor-mode - - "o" 'pdf-outline - - ;; quit - "q" 'quit-window - "Q" 'kill-current-buffer - "ZQ" 'kill-current-buffer - "ZZ" 'quit-window) - - - (when evil-want-C-d-scroll - (evil-collection-define-key 'normal 'pdf-view-mode-map - (kbd "C-d") 'pdf-view-scroll-up-or-next-page)) - (when evil-want-C-u-scroll - (evil-collection-define-key 'normal 'pdf-view-mode-map - (kbd "C-u") 'pdf-view-scroll-down-or-previous-page)) - - (add-hook 'pdf-view-mode-hook #'evil-collection-pdf-disable-visual-mode) - - (evil-collection-define-key 'normal 'pdf-view-mode-map - "y" 'evil-collection-pdf-yank) - - (evil-collection-inhibit-insert-state 'pdf-history-minor-mode-map) - (evil-set-initial-state 'pdf-history-minor-mode 'normal) - (evil-collection-define-key 'normal 'pdf-history-minor-mode-map - ;; history forward / backward - (kbd "C-i") 'evil-collection-pdf-jump-forward - (kbd "C-o") 'evil-collection-pdf-jump-backward) - - (evil-collection-inhibit-insert-state 'pdf-outline-buffer-mode-map) - (evil-set-initial-state 'pdf-outline-buffer-mode 'normal) - (evil-collection-define-key 'normal 'pdf-outline-buffer-mode-map - ;; open - (kbd "RET") 'pdf-outline-follow-link-and-quit - (kbd "S-") 'pdf-outline-follow-link - (kbd "M-") 'pdf-outline-display-link - "go" 'pdf-outline-follow-link - "." 'pdf-outline-move-to-current-page - (kbd "SPC") 'pdf-outline-select-pdf-window - - "G" 'pdf-outline-end-of-buffer - "^" 'pdf-outline-up-heading - "<" 'pdf-outline-up-heading ; TODO: Don't set this by default? - - "zf" 'pdf-outline-follow-mode ; Helm has "C-c C-f" in Emacs state. - - (kbd "") 'outline-toggle-children - (kbd "") 'pdf-outline-toggle-subtree - - ;; quit - (kbd "C-w q") 'pdf-outline-quit-and-kill ; TODO: Do we need to set this? I think not. - "q" 'quit-window - "ZQ" 'quit-window - "ZZ" 'pdf-outline-quit-and-kill) - - (evil-collection-inhibit-insert-state 'pdf-occur-buffer-mode-map) - (evil-set-initial-state 'pdf-occur-buffer-mode 'normal) - (evil-collection-define-key 'normal 'pdf-occur-buffer-mode-map - ;; open - (kbd "RET") 'pdf-occur-goto-occurrence - (kbd "S-") 'pdf-occur-view-occurrence - (kbd "SPC") 'pdf-occur-view-occurrence - "gd" 'pdf-occur-goto-occurrence - "gD" 'pdf-occur-view-occurrence - - "A" 'pdf-occur-tablist-gather-documents - "D" 'pdf-occur-tablist-do-delete - - ;; sort - "o" 'tabulated-list-sort - "O" 'tablist-sort ; TODO: Do we need this? - - ;; refresh - "G" 'tablist-revert - - "K" 'pdf-occur-abort-search - - ;; mark - "*m" 'tablist-mark-forward - "m" 'tablist-mark-forward - "~" 'tablist-toggle-marks - "u" 'tablist-unmark-forward - "U" 'tablist-unmark-all-marks - "*!" 'tablist-unmark-all-marks - "*c" 'tablist-change-marks - "*n" 'tablist-mark-items-numeric - "*r" 'tablist-mark-items-regexp - "%" 'tablist-mark-items-regexp - - "a" 'tablist-flag-forward - - ;; "f" 'tablist-find-entry ; TODO: Equivalent to 'pdf-occur-goto-occurrence? - "r" 'pdf-occur-revert-buffer-with-args - "d" 'tablist-do-kill-lines - "x" 'pdf-occur-tablist-do-flagged-delete - (kbd "") 'tablist-unmark-backward - (kbd "S-SPC") 'scroll-down-command - (kbd "") 'tablist-backward-column - (kbd "C-c C-e") 'tablist-export-csv - - [remap evil-first-non-blank] 'tablist-move-to-major-column - [remap evil-next-line] 'tablist-next-line - [remap evil-previous-line] 'tablist-previous-line - - ;; filter - ;; TODO: See if overriding "/" is a good idea. - "/!" 'tablist-negate-filter - "//" 'tablist-display-filter - "/=" 'tablist-push-equal-filter - "/C" 'tablist-clear-filter - "/D" 'tablist-delete-named-filter - "/a" 'tablist-push-named-filter - "/d" 'tablist-deconstruct-named-filter - "/e" 'tablist-edit-filter - "/n" 'tablist-push-numeric-filter - "/p" 'tablist-pop-filter - "/r" 'tablist-push-regexp-filter - "/s" 'tablist-name-current-filter - "/t" 'tablist-toggle-first-filter-logic - "/z" 'tablist-suspend-filter - - ;; quit - "q" 'tablist-quit - "ZQ" 'tablist-quit - "ZZ" 'tablist-quit)) - -(provide 'evil-collection-pdf) -;;; evil-collection-pdf.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/popup/README.org b/.config/emacs/lisp/evil-collection/modes/popup/README.org deleted file mode 100644 index 4409b19..0000000 --- a/.config/emacs/lisp/evil-collection/modes/popup/README.org +++ /dev/null @@ -1,12 +0,0 @@ -* popup - - Evil bindings for [[https://github.com/auto-complete/popup-el][popup.el]] menus. - -** Key bindings - -*** popup-menu-keymap - - | Command | Original | Evil | - |------------------+----------+-------| - | =popup-next= | =C-n= | =C-j= | - | =popup-previous= | =C-p= | =C-k= | diff --git a/.config/emacs/lisp/evil-collection/modes/popup/evil-collection-popup.el b/.config/emacs/lisp/evil-collection/modes/popup/evil-collection-popup.el deleted file mode 100644 index 67ea70a..0000000 --- a/.config/emacs/lisp/evil-collection/modes/popup/evil-collection-popup.el +++ /dev/null @@ -1,44 +0,0 @@ -;;; evil-collection-popup.el --- Bindings for `popup' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `popup'. - -;;; Code: -(require 'evil-collection) -(require 'popup nil t) - -(defconst evil-collection-popup-maps '(popup-menu-keymap)) - -;;;###autoload -(defun evil-collection-popup-setup () - "Set up `evil' bindings for `popup'." - (defvar popup-menu-keymap) - (evil-collection-define-key nil 'popup-menu-keymap - (kbd "C-j") 'popup-next - (kbd "C-k") 'popup-previous)) - -(provide 'evil-collection-popup) -;;; evil-collection-popup.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/proced/README.org b/.config/emacs/lisp/evil-collection/modes/proced/README.org deleted file mode 100644 index 5789230..0000000 --- a/.config/emacs/lisp/evil-collection/modes/proced/README.org +++ /dev/null @@ -1,33 +0,0 @@ -* proced - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Processes.html][proced]]. - -** Key bindings - - | Command | Original | Evil | - |-----------------------------+----------+----------| - | =proced-refine= | =RET= | =RET= | - | =proced-mark= | =m=, =d= | =m= | - | =proced-mark-all= | =M= | =*=, =M= | - | =proced-unmark-all= | =U= | =U= | - | =proced-toggle-marks= | =t= | =~= | - | =proced-mark-children= | =C= | =c=, =C= | - | =proced-mark-parents= | =P= | =p=, =P= | - | =proced-unmark-backward= | =DEL= | =DEL= | - | =evil-scroll-down= | n/a | =SPC= | - | =evil-scroll-up= | n/a | =S-SPC= | - | =proced-toggle-tree= | =T= | =zt= | - | =proced-undo= | n/a | =u= | - | =proced-omit-processes= | =o= | =O= | - | =proced-send-signal= | =k=, =x= | =x= | - | =proced-filter-interactive= | =f= | =s= | - | =proced-format-interactive= | =F= | =S= | - | =proced-sort-start= | =s s= | =oo= | - | =proced-sort-interactive= | =s S= | =oO= | - | =proced-sort-pcpu= | =s c= | =oc= | - | =proced-sort-pmem= | =s m= | =om= | - | =proced-sort-pid= | =s p= | =op= | - | =proced-sort-time= | =s t= | =ot= | - | =proced-sort-user= | =s u= | =ou= | - | =proced-renice= | =r= | =r= | - | =revert-buffer= | n/a | =gr= | diff --git a/.config/emacs/lisp/evil-collection/modes/proced/evil-collection-proced.el b/.config/emacs/lisp/evil-collection/modes/proced/evil-collection-proced.el deleted file mode 100644 index 8723cd8..0000000 --- a/.config/emacs/lisp/evil-collection/modes/proced/evil-collection-proced.el +++ /dev/null @@ -1,88 +0,0 @@ -;;; evil-collection-proced.el --- Evil bindings for proced -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, proced, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for proced. - -;;; Code: -(require 'evil-collection) -(require 'proced) - -(defconst evil-collection-proced-maps '(proced-mode-map)) - -;;;###autoload -(defun evil-collection-proced-setup () - "Set up `evil' bindings for `proced'." - (evil-collection-set-readonly-bindings 'proced-mode-map) - (evil-set-initial-state 'proced-mode 'normal) - (evil-collection-define-key 'normal 'proced-mode-map - (kbd "RET") 'proced-refine - - ;; mark - ;; TODO: Implement a proced-toggle-mark? - "m" 'proced-mark ; Mentioned in documentation, should be followed. - "*" 'proced-mark-all - "M" 'proced-mark-all - "U" 'proced-unmark-all - "~" 'proced-toggle-marks - "c" 'proced-mark-children - "C" 'proced-mark-children ; Emacs has "C" - "p" 'proced-mark-parents - "P" 'proced-mark-parents ; Emacs has "P" - (kbd "") 'proced-unmark-backward - - ;; motion - ;; TODO: Implement beginning-of-buffer / end-of-buffer. - (kbd "SPC") 'evil-scroll-down - (kbd "S-SPC") 'evil-scroll-up - - "zt" 'proced-toggle-tree - - "u" 'proced-undo - - "O" 'proced-omit-processes ; TODO: Change default binding? - - "x" 'proced-send-signal ; Emacs has "k" and "x", "k" is mentioned in documentation - - ;; filter - "s" 'proced-filter-interactive ; Refers to "[s]elect", Emacs has "f" mentioned in documentation. - "S" 'proced-format-interactive - - ;; sort - "oo" 'proced-sort-start ; Refers to "[o]rder", Emacs has "s" mentioned in documentation. - "oO" 'proced-sort-interactive - "oc" 'proced-sort-pcpu - "om" 'proced-sort-pmem - "op" 'proced-sort-pid - "ot" 'proced-sort-time - "ou" 'proced-sort-user - - "r" 'proced-renice - - ;; refresh - "gr" 'revert-buffer)) - -(provide 'evil-collection-proced) -;;; evil-collection-proced.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/process-menu/README.org b/.config/emacs/lisp/evil-collection/modes/process-menu/README.org deleted file mode 100644 index c82676c..0000000 --- a/.config/emacs/lisp/evil-collection/modes/process-menu/README.org +++ /dev/null @@ -1,18 +0,0 @@ -* process-menu - - Evil bindings for =process-menu-mode= (=M-x list-processes=). - - Read-only motion / quit bindings come from - =evil-collection-set-readonly-bindings= and are not repeated below. - -** Key bindings - - | Command | Original | Evil | - |-------------------------------+----------+---------| - | =process-menu-delete-process= | =d= | =D= | - | =tabulated-list-sort= | =S= | =S= | - | =forward-button= | n/a | =TAB= | - | =backward-button= | n/a | =S-TAB= | - | =evil-scroll-down= | n/a | =SPC= | - | =evil-scroll-up= | n/a | =S-SPC= | - | =revert-buffer= | n/a | =gr= | diff --git a/.config/emacs/lisp/evil-collection/modes/process-menu/evil-collection-process-menu.el b/.config/emacs/lisp/evil-collection/modes/process-menu/evil-collection-process-menu.el deleted file mode 100644 index af5ce21..0000000 --- a/.config/emacs/lisp/evil-collection/modes/process-menu/evil-collection-process-menu.el +++ /dev/null @@ -1,54 +0,0 @@ -;;; evil-collection-process-menu.el --- Evil bindings for process-menu-mode -*- lexical-binding: t -*- - -;; Copyright (C) 2019 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, process, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for process-menu-mode (M-x list-processes). - -;;; Code: -(require 'evil-collection) - -(defconst evil-collection-process-menu-maps '(process-menu-mode-map)) - -;;;###autoload -(defun evil-collection-process-menu-setup () - "Set up `evil' bindings for `list-processes'." - (evil-collection-set-readonly-bindings 'process-menu-mode-map) - (evil-collection-define-key 'normal 'process-menu-mode-map - (kbd "") 'forward-button - (kbd "") 'backward-button - - "S" 'tabulated-list-sort - "D" 'process-menu-delete-process - - ;; motion - ;; TODO: Implement beginning-of-buffer / end-of-buffer. - (kbd "SPC") 'evil-scroll-down - (kbd "S-SPC") 'evil-scroll-up - - ;; refresh - "gr" 'revert-buffer)) - -(provide 'evil-collection-process-menu) -;;; evil-collection-process-menu.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/prodigy/evil-collection-prodigy.el b/.config/emacs/lisp/evil-collection/modes/prodigy/evil-collection-prodigy.el deleted file mode 100644 index 18f28f9..0000000 --- a/.config/emacs/lisp/evil-collection/modes/prodigy/evil-collection-prodigy.el +++ /dev/null @@ -1,86 +0,0 @@ -;;; evil-collection-prodigy.el --- Evil bindings for prodigy -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, prodigy, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `prodigy'. - -;;; Code: -(require 'evil-collection) -(require 'prodigy nil t) - -(defconst evil-collection-prodigy-maps '(prodigy-mode-map - prodigy-view-mode-map)) - -;;;###autoload -(defun evil-collection-prodigy-setup () - "Set up `evil' bindings for `prodigy'." - (evil-collection-define-key 'normal 'prodigy-mode-map - ;; quit - "q" 'quit-window - - "j" 'prodigy-next - "k" 'prodigy-prev - "gg" 'prodigy-first - "G" 'prodigy-last - - ;; mark - "m" 'prodigy-mark - "*t" 'prodigy-mark-tag - "M" 'prodigy-mark-all - "u" 'prodigy-unmark - "*T" 'prodigy-unmark-tag - "U" 'prodigy-unmark-all - - "s" 'prodigy-start - "S" 'prodigy-stop - - ;; refresh - "gr" 'prodigy-restart - - "`" 'prodigy-display-process - (kbd "RET") 'prodigy-browse - "it" 'prodigy-add-tag-filter - "in" 'prodigy-add-name-filter - "I" 'prodigy-clear-filters - "Jm" 'prodigy-jump-magit - "Jd" 'prodigy-jump-file-manager - - "gj" 'prodigy-next-with-status - "gk" 'prodigy-prev-with-status - (kbd "C-j") 'prodigy-next-with-status - (kbd "C-k") 'prodigy-prev-with-status - (kbd "Y") 'prodigy-copy-cmd) - - (evil-collection-define-key 'normal 'prodigy-view-mode-map - "s" 'prodigy-start - "S" 'prodigy-stop - "gr" 'prodigy-restart - "r" 'prodigy-restart - "c" 'prodigy-view-clear-buffer - (kbd "C-l") 'prodigy-view-clear-buffer - "x" 'prodigy-view-clear-buffer)) - -(provide 'evil-collection-prodigy) -;;; evil-collection-prodigy.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/profiler/README.org b/.config/emacs/lisp/evil-collection/modes/profiler/README.org deleted file mode 100644 index 79bd707..0000000 --- a/.config/emacs/lisp/evil-collection/modes/profiler/README.org +++ /dev/null @@ -1,25 +0,0 @@ -* profiler - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Profiling.html][profiler]]. - -** Key bindings - - Bindings added to =profiler-report-mode-map= in normal state. - - | Command | Original | Evil | - |--------------------------------------------+------------+---------------------| - | =profiler-report-next-entry= | =n= | =j= | - | =profiler-report-previous-entry= | =p= | =k= | - | =profiler-report-toggle-entry= | =RET=, =i= | =TAB= | - | =profiler-report-find-entry= | =f=, =j= | =RET= | - | =profiler-report-describe-entry= | =d= | =i= | - | =profiler-report-render-calltree= | =C= | =c= | - | =profiler-report-render-reversed-calltree= | =B= | =C= | - | =profiler-report-ascending-sort= | =A= | =o= | - | =profiler-report-descending-sort= | =D= | =O= | - | =profiler-report-compare-profile= | === | === | - | =scroll-up-command= | n/a | =SPC= | - | =scroll-down-command= | n/a | =S-SPC=, == | - | =revert-buffer= | n/a | =gr= | - | =quit-window= | n/a | =q=, =ZZ= | - | =evil-quit= | n/a | =ZQ= | diff --git a/.config/emacs/lisp/evil-collection/modes/profiler/evil-collection-profiler.el b/.config/emacs/lisp/evil-collection/modes/profiler/evil-collection-profiler.el deleted file mode 100644 index ce0c6ff..0000000 --- a/.config/emacs/lisp/evil-collection/modes/profiler/evil-collection-profiler.el +++ /dev/null @@ -1,71 +0,0 @@ -;;; evil-collection-profiler.el --- Evil bindings for profiler -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, profiler, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `profiler'. - -;;; Code: -(require 'evil-collection) -(require 'profiler) - -(defconst evil-collection-profiler-maps '(profiler-report-mode-map)) - -;;;###autoload -(defun evil-collection-profiler-setup () - "Set up `evil' bindings for `profiler'." - (evil-set-initial-state 'profiler-report-mode 'normal) - - (evil-collection-define-key 'normal 'profiler-report-mode-map - ;; motion - (kbd "SPC") 'scroll-up-command - (kbd "S-SPC") 'scroll-down-command - (kbd "") 'scroll-down-command - "j" 'profiler-report-next-entry - "k" 'profiler-report-previous-entry - - (kbd "") 'profiler-report-toggle-entry - - ;; sort - "o" 'profiler-report-ascending-sort - "O" 'profiler-report-descending-sort - - "c" 'profiler-report-render-calltree - "C" 'profiler-report-render-reversed-calltree - "i" 'profiler-report-describe-entry - "=" 'profiler-report-compare-profile - - ;; open - (kbd "RET") 'profiler-report-find-entry - - ;; refresh - "gr" 'revert-buffer - - ;; quit - "q" 'quit-window - "ZQ" 'evil-quit - "ZZ" 'quit-windw)) - -(provide 'evil-collection-profiler) -;;; evil-collection-profiler.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/python/README.org b/.config/emacs/lisp/evil-collection/modes/python/README.org deleted file mode 100644 index 1daae7e..0000000 --- a/.config/emacs/lisp/evil-collection/modes/python/README.org +++ /dev/null @@ -1,17 +0,0 @@ -* python - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Python.html][python-mode]]. - -** Key bindings - - Applied to =python-mode-map=, =python-ts-mode-map=, and - =python-base-mode-map= in normal state. - - | Command | Original | Evil | - |--------------------------------+-----------+------| - | =python-shell-switch-to-shell= | =C-c C-z= | =gz= | - -** Notes - - - =evil-shift-width= is set to =python-indent-offset= on - =python-mode-hook= and =python-ts-mode-hook=. diff --git a/.config/emacs/lisp/evil-collection/modes/python/evil-collection-python.el b/.config/emacs/lisp/evil-collection/modes/python/evil-collection-python.el deleted file mode 100644 index c71395e..0000000 --- a/.config/emacs/lisp/evil-collection/modes/python/evil-collection-python.el +++ /dev/null @@ -1,52 +0,0 @@ -;;; evil-collection-python.el --- Bindings for `python' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `python'. - -;;; Code: -(require 'evil-collection) -(require 'python) - -(defconst evil-collection-python-maps '(python-mode-map - python-ts-mode-map - python-base-mode-map)) - -(defun evil-collection-python-set-evil-shift-width () - "Set `evil-shift-width' according to `python-indent-offset'." - (setq-local evil-shift-width python-indent-offset)) - -;;;###autoload -(defun evil-collection-python-setup () - "Set up `evil' bindings for `python'." - (dolist (hook '(python-mode-hook python-ts-mode-hook)) - (add-hook hook #'evil-collection-python-set-evil-shift-width)) - - (dolist (kmap evil-collection-python-maps) - (evil-collection-define-key 'normal kmap - "gz" 'python-shell-switch-to-shell))) - -(provide 'evil-collection-python) -;;; evil-collection-python.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/quickrun/evil-collection-quickrun.el b/.config/emacs/lisp/evil-collection/modes/quickrun/evil-collection-quickrun.el deleted file mode 100644 index af27992..0000000 --- a/.config/emacs/lisp/evil-collection/modes/quickrun/evil-collection-quickrun.el +++ /dev/null @@ -1,42 +0,0 @@ -;;; evil-collection-quickrun.el --- Bindings for `quickrun' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools, quickrun - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `quickrun'. - -;;; Code: -(require 'evil-collection) -(require 'quickrun nil t) - -(defconst evil-collection-quickrun-maps '(quickrun--mode-map)) - -;;;###autoload -(defun evil-collection-quickrun-setup () - "Set up `evil' bindings for `quickrun'.." - (evil-collection-define-key 'normal 'quickrun--mode-map - "q" 'quit-window)) - -(provide 'evil-collection-quickrun) -;;; evil-collection-quickrun.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/racer/evil-collection-racer.el b/.config/emacs/lisp/evil-collection/modes/racer/evil-collection-racer.el deleted file mode 100644 index 7283669..0000000 --- a/.config/emacs/lisp/evil-collection/modes/racer/evil-collection-racer.el +++ /dev/null @@ -1,48 +0,0 @@ -;;; evil-collection-racer.el --- Bindings for `racer' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: emacs, rust, tools, evil - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `racer'. - -;;; Code: -(require 'evil-collection) -(require 'racer nil t) - -(defconst evil-collection-racer-maps '(racer-mode-map - racer-help-mode-map)) - -;;;###autoload -(defun evil-collection-racer-setup () - "Set up `evil' bindings for `racer'." - (evil-collection-define-key 'normal 'racer-mode-map - "gd" 'racer-find-definition - (kbd "C-t") 'pop-tag-mark - "K" 'racer-describe) - - (evil-collection-define-key 'normal 'racer-help-mode-map - "q" 'quit-window)) - -(provide 'evil-collection-racer) -;;; evil-collection-racer.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/racket-describe/evil-collection-racket-describe.el b/.config/emacs/lisp/evil-collection/modes/racket-describe/evil-collection-racket-describe.el deleted file mode 100644 index a7d24e1..0000000 --- a/.config/emacs/lisp/evil-collection/modes/racket-describe/evil-collection-racket-describe.el +++ /dev/null @@ -1,45 +0,0 @@ -;;; evil-collection-racket-describe.el --- Bindings for `racket-describe' -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Andre Goderich - -;; Author: Andre Goderich -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `racket-describe'. - -;;; Code: -(require 'evil-collection) -(require 'racket-describe nil t) - -(defconst evil-collection-racket-describe-maps '(racket-describe-mode-map)) - -;;;###autoload -(defun evil-collection-racket-describe-setup () - "Set up `evil' bindings for `racket-describe'." - (evil-collection-inhibit-insert-state 'racket-describe-mode-map) - (evil-set-initial-state 'racket-describe-mode 'normal) - (evil-collection-define-key 'normal 'racket-describe-mode-map - "q" 'quit-window - "g?" 'describe-mode)) - -(provide 'evil-collection-racket-describe) -;;; evil-collection-racket-describe.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/reader/evil-collection-reader.el b/.config/emacs/lisp/evil-collection/modes/reader/evil-collection-reader.el deleted file mode 100644 index 3fc3187..0000000 --- a/.config/emacs/lisp/evil-collection/modes/reader/evil-collection-reader.el +++ /dev/null @@ -1,162 +0,0 @@ -;;; evil-collection-reader.el --- Evil bindings for `reader' -*- lexical-binding: t -*- - -;; Copyright (C) 2025 Icy-Thought - -;; Author: Icy-Thought -;; Maintainer: Icy-Thought -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools, reader - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for Emacs `reader'. - -;;; Code: -(require 'evil-collection) -(require 'reader nil t) - -(declare-function reader-first-page "reader") -(declare-function reader-last-page "reader") -(declare-function reader-goto-page "reader") -(declare-function reader-close-doc "reader") -(declare-function reader-outline-show "reader") -(declare-function reader-presentation-mode "reader") -(declare-function reader-rotate-counter-clockwise "reader") -(declare-function reader-rotate-clockwise "reader") -(declare-function reader-fit-to-width "reader") -(declare-function reader-fit-to-height "reader") -(declare-function reader-mwheel-shrink-size "reader") -(declare-function reader-shrink-size "reader") -(declare-function reader-mwheel-enlarge-size "reader") -(declare-function reader-enlarge-size "reader") -(declare-function reader-scroll-left-most "reader") -(declare-function reader-scroll-right-most "reader") -(declare-function reader-scroll-left "reader") -(declare-function reader-scroll-right "reader") -(declare-function reader-scroll-up-or-prev-page "reader") -(declare-function reader-scroll-down-or-next-page "reader") -(declare-function reader-scroll-down-screen "reader") -(declare-function reader-scroll-up-screen "reader") -(declare-function reader-mwheel-scroll-right "reader") -(declare-function reader-mwheel-scroll-left "reader") -(declare-function reader-mwheel-scroll-down "reader") -(declare-function reader-mwheel-scroll-up "reader") -(declare-function reader-scroll-down-or-next-page "reader") -(declare-function reader-scroll-up-or-prev-page "reader") -(declare-function reader-previous-page "reader") -(declare-function reader-next-page "reader") - -(declare-function reader-outline-visit-page "reader") -(declare-function reader-outline-select-doc-window "reader") - -(defvar reader-mode-map) -(defvar reader-outline-mode-map) - -(defun evil-collection-reader-goto-first-page (&optional page) - "Navigates to `page' X or jump to the FIRST PAGE of the document." - (interactive "P") - (if page - (reader-goto-page page) - (reader-first-page))) - -(defun evil-collection-reader-goto-page (&optional page) - "Navigates to `page' X or jump to the LAST PAGE of the document. -`evil' wrapper around `reader-last-page'." - (interactive "P") - (if page - (reader-goto-page page) - (reader-last-page))) - -(defconst evil-collection-reader-maps - '(reader-mode-map reader-outline-mode-map)) - -;;;###autoload -(defun evil-collection-reader-setup () - "Set up `evil' bindings for `reader'." - (evil-collection-set-readonly-bindings 'reader-mode-map) - - ;; Refresh reader-mode bindings - (add-hook 'reader-mode-hook #'evil-normalize-keymaps) - (add-hook 'reader-outline-mode-hook #'evil-normalize-keymaps) - - (evil-collection-define-key 'normal 'reader-mode-map - "n" #'reader-next-page - "p" #'reader-previous-page - "k" #'reader-scroll-up-or-prev-page - "j" #'reader-scroll-down-or-next-page - [remap next] #'reader-scroll-down-or-next-page - [remap previous] #'reader-scroll-up-or-prev-page - [remap evil-next-line] #'reader-scroll-down-or-next-page - [remap evil-previous-line] #'reader-scroll-up-or-prev-page - - "" #'reader-mwheel-scroll-up - "" #'reader-mwheel-scroll-down - "S-" #'reader-mwheel-scroll-left - "S-" #'reader-mwheel-scroll-right - - "C-b" #'reader-scroll-up-screen - "C-f" #'reader-scroll-down-screen - [remap scroll-down-command] #'reader-scroll-up-screen - [remap scroll-up-command] #'reader-scroll-down-screen - - "SPC" #'reader-scroll-down-or-next-page - "DEL" #'reader-scroll-up-or-prev-page - "S-SPC" #'reader-scroll-up-or-prev-page - - "l" #'reader-scroll-right - "h" #'reader-scroll-left - [remap forward-char] #'reader-scroll-right - [remap backward-char] #'reader-scroll-left - - "$" #'reader-scroll-right-most - "^" #'reader-scroll-left-most - [remap move-end-of-line] #'reader-scroll-right-most - [remap move-beginning-of-line] #'reader-scroll-left-most - - "gg" #'evil-collection-reader-goto-first-page - "G" #'evil-collection-reader-goto-page - [remap beginning-of-buffer] #'reader-first-page - [remap end-of-buffer] #'reader-last-page - [remap goto-line] #'reader-goto-page - - ;; "0" #'evil-collections-reader-reset-zoom - "=" #'reader-enlarge-size - "+" #'reader-enlarge-size - "C-" #'reader-mwheel-enlarge-size - "-" #'reader-shrink-size - "C-" #'reader-mwheel-shrink-size - - "H" #'reader-fit-to-height - "W" #'reader-fit-to-width - - "r" #'reader-rotate-clockwise - "R" #'reader-rotate-counter-clockwise - - "" #'reader-presentation-mode - "o" #'reader-outline-show - "Q" #'reader-close-doc) - - (evil-collection-define-key 'normal 'reader-outline-mode-map - "p" #'previous-line - "n" #'next-line - "o" #'reader-outline-select-doc-window - "q" #'quit-window - "RET" #'reader-outline-visit-page - "M-RET" #'reader-outline-visit-page)) - -(provide 'evil-collection-reader) -;;; evil-collection-reader.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/realgud/evil-collection-realgud.el b/.config/emacs/lisp/evil-collection/modes/realgud/evil-collection-realgud.el deleted file mode 100644 index a8462ae..0000000 --- a/.config/emacs/lisp/evil-collection/modes/realgud/evil-collection-realgud.el +++ /dev/null @@ -1,103 +0,0 @@ -;;; evil-collection-realgud.el --- Bindings for `realgud' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools, realgud - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `realgud'. - -;;; Code: -(require 'evil-collection) -(require 'realgud nil t) - -(defconst evil-collection-realgud-maps '(realgud:shortkey-mode-map)) - -;;;###autoload -(defun evil-collection-realgud-setup () - "Set up `evil' bindings for `realgud'." - ;; This one is to represent `realgud-populate-src-buffer-map-plain'. - (evil-collection-define-key 'normal 'realgud:shortkey-mode-map - "b" 'realgud:cmd-break - "D" 'realgud:cmd-delete - "X" 'realgud:cmd-clear - "-" 'realgud:cmd-disable - "+" 'realgud:cmd-enable - "T" 'realgud:cmd-backtrace - "f" 'realgud:cmd-finish - "n" 'realgud:cmd-next - "q" 'realgud:cmd-quit - "Q" 'realgud:cmd-kill - "r" 'realgud:cmd-restart - "R" 'realgud:cmd-restart - "s" 'realgud:cmd-step - "i" 'realgud:cmd-step - "!" 'realgud:cmd-shell - - ;; (evil-collection-define-key nil map [M-down] 'realgud-track-hist-newer) - ;; (evil-collection-define-key nil map [M-kp-2] 'realgud-track-hist-newer) - ;; (evil-collection-define-key nil map [M-up] 'realgud-track-hist-older) - ;; (evil-collection-define-key nil map [M-kp-8] 'realgud-track-hist-older) - ;; (evil-collection-define-key nil map [M-kp-up] 'realgud-track-hist-older) - ;; (evil-collection-define-key nil map [M-kp-down] 'realgud-track-hist-newer) - ;; (evil-collection-define-key nil map [M-print] 'realgud-track-hist-older) - ;; (evil-collection-define-key nil map [M-S-down] 'realgud-track-hist-newest) - ;; (evil-collection-define-key nil map [M-S-up] 'realgud-track-hist-oldest) - ) - - (evil-collection-define-key 'normal 'realgud:shortkey-mode-map - (kbd "C-x C-q") 'realgud-short-key-mode - "1" 'realgud-goto-arrow1 - "2" 'realgud-goto-arrow2 - "3" 'realgud-goto-arrow3 - "4" 'realgud:goto-loc-hist-4 - "5" 'realgud:goto-loc-hist-5 - "6" 'realgud:goto-loc-hist-6 - "7" 'realgud:goto-loc-hist-7 - "8" 'realgud:goto-loc-hist-8 - "9" 'realgud:goto-loc-hist-9 - "b" 'realgud:cmd-break - "J" 'realgud:cmd-jump - "c" 'realgud:cmd-continue - "e" 'realgud:cmd-eval-dwim - "E" 'realgud:cmd-eval-at-point - "U" 'realgud:cmd-until - "H" 'realgud:cmd-until-here - [mouse-2] 'realgud:tooltip-eval - [left-fringe mouse-1] 'realgud-cmds--mouse-add-remove-bp - [left-margin mouse-1] 'realgud-cmds--mouse-add-remove-bp - ">" 'realgud:cmd-newer-frame - "<" 'realgud:cmd-older-frame - "d" 'realgud:cmd-newer-frame - "u" 'realgud:cmd-older-frame - "gR" 'realgud-recenter-arrow ;; FIXME: Hmnn! - "C" 'realgud-window-cmd-undisturb-src - "g?" 'realgud:cmdbuf-info-describe - "S" 'realgud-window-src-undisturb-cmd - "R" 'realgud:cmd-restart - "gr" 'realgud:cmd-restart - "!" 'realgud:cmd-shell) - - (add-hook 'realgud-short-key-mode-hook #'evil-normalize-keymaps)) - -(provide 'evil-collection-realgud) -;;; evil-collection-realgud.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/reftex/README.org b/.config/emacs/lisp/evil-collection/modes/reftex/README.org deleted file mode 100644 index d6f1d49..0000000 --- a/.config/emacs/lisp/evil-collection/modes/reftex/README.org +++ /dev/null @@ -1,75 +0,0 @@ -* reftex - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/reftex/index.html][reftex-mode]]. - -** Key bindings - -*** reftex-select-shared-map - - Used by =reftex-select-label-mode= and =reftex-select-bib-mode= (initial - state: normal). - - | Command | Original | Evil | - |------------------------------------------+----------+-------------------| - | =reftex-select-next= | =n= | =j= | - | =reftex-select-previous= | =p= | =k= | - | =reftex-select-next-heading= | n/a | =]]=, =gj=, =C-j= | - | =reftex-select-previous-heading= | n/a | =[[=, =gk=, =C-k= | - | =reftex-select-accept= | =RET= | =RET= | - | =reftex-select-callback= | =SPC= | =go= | - | =reftex-select-show-insertion-point= | =.= | =gO= | - | =reftex-select-read-label= | n/a | =TAB= | - | =reftex-select-quit= | =q= | =q=, =ZZ= | - | =evil-quit= | n/a | =ZQ= | - | =reftex-select-help= | =?= | =g?= | - | =reftex-select-jump= | n/a | =J= | - | =reftex-select-cycle-ref-style-forward= | n/a | =r= | - | =reftex-select-cycle-ref-style-backward= | n/a | =R= | - | =reftex-select-mark= | n/a | =m= | - | =reftex-select-unmark= | n/a | =u= | - - The keys =gr=, =c=, =s=, =x=, =X=, =S=, =o=, =O= dispatch back to - reftex's underlying =throw= protocol so the original selection actions - (rescan, reuse, switch label type, ref grouping, external xr, BibTeX - export) still work. - -*** reftex-toc-mode-map - - Initial state: normal. - - | Command | Original | Evil | - |-----------------------------------+-----------+------------| - | =reftex-toc-next= | =n= | =j= | - | =reftex-toc-previous= | =p= | =k= | - | =reftex-toc-view-line= | =SPC= | =go=, =gO= | - | =reftex-toc-goto-line-and-hide= | =RET= | =RET= | - | =reftex-toc-goto-line= | =TAB= | =TAB= | - | =reftex-toc-show-help= | =?= | =g?=, =?= | - | =reftex-toc-quit= | =q= | =q= | - | =reftex-toc-quit-and-kill= | =k= | =ZZ= | - | =evil-quit= | n/a | =ZQ= | - | =reftex-toc-rescan= | =r= | =gr= | - | =reftex-toc-Rescan= | =R= | =gR= | - | =reftex-toc-toggle-labels= | =l= | =l= | - | =reftex-toc-toggle-index= | =i= | =i= | - | =reftex-toc-toggle-context= | =c= | =c= | - | =reftex-toc-toggle-file-boundary= | =F= | =F= | - | =reftex-toc-rename-label= | =M-%= | =rl= | - | =reftex-toc-display-index= | =C-c >= | =zi= | - | =reftex-toc-external= | =x= | =x= | - | =reftex-toc-show-calling-point= | =.= | =.= | - | =reftex-toc-jump= | =z= | =J= | - | =reftex-toc-previous-heading= | =C-c C-p= | =[[= | - | =reftex-toc-next-heading= | =C-c C-n= | =]]= | - | =reftex-toc-promote= | =<= | =>= | - | =reftex-toc-demote= | =>= | =<= | - | =reftex-toc-toggle-follow= | =f= | =f= | - - Note: =>= and =<= are swapped relative to upstream so that =>= promotes - and =<= demotes; this matches the visual outline-shift direction. - -** Notes - - - =reftex-select-label-prompt=, =reftex-citation-prompt=, - =reftex-select-label-help=, =reftex-citation-help=, and - =reftex-toc-help= are rewritten to advertise the evil keys. diff --git a/.config/emacs/lisp/evil-collection/modes/reftex/evil-collection-reftex.el b/.config/emacs/lisp/evil-collection/modes/reftex/evil-collection-reftex.el deleted file mode 100644 index 274753f..0000000 --- a/.config/emacs/lisp/evil-collection/modes/reftex/evil-collection-reftex.el +++ /dev/null @@ -1,174 +0,0 @@ -;;; evil-collection-reftex.el --- Bindings for `reftex' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Maximiliano Sandoval -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, reftex, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for `reftex-mode'. - -;;; Code: -(require 'evil-collection) -(require 'reftex-ref nil t) -(require 'reftex-ref nil t) -(require 'reftex-cite nil t) -(require 'reftex-toc nil t) - -(defconst evil-collection-reftex-maps '(reftex-select-shared-map - reftex-toc-mode-map)) - -;; original code can be found in reftex-ref.el -(setq reftex-select-label-prompt - "Select: [RET]select [j]next [k]previous [gr]escan [go]context [q]uit [g?]help") - -;; original code can be found in reftex-cite.el -(setq reftex-citation-prompt - "Select: [RET]select [j]next [k]previous [q]uit [g?]help") - -;; original at reftex-ref.el -(setq reftex-select-label-help - " j / k Go to next/previous label (Cursor motion works as well) - [ / ] Go to previous/next section heading. - c Reuse last referenced label. - J Jump to a specific section, e.g. '3 J' jumps to section 3. - s Switch label type. - gr Reparse document. - go / gO Show context / Show insertion point. - S Switch to label menu of external document (with LaTeX package `xr'). - r / R Toggle \\ref <-> \\vref / Rotate \\ref <=> \\fref <=> \\Fref. - TAB Enter a label with completion. - m / M Mark/unmark entry. - x / X Put all marked entries into one/many \\ref commands. - q / RET Quit without referencing / Accept current label.") - -;; code can be found in reftex-cite.el -(setq reftex-citation-help - " j / k Go to next/previous entry (Cursor motion works as well). - go / gO Show citation / Show insertion point. - q Quit without inserting \\cite macro into buffer. - TAB Enter citation key with completion. - RET Accept current entry and create \\cite macro. - m / M Mark/Unmark the entry. - o / O Create BibTeX file with all marked / unmarked entries. - X / X Put all (marked) entries into one/many \\cite commands.") - -(setq reftex-toc-help - " AVAILABLE KEYS IN TOC BUFFER - ============================ - j / k next-line / previous-line - go Show the corresponding location of the LaTeX document. - TAB Goto the location and keep the TOC window. - RET Goto the location and hide the TOC window (also on mouse-2). - < / > Promote / Demote section, or all sections in region. - zi Display Index. With prefix arg, restrict index to current section. - q / ZZ Hide/Kill *toc* buffer, return to position of reftex-toc command. - l i c F Toggle display of [l]abels, [i]ndex, [c]ontext, [F]ile borders. - f Toggle follow mode - gr / gR Reparse the LaTeX document / Reparse entire LaTeX document. - . In other window, show position from where `reftex-toc' was called. - rl Global search and replace to rename label at point. - x Switch to TOC of external document (with LaTeX package `xr'). - J Jump to a specific section (e.g. '3 J' goes to section 3).") - -;;;###autoload -(defun evil-collection-reftex-setup () - "Set up `evil' bindings for `reftex'." - - (evil-set-initial-state 'reftex-select-label-mode 'normal) - (evil-set-initial-state 'reftex-select-bib-mode 'normal) - - (evil-collection-define-key 'normal 'reftex-select-shared-map - "j" 'reftex-select-next - "k" 'reftex-select-previous - (kbd "]]") 'reftex-select-next-heading - (kbd "[[") 'reftex-select-previous-heading - (kbd "gj") 'reftex-select-next-heading - (kbd "gk") 'reftex-select-previous-heading - (kbd "C-j") 'reftex-select-next-heading - (kbd "C-k") 'reftex-select-previous-heading - (kbd "RET") 'reftex-select-accept - "go" 'reftex-select-callback ;shows the point where the label is - "gr" (lambda nil "Press `?' during selection to find out - about this key" (interactive) (throw (quote myexit) 114)) ;reftex binds keys in a very arcane way using the number asigned by describe-char, in this case the value of "g" is 114 - "q" 'reftex-select-quit - "ZZ" 'reftex-select-quit - "ZQ" 'evil-quit - "g?" 'reftex-select-help - "c" (lambda nil "Press `?' during selection to find out - about this key." (interactive) (throw (quote myexit) 108)) - "J" 'reftex-select-jump ;; weird binding, using default - (kbd "") 'reftex-select-read-label - "s" (lambda nil "Press `?' during selection to find out - about this key." (interactive) (throw (quote myexit) 115)) - "x" (lambda nil "Press `?' during selection to find out - about this key." (interactive) (throw (quote myexit) 97)) - "X" (lambda nil "Press `?' during selection to find out - about this key." (interactive) (throw (quote myexit) 65)) - "S" (lambda nil "Press `?' during selection to find out - about this key." (interactive) (throw (quote myexit) 120)) - "r" 'reftex-select-cycle-ref-style-forward - "R" 'reftex-select-cycle-ref-style-backward - "gO" 'reftex-select-show-insertion-point - "o" (lambda nil "Press `?' during selection to find out - about this key." (interactive) (throw (quote myexit) 101)) - "O" (lambda nil "Press `?' during selection to find out - about this key." (interactive) (throw (quote myexit) 69)) - - ;; mark - "m" 'reftex-select-mark ; TODO: Need a mark toggle function. - "u" 'reftex-select-unmark) - - (evil-set-initial-state 'reftex-toc-mode 'normal) - - ;; This one is more involved, in reftex-toc.el, line 267 it shows the prompt - ;; string with the keybinds and I don't see any way of changing it to show evil-like binds. - (evil-collection-define-key 'normal 'reftex-toc-mode-map - "j" 'reftex-toc-next - "k" 'reftex-toc-previous - "go" 'reftex-toc-view-line - "gO" 'reftex-toc-view-line - (kbd "RET") 'reftex-toc-goto-line-and-hide - (kbd "") 'reftex-toc-goto-line - "g?" 'reftex-toc-show-help - "?" 'reftex-toc-show-help - "q" 'reftex-toc-quit - "ZZ" 'reftex-toc-quit-and-kill - "ZQ" 'evil-quit - "gr" 'reftex-toc-rescan - "gR" 'reftex-toc-Rescan - "l" 'reftex-toc-toggle-labels - "i" 'reftex-toc-toggle-index - "c" 'reftex-toc-toggle-context - "F" 'reftex-toc-toggle-file-boundary - "rl" 'reftex-toc-rename-label - "zi" 'reftex-toc-display-index - "x" 'reftex-toc-external - "." 'reftex-toc-show-calling-point - "J" 'reftex-toc-jump - (kbd "[[") 'reftex-toc-previous-heading - (kbd "]]") 'reftex-toc-next-heading - (kbd ">") 'reftex-toc-promote - (kbd "<") 'reftex-toc-demote - "f" 'reftex-toc-toggle-follow)) - -(provide 'evil-collection-reftex) -;;; evil-collection-reftex.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/replace/README.org b/.config/emacs/lisp/evil-collection/modes/replace/README.org deleted file mode 100644 index 9d85f62..0000000 --- a/.config/emacs/lisp/evil-collection/modes/replace/README.org +++ /dev/null @@ -1,34 +0,0 @@ -* replace - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Other-Repeating-Search.html][occur]] and =occur-edit-mode=. - -** Key bindings - -*** occur-mode-map - - Initial state: normal. - - | Command | Original | Evil | - |-------------------------------------------+-----------+------------------| - | =occur-edit-mode= | =e= | =i=, =C-x C-q= | - | =occur-mode-goto-occurrence= | =RET= | =RET=, =C-c C-c= | - | =occur-mode-goto-occurrence-other-window= | =o= | =go=, =S-RET= | - | =occur-mode-display-occurrence= | =C-o= | =M-RET= | - | =next-error-no-select= | =n= | =gj=, =C-j= | - | =previous-error-no-select= | =p= | =gk=, =C-k= | - | =occur-rename-buffer= | =r= | =r= | - | =clone-buffer= | =c= | =c= | - | =next-error-follow-minor-mode= | =C-c C-f= | =C-c C-f= | - | =occur-mode-mouse-goto= | =mouse-2= | =mouse-2= | - -*** occur-edit-mode-map - - | Command | Original | Evil | - |---------------------------------+-----------+----------------------------------------------| - | =occur-cease-edit= | =C-c C-c= | =C-x C-q=, ==, =ZZ=, =ZQ=, =C-c C-c= | - | =occur-mode-display-occurrence= | =C-c C-o= | =C-o= | - | =next-error-follow-minor-mode= | =C-c C-f= | =C-c C-f= | - | =occur-mode-mouse-goto= | =mouse-2= | =mouse-2= | - - Note: =occur-edit-mode= has no abort command; =ZZ=, =ZQ= and == - all commit the edit. diff --git a/.config/emacs/lisp/evil-collection/modes/replace/evil-collection-replace.el b/.config/emacs/lisp/evil-collection/modes/replace/evil-collection-replace.el deleted file mode 100644 index 5dc91e4..0000000 --- a/.config/emacs/lisp/evil-collection/modes/replace/evil-collection-replace.el +++ /dev/null @@ -1,79 +0,0 @@ -;;; evil-collection-replace.el --- Evil bindings for `replace' -*- lexical-binding: t -*- - -;; Copyright (C) 2022 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, occur, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `replace'. - -;;; Code: -(require 'evil-collection) -(require 'replace nil t) - -(defconst evil-collection-replace-maps '(occur-mode-map - occur-edit-mode-map)) - -;;;###autoload -(defun evil-collection-replace-setup () - "Set up `evil' bindings for `occur'." - (evil-set-initial-state 'occur-mode 'normal) - - (evil-collection-define-key 'normal 'occur-mode-map - ;; Like `wdired-mode'. - (kbd "C-x C-q") 'occur-edit-mode - "i" 'occur-edit-mode - - [mouse-2] 'occur-mode-mouse-goto - (kbd "C-c C-c") 'occur-mode-goto-occurrence - - ;; open - (kbd "RET") 'occur-mode-goto-occurrence - (kbd "S-") 'occur-mode-goto-occurrence-other-window - (kbd "M-") 'occur-mode-display-occurrence - "go" 'occur-mode-goto-occurrence-other-window - - "gj" 'next-error-no-select - "gk" 'previous-error-no-select - (kbd "C-j") 'next-error-no-select - (kbd "C-k") 'previous-error-no-select - "r" 'occur-rename-buffer - "c" 'clone-buffer - (kbd "C-c C-f") 'next-error-follow-minor-mode) - - (evil-collection-define-key 'normal 'occur-edit-mode-map - ;; Like `wdired-mode'. - (kbd "C-x C-q") 'occur-cease-edit - - ;; Sadly, `occur-edit-mode' has no abort commands supported. ZZ, ZQ and - ;; are same. - (kbd "") 'occur-cease-edit - "ZZ" 'occur-cease-edit - "ZQ" 'occur-cease-edit - - [mouse-2] 'occur-mode-mouse-goto - (kbd "C-c C-c") 'occur-cease-edit - (kbd "C-o") 'occur-mode-display-occurrence - (kbd "C-c C-f") 'next-error-follow-minor-mode)) - -(provide 'evil-collection-replace) -;;; evil-collection-replace.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/restclient/evil-collection-restclient.el b/.config/emacs/lisp/evil-collection/modes/restclient/evil-collection-restclient.el deleted file mode 100644 index 49da419..0000000 --- a/.config/emacs/lisp/evil-collection/modes/restclient/evil-collection-restclient.el +++ /dev/null @@ -1,66 +0,0 @@ -;;; evil-collection-restclient.el --- Bindings for `restclient' -*- lexical-binding: t -*- - -;; Copyright (C) 2018 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.2 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `restclient'. - -;;; Code: -(require 'evil-collection) -(require 'restclient nil t) - -(defconst evil-collection-restclient-maps - '(evil-collection-restclient-mode-map - restclient-mode-map)) - -(defvar evil-collection-restclient-mode-map (make-sparse-keymap)) - -(define-minor-mode evil-collection-restclient-result-mode - "A minor mode to attach to `restclient' results" - :group 'evil-collection-restclient-mode - :keymap evil-collection-restclient-mode-map - :lighter nil) - -(defun evil-collection-restclient-setup-result-mode () - "Set up `evil-collection-restclient-result-mode'." - (evil-collection-restclient-result-mode) - (evil-normalize-keymaps)) - -;;;###autoload -(defun evil-collection-restclient-setup () - "Set up `evil' bindings for `restclient'." - (evil-collection-define-key 'normal 'restclient-mode-map - "[[" 'restclient-jump-prev - "]]" 'restclient-jump-next) - (evil-collection-define-key 'normal 'evil-collection-restclient-mode-map - "q" #'quit-window - "ZZ" #'quit-window - "ZQ" #'evil-quit) - - ;; Enable a separate minor mode so that we can bind keys to it. - (add-hook 'restclient-response-loaded-hook - #'evil-collection-restclient-setup-result-mode)) - -(provide 'evil-collection-restclient) -;;; evil-collection-restclient.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/rg/README.org b/.config/emacs/lisp/evil-collection/modes/rg/README.org deleted file mode 100644 index 677010c..0000000 --- a/.config/emacs/lisp/evil-collection/modes/rg/README.org +++ /dev/null @@ -1,47 +0,0 @@ -* rg - - Evil bindings for [[https://github.com/dajva/rg.el][rg.el]] (ripgrep) result buffers. - - Initial state for =rg-mode= is forced to =normal=. Bindings cover - =normal=, =motion=, and =visual= states so that evil motion overrides - conflicting single-letter rg commands. - -** Key bindings - -*** normal state - - | Command | Original | Evil | - |--------------------------------+-----------+-------------| - | =rg-rerun-toggle-case= | =c= | =c= | - | =rg-rerun-change-dir= | =d= | =d= | - | =rg-rerun-change-files= | =f= | =f= | - | =rg-rerun-toggle-ignore= | =i= | =I= | - | =rg-rerun-change-regexp= | =r= | =r= | - | =rg-rerun-change-literal= | =t= | =t= | - | =rg-save-search= | =s= | =s= | - | =rg-save-search-as-name= | =S= | =S= | - | =rg-menu= | =m= | =m= | - | =wgrep-change-to-wgrep-mode= | =e= | =i= | - | =next-error-follow-minor-mode= | =C-c C-f= | =F= | - | =rg-list-searches= | =L= | =L= | - | =rg-back-history= | =C-c <= | =C-p= | - | =rg-forward-history= | =C-c >= | =C-n= | - | =rg-prev-file= | =M-P= | ={= | - | =rg-next-file= | =M-N= | =}= | - | =previous-error-no-select= | =p= | =gk=, =C-k= | - | =next-error-no-select= | =n= | =gj=, =C-j= | - | =evil-forward-word-end= | | =e= | - | =evil-forward-char= | | =l= | - | =evil-forward-word-begin= | | =w= | - | =evil-goto-first-line= | | =gg= | - | =rg-recompile= | =g= | =gr= | - | =quit-window= | | =q= | - -*** motion / visual states - - | Command | Evil | - |---------------------------+------| - | =evil-forward-word-end= | =e= | - | =evil-forward-char= | =l= | - | =evil-forward-word-begin= | =w= | - | =evil-goto-first-line= | =gg= | diff --git a/.config/emacs/lisp/evil-collection/modes/rg/evil-collection-rg.el b/.config/emacs/lisp/evil-collection/modes/rg/evil-collection-rg.el deleted file mode 100644 index af20fb7..0000000 --- a/.config/emacs/lisp/evil-collection/modes/rg/evil-collection-rg.el +++ /dev/null @@ -1,91 +0,0 @@ -;;; evil-collection-rg.el --- Evil bindings for rg -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, rg, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for rg. - -;;; Code: -(require 'evil-collection) -(require 'rg nil t) - -(defconst evil-collection-rg-maps '(rg-mode-map)) - -;;;###autoload -(defun evil-collection-rg-setup () - "Set up `evil' bindings for `rg'." - (evil-set-initial-state 'rg-mode 'normal) - - (evil-collection-define-key 'normal 'rg-mode-map - ;; rerun - "c" 'rg-rerun-toggle-case - "d" 'rg-rerun-change-dir - "f" 'rg-rerun-change-files - "I" 'rg-rerun-toggle-ignore ;; was i - "r" 'rg-rerun-change-regexp - "t" 'rg-rerun-change-literal - - ;; save - "s" 'rg-save-search - "S" 'rg-save-search-as-name - - ;; action - "m" 'rg-menu - "i" 'wgrep-change-to-wgrep-mode ;; was w/e - "F" 'next-error-follow-minor-mode ;; C-c C-f - "L" 'rg-list-searches ;; was l - (kbd "C-p") 'rg-back-history ;; C-c < - (kbd "C-n") 'rg-forward-history ;; C-c > - - ;; navigation - "{" 'rg-prev-file - "}" 'rg-next-file - "gk" 'previous-error-no-select - "gj" 'next-error-no-select - (kbd "C-k") 'previous-error-no-select - (kbd "C-j") 'next-error-no-select - - "e" 'evil-forward-word-end ;; shadows wgrep-change-to-wgrep-mode - "l" 'evil-forward-char ;; shadows rg-list-searches - "w" 'evil-forward-word-begin ;; shadows wgrep-change-to-wgrep-mode - "gg" 'evil-goto-first-line - "gr" 'rg-recompile - - ;; quit - "q" 'quit-window) - - (evil-collection-define-key 'motion 'rg-mode-map - "e" 'evil-forward-word-end ;; shadows wgrep-change-to-wgrep-mode - "l" 'evil-forward-char ;; shadows rg-list-searches - "w" 'evil-forward-word-begin ;; shadows wgrep-change-to-wgrep-mode - "gg" 'evil-goto-first-line) - - (evil-collection-define-key 'visual 'rg-mode-map - "e" 'evil-forward-word-end ;; shadows wgrep-change-to-wgrep-mode - "l" 'evil-forward-char ;; shadows rg-list-searches - "w" 'evil-forward-word-begin ;; shadows wgrep-change-to-wgrep-mode - "gg" 'evil-goto-first-line)) - -(provide 'evil-collection-rg) -;;; evil-collection-rg.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/ripgrep/README.org b/.config/emacs/lisp/evil-collection/modes/ripgrep/README.org deleted file mode 100644 index bae0b91..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ripgrep/README.org +++ /dev/null @@ -1,14 +0,0 @@ -* ripgrep - - Evil bindings for [[https://github.com/nlamirault/ripgrep.el][ripgrep.el]] search result buffers. - -** Key bindings - - | Command | Original | Evil | - |------------------------------+-----------+-------------| - | =evil-search-next= | | =n= | - | =previous-error-no-select= | =p= | =gk=, =C-k= | - | =next-error-no-select= | =n= | =gj=, =C-j= | - | =compilation-previous-file= | ={= | ={= | - | =compilation-next-file= | =}= | =}= | - | =wgrep-change-to-wgrep-mode= | =C-c C-p= | =i= | diff --git a/.config/emacs/lisp/evil-collection/modes/ripgrep/evil-collection-ripgrep.el b/.config/emacs/lisp/evil-collection/modes/ripgrep/evil-collection-ripgrep.el deleted file mode 100644 index f96398a..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ripgrep/evil-collection-ripgrep.el +++ /dev/null @@ -1,48 +0,0 @@ -;;; evil-collection-ripgrep.el --- Bindings for `ripgrep' -*- lexical-binding: t -*- - -;; Author: Sid Kasivajhula -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `ripgrep'. - -;;; Code: -(require 'evil-collection) -(require 'ripgrep nil t) - -(defconst evil-collection-ripgrep-maps '(ripgrep-search-mode-map)) - -;;;###autoload -(defun evil-collection-ripgrep-setup () - "Set up `evil' bindings for `ripgrep'." - (evil-collection-define-key 'normal 'ripgrep-search-mode-map - "n" 'evil-search-next - "\C-k" 'previous-error-no-select - "\C-j" 'next-error-no-select - "gk" 'previous-error-no-select - "gj" 'next-error-no-select - "{" 'compilation-previous-file - "}" 'compilation-next-file - "i" 'wgrep-change-to-wgrep-mode)) - - -(provide 'evil-collection-ripgrep) -;;; evil-collection-ripgrep.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/rjsx-mode/evil-collection-rjsx-mode.el b/.config/emacs/lisp/evil-collection/modes/rjsx-mode/evil-collection-rjsx-mode.el deleted file mode 100644 index fa99f5f..0000000 --- a/.config/emacs/lisp/evil-collection/modes/rjsx-mode/evil-collection-rjsx-mode.el +++ /dev/null @@ -1,47 +0,0 @@ -;;; evil-collection-rjsx-mode.el --- Bindings for `rjsx-mode' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, rjsx, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `rjsx-mode'. - -;;; Code: -(require 'evil-collection) -(require 'rjsx-mode nil t) - -(defvar rjsx-mode-map) - -(defconst evil-collection-rjsx-maps '(rjsx-mode-map)) - -;;;###autoload -(defun evil-collection-rjsx-mode-setup () - "Set up `evil' bindings for `rjsx-mode'." - (when evil-want-C-d-scroll - (evil-collection-define-key 'insert 'rjsx-mode-map - (kbd "C-d") 'rjsx-delete-creates-full-tag) - (evil-collection-define-key 'normal 'rjsx-mode-map - (kbd "C-d") 'evil-scroll-down))) - -(provide 'evil-collection-rjsx-mode) -;;; evil-collection-rjsx-mode.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/robe/evil-collection-robe.el b/.config/emacs/lisp/evil-collection/modes/robe/evil-collection-robe.el deleted file mode 100644 index 48480b5..0000000 --- a/.config/emacs/lisp/evil-collection/modes/robe/evil-collection-robe.el +++ /dev/null @@ -1,45 +0,0 @@ -;;; evil-collection-robe.el --- Bindings for `robe' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: emacs, evil, tools, robe - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `robe'. - -;;; Code: -(require 'evil-collection) -(require 'robe nil t) - -(defconst evil-collection-robe-maps '(robe-mode-map)) - -;;;###autoload -(defun evil-collection-robe-setup () - "Set up `evil' bindings for `robe'." - (evil-collection-define-key 'normal 'robe-mode-map - "gd" 'robe-jump - (kbd "C-t") 'pop-tag-mark - "K" 'robe-doc - "gr" 'robe-rails-refresh)) - -(provide 'evil-collection-robe) -;;; evil-collection-robe.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/rtags/evil-collection-rtags.el b/.config/emacs/lisp/evil-collection/modes/rtags/evil-collection-rtags.el deleted file mode 100644 index 009e46d..0000000 --- a/.config/emacs/lisp/evil-collection/modes/rtags/evil-collection-rtags.el +++ /dev/null @@ -1,141 +0,0 @@ -;;; evil-collection-rtags.el --- Evil bindings for `rtags' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, rtags, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Evil bindings for `rtags'. - -;;; Code: -(require 'evil-collection) -(require 'rtags nil t) - -(defvar rtags-mode-map) -(defvar rtags-dependency-tree-mode-map) -(defvar rtags-references-tree-mode-map) -(defvar rtags-location-stack-visualize-mode-map) - -(defconst evil-collection-rtags-maps '(rtags-mode-map - rtags-dependency-tree-mode-map - rtags-references-tree-mode-map - rtags-location-stack-visualize-mode-map)) - -;;;###autoload -(defun evil-collection-rtags-setup () - "Set up `evil' bindings for `rtags'." - (evil-set-initial-state 'rtags-mode 'normal) - (evil-set-initial-state 'rtags-dependency-tree-mode 'normal) - (evil-set-initial-state 'rtags-references-tree-mode 'normal) - (evil-set-initial-state 'rtags-location-stack-visualize-mode 'normal) - - (evil-collection-define-key 'normal 'rtags-mode-map - ;; open - (kbd "RET") 'rtags-select - (kbd "S-") 'rtags-select-other-window - (kbd "M-") 'rtags-show-in-other-window - (kbd "go") 'rtags-select-other-window - (kbd "gO") 'rtags-show-in-other-window - [mouse-1] 'rtags-select-other-window - [mouse-2] 'rtags-select-other-window - - "c" 'rtags-select-caller - "C" 'rtags-select-caller-other-window - "x" 'rtags-select-and-remove-rtags-buffer - "q" 'rtags-call-bury-or-delete) - - (evil-collection-define-key 'normal 'rtags-dependency-tree-mode-map - (kbd "") 'rtags-dependency-tree-toggle-current-expanded - "E" 'rtags-dependency-tree-expand-all - "c" 'rtags-dependency-tree-collapse-all - "-" 'rtags-dependency-tree-collapse-current - "+" 'rtags-dependency-tree-expand-current - "P" 'rtags-dependency-tree-find-path - "gf" 'rtags-dependency-tree-find-path - - "gj" 'rtags-dependency-tree-next-level - "gk" 'rtags-dependency-tree-previous-level - - (kbd "C-j") 'rtags-dependency-tree-next-level - (kbd "C-k") 'rtags-dependency-tree-previous-level - "]]" 'rtags-dependency-tree-next-level - "[[" 'rtags-dependency-tree-previous-level - - ;; open - (kbd "RET") 'rtags-select - (kbd "S-") 'rtags-select-other-window - (kbd "M-") 'rtags-show-in-other-window - "go" 'rtags-select-other-window - "gO" 'rtags-show-in-other-window - [mouse-1] 'rtags-select-other-window - [mouse-2] 'rtags-select-other-window - "s" 'rtags-show-in-other-window - - "x" 'rtags-select-and-remove-rtags-buffer - "q" 'rtags-call-bury-or-delete) - - (evil-collection-define-key 'normal 'rtags-references-tree-mode-map - (kbd "") 'rtags-references-tree-toggle-current-expanded - - "E" 'rtags-references-tree-expand-all - "c" 'rtags-references-tree-collapse-all - "-" 'rtags-references-tree-collapse-current - "+" 'rtags-references-tree-expand-current - - "gj" 'rtags-references-tree-next-level - "gk" 'rtags-references-tree-previous-level - - (kbd "C-j") 'rtags-references-tree-next-level - (kbd "C-k") 'rtags-references-tree-previous-level - - "]]" 'rtags-references-tree-next-level - "[[" 'rtags-references-tree-previous-level - - ;; open - (kbd "RET") 'rtags-select - (kbd "S-") 'rtags-select-other-window - (kbd "M-") 'rtags-show-in-other-window - "go" 'rtags-select-other-window - "gO" 'rtags-show-in-other-window - [mouse-1] 'rtags-select-other-window - [mouse-2] 'rtags-select-other-window - "s" 'rtags-show-in-other-window - - "x" 'rtags-select-and-remove-rtags-buffer - "q" 'rtags-call-bury-or-delete) - - (evil-collection-define-key 'normal 'rtags-location-stack-visualize-mode-map - ;; open - (kbd "RET") 'rtags-select - (kbd "S-") 'rtags-select-other-window - (kbd "M-") 'rtags-show-in-other-window - (kbd "go") 'rtags-select-other-window - (kbd "gO") 'rtags-show-in-other-window - [mouse-1] 'rtags-select-other-window - [mouse-2] 'rtags-select-other-window - "s" 'rtags-show-in-other-window - - "x" 'rtags-select-and-remove-rtags-buffer - "q" 'rtags-call-bury-or-delete)) - -(provide 'evil-collection-rtags) -;;; evil-collection-rtags.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/ruby-mode/README.org b/.config/emacs/lisp/evil-collection/modes/ruby-mode/README.org deleted file mode 100644 index 9d81ad8..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ruby-mode/README.org +++ /dev/null @@ -1,9 +0,0 @@ -* ruby-mode - - Evil support for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Misc-for-Programmers.html][ruby-mode]]. - -** Notes - - No key bindings are added. =evil-shift-width= is set to - =ruby-indent-level= on =ruby-mode-hook= so that =>>= / =<<= reindent by - the same amount as ruby-mode itself. diff --git a/.config/emacs/lisp/evil-collection/modes/ruby-mode/evil-collection-ruby-mode.el b/.config/emacs/lisp/evil-collection/modes/ruby-mode/evil-collection-ruby-mode.el deleted file mode 100644 index 347e6c8..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ruby-mode/evil-collection-ruby-mode.el +++ /dev/null @@ -1,45 +0,0 @@ -;;; evil-collection-ruby-mode.el --- Bindings for `ruby-mode' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: emacs, tools, ruby - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `ruby-mode'. - -;;; Code: -(require 'evil-collection) -(require 'ruby-mode) - -(defconst evil-collection-ruby-mode-maps nil) - -(defun evil-collection-ruby-mode-set-evil-shift-width () - "Set `evil-shift-width' according to `ruby-indent-level'." - (setq-local evil-shift-width ruby-indent-level)) - -;;;###autoload -(defun evil-collection-ruby-mode-setup () - "Set up `evil' bindings for `ruby'." - (add-hook 'ruby-mode-hook #'evil-collection-ruby-mode-set-evil-shift-width)) - -(provide 'evil-collection-ruby-mode) -;;; evil-collection-ruby-mode.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/scheme/README.org b/.config/emacs/lisp/evil-collection/modes/scheme/README.org deleted file mode 100644 index c9397ba..0000000 --- a/.config/emacs/lisp/evil-collection/modes/scheme/README.org +++ /dev/null @@ -1,17 +0,0 @@ -* scheme - - Evil bindings for =scheme-mode=. - -** Key bindings - - Added to =scheme-mode-map= in normal state. - - | Command | Original | Evil | - |-------------------------------+----------+------| - | =evil-collection-scheme-repl= | n/a | =gz= | - -** New commands - - | Command | Key | | - |-------------------------------+------+------------------------------------------------| - | =evil-collection-scheme-repl= | =gz= | pop to =*scheme*= buffer and call =run-scheme= | diff --git a/.config/emacs/lisp/evil-collection/modes/scheme/evil-collection-scheme.el b/.config/emacs/lisp/evil-collection/modes/scheme/evil-collection-scheme.el deleted file mode 100644 index 3d10dd8..0000000 --- a/.config/emacs/lisp/evil-collection/modes/scheme/evil-collection-scheme.el +++ /dev/null @@ -1,47 +0,0 @@ -;;; evil-collection-scheme.el --- Evil bindings for scheme -*- lexical-binding: t -*- - -;; Copyright (C) 2021 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, lisp, languages - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for scheme. - -;;; Code: -(require 'evil-collection) - -(defconst evil-collection-scheme-maps '(scheme-mode-map)) - -(defun evil-collection-scheme-repl () - "Open the scheme REPL." - (interactive) - (pop-to-buffer (get-buffer-create "*scheme*")) - (call-interactively #'run-scheme)) - -;;;###autoload -(defun evil-collection-scheme-setup () - "Set up `evil' bindings for `scheme'." - (evil-collection-define-key 'normal 'scheme-mode-map - "gz" 'evil-collection-scheme-repl)) - -(provide 'evil-collection-scheme) -;;; evil-collection-scheme.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/scroll-lock/README.org b/.config/emacs/lisp/evil-collection/modes/scroll-lock/README.org deleted file mode 100644 index 4b80844..0000000 --- a/.config/emacs/lisp/evil-collection/modes/scroll-lock/README.org +++ /dev/null @@ -1,24 +0,0 @@ -* scroll-lock - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Scrolling.html][scroll-lock-mode]]. - -** Key bindings - - Standard evil motions are remapped to scroll-lock equivalents so the - cursor stays fixed while the buffer scrolls. - - | Command | Remaps from | - |--------------------------------------------------+---------------------------| - | =evil-collection-scroll-lock-next-line= | =evil-next-line= | - | =evil-collection-scroll-lock-previous-line= | =evil-previous-line= | - | =evil-collection-scroll-lock-forward-paragraph= | =evil-forward-paragraph= | - | =evil-collection-scroll-lock-backward-paragraph= | =evil-backward-paragraph= | - -** New commands - - | Command | | - |--------------------------------------------------+------------------------------------| - | =evil-collection-scroll-lock-next-line= | line-wise scroll down, point fixed | - | =evil-collection-scroll-lock-previous-line= | line-wise scroll up, point fixed | - | =evil-collection-scroll-lock-forward-paragraph= | paragraph scroll down (=:jump t=) | - | =evil-collection-scroll-lock-backward-paragraph= | paragraph scroll up (=:jump t=) | diff --git a/.config/emacs/lisp/evil-collection/modes/scroll-lock/evil-collection-scroll-lock.el b/.config/emacs/lisp/evil-collection/modes/scroll-lock/evil-collection-scroll-lock.el deleted file mode 100644 index ae81b10..0000000 --- a/.config/emacs/lisp/evil-collection/modes/scroll-lock/evil-collection-scroll-lock.el +++ /dev/null @@ -1,87 +0,0 @@ -;;; evil-collection-scroll-lock.el --- Bindings for `scroll-lock' -*- lexical-binding: t -*- - -;; Copyright (C) 2021 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, elisp, lisp - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `scroll-lock'. - -;;; Code: -(require 'scroll-lock) -(require 'evil-collection) - -(declare-function scroll-lock-next-line "scroll-lock") -(declare-function scroll-lock-previous-line "scroll-lock") -(declare-function scroll-lock-forward-paragraph "scroll-lock") -(declare-function scroll-lock-backward-paragraph "scroll-lock") - -(defconst evil-collection-scroll-lock-maps '(scroll-lock-mode-map)) - -(evil-define-motion evil-collection-scroll-lock-next-line (count) - "Scroll down COUNT lines keeping point fixed." - :type line - (let (line-move-visual) - (scroll-lock-next-line (or count 1)))) - -(evil-define-motion evil-collection-scroll-lock-previous-line (count) - "Scroll up COUNT lines keeping point fixed." - :type line - (let (line-move-visual) - (scroll-lock-previous-line (or count 1)))) - -(evil-define-motion evil-collection-scroll-lock-forward-paragraph (count) - "Scroll down COUNT paragraphs keeping point fixed." - :jump t - :type exclusive - (evil-signal-at-bob-or-eob count) - (scroll-lock-forward-paragraph count) - (unless (eobp) (forward-line))) - -(evil-define-motion evil-collection-scroll-lock-backward-paragraph (count) - "Scroll up COUNT paragraphs keeping point fixed." - :jump t - :type exclusive - (evil-signal-at-bob-or-eob (- (or count 1))) - (unless (eobp) (forward-line)) - (scroll-lock-backward-paragraph count) - (unless (bobp) (forward-line -1))) - -;;;###autoload -(defun evil-collection-scroll-lock-setup () - "Set up `evil' bindings for `scroll-lock'." - (evil-collection-define-key 'normal 'scroll-lock-mode-map - [remap evil-next-line] 'evil-collection-scroll-lock-next-line - [remap evil-previous-line] 'evil-collection-scroll-lock-previous-line - [remap evil-forward-paragraph] - 'evil-collection-scroll-lock-forward-paragraph - [remap evil-backward-paragraph] - 'evil-collection-scroll-lock-backward-paragraph) - - (evil-add-command-properties - #'evil-collection-scroll-lock-forward-paragraph :jump t) - (evil-add-command-properties - #'evil-collection-scroll-lock-backward-paragraph :jump t) - - (add-hook 'scroll-lock-mode-hook 'evil-normalize-keymaps)) - -(provide 'evil-collection-scroll-lock) -;;; evil-collection-scroll-lock.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/selectrum/README.org b/.config/emacs/lisp/evil-collection/modes/selectrum/README.org deleted file mode 100644 index aafc019..0000000 --- a/.config/emacs/lisp/evil-collection/modes/selectrum/README.org +++ /dev/null @@ -1,43 +0,0 @@ -* selectrum - - Evil bindings for [[https://github.com/radian-software/selectrum][selectrum]], the incremental narrowing UI for the minibuffer. - - Bindings are installed only when =evil-collection-setup-minibuffer= is - non-nil. - -** Key bindings - -*** selectrum-minibuffer-map (insert and normal) - - | Command | Original | Evil | - |--------------------------------------+----------+---------| - | =selectrum-previous-page= | =M-v= | =C-b= | - | =selectrum-next-page= | =C-v= | =C-f= | - | =selectrum-submit-exact-input= | =C-j= | =M-RET= | - | =selectrum-select-current-candidate= | =RET= | =RET= | - | =selectrum-previous-page= | =M-v= | =C-u= | - | =selectrum-next-page= | =C-v= | =C-d= | - - =C-u= and =C-d= are added only when =evil-want-C-u-scroll= and - =evil-want-C-d-scroll= respectively are non-nil. - -*** selectrum-minibuffer-map (insert) - - | Command | Original | Evil | - |--------------------------------+----------+-------| - | =selectrum-next-candidate= | =C-n= | =C-j= | - | =selectrum-previous-candidate= | =C-p= | =C-k= | - | =selectrum-next-candidate= | =C-n= | =C-n= | - | =selectrum-previous-candidate= | =C-p= | =C-p= | - -*** selectrum-minibuffer-map (normal) - - | Command | Original | Evil | - |--------------------------------+----------+------| - | =selectrum-next-candidate= | n/a | =j= | - | =selectrum-previous-candidate= | n/a | =k= | - | =selectrum-next-group= | =C-q n= | =gj= | - | =selectrum-previous-group= | =C-q p= | =gk= | - | =selectrum-goto-beginning= | =M-<= | =gg= | - | =selectrum-goto-end= | =M->= | =G= | - | =selectrum-kill-ring-save= | =M-w= | =gy= | diff --git a/.config/emacs/lisp/evil-collection/modes/selectrum/evil-collection-selectrum.el b/.config/emacs/lisp/evil-collection/modes/selectrum/evil-collection-selectrum.el deleted file mode 100644 index 525e33d..0000000 --- a/.config/emacs/lisp/evil-collection/modes/selectrum/evil-collection-selectrum.el +++ /dev/null @@ -1,72 +0,0 @@ -;;; evil-collection-selectrum.el --- Evil bindings for Selectrum -*- lexical-binding: t -*- - -;; Copyright (C) 2021 Balaji Sivaraman - -;; Author: Balaji Sivaraman -;; Maintainer: Balaji Sivaraman -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for Selectrum. - -;;; Code: - -(require 'evil-collection) -(require 'selectrum nil t) - -(defconst evil-collection-selectrum-maps '(selectrum-minibuffer-map)) - -;;;###autoload -(defun evil-collection-selectrum-setup () - "Set up `evil' bindings for `selectrum-mode'." - - (defvar evil-collection-setup-minibuffer) - (when evil-collection-setup-minibuffer - (evil-collection-define-key '(insert normal) 'selectrum-minibuffer-map - (kbd "C-b") 'selectrum-previous-page - (kbd "C-f") 'selectrum-next-page - (kbd "M-RET") 'selectrum-submit-exact-input - (kbd "") 'selectrum-select-current-candidate) - - (evil-collection-define-key 'insert 'selectrum-minibuffer-map - (kbd "C-j") 'selectrum-next-candidate - (kbd "C-k") 'selectrum-previous-candidate - (kbd "C-n") 'selectrum-next-candidate - (kbd "C-p") 'selectrum-previous-candidate) - - (evil-collection-define-key 'normal 'selectrum-minibuffer-map - (kbd "j") 'selectrum-next-candidate - (kbd "k") 'selectrum-previous-candidate - (kbd "gj") 'selectrum-next-group - (kbd "gk") 'selectrum-previous-group - (kbd "G") 'selectrum-goto-end - (kbd "gg") 'selectrum-goto-beginning - (kbd "gy") 'selectrum-kill-ring-save) - - (when evil-want-C-u-scroll - (evil-collection-define-key '(insert normal) 'selectrum-minibuffer-map - (kbd "C-u") 'selectrum-previous-page)) - - (when evil-want-C-d-scroll - (evil-collection-define-key '(insert normal) 'selectrum-minibuffer-map - (kbd "C-d") 'selectrum-next-page)))) - -(provide 'evil-collection-selectrum) -;;; evil-collection-selectrum.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/sh-script/README.org b/.config/emacs/lisp/evil-collection/modes/sh-script/README.org deleted file mode 100644 index 0d63469..0000000 --- a/.config/emacs/lisp/evil-collection/modes/sh-script/README.org +++ /dev/null @@ -1,15 +0,0 @@ -* sh-script - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Shell.html][sh-script]] (=sh-mode=). - -** Key bindings - - Added to =sh-mode-map= in normal state. - - | Command | Original | Evil | - |-----------------+----------+------| - | =sh-show-shell= | n/a | =gz= | - -** Notes - - - =evil-shift-width= is set to =sh-basic-offset= on =sh-mode-hook=. diff --git a/.config/emacs/lisp/evil-collection/modes/sh-script/evil-collection-sh-script.el b/.config/emacs/lisp/evil-collection/modes/sh-script/evil-collection-sh-script.el deleted file mode 100644 index 35a7bff..0000000 --- a/.config/emacs/lisp/evil-collection/modes/sh-script/evil-collection-sh-script.el +++ /dev/null @@ -1,48 +0,0 @@ -;;; evil-collection-sh-script.el --- Evil bindings for sh-script -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for sh-script. - -;;; Code: -(require 'evil-collection) -(require 'sh-script) - -(defconst evil-collection-sh-script-maps '(sh-mode-map)) - -(defun evil-collection-sh-script-set-evil-shift-width () - "Set `evil-shift-width' according to `sh-basic-offset'." - (setq-local evil-shift-width sh-basic-offset)) - -;;;###autoload -(defun evil-collection-sh-script-setup () - "Set up `evil' bindings for `sh-script'." - (add-hook 'sh-mode-hook #'evil-collection-sh-script-set-evil-shift-width) - - (evil-collection-define-key 'normal 'sh-mode-map - "gz" 'sh-show-shell)) - -(provide 'evil-collection-sh-script) -;;; evil-collection-sh-script.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/shell-maker/evil-collection-shell-maker.el b/.config/emacs/lisp/evil-collection/modes/shell-maker/evil-collection-shell-maker.el deleted file mode 100644 index 710fbf4..0000000 --- a/.config/emacs/lisp/evil-collection/modes/shell-maker/evil-collection-shell-maker.el +++ /dev/null @@ -1,65 +0,0 @@ -;;; evil-collection-shell-maker.el --- Bindings for `shell-maker' -*- lexical-binding: t -*- - -;; Copyright (C) 2026 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "27.1")) -;; Keywords: evil, shell-maker, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `shell-maker'. -;;; -;;; These bindings apply to `shell-maker-mode' and any derived mode that -;;; doesn't override RET / S-RET in its own evil state map (for example, -;;; `agent-shell-mode' inherits from `shell-maker-mode-map'). - -;;; Code: -(require 'evil-collection) -(require 'shell-maker nil t) - -(defgroup evil-collection-shell-maker nil - "Evil bindings for `shell-maker'." - :group 'evil-collection) - -(make-obsolete-variable 'evil-collection-shell-maker-submit-state - 'evil-collection-repl-submit-state - "evil-collection 0.0.2") - -(defconst evil-collection-shell-maker-maps '(shell-maker-mode-map)) - - -(defvar shell-maker-mode-map) - -;;;###autoload -(defun evil-collection-shell-maker-setup () - "Set up `evil' bindings for `shell-maker'." - (let* ((submit evil-collection-repl-submit-state) - (newline-state (if (eq submit 'normal) 'insert 'normal))) - (evil-collection-define-key submit 'shell-maker-mode-map - (kbd "RET") 'shell-maker-submit) - (evil-collection-define-key newline-state 'shell-maker-mode-map - (kbd "RET") 'newline)) - - (evil-collection-define-key 'insert 'shell-maker-mode-map - (kbd "S-") 'newline) - (evil-collection-define-key 'normal 'shell-maker-mode-map - (kbd "S-") 'newline)) - -(provide 'evil-collection-shell-maker) -;;; evil-collection-shell-maker.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/shortdoc/README.org b/.config/emacs/lisp/evil-collection/modes/shortdoc/README.org deleted file mode 100644 index ec50145..0000000 --- a/.config/emacs/lisp/evil-collection/modes/shortdoc/README.org +++ /dev/null @@ -1,20 +0,0 @@ -* shortdoc - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Documentation-Groups.html][shortdoc]]. - -** Key bindings - - Bindings added to =shortdoc-mode-map= in normal state (initial state: - normal). - - | Command | Original | Evil | - |-----------------------------+----------------+-------------| - | =forward-button= | n/a | =TAB= | - | =backward-button= | n/a | == | - | =shortdoc-next= | =n= | =C-j= | - | =shortdoc-previous= | =p= | =C-k= | - | =shortdoc-next-section= | =N=, =C-c C-n= | =]]= | - | =shortdoc-previous-section= | =P=, =C-c C-p= | =[[= | - - The upstream =n=, =p=, =N=, =P=, =w= keys keep their bindings so they - remain available alongside the evil-friendly additions. diff --git a/.config/emacs/lisp/evil-collection/modes/shortdoc/evil-collection-shortdoc.el b/.config/emacs/lisp/evil-collection/modes/shortdoc/evil-collection-shortdoc.el deleted file mode 100644 index 03e5061..0000000 --- a/.config/emacs/lisp/evil-collection/modes/shortdoc/evil-collection-shortdoc.el +++ /dev/null @@ -1,49 +0,0 @@ -;;; evil-collection-shortdoc.el --- Evil bindings for shortdoc -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; TODO: Update to emacs 28.1 when it's out -;; Package-Requires: ((emacs "27.1")) -;; Keywords: evil, lisp, help - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for shortdoc. - -;;; Code: -(require 'evil-collection) -(require 'shortdoc nil t) - -(defconst evil-collection-shortdoc-maps '(shortdoc-mode-map)) - -;;;###autoload -(defun evil-collection-shortdoc-setup () - "Set up `evil' bindings for `shortdoc'." - (evil-set-initial-state 'shortdoc-mode 'normal) - (evil-collection-define-key 'normal 'shortdoc-mode-map - (kbd "") 'forward-button - (kbd "") 'backward-button - (kbd "C-k") 'shortdoc-previous - (kbd "C-j") 'shortdoc-next - "[[" 'shortdoc-previous-section - "]]" 'shortdoc-next-section)) - -(provide 'evil-collection-shortdoc) -;;; evil-collection-shortdoc.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/simple-mpc/evil-collection-simple-mpc.el b/.config/emacs/lisp/evil-collection/modes/simple-mpc/evil-collection-simple-mpc.el deleted file mode 100644 index fea1bb0..0000000 --- a/.config/emacs/lisp/evil-collection/modes/simple-mpc/evil-collection-simple-mpc.el +++ /dev/null @@ -1,122 +0,0 @@ -;;; evil-collection-simple-mpc.el --- Bindings for `simple-mpc' -*- lexical-binding: t -*- -;; Copyright (C) 2022 Joseph Turner - -;; Author: Joseph Turner -;; Maintainer: Joseph Turner -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, simple-mpc, processes, mpd - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `simple-mpc'. - -;;; Code: -(require 'simple-mpc nil t) -(require 'evil-collection) - -(defconst evil-collection-simple-mpc-maps '(simple-mpc-mode-map - simple-mpc-query-mode-map - simple-mpc-current-playlist-mode-map)) - -(defun evil-collection-simple-mpc-set-bindings () - "Set up `evil' bindings for `simple-mpc'. - -Other modes that are configured: -`simple-mpc-mode' -`simple-mpc-query-mode' -`simple-mpc-current-playlist-mode'" - (evil-collection-define-key 'normal 'simple-mpc-mode-map - "p" 'simple-mpc-toggle - ">" 'simple-mpc-next - "<" 'simple-mpc-prev - "f" 'simple-mpc-seek-forward - "b" 'simple-mpc-seek-backward - "s" 'simple-mpc-query - "c" 'simple-mpc-view-current-playlist - "l" 'simple-mpc-load-playlist - "S" 'simple-mpc-shuffle-current-playlist - "C" 'simple-mpc-clear-current-playlist - "+" 'simple-mpc-increase-volume - "-" 'simple-mpc-decrease-volume - - "q" 'simple-mpc-quit - "ZQ" 'simple-mpc-quit - "ZZ" 'simple-mpc-quit) - - (evil-collection-define-key 'normal 'simple-mpc-current-playlist-mode-map - "x" 'simple-mpc-delete - "d" 'simple-mpc-delete - - "q" 'simple-mpc-current-playlist-quit - "ZQ" 'simple-mpc-current-playlist-quit - "ZZ" 'simple-mpc-current-playlist-quit - - "" 'simple-mpc-play-current-line - (kbd "RET") 'simple-mpc-play-current-line) - - (evil-collection-define-key 'normal 'simple-mpc-query-mode-map - "o" 'simple-mpc-query-sort - - "q" 'simple-mpc-query-quit - "ZQ" 'simple-mpc-query-quit - "ZZ" 'simple-mpc-query-quit - - "" 'simple-mpc-query-add - (kbd "M-RET") 'simple-mpc-query-add - - "" 'simple-mpc-query-add-and-play - (kbd "RET") 'simple-mpc-query-add-and-play)) - -(defvar simple-mpc-main-buffer-name "*simple-mpc-main*") - -(defun evil-collection-simple-mpc-replace-main-view () - "Update main view to show keys in use with evil mode." - (interactive) - (when - (string= (buffer-name) simple-mpc-main-buffer-name) - (read-only-mode -1) - (erase-buffer) - (insert (propertize "* simple-mpc *\n\n" - 'face 'simple-mpc-main-name) - (propertize " * controls\n" 'face 'simple-mpc-main-headers) - " * [p]lay/pause toggle\n" - " * [>] next track\n" - " * [<] previous track\n" - " * seek [f]orward\n" - - " * seek [b]ackward\n" - " * [+] increase volume\n" - " * [-] decrease volume\n" - (propertize "\n * playlist\n" 'face 'simple-mpc-main-headers) - " * view [c]urrent playlist\n" - " * [C]lear current playlist\n" - " * [S]huffle playlist\n" - " * [l]oad playlist\n" - " * [s]earch database\n" - (propertize "\n * misc\n" 'face 'simple-mpc-main-headers) - " * [q]uit"))) - -;;;###autoload -(defun evil-collection-simple-mpc-setup () - "Set up simple-mpc bindings and main view." - (evil-collection-simple-mpc-set-bindings) - (add-hook 'simple-mpc-mode-hook 'evil-collection-simple-mpc-replace-main-view) - (add-hook 'simple-mpc-query-mode-hook 'evil-normalize-keymaps) - (add-hook 'simple-mpc-current-playlist-mode-hook 'evil-normalize-keymaps)) - -(provide 'evil-collection-simple-mpc) -;;; evil-collection-simple-mpc.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/simple/README.org b/.config/emacs/lisp/evil-collection/modes/simple/README.org deleted file mode 100644 index 5cbc496..0000000 --- a/.config/emacs/lisp/evil-collection/modes/simple/README.org +++ /dev/null @@ -1,23 +0,0 @@ -* simple - - Evil bindings for =special-mode-map=, the base keymap shared by many - read-only Emacs buffers. - -** Key bindings - - Applies =evil-collection-set-readonly-bindings= to =special-mode-map= - (standard motion / quit bindings for read-only buffers), then layers: - - | Command | Original | Evil | - |-----------------+----------+------| - | =revert-buffer= | =g= | =gr= | - - The following upstream single-letter bindings are unset so they do not - shadow evil normal-state keys: - - | Key | Was upstream | - |-----+------------------| - | =g= | =revert-buffer= | - | =h= | =describe-mode= | - | =?= | =describe-mode= | - | =0= | =digit-argument= | diff --git a/.config/emacs/lisp/evil-collection/modes/simple/evil-collection-simple.el b/.config/emacs/lisp/evil-collection/modes/simple/evil-collection-simple.el deleted file mode 100644 index 9f8b7b6..0000000 --- a/.config/emacs/lisp/evil-collection/modes/simple/evil-collection-simple.el +++ /dev/null @@ -1,49 +0,0 @@ -;;; evil-collection-simple.el --- Bindings for `simple' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `simple' - -;;; Code: -(require 'evil-collection) -(require 'simple) - -(defvar special-mode-map) - -(defconst evil-collection-simple-maps '(special-mode-map)) - -;;;###autoload -(defun evil-collection-simple-setup () - "Set up `evil' bindings for `simple'." - (evil-collection-set-readonly-bindings 'special-mode-map) - (evil-collection-define-key nil 'special-mode-map - "g" nil - "gr" 'revert-buffer - "h" nil - "?" nil - "0" nil)) - -(provide 'evil-collection-simple) -;;; evil-collection-simple.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/slime/evil-collection-slime.el b/.config/emacs/lisp/evil-collection/modes/slime/evil-collection-slime.el deleted file mode 100644 index f89af6f..0000000 --- a/.config/emacs/lisp/evil-collection/modes/slime/evil-collection-slime.el +++ /dev/null @@ -1,222 +0,0 @@ -;;; evil-collection-slime.el --- Evil bindings for `slime' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, slime, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `slime-mode'. - -;;; Code: -(require 'evil-collection) -(require 'slime nil t) - -(defvar slime-parent-map) -(defvar sldb-mode-map) -(defvar slime-inspector-mode-map) -(defvar slime-mode-map) -(defvar slime-popup-buffer-mode-map) -(defvar slime-thread-control-mode-map) -(defvar slime-xref-mode-map) - -(defconst evil-collection-slime-maps '(slime-parent-map - sldb-mode-map - slime-inspector-mode-map - slime-mode-map - slime-popup-buffer-mode-map - slime-thread-control-mode-map - slime-xref-mode-map)) - -(defun evil-collection-slime-last-sexp (command &rest args) - "In normal-state or motion-state, last sexp ends at point." - (if (and (not evil-move-beyond-eol) - (or (evil-normal-state-p) (evil-motion-state-p))) - (save-excursion - (unless (or (eobp) (eolp)) (forward-char)) - (apply command args)) - (apply command args))) - -;;;###autoload -(defun evil-collection-slime-setup () - "Set up `evil' bindings for `slime'." - (unless evil-move-beyond-eol - (advice-add 'slime-eval-last-expression :around 'evil-collection-slime-last-sexp) - (advice-add 'slime-pprint-eval-last-expression :around 'evil-collection-slime-last-sexp) - (advice-add 'slime-eval-print-last-expression :around 'evil-collection-slime-last-sexp) - (advice-add 'slime-eval-last-expression-in-repl - :around 'evil-collection-slime-last-sexp)) - - (evil-set-initial-state 'sldb-mode 'normal) - (evil-set-initial-state 'slime-inspector-mode 'normal) - (evil-set-initial-state 'slime-popup-buffer-mode 'normal) - (evil-set-initial-state 'slime-thread-control-mode 'normal) - (evil-set-initial-state 'slime-xref-mode 'normal) - - (evil-collection-define-key 'normal 'slime-parent-map - "gd" 'slime-edit-definition - (kbd "C-t") 'slime-pop-find-definition-stack) - - (evil-collection-define-key 'normal 'sldb-mode-map - (kbd "RET") 'sldb-default-action - [mouse-2] 'sldb-default-action/mouse - [follow-link] 'mouse-face - "\C-i" 'sldb-cycle - "g?" 'describe-mode - "S" 'sldb-show-source - "e" 'sldb-eval-in-frame - "d" 'sldb-pprint-eval-in-frame - "D" 'sldb-disassemble - "i" 'sldb-inspect-in-frame - "gj" 'sldb-down - "gk" 'sldb-up - (kbd "C-j") 'sldb-down - (kbd "C-k") 'sldb-up - "]]" 'sldb-details-down - "[[" 'sldb-details-up - (kbd "M-j") 'sldb-details-down - (kbd "M-k") 'sldb-details-up - "gg" 'sldb-beginning-of-backtrace - "G" 'sldb-end-of-backtrace - "t" 'sldb-toggle-details - "gr" 'sldb-restart-frame - "I" 'sldb-invoke-restart-by-name - "R" 'sldb-return-from-frame - "c" 'sldb-continue - "s" 'sldb-step - "n" 'sldb-next - "o" 'sldb-out - "b" 'sldb-break-on-return - "a" 'sldb-abort - "q" 'sldb-quit - "A" 'sldb-break-with-system-debugger - "B" 'sldb-break-with-default-debugger - "P" 'sldb-print-condition - "C" 'sldb-inspect-condition - "g:" 'slime-interactive-eval - "0" 'sldb-invoke-restart-0 - "1" 'sldb-invoke-restart-1 - "2" 'sldb-invoke-restart-2 - "3" 'sldb-invoke-restart-3 - "4" 'sldb-invoke-restart-4 - "5" 'sldb-invoke-restart-5 - "6" 'sldb-invoke-restart-6 - "7" 'sldb-invoke-restart-7 - "8" 'sldb-invoke-restart-8 - "9" 'sldb-invoke-restart-9) - - (evil-collection-define-key 'normal 'slime-inspector-mode-map - (kbd "RET") 'slime-inspector-operate-on-point - [mouse-1] 'slime-inspector-operate-on-click - [mouse-2] 'slime-inspector-operate-on-click - [mouse-6] 'slime-inspector-pop - [mouse-7] 'slime-inspector-next - ;; TODO: `slime-inspector-next' and `slime-inspector-pop' should probably - ;; just be bound to C-i and C-o. - "gk" 'slime-inspector-pop - (kbd "C-k") 'slime-inspector-pop - "[[" 'slime-inspector-pop - (kbd "C-o") 'slime-inspector-pop - "gj" 'slime-inspector-next - (kbd "C-j") 'slime-inspector-next - "]]" 'slime-inspector-next - (kbd "C-i") 'slime-inspector-next - "K" 'slime-inspector-describe - "p" 'slime-inspector-pprint - "e" 'slime-inspector-eval - "M-p" 'slime-inspector-history - "gr" 'slime-inspector-reinspect - "gv" 'slime-inspector-toggle-verbose - (kbd "") 'slime-inspector-next-inspectable-object - (kbd "C-i") 'slime-inspector-next-inspectable-object - (kbd "") 'slime-inspector-previous-inspectable-object ; Emacs translates S-TAB - (kbd "") 'slime-inspector-previous-inspectable-object ; to BACKTAB on X. - "." 'slime-inspector-show-source - "gd" 'slime-inspector-show-source - "gR" 'slime-inspector-fetch-all - "q" 'slime-inspector-quit) - - (evil-collection-define-key 'normal 'slime-mode-map - (kbd "K") 'slime-describe-symbol - (kbd "C-t") 'slime-pop-find-definition-stack - ;; goto - "gd" 'slime-edit-definition - "gz" 'slime-switch-to-output-buffer) - - (when evil-collection-want-find-usages-bindings - (evil-collection-define-key 'normal 'slime-mode-map - "gr" 'slime-edit-uses)) - - (evil-collection-define-key 'normal 'slime-popup-buffer-mode-map - ;; quit - "q" 'quit-window - - (kbd "C-t") 'slime-pop-find-definition-stack - - ;; goto - "gd" 'slime-edit-definition) - - (evil-collection-inhibit-insert-state 'slime-thread-control-mode-map) - (evil-collection-define-key 'normal 'slime-thread-control-mode-map - "a" 'slime-thread-attach - "d" 'slime-thread-debug - "x" 'slime-thread-kill - "gr" 'slime-update-threads-buffer) - - (evil-collection-define-key 'normal 'slime-xref-mode-map - (kbd "RET") 'slime-goto-xref - (kbd "S-") 'slime-goto-xref - "go" 'slime-show-xref - "gj" 'slime-xref-next-line - "gk" 'slime-xref-prev-line - (kbd "C-j") 'slime-xref-next-line - (kbd "C-k") 'slime-xref-prev-line - "]]" 'slime-xref-next-line - "[[" 'slime-xref-prev-line - "gr" 'slime-recompile-xref - "gR" 'slime-recompile-all-xrefs - "r" 'slime-xref-retract) - - (let* ((submit evil-collection-repl-submit-state) - (newline-state (if (eq submit 'normal) 'insert 'normal))) - (evil-collection-define-key submit 'slime-repl-mode-map - (kbd "RET") 'slime-repl-return - (kbd "\C-m") 'slime-repl-return - [return] 'slime-repl-return) - (evil-collection-define-key newline-state 'slime-repl-mode-map - (kbd "RET") 'slime-repl-newline-and-indent - (kbd "\C-m") 'slime-repl-newline-and-indent - [return] 'slime-repl-newline-and-indent)) - - (evil-collection-define-key 'normal 'slime-repl-mode-map - "gj" 'slime-repl-next-prompt - "gk" 'slime-repl-previous-prompt - (kbd "C-j") 'slime-repl-next-prompt - (kbd "C-k") 'slime-repl-previous-prompt - "]]" 'slime-repl-next-prompt - "[[" 'slime-repl-previous-prompt - (kbd "C-p") 'slime-repl-previous-input - (kbd "C-n") 'slime-repl-next-input) - - (add-hook 'slime-popup-buffer-mode-hook #'evil-normalize-keymaps)) - -(provide 'evil-collection-slime) -;;; evil-collection-slime.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/sly/evil-collection-sly.el b/.config/emacs/lisp/evil-collection/modes/sly/evil-collection-sly.el deleted file mode 100644 index 0443f2a..0000000 --- a/.config/emacs/lisp/evil-collection/modes/sly/evil-collection-sly.el +++ /dev/null @@ -1,276 +0,0 @@ -;;; evil-collection-sly.el --- Evil bindings for `sly' -*- lexical-binding: t -*- - -;; Copyright (C) 2019 Pierre Neidhardt - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, sly, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `sly-mode'. - -;;; Code: -;; WARNING: This mirrors evil-collection-slime.el. Keep them in sync! - -(require 'evil-collection) -(require 'sly nil t) - -(declare-function sly-last-expression "sly") -(declare-function sly-eval-print "sly") - -(defvar sly-connection-list-mode-map) -(defvar sly-db-mode-map) -(defvar sly-inspector-mode-map) -(defvar sly-mode-map) -(defvar sly-popup-buffer-mode-map) -(defvar sly-thread-control-mode-map) -(defvar sly-trace-dialog-mode-map) -(defvar sly-stickers--replay-mode-map) -(defvar sly-xref-mode-map) - -(defconst evil-collection-sly-maps '(sly-connection-list-mode-map - sly-db-mode-map - sly-inspector-mode-map - sly-mode-map - sly-popup-buffer-mode-map - sly-stickers--replay-mode-map - sly-thread-control-mode-map - sly-trace-dialog-mode-map - sly-xref-mode-map)) - -;; Same as `evil-collection-slime-last-sexp'. -(defun evil-collection-sly-last-sexp (command &rest args) - "In normal-state or motion-state, last sexp ends at point." - (if (and (not evil-move-beyond-eol) - (or (evil-normal-state-p) (evil-motion-state-p))) - (save-excursion - (unless (or (eobp) (eolp)) (forward-char)) - (apply command args)) - (apply command args))) - -(defun evil-collection-sly-eval-print-last-expression (string) - "Evaluate sexp before point; print value into the current buffer. - -Evil version of `sly-eval-print-last-expression' that accounts for -`evil-move-beyond-eol'." - (interactive - (list (progn - (when (and (not evil-move-beyond-eol) - (or (evil-normal-state-p) (evil-motion-state-p))) - (unless (or (eobp) (eolp)) - (forward-char))) - (sly-last-expression)))) - (insert "\n") - (sly-eval-print string)) - -;;;###autoload -(defun evil-collection-sly-setup () - "Set up `evil' bindings for `sly'." - (unless evil-move-beyond-eol - (advice-add 'sly-eval-last-expression :around 'evil-collection-sly-last-sexp) - (advice-add 'sly-pprint-eval-last-expression :around 'evil-collection-sly-last-sexp) - (advice-add 'sly-mrepl-return :around 'evil-collection-sly-last-sexp) - (advice-add 'sly-eval-print-last-expression :override 'evil-collection-sly-eval-print-last-expression)) - - (evil-collection-define-key 'normal 'sly-db-mode-map - [follow-link] 'mouse-face - "\C-i" 'sly-db-cycle - "g?" 'describe-mode - "S" 'sly-db-show-frame-source - "e" 'sly-db-eval-in-frame - "d" 'sly-db-pprint-eval-in-frame - "D" 'sly-db-disassemble - "i" 'sly-db-inspect-in-frame - "gj" 'sly-db-down - "gk" 'sly-db-up - (kbd "C-j") 'sly-db-down - (kbd "C-k") 'sly-db-up - "]]" 'sly-db-details-down - "[[" 'sly-db-details-up - (kbd "M-j") 'sly-db-details-down - (kbd "M-k") 'sly-db-details-up - "gg" 'sly-db-beginning-of-backtrace - "G" 'sly-db-end-of-backtrace - "t" 'sly-db-toggle-details - "gr" 'sly-db-restart-frame - "I" 'sly-db-invoke-restart-by-name - "R" 'sly-db-return-from-frame - "c" 'sly-db-continue - "s" 'sly-db-step - "n" 'sly-db-next - "o" 'sly-db-out - "b" 'sly-db-break-on-return - "a" 'sly-db-abort - "q" 'sly-db-quit - "A" 'sly-db-break-with-system-debugger - "B" 'sly-db-break-with-default-debugger - "P" 'sly-db-print-condition - "C" 'sly-db-inspect-condition - "g:" 'sly-interactive-eval - "0" 'sly-db-invoke-restart-0 - "1" 'sly-db-invoke-restart-1 - "2" 'sly-db-invoke-restart-2 - "3" 'sly-db-invoke-restart-3 - "4" 'sly-db-invoke-restart-4 - "5" 'sly-db-invoke-restart-5 - "6" 'sly-db-invoke-restart-6 - "7" 'sly-db-invoke-restart-7 - "8" 'sly-db-invoke-restart-8 - "9" 'sly-db-invoke-restart-9) - - (evil-collection-define-key 'normal 'sly-inspector-mode-map - [mouse-6] 'sly-inspector-pop - [mouse-7] 'sly-inspector-next - ;; TODO: `sly-inspector-next' and `sly-inspector-pop' should probably - ;; just be bound to C-i and C-o. - "gk" 'sly-inspector-pop - (kbd "C-k") 'sly-inspector-pop - "[[" 'sly-inspector-pop - (kbd "C-o") 'sly-inspector-pop - "gj" 'sly-inspector-next - (kbd "C-j") 'sly-inspector-next - "]]" 'sly-inspector-next - (kbd "C-i") 'sly-inspector-next - "K" 'sly-inspector-describe-inspectee - "e" 'sly-inspector-eval - "M-p" 'sly-inspector-history - "gr" 'sly-inspector-reinspect - "gv" 'sly-inspector-toggle-verbose - (kbd "") 'forward-button - (kbd "C-i") 'forward-button - (kbd "") 'backward-button ; Emacs translates S-TAB - (kbd "") 'backward-button ; to BACKTAB on X. - "." 'sly-edit-definition - "gd" 'sly-edit-definition - "gR" 'sly-inspector-fetch-all - "q" 'sly-inspector-quit) - - (evil-collection-define-key 'normal 'sly-mode-map - (kbd "K") 'sly-describe-symbol - (kbd "C-t") 'sly-pop-find-definition-stack - ;; goto - "gd" 'sly-edit-definition - "gz" 'sly-mrepl) - - (when evil-collection-want-find-usages-bindings - (evil-collection-define-key 'normal 'sly-mode-map - "gr" 'sly-who-references)) - - (evil-collection-define-key 'normal 'sly-popup-buffer-mode-map - ;; quit - "q" 'quit-window - - (kbd "C-t") 'sly-pop-find-definition-stack - - ;; goto - "gd" 'sly-edit-definition) - - (evil-collection-inhibit-insert-state 'sly-thread-control-mode-map) - (evil-collection-define-key 'normal 'sly-thread-control-mode-map - "a" 'sly-thread-attach - "d" 'sly-thread-debug - "x" 'sly-thread-kill - "gr" 'sly-update-threads-buffer) - - (evil-collection-define-key 'normal 'sly-xref-mode-map - "q" 'quit-window - (kbd "RET") 'sly-xref-goto - (kbd "SPC") 'sly-xref-show - "go" 'sly-show-xref - (kbd "") 'forward-button - (kbd "C-i") 'forward-button - (kbd "") 'backward-button ; Emacs translates S-TAB - (kbd "") 'backward-button ; to BACKTAB on X. - "gj" 'sly-xref-next-line - "gk" 'sly-xref-prev-line - (kbd "C-j") 'sly-xref-next-line - (kbd "C-k") 'sly-xref-prev-line - "]]" 'sly-xref-next-line - "[[" 'sly-xref-prev-line - "gr" 'sly-recompile-xref - "gR" 'sly-recompile-all-xrefs - ;; "r" 'sly-xref-retract ; TODO: Equivalent for Sly? - ) - - (let* ((submit evil-collection-repl-submit-state) - (newline-state (if (eq submit 'normal) 'insert 'normal))) - (evil-collection-define-key submit 'sly-mrepl-mode-map - (kbd "RET") 'sly-mrepl-return) - (evil-collection-define-key newline-state 'sly-mrepl-mode-map - (kbd "RET") 'newline)) - - (evil-collection-define-key 'normal 'sly-mrepl-mode-map - "gj" 'sly-mrepl-next-prompt - "gk" 'sly-mrepl-previous-prompt - (kbd "C-j") 'sly-mrepl-next-prompt - (kbd "C-k") 'sly-mrepl-previous-prompt - "]]" 'sly-mrepl-next-prompt - "[[" 'sly-mrepl-previous-prompt - (kbd "C-p") 'sly-mrepl-previous-input-or-button - (kbd "C-n") 'sly-mrepl-next-input-or-button) - - (evil-collection-define-key 'normal 'sly-trace-dialog-mode-map - "q" 'quit-window - "gr" 'sly-trace-dialog-fetch-status - "gR" 'sly-trace-dialog-fetch-traces) - - (evil-collection-define-key 'normal 'sly-stickers--replay-mode-map - ;; The "n", "p", "x", "h" and "q" key are hard-coded in the description, so - ;; we need to set them to the expected command. - "gg" 'sly-stickers-replay-jump-to-beginning - "G" 'sly-stickers-replay-jump-to-end - "F" 'sly-stickers-forget - "J" 'sly-stickers-replay-next-for-sticker - "K" 'sly-stickers-replay-prev-for-sticker - "N" 'sly-stickers-replay-next-for-sticker - "P" 'sly-stickers-replay-prev-for-sticker - "R" 'sly-stickers-replay-reset-ignore-list - "zv" 'sly-stickers-replay-toggle-pop-to-stickers - "h" 'sly-stickers-replay-toggle-help - "g?" 'sly-stickers-replay-toggle-help - "gd" 'sly-stickers-replay-jump - "j" 'sly-stickers-replay-next - "k" 'sly-stickers-replay-prev - "n" 'sly-stickers-replay-next - "p" 'sly-stickers-replay-prev - "q" 'quit-window - "go" 'sly-stickers-replay-pop-to-current-sticker - "v" 'sly-stickers-replay-pop-to-current-sticker - "x" 'sly-stickers-replay-toggle-ignore-sticker - "zi" 'sly-stickers-replay-toggle-ignore-sticker - "zz" 'sly-stickers-replay-toggle-ignore-zombies) - - (evil-collection-define-key 'normal 'sly-connection-list-mode-map - (kbd "") 'forward-button - (kbd "C-i") 'forward-button - (kbd "") 'backward-button - (kbd "") 'backward-button - (kbd "RET") 'sly-connection-list-default-action - "R" 'sly-restart-connection-at-point - "d" 'sly-connection-list-make-default - "x" 'sly-quit-connection-at-point - "gr" 'sly-update-connection-list - "o" 'tabulated-list-sort - "q" 'quit-window) - - (add-hook 'sly-popup-buffer-mode-hook #'evil-normalize-keymaps)) - -(provide 'evil-collection-sly) -;;; evil-collection-sly.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/smerge-mode/README.org b/.config/emacs/lisp/evil-collection/modes/smerge-mode/README.org deleted file mode 100644 index 44871a7..0000000 --- a/.config/emacs/lisp/evil-collection/modes/smerge-mode/README.org +++ /dev/null @@ -1,16 +0,0 @@ -* smerge - - The table below shows the binding changes that are made to smerge-mode. - -| Command | Original Binding | evil-collection-smerge | -|----------------------------+------------------+------------------------| -| =smerge-next= | =C-c ^ n= | =gj, ]]= | -| =smerge-prev= | =C-c ^ p= | =gk, [[= | -| =smerge-keep-all= | =C-c ^ a= | =ga= | -| =smerge-keep-upper= | =C-c ^ u= | =gu= | -| =smerge-keep-lower= | =C-c ^ l= | =gl= | -| =smerge-keep-other= | =C-c ^ o= | =go= | -| =smerge-keep-mine= | =C-c ^ m= | =gm= | -| =smerge-combine-with-next= | =C-c ^ C= | =gc= | -| =smerge-refine= | =C-c ^ R= | =gr= | -| =smerge-keep-base= | =C-c ^ b= | =gb= | diff --git a/.config/emacs/lisp/evil-collection/modes/smerge-mode/evil-collection-smerge-mode.el b/.config/emacs/lisp/evil-collection/modes/smerge-mode/evil-collection-smerge-mode.el deleted file mode 100644 index fa939c5..0000000 --- a/.config/emacs/lisp/evil-collection/modes/smerge-mode/evil-collection-smerge-mode.el +++ /dev/null @@ -1,54 +0,0 @@ -;;; evil-collection-smerge-mode.el --- Bindings for `smerge-mode' -*- lexical-binding: t -*- - -;; Copyright (C) 2021 pspiagicw - -;; Author: pspiagicw -;; Maintainer: pspiagicw -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, python, tools, emacs - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `smerge-mode'. -;;; Code: -(require 'evil-collection) -(require 'smerge-mode) -;; - -(defconst evil-collection-smerge-mode-maps '(smerge-mode-map)) - -;;;###autoload -(defun evil-collection-smerge-mode-setup () - "Setup up `evil' bindings for `smerge-mode'." - (add-hook 'smerge-mode-hook #'evil-normalize-keymaps) - (evil-collection-define-key 'normal 'smerge-mode-map - "gj" 'smerge-next - "]]" 'smerge-next - "gk" 'smerge-prev - "[[" 'smerge-prev - "gr" 'smerge-resolve - "ga" 'smerge-keep-all - "gu" 'smerge-keep-upper - "gl" 'smerge-keep-lower - "go" 'smerge-keep-other - "gm" 'smerge-keep-mine - "gc" 'smerge-combine-with-next - "gR" 'smerge-refine - "gb" 'smerge-keep-base)) - -(provide 'evil-collection-smerge-mode) -;;; evil-collection-smerge-mode.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/snake/README.org b/.config/emacs/lisp/evil-collection/modes/snake/README.org deleted file mode 100644 index 0234ac4..0000000 --- a/.config/emacs/lisp/evil-collection/modes/snake/README.org +++ /dev/null @@ -1,16 +0,0 @@ -* snake - - Evil bindings for =snake=, the built-in implementation of the classic arcade game. - -** Key bindings - - | Command | Original | Evil | - |--------------------+------------------+-----------| - | =snake-move-left= | ==, =C-b= | =h= | - | =snake-move-right= | ==, =C-f= | =l= | - | =snake-move-down= | ==, =C-n= | =j= | - | =snake-move-up= | ==, =C-p= | =k= | - | =snake-start-game= | =n= | =gr= | - | =snake-pause-game= | =p= | =p= | - | =snake-end-game= | =q= | =ZZ= | - | =quit-window= | n/a | =q=, =ZQ= | diff --git a/.config/emacs/lisp/evil-collection/modes/snake/evil-collection-snake.el b/.config/emacs/lisp/evil-collection/modes/snake/evil-collection-snake.el deleted file mode 100644 index f1fc86e..0000000 --- a/.config/emacs/lisp/evil-collection/modes/snake/evil-collection-snake.el +++ /dev/null @@ -1,50 +0,0 @@ -;;; evil-collection-snake.el --- Bindings for `snake' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen -;; Copyright (C) 2022 Farzin Firouzi - -;; Author: Farzin Firouzi -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `snake'. - -;;; Code: -(require 'evil-collection) - -(defconst evil-collection-snake-maps '(snake-mode-map)) - -;;;###autoload -(defun evil-collection-snake-setup () - "Set up `evil' bindings for `snake'." - (evil-set-initial-state 'snake-mode 'normal) - (evil-collection-define-key 'normal 'snake-mode-map - "h" 'snake-move-left - "l" 'snake-move-right - "j" 'snake-move-down - "k" 'snake-move-up - "gr" 'snake-start-game - "p" 'snake-pause-game - "q" 'quit-window - "ZQ" 'quit-window - "ZZ" 'snake-end-game)) - -(provide 'evil-collection-snake) -;;; evil-collection-snake.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/so-long/README.org b/.config/emacs/lisp/evil-collection/modes/so-long/README.org deleted file mode 100644 index f8ff959..0000000 --- a/.config/emacs/lisp/evil-collection/modes/so-long/README.org +++ /dev/null @@ -1,22 +0,0 @@ -* so-long - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/So-Long.html][so-long]], which mitigates performance problems in buffers with very long lines. - -** Key bindings - - Normal and visual state bindings added to =so-long-mode-map=. The defaults - make motion respect visual lines, matching how so-long buffers are usually - read. - - | Command | Original | Evil | - |---------------------------------------+----------+-----------| - | =evil-next-visual-line= | n/a | =j= | - | =evil-previous-visual-line= | n/a | =k= | - | =evil-next-line= | n/a | =gj= | - | =evil-previous-line= | n/a | =gk= | - | =evil-beginning-of-visual-line= | n/a | =0=, =g0= | - | =evil-end-of-visual-line= | n/a | =$= | - | =evil-end-of-line= | n/a | =g$= | - | =evil-first-non-blank-of-visual-line= | n/a | =^= | - | =evil-first-non-blank= | n/a | =g^= | - | =end-of-buffer= | n/a | =G= | diff --git a/.config/emacs/lisp/evil-collection/modes/so-long/evil-collection-so-long.el b/.config/emacs/lisp/evil-collection/modes/so-long/evil-collection-so-long.el deleted file mode 100644 index 81500a7..0000000 --- a/.config/emacs/lisp/evil-collection/modes/so-long/evil-collection-so-long.el +++ /dev/null @@ -1,51 +0,0 @@ -;;; evil-collection-so-long.el --- Bindings for `so-long' -*- lexical-binding: t -*- - -;; Copyright (C) 2022 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.2 -;; Package-Requires: ((emacs "27.1")) -;; Keywords: evil, emacs, convenience, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for so-long. - -;;; Code: -(require 'evil-collection) -(require 'so-long nil t) - -(defvar so-long-mode-map) -(defconst evil-collection-so-long-maps '(so-long-mode-map)) - -(defun evil-collection-so-long-setup () - "Set up `evil' bindings for so-long." - (evil-collection-define-key '(normal visual) 'so-long-mode-map - "j" #'evil-next-visual-line - "k" #'evil-previous-visual-line - "gj" #'evil-next-line - "gk" #'evil-previous-line - "0" #'evil-beginning-of-visual-line - "g0" #'evil-beginning-of-visual-line - "$" #'evil-end-of-visual-line - "g$" #'evil-end-of-line - "^" #'evil-first-non-blank-of-visual-line - "g^" #'evil-first-non-blank - "G" 'end-of-buffer)) - -(provide 'evil-collection-so-long) -;;; evil-collection-so-long.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/speedbar/README.org b/.config/emacs/lisp/evil-collection/modes/speedbar/README.org deleted file mode 100644 index 81a39b4..0000000 --- a/.config/emacs/lisp/evil-collection/modes/speedbar/README.org +++ /dev/null @@ -1,61 +0,0 @@ -* speedbar - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/speedbar/index.html][speedbar]], the everything browser sidebar. - -** Key bindings - -*** speedbar-mode-map - - | Command | Original | Evil | - |------------------------------------------+------------+-------| - | =speedbar-next= | =n= | =j= | - | =speedbar-prev= | =p= | =k= | - | =evil-goto-first-line= | n/a | =gg= | - | =evil-goto-line= | n/a | =G= | - | =speedbar-refresh= | =g= | =gr= | - | =speedbar-edit-line= | =RET=, =e= | =RET= | - | =speedbar-toggle-line-expansion= | =SPC= | =TAB= | - | =speedbar-expand-line= | =+= | =zo= | - | =speedbar-expand-line-descendants= | =[= | =zO= | - | =speedbar-contract-line= | =-= | =zc= | - | =speedbar-contract-line-descendants= | =]= | =zC= | - | =speedbar-toggle-show-all-files= | n/a | =a= | - | =speedbar-toggle-updates= | =t= | =t= | - | =speedbar-toggle-images= | n/a | =i= | - | =speedbar-toggle-sorting= | n/a | =o= | - | =speedbar-restricted-next= | =M-n= | =M-j= | - | =speedbar-restricted-prev= | =M-p= | =M-k= | - | =speedbar-forward-list= | =M-C-n= | =]]= | - | =speedbar-backward-list= | =M-C-p= | =[[= | - | =switch-to-quick-buffers= | =b= | =b= | - | =switch-to-files= | =f= | =f= | - | =speedbar-change-initial-expansion-list= | n/a | =J= | - -*** speedbar-file-key-map - - | Command | Original | Evil | - |-------------------------------+----------+----------| - | =speedbar-item-byte-compile= | =B= | =B= | - | =speedbar-item-copy= | =C= | =C= | - | =speedbar-item-delete= | =D= | =D= | - | =speedbar-item-info= | =I= | =I= | - | =speedbar-item-object-delete= | =O= | =K= | - | =speedbar-item-load= | =L= | =L= | - | =speedbar-item-rename= | =R= | =R= | - | =speedbar-create-directory= | =M= | =+= | - | =speedbar-up-directory= | =U= | =^=, =-= | - -*** speedbar-buffers-key-map - - | Command | Original | Evil | - |---------------------------------+----------+------| - | =speedbar-buffer-kill-buffer= | =k= | =K= | - | =speedbar-buffer-revert-buffer= | =r= | =gr= | - -** New commands - - | Command | Key | - |--------------------------------------------------------------+--------------| - | =evil-collection-speedbar-switch-to-previous-expansion-list= | =C-p=, =C-n= | - | =evil-collection-speedbar-switch-to-quick-buffers= | =b= | - | =evil-collection-speedbar-switch-to-files= | =f= | diff --git a/.config/emacs/lisp/evil-collection/modes/speedbar/evil-collection-speedbar.el b/.config/emacs/lisp/evil-collection/modes/speedbar/evil-collection-speedbar.el deleted file mode 100644 index 5abc28b..0000000 --- a/.config/emacs/lisp/evil-collection/modes/speedbar/evil-collection-speedbar.el +++ /dev/null @@ -1,110 +0,0 @@ -;;; evil-collection-speedbar.el --- Evil bindings for speedbar -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, speedbar, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for speedbar. - -;;; Code: - -(require 'evil-collection) -(require 'speedbar) - -(defconst evil-collection-speedbar-maps '(speedbar-mode-map - speedbar-file-key-map - speedbar-buffers-key-map)) - -(defun evil-collection-speedbar-switch-to-previous-expansion-list () - "Back to previously used expansion list." - (interactive) - (speedbar-change-initial-expansion-list speedbar-previously-used-expansion-list-name)) - -(defun evil-collection-speedbar-switch-to-quick-buffers () - "Switch to quick-buffers expansion list." - (interactive) - (speedbar-change-initial-expansion-list "quick buffers")) - -(defun evil-collection-speedbar-switch-to-files () - "Switch to files expansion list." - (interactive) - (speedbar-change-initial-expansion-list "files")) - -;;;###autoload -(defun evil-collection-speedbar-setup () - "Set up `evil' bindings for `speedbar'." - (evil-set-initial-state 'speedbar-mode 'normal) - (evil-collection-define-key 'normal 'speedbar-mode-map - "j" 'speedbar-next - "k" 'speedbar-prev - "gr" 'speedbar-refresh - "gg" 'evil-goto-first-line - "G" 'evil-goto-line - - ;; Basic tree features - (kbd "RET") 'speedbar-edit-line - (kbd "TAB") 'speedbar-toggle-line-expansion - - ;; Fold - "zo" 'speedbar-expand-line - "zO" 'speedbar-expand-line-descendants - "zc" 'speedbar-contract-line - "zC" 'speedbar-contract-line-descendants - - ;; Toggle - "a" 'speedbar-toggle-show-all-files - "t" 'speedbar-toggle-updates - "i" 'speedbar-toggle-images - "o" 'speedbar-toggle-sorting - - ;; Navigation - (kbd "M-j") 'speedbar-restricted-next - (kbd "M-k") 'speedbar-restricted-prev - "]]" 'speedbar-forward-list - "[[" 'speedbar-backward-list - (kbd "C-p") 'evil-collection-speedbar-switch-to-previous-expansion-list - (kbd "C-n") 'evil-collection-speedbar-switch-to-previous-expansion-list - "b" 'evil-collection-speedbar-switch-to-quick-buffers - "f" 'evil-collection-speedbar-switch-to-files - "J" 'speedbar-change-initial-expansion-list) - - (evil-collection-define-key 'normal 'speedbar-file-key-map - ;; File based commands - "B" 'speedbar-item-byte-compile - "C" 'speedbar-item-copy - "D" 'speedbar-item-delete - "I" 'speedbar-item-info - "K" 'speedbar-item-object-delete - "L" 'speedbar-item-load - "R" 'speedbar-item-rename - "+" 'speedbar-create-directory - "^" 'speedbar-up-directory - "-" 'speedbar-up-directory) - - (evil-collection-define-key 'normal 'speedbar-buffers-key-map - ;; Buffer specific keybindings - "K" 'speedbar-buffer-kill-buffer - "gr" 'speedbar-buffer-revert-buffer)) - -(provide 'evil-collection-speedbar) -;;; evil-collection-speedbar.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/tab-bar/README.org b/.config/emacs/lisp/evil-collection/modes/tab-bar/README.org deleted file mode 100644 index 70f8f43..0000000 --- a/.config/emacs/lisp/evil-collection/modes/tab-bar/README.org +++ /dev/null @@ -1,15 +0,0 @@ -* tab-bar - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Tab-Bars.html][tab-bar]]. Only =tab-switcher-mode-map= (the =M-x tab-switcher= list) is touched; the global =tab-bar-mode= itself has no buffer-local map to rebind. - -** Key bindings - - | Command | Original | Evil | - |--------------------------+-----------------+-----------------| - | =tab-switcher-next-line= | =n=, =SPC= | =j=, =gj= | - | =tab-switcher-prev-line= | =p= | =k=, =gk= | - | =tab-switcher-delete= | =d=, =k=, =C-k= | =d= | - | =tab-switcher-select= | =RET= | =RET= | - | =tab-switcher-unmark= | =u= | =u= | - | =tab-switcher-execute= | =x= | =x= | - | =quit-window= | =q= | =q=, =ZZ=, =ZQ= | diff --git a/.config/emacs/lisp/evil-collection/modes/tab-bar/evil-collection-tab-bar.el b/.config/emacs/lisp/evil-collection/modes/tab-bar/evil-collection-tab-bar.el deleted file mode 100644 index 9e2500c..0000000 --- a/.config/emacs/lisp/evil-collection/modes/tab-bar/evil-collection-tab-bar.el +++ /dev/null @@ -1,59 +0,0 @@ -;;; evil-collection-tab-bar.el --- Evil bindings for tab-bar -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "27.1")) -;; Keywords: evil, tab-bar, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for tab-bar. - -;;; Code: - -(require 'evil-collection) -(require 'tab-bar nil t) - -(defconst evil-collection-tab-bar-maps '(tab-switcher-mode-map)) - -(defun evil-collection-tab-bar-setup () - "Set up `evil' bindings to `tab-bar'." - (evil-set-initial-state 'tab-switcher-mode 'normal) - (evil-collection-define-key 'normal 'tab-switcher-mode-map - ;; Movement - "j" 'tab-switcher-next-line - "k" 'tab-switcher-prev-line - "gj" 'tab-switcher-next-line - "gk" 'tab-switcher-prev-line - - ;; Mark - "d" 'tab-switcher-delete - (kbd "RET") 'tab-switcher-select - "u" 'tab-switcher-unmark - "x" 'tab-switcher-execute - - ;; Quit - "q" 'quit-window - "ZZ" 'quit-window - "ZQ" 'quit-window)) - -(provide 'evil-collection-tab-bar) - -;;; evil-collection-tab-bar.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/tablist/evil-collection-tablist.el b/.config/emacs/lisp/evil-collection/modes/tablist/evil-collection-tablist.el deleted file mode 100644 index 0781c1c..0000000 --- a/.config/emacs/lisp/evil-collection/modes/tablist/evil-collection-tablist.el +++ /dev/null @@ -1,64 +0,0 @@ -;;; evil-collection-tablist.el --- Evil bindings for Tablist -*- lexical-binding: t -*- - -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, tablist, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for Tablist. - -;;; Code: -(require 'tablist nil t) -(require 'evil-collection) - -(defconst evil-collection-tablist-maps '(tablist-mode-map tablist-minor-mode-map)) - -(defvar tablist-mode-regexp-map) -(defvar tablist-mode-mark-map) -(defvar tablist-mode-filter-map) - -;;;###autoload -(defun evil-collection-tablist-setup () - "Set up `evil' bindings for `tablist'." - - (let ((common-bindings - (list - "U" 'tablist-unmark-all-marks - "g%" tablist-mode-regexp-map - "g*" tablist-mode-mark-map - "g/" tablist-mode-filter-map - "gr" 'tablist-revert - "K" 'tablist-do-kill-lines - "m" 'tablist-mark-forward - "S" 'tablist-sort - "t" 'tablist-toggle-marks - "u" 'tablist-unmark-forward))) - - (apply #'evil-collection-define-key 'normal 'tablist-mode-map - (kbd "RET") 'tablist-find-entry - "d" 'tablist-flag-forward - "f" 'tablist-find-entry - "X" 'tablist-do-delete - "x" 'tablist-do-flagged-delete - common-bindings) - - (apply #'evil-collection-define-key 'normal 'tablist-minor-mode-map - "q" 'tablist-quit - common-bindings))) - -(provide 'evil-collection-tablist) -;;; evil-collection-tablist.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/tabulated-list/README.org b/.config/emacs/lisp/evil-collection/modes/tabulated-list/README.org deleted file mode 100644 index f405393..0000000 --- a/.config/emacs/lisp/evil-collection/modes/tabulated-list/README.org +++ /dev/null @@ -1,20 +0,0 @@ -* tabulated-list - - Evil bindings for =tabulated-list-mode=, the parent mode behind package menu, process list, bookmark list, and many other list-based buffers. - -** Key bindings - - =n= and =p= are unbound so they fall through to evil motion. The default - =g= (revert) and =S= (sort) are kept; column commands move under the =g= - prefix. - - | Command | Original | Evil | - |----------------------------------------+-------------+------| - | =tabulated-list-sort= | =S= | =S= | - | =tabulated-list-narrow-current-column= | ={= | ={= | - | =tabulated-list-widen-current-column= | =}= | =}= | - | =tabulated-list-next-column= | =M-= | =gl= | - | =tabulated-list-previous-column= | =M-= | =gh= | - | =quit-window= | =q= | =q= | - | =next-line= (unbound) | =n= | n/a | - | =previous-line= (unbound) | =p= | n/a | diff --git a/.config/emacs/lisp/evil-collection/modes/tabulated-list/evil-collection-tabulated-list.el b/.config/emacs/lisp/evil-collection/modes/tabulated-list/evil-collection-tabulated-list.el deleted file mode 100644 index 081adb5..0000000 --- a/.config/emacs/lisp/evil-collection/modes/tabulated-list/evil-collection-tabulated-list.el +++ /dev/null @@ -1,54 +0,0 @@ -;;; evil-collection-tabulated-list.el --- Bindings for `tabulated-list' -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Morgan Smith - -;; Author: Morgan Smith -;; Maintainer: Morgan Smith -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `tabulated-list' - -;;; Code: -(require 'evil-collection) -(require 'tabulated-list) - -(defvar tabulated-list-mode-map) - -(defconst evil-collection-tabulated-list-maps '(tabulated-list-mode-map)) - -;;;###autoload -(defun evil-collection-tabulated-list-setup () - "Set up `evil' bindings for `tabulated-list'." - - (evil-collection-define-key nil 'tabulated-list-mode-map - "n" nil - "p" nil) - - (evil-set-initial-state 'tabulated-list-mode 'normal) - (evil-collection-define-key 'normal 'tabulated-list-mode-map - "S" 'tabulated-list-sort - "{" 'tabulated-list-narrow-current-column - "}" 'tabulated-list-widen-current-column - "gl" 'tabulated-list-next-column - "gh" 'tabulated-list-previous-column - "q" 'quit-window)) - -(provide 'evil-collection-tabulated-list) -;;; evil-collection-tabulated-list.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/tar-mode/README.org b/.config/emacs/lisp/evil-collection/modes/tar-mode/README.org deleted file mode 100644 index fbb0da6..0000000 --- a/.config/emacs/lisp/evil-collection/modes/tar-mode/README.org +++ /dev/null @@ -1,27 +0,0 @@ -* tar-mode - - Evil bindings for =tar-mode=, the built-in tar archive browser. - -** Key bindings - - | Command | Original | Evil | - |--------------------------------+-----------------------------+--------------------| - | =tar-next-line= | =n=, =SPC=, =C-n=, == | =j=, =gj=, =C-j= | - | =tar-previous-line= | =p=, =C-p=, == | =k=, =gk=, =C-k= | - | =beginning-of-buffer= | n/a | =gg= | - | =end-of-buffer= | n/a | =G= | - | =tar-extract= | =RET=, =e=, =f= | =RET= | - | =tar-extract-other-window= | =o=, =E= | =go=, =S-= | - | =tar-view= | =v= | =gO=, =M-= | - | =tar-flag-deleted= | =d=, =C-d= | =d= | - | =tar-rename-entry= | =R= | =r= | - | =tar-expunge= | =x= | =x= | - | =tar-chmod-entry= | =M= | =M= | - | =tar-chgrp-entry= | =G= | =P= | - | =tar-chown-entry= | =O= | =O= | - | =revert-buffer= | =g= | =gr= | - | =tar-new-entry= | =I= | =I= | - | =tar-copy= | =C= | =C= | - | =tar-unflag= | =u= | =u= | - | =tar-clear-modification-flags= | n/a | =U= | - | =quit-window= | n/a | =q= | diff --git a/.config/emacs/lisp/evil-collection/modes/tar-mode/evil-collection-tar-mode.el b/.config/emacs/lisp/evil-collection/modes/tar-mode/evil-collection-tar-mode.el deleted file mode 100644 index 5df995d..0000000 --- a/.config/emacs/lisp/evil-collection/modes/tar-mode/evil-collection-tar-mode.el +++ /dev/null @@ -1,81 +0,0 @@ -;;; evil-collection-tar-mode.el --- Evil bindings for tar-mode -*- lexical-binding: t -*- - -;; Copyright (C) 2019 Michael Arndt - -;; Author: 0x28 -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, tar-mode, archive, bindings, files - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Evil bindings for `tar-mode'. - -;;; Code: -(require 'tar-mode) -(require 'evil-collection) - -(defconst evil-collection-tar-mode-maps '(tar-mode-map)) - -;;;###autoload -(defun evil-collection-tar-mode-setup () - "Set up `evil' bindings for `tar-mode'." - (evil-set-initial-state 'tar-mode 'normal) - (evil-collection-define-key 'normal 'tar-mode-map - "j" 'tar-next-line - "k" 'tar-previous-line - (kbd "C-j") 'tar-next-line - (kbd "C-k") 'tar-previous-line - "gj" 'tar-next-line - "gk" 'tar-previous-line - - "gg" 'beginning-of-buffer - "G" 'end-of-buffer - - ;; open - (kbd "RET") 'tar-extract - (kbd "S-") 'tar-extract-other-window - (kbd "M-") 'tar-view - "go" 'tar-extract-other-window - "gO" 'tar-view - - "d" 'tar-flag-deleted - "r" 'tar-rename-entry - "x" 'tar-expunge - "M" 'tar-chmod-entry - "P" 'tar-chgrp-entry - "O" 'tar-chown-entry - - ;; refresh - "gr" 'revert-buffer - - ;; create - "I" 'tar-new-entry - - ;; write - "C" 'tar-copy - - ;; mark - "u" 'tar-unflag - "U" 'tar-clear-modification-flags - - ;; quit - "q" 'quit-window)) - -(provide 'evil-collection-tar-mode) -;;; evil-collection-tar-mode.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/telega/evil-collection-telega.el b/.config/emacs/lisp/evil-collection/modes/telega/evil-collection-telega.el deleted file mode 100644 index 2fcbd00..0000000 --- a/.config/emacs/lisp/evil-collection/modes/telega/evil-collection-telega.el +++ /dev/null @@ -1,218 +0,0 @@ -;;; evil-collection-telega.el --- Evil bindings for telega -*- lexical-binding: t -*- - -;; Copyright (C) 2021 Ruoyu Feng - -;; Author: Ruoyu Feng -;; Maintainer: James Nguyen , Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.6 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools, telegram, telega - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for telega. - -;;; Code: -(require 'telega nil t) -(require 'evil-collection) - -(defvar telega-prefix-map) -(defvar telega-filter-map) -(defvar telega-sort-map) -(defvar telega-chatbuf-fastnav-map) -(defvar telega-describe-map) -(defvar telega-folder-map) -(defvar telega-voip-map) -(defvar telega-root-view-map) -(defvar telega-root-fastnav-map) - -(defconst evil-collection-telega-maps '(telega-root-mode-map - telega-chat-mode-map - telega-image-mode-map - telega-webpage-mode-map - telega-user-button-map - telega-msg-button-map - telega-chat-button-map - telega-sticker-button-map)) - -(defconst evil-collection-telega-modes '(telega-root-mode - telega-chat-mode - telega-image-mode - telega-webpage-mode)) - -;;;###autoload -(defun evil-collection-telega-setup () - "Set up `evil' bindings for `telega'." - (evil-collection-set-readonly-bindings 'telega-root-mode-map) - - (dolist (mode evil-collection-telega-modes) - (evil-set-initial-state mode 'normal)) - - (evil-collection-define-key 'normal 'telega-root-mode-map - "j" 'evil-next-line - "k" 'evil-previous-line - - "ga" telega-prefix-map - - (kbd "") 'telega-button-forward - (kbd "") 'telega-button-backward - - "S" telega-sort-map - "s" telega-filter-map - "_" 'telega-filter-undo - "-" 'telega-filter-redo - - "c" 'telega-chat-join-by-link - "C" 'telega-chat-create - "D" 'telega-chats-filtered-kill-chatbuf - "R" 'telega-chats-filtered-toggle-read - - "q" 'bury-buffer - "Q" 'telega-kill - - "g?" telega-describe-map - "gO" telega-folder-map - "gC" telega-voip-map - "gV" telega-root-view-map - "J" telega-root-fastnav-map - - "gs" 'telega-view-search) - - (evil-collection-define-key 'normal 'telega-chat-mode-map - "ga" telega-prefix-map - "gA" telega-chatbuf-fastnav-map - - "zz" 'telega-chatbuf-recenter-1 - - "^" 'telega-chatbuf-beginning-of-thing - - "g?" 'telega-describe-chat - - "Za" 'telega-chatbuf-attach - "Zf" 'telega-chatbuf-attach-media - "Zv" 'telega-chatbuf-attach-clipboard - - "s" 'telega-chatbuf-filter - "_" 'telega-chatbuf-filter-cancel - "S" 'telega-chatbuf-filter-search - - (kbd "") 'telega-chatbuf-complete-or-next-link - (kbd "") 'telega-chatbuf-prev-link - - "q" 'quit-window) - - (let* ((submit evil-collection-repl-submit-state) - (newline-state (if (eq submit 'normal) 'insert 'normal))) - (evil-collection-define-key submit 'telega-chat-mode-map - (kbd "RET") 'telega-chatbuf-newline-or-input-send) - (evil-collection-define-key newline-state 'telega-chat-mode-map - (kbd "RET") 'newline)) - - (evil-collection-define-key 'normal 'telega-image-mode-map - "ga" telega-prefix-map - - "}" 'telega-image-next - "{" 'telega-image-prev - "q" 'telega-image-quit) - - (evil-collection-define-key 'normal 'telega-webpage-mode-map - "ga" telega-prefix-map - - "gx" 'telega-webpage-browse-url - "yy" 'telega-webpage-copy-url - "(" 'telega-webpage-history-prev - ")" 'telega-webpage-history-next - (kbd "") 'telega-button-forward - (kbd "") 'telega-button-backward) - - (evil-collection-set-readonly-bindings 'telega-user-button-map) - ; We have to set keybinds for emacs instead of normal state because normal - ; states takes no effects on buttons and remove the default bindings. - ; ref: emacs-evil/evil#1477 - (evil-collection-define-key nil 'telega-user-button-map - "B" nil - "K" nil - (kbd "DEL") nil - - "g?" 'telega-describe-user - "m" 'telega-user-chat-with - "D" 'telega-user-block) - - (evil-collection-set-readonly-bindings 'telega-msg-button-map) - (evil-collection-define-key nil 'telega-msg-button-map - "c" nil - "d" nil - "e" nil - "f" nil - "k" nil - "l" nil - "m" nil - "n" nil - "p" nil - "^" nil - (kbd "DEL") nil - "*" nil - - "D" 'telega-msg-delete-dwim - "dd" 'telega-msg-delete-dwim - "i" 'telega-msg-edit - "g?" 'telega-describe-message - "a" 'telega-msg-mark-toggle - (kbd "") 'telega-button-forward - (kbd "") 'telega-button-backward - "R" 'telega-msg-forward-dwim - "r" 'telega-msg-reply - "gr" 'telega-msg-open-thread-or-topic - - "Zy" 'telega-msg-copy-text - "Zl" 'telega-msg-copy-link - "ds" 'telega-msg-ban-sender - "ZL" 'telega-msg-redisplay - "P" 'telega-msg-pin-toggle - "ZR" 'telega-msg-resend - "S" 'telega-msg-save - "u" 'telega-msg-unmark - "U" 'telega-chatbuf-msg-marks-toggle - "=" 'telega-msg-diff-edits - "s" 'telega-msg-favorite-toggle) - - (evil-collection-set-readonly-bindings 'telega-chat-button-map) - (evil-collection-define-key nil 'telega-chat-button-map - "i" nil - "d" nil - "^" nil - (kbd "DEL") nil - - "g?" 'telega-describe-chat - "a" 'telega-chat-add-member - "o" 'telega-chat-set-custom-order - "r" 'telega-chat-toggle-read - "P" 'telega-chat-toggle-pin - "C" 'telega-chat-call - "D" 'telega-chat-delete) - - (evil-collection-set-readonly-bindings 'telega-sticker-button-map) - (evil-collection-define-key nil 'telega-sticker-button-map - "f" nil - "*" nil - "i" nil - "h" nil - - "t" 'telega-sticker-toggle-favorite - "g?" 'telega-sticker-help)) - -(provide 'evil-collection-telega) -;;; evil-collection-telega.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/term/README.org b/.config/emacs/lisp/evil-collection/modes/term/README.org deleted file mode 100644 index aa7fcc2..0000000 --- a/.config/emacs/lisp/evil-collection/modes/term/README.org +++ /dev/null @@ -1,55 +0,0 @@ -* term - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Terminal-emulator.html][term]] and =ansi-term=, also usable with =multi-term=. - - Insert state corresponds to =term-char-mode=, normal state to =term-line-mode=. - When =evil-collection-term-sync-state-and-mode-p= is non-nil the mode and - state switch in lockstep. - -** Key bindings - -*** term-raw-map (insert state) - - Restores raw passthrough for control characters evil otherwise intercepts. - - | Command | Original | Evil | - |---------------------------------+-----------+-------------------------------------------------------------------------------------------------------------------------------------| - | =term-send-raw= | (default) | =C-a=, =C-b=, =C-d=, =C-e=, =C-f=, =C-k=, =C-l=, =C-n=, =C-o=, =C-p=, =C-q=, =C-r=, =C-s=, =C-t=, =C-u=, =C-v=, =C-w=, =C-y=, =C-z= | - | =evil-collection-term-send-tab= | n/a | == | - | =term-send-eof= | =C-c C-d= | =C-c C-d= | - | =term-stop-subjob= | =C-c C-z= | =C-c C-z= | - -*** term-mode-map (normal state) - - | Command | Original | Evil | - |-----------------------------------------+-----------+------------------------------------------------| - | =evil-collection-term-char-mode-insert= | n/a | =C-c C-k= | - | =term-paste= | =C-c C-y= | =p= | - | =term-previous-prompt= | =C-c C-p= | =[[=, =C-k=, =gk= | - | =term-next-prompt= | =C-c C-n= | =]]=, =C-j=, =gj= | - | =term-bol= | =C-a= | =^= | - | =term-show-maximum-output= | =M-> = | =$= | - | =term-send-input= | =RET= | =RET= (in =evil-collection-repl-submit-state=) | - -** New commands - - | Command | Description | - |------------------------------------------------------+-----------------------------------------------------------| - | =evil-collection-term-char-mode-insert= | switch to =term-char-mode= and insert state | - | =evil-collection-term-send-tab= | send a literal TAB through =term-send-raw-string= | - | =evil-collection-term-escape-stay= | hook that disables backwards cursor on normal-state entry | - | =evil-collection-term-sync-state-and-mode= | hook that ties insert/normal to char/line mode | - | =evil-collection-term-switch-to-char-mode-on-insert= | default sync function | - | =evil-collection-term-char-mode-entry-function= | alternative sync function that only flips at the prompt | - -** Customization - - | Variable | Default | - |----------------------------------------------+------------------------------------------------------| - | =evil-collection-term-sync-state-and-mode-p= | =t= | - | =evil-collection-term-sync-state-function= | =evil-collection-term-switch-to-char-mode-on-insert= | - -** Integrations - - - =multi-term=: =M-DEL= sends =term-send-backward-kill-word= in both - normal state on =term-mode-map= and insert state on =term-raw-map=. diff --git a/.config/emacs/lisp/evil-collection/modes/term/evil-collection-term.el b/.config/emacs/lisp/evil-collection/modes/term/evil-collection-term.el deleted file mode 100644 index bc566fb..0000000 --- a/.config/emacs/lisp/evil-collection/modes/term/evil-collection-term.el +++ /dev/null @@ -1,170 +0,0 @@ -;;; evil-collection-term.el --- Evil bindings for term and ansi-term -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, term, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil integration for `term' and `ansi-term'. -;; This should also work for other terminal emulators such as `multi-term'. -;; -;; Switching to normal state will automatically switch to line mode. -;; Conversely, switching to insert state will automatically switch to char mode. - -;;; Code: -(require 'evil-collection) -(require 'term) - -(defcustom evil-collection-term-sync-state-and-mode-p t - "Synchronize insert/normal state with char/line-mode respectively. - -When non-nil, going to normal state will automatically switch to -line-mode. Conversely, going to insert state on the last -commandline will automatically switch to char-mode. - -Warning: This feature is experimental." - :group 'evil-collection-term - :type 'boolean) - -(defcustom evil-collection-term-sync-state-function - 'evil-collection-term-switch-to-char-mode-on-insert - "Function used when synchronizing insert/normal state with char/line-mode. - -This is only used if `evil-collection-term-sync-state-and-mode-p' is true." - :group 'evil-collection-term - :type 'function) - -;; TODO: Rebinding ESC has the drawback that programs like vi cannot use it anymore. -;; Workaround: switch to Emacs state and double-press ESC. -;; Otherwise leave ESC to "C-c C-j". -;; Or bind char-mode ESC to "C-c C-x"? - -;; TODO: Add support for normal-state editing. - -(defconst evil-collection-term-maps '(term-raw-map - term-mode-map)) - -(defun evil-collection-term-escape-stay () - "Go back to normal state but don't move cursor backwards. -Moving cursor backwards is the default Vim behavior but -it is not appropriate in some cases like terminals." - (setq-local evil-move-cursor-back nil)) - -(defun evil-collection-term-char-mode-insert () - "Switch to `term-char-mode' and enter insert state." - (interactive) - (term-char-mode) - (evil-insert-state)) - -(defun evil-collection-term-char-mode-entry-function () - "Maybe switch to `term-char-mode' on insert state." - (when (get-buffer-process (current-buffer)) - (let (last-prompt) - (save-excursion - (goto-char (point-max)) - (when (= (line-beginning-position) (line-end-position)) - (ignore-errors (backward-char))) - (setq last-prompt (max (term-bol nil) (line-beginning-position)))) - (when (>= (point) last-prompt) - (term-char-mode))))) - -(defun evil-collection-term-switch-to-char-mode-on-insert () - "Switch to `term-char-mode' on insert state." - (when (get-buffer-process (current-buffer)) - (term-char-mode))) - -(defun evil-collection-term-sync-state-and-mode () - "Sync `term-char-mode' and `term-line-mode' with insert and normal state." - (add-hook 'evil-insert-state-entry-hook - evil-collection-term-sync-state-function nil t) - (add-hook 'evil-insert-state-exit-hook 'term-line-mode nil t)) - -(defun evil-collection-term-send-tab () - "Send tab in term mode." - (interactive) - (term-send-raw-string "\t")) - -;;;###autoload -(defun evil-collection-term-setup () - "Set up `evil' bindings for `term'." - (evil-set-initial-state 'term-mode 'insert) - (if evil-collection-term-sync-state-and-mode-p - (add-hook 'term-mode-hook 'evil-collection-term-sync-state-and-mode) - (remove-hook 'term-mode-hook 'evil-collection-term-sync-state-and-mode)) - - (add-hook 'term-mode-hook 'evil-collection-term-escape-stay) - - ;; Evil has some "C-" bindings in insert state that shadow regular terminal - ;; bindings. Don't raw-send "C-c" (prefix key) nor "C-h" (help prefix). - (evil-collection-define-key 'insert 'term-raw-map - (kbd "C-a") 'term-send-raw - (kbd "C-b") 'term-send-raw ; Should not be necessary. - (kbd "C-d") 'term-send-raw - (kbd "C-e") 'term-send-raw - (kbd "C-f") 'term-send-raw ; Should not be necessary. - (kbd "C-k") 'term-send-raw - (kbd "C-l") 'term-send-raw ; Should not be necessary. - (kbd "C-n") 'term-send-raw - (kbd "C-o") 'term-send-raw - (kbd "C-p") 'term-send-raw - (kbd "C-q") 'term-send-raw ; Should not be necessary. - (kbd "C-r") 'term-send-raw - (kbd "C-s") 'term-send-raw ; Should not be necessary. - (kbd "C-t") 'term-send-raw - (kbd "C-u") 'term-send-raw ; Should not be necessary. - (kbd "C-v") 'term-send-raw ; Should not be necessary. - (kbd "C-w") 'term-send-raw - (kbd "C-y") 'term-send-raw - (kbd "C-z") 'term-send-raw - (kbd "") 'evil-collection-term-send-tab ; Should not be necessary. - (kbd "C-c C-d") 'term-send-eof - (kbd "C-c C-z") 'term-stop-subjob) - - (let* ((submit evil-collection-repl-submit-state)) - (evil-collection-define-key submit 'term-mode-map - (kbd "RET") 'term-send-input)) - - (evil-collection-define-key 'normal 'term-mode-map - (kbd "C-c C-k") 'evil-collection-term-char-mode-insert - - (kbd "p") 'term-paste - - ;; motion - "[[" 'term-previous-prompt - "]]" 'term-next-prompt - (kbd "C-k") 'term-previous-prompt - (kbd "C-j") 'term-next-prompt - "gk" 'term-previous-prompt - "gj" 'term-next-prompt - ;; "0" 'term-bol ; "0" is meant to really go at the beginning of line. - "^" 'term-bol - "$" 'term-show-maximum-output) - - ;; https://github.com/emacs-evil/evil-collection/issues/235 - (with-eval-after-load 'multi-term - (evil-collection-define-key 'normal 'term-mode-map - (kbd "M-DEL") 'term-send-backward-kill-word) - (evil-collection-define-key 'insert 'term-raw-map - (kbd "M-DEL") 'term-send-backward-kill-word))) - -(provide 'evil-collection-term) -;;; evil-collection-term.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/tetris/README.org b/.config/emacs/lisp/evil-collection/modes/tetris/README.org deleted file mode 100644 index 5adab75..0000000 --- a/.config/emacs/lisp/evil-collection/modes/tetris/README.org +++ /dev/null @@ -1,18 +0,0 @@ -* tetris - - Evil bindings for =tetris=, the built-in implementation of the falling-blocks game. - -** Key bindings - - | Command | Original | Evil | - |----------------------+-----------+-----------------| - | =tetris-move-left= | == | =h= | - | =tetris-move-right= | == | =l= | - | =tetris-rotate-next= | n/a | =k= | - | =tetris-rotate-prev= | == | =K= | - | =tetris-move-down= | == | =j= | - | =tetris-move-bottom= | =SPC= | =J=, =G=, =TAB= | - | =tetris-start-game= | =n= | =gr= | - | =tetris-pause-game= | =p= | =p= | - | =tetris-end-game= | =q= | =ZZ= | - | =quit-window= | n/a | =q=, =ZQ= | diff --git a/.config/emacs/lisp/evil-collection/modes/tetris/evil-collection-tetris.el b/.config/emacs/lisp/evil-collection/modes/tetris/evil-collection-tetris.el deleted file mode 100644 index 682b275..0000000 --- a/.config/emacs/lisp/evil-collection/modes/tetris/evil-collection-tetris.el +++ /dev/null @@ -1,55 +0,0 @@ -;;; evil-collection-tetris.el --- Bindings for `tetris' -*- lexical-binding: t -*- - -;; Copyright (C) 2018 James Nguyen - -;; Author: MaxSt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `tetris'. - -;;; Code: -(require 'evil-collection) -(require 'tetris nil t) - -(defconst evil-collection-tetris-maps '(tetris-mode-map)) - -;;;###autoload -(defun evil-collection-tetris-setup () - "Set up `evil' bindings for `tetris'." - (evil-set-initial-state 'tetris-mode 'normal) - (evil-collection-define-key 'normal 'tetris-mode-map - "h" 'tetris-move-left - "l" 'tetris-move-right - "k" 'tetris-rotate-next - "K" 'tetris-rotate-prev - "j" 'tetris-move-down - "J" 'tetris-move-bottom - "G" 'tetris-move-bottom - "gr" 'tetris-start-game - (kbd "TAB") 'tetris-move-bottom - "p" 'tetris-pause-game - "q" 'quit-window - "ZQ" 'quit-window - "ZZ" 'tetris-end-game)) - -(provide 'evil-collection-tetris) -;;; evil-collection-tetris.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/thread/README.org b/.config/emacs/lisp/evil-collection/modes/thread/README.org deleted file mode 100644 index 1b51bed..0000000 --- a/.config/emacs/lisp/evil-collection/modes/thread/README.org +++ /dev/null @@ -1,14 +0,0 @@ -* thread - - Evil bindings for =thread-list-mode=, the built-in =M-x list-threads= buffer. - -** Key bindings - - Inherits the standard =tabulated-list-mode= bindings (=S=, ={=, =}=, =gh=, - =gl=, =q=). evil-collection only rebinds the thread-specific actions. - - | Command | Original | Evil | - |---------------------------------+----------+------| - | =thread-list-pop-to-backtrace= | =b= | =B= | - | =thread-list-send-quit-signal= | =s q= | =Q= | - | =thread-list-send-error-signal= | =s e= | =E= | diff --git a/.config/emacs/lisp/evil-collection/modes/thread/evil-collection-thread.el b/.config/emacs/lisp/evil-collection/modes/thread/evil-collection-thread.el deleted file mode 100644 index 848b035..0000000 --- a/.config/emacs/lisp/evil-collection/modes/thread/evil-collection-thread.el +++ /dev/null @@ -1,45 +0,0 @@ -;;; evil-collection-thread.el --- Evil bindings for `thread' -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "27.1")) -;; Keywords: evil, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `thread'. - -;;; Code: -(require 'evil-collection) -(require 'thread nil t) - -(defconst evil-collection-thread-maps '(thread-list-mode-map)) - -;;;###autoload -(defun evil-collection-thread-setup () - "Set up `evil' bindings for `thread'." - (evil-set-initial-state 'thread-list-mode 'normal) - (evil-collection-define-key 'normal 'thread-list-mode-map - "B" 'thread-list-pop-to-backtrace - "Q" 'thread-list-send-quit-signal - "E" 'thread-list-send-error-signal)) - -(provide 'evil-collection-thread) -;;; evil-collection-thread.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/tide/evil-collection-tide.el b/.config/emacs/lisp/evil-collection/modes/tide/evil-collection-tide.el deleted file mode 100644 index abce9c4..0000000 --- a/.config/emacs/lisp/evil-collection/modes/tide/evil-collection-tide.el +++ /dev/null @@ -1,64 +0,0 @@ -;;; evil-collection-tide.el --- Bindings for `tide-mode' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, tide, typescript, languages - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `tide-mode'. - -;;; Code: -(require 'tide nil t) -(require 'evil-collection) - -(defconst evil-collection-tide-maps '(tide-mode-map - tide-references-mode-map - tide-project-errors-mode-map)) - -;;;###autoload -(defun evil-collection-tide-setup () - "Set up `evil' bindings for `tide'." - (evil-collection-define-key 'normal 'tide-mode-map - "gd" 'tide-jump-to-definition - (kbd "C-t") 'tide-jump-back - "K" 'tide-documentation-at-point) - - (evil-collection-define-key 'normal 'tide-references-mode-map - "gj" 'tide-find-next-reference - "gk" 'tide-find-previous-reference - (kbd "C-j") 'tide-find-next-reference - (kbd "C-k") 'tide-find-previous-reference - (kbd "RET") 'tide-goto-line-reference - ;; quit - "q" 'quit-window) - - (evil-collection-define-key 'normal 'tide-project-errors-mode-map - "gj" 'tide-find-next-error - "gk" 'tide-find-previous-error - (kbd "C-j") 'tide-find-next-error - (kbd "C-k") 'tide-find-previous-error - (kbd "RET") 'tide-goto-error - ;; quit - (kbd "q") 'quit-window)) - -(provide 'evil-collection-tide) -;;; evil-collection-tide.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/timer-list/README.org b/.config/emacs/lisp/evil-collection/modes/timer-list/README.org deleted file mode 100644 index 65f5174..0000000 --- a/.config/emacs/lisp/evil-collection/modes/timer-list/README.org +++ /dev/null @@ -1,12 +0,0 @@ -* timer-list - - Evil bindings for =timer-list-mode=, the built-in =M-x list-timers= buffer. - -** Key bindings - - Inherits the standard =tabulated-list-mode= bindings (=S=, ={=, =}=, =gh=, - =gl=, =q=). - - | Command | Original | Evil | - |---------------------+----------+------| - | =timer-list-cancel= | =c= | =C= | diff --git a/.config/emacs/lisp/evil-collection/modes/timer-list/evil-collection-timer-list.el b/.config/emacs/lisp/evil-collection/modes/timer-list/evil-collection-timer-list.el deleted file mode 100644 index aff8127..0000000 --- a/.config/emacs/lisp/evil-collection/modes/timer-list/evil-collection-timer-list.el +++ /dev/null @@ -1,43 +0,0 @@ -;;; evil-collection-timer-list.el --- Evil bindings for `timer-list' -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `timer-list'. - -;;; Code: -(require 'evil-collection) -(require 'timer-list) - -(defconst evil-collection-timer-list-maps '(timer-list-mode-map)) - -;;;###autoload -(defun evil-collection-timer-list-setup () - "Set up `evil' bindings for `timer-list'." - (evil-set-initial-state 'timer-list-mode 'normal) - (evil-collection-define-key 'normal 'timer-list-mode-map - "C" 'timer-list-cancel)) - -(provide 'evil-collection-timer-list) -;;; evil-collection-timer-list.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/transmission/evil-collection-transmission.el b/.config/emacs/lisp/evil-collection/modes/transmission/evil-collection-transmission.el deleted file mode 100644 index 547bc10..0000000 --- a/.config/emacs/lisp/evil-collection/modes/transmission/evil-collection-transmission.el +++ /dev/null @@ -1,163 +0,0 @@ -;;; evil-collection-transmission.el --- Evil bindings for transmission.el -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, transmission, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - - -;;; Commentary: -;; Evil bindings for `transmission'. - -;;; Code: -(require 'evil-collection) -(require 'transmission nil t) - -(defvar transmission-mode-map) -(defvar transmission-files-mode-map) -(defvar transmission-info-mode-map) -(defvar transmission-peers-mode-map) - -(defconst evil-collection-transmission-maps '(transmission-mode-map - transmission-files-mode-map - transmission-info-mode-map - transmission-peers-mode-map)) - -;;;###autoload -(defun evil-collection-transmission-setup () - "Set up `evil' bindings for `transmission'." - - (evil-collection-inhibit-insert-state 'transmission-mode-map) - (evil-set-initial-state 'transmission-mode 'normal) - (evil-collection-define-key 'normal 'transmission-mode-map - ;; motion - (kbd "SPC") 'scroll-up-command - (kbd "S-SPC") 'scroll-down-command - (kbd "") 'scroll-down-command - - ;; sort - "o" 'tabulated-list-sort - - (kbd "RET") 'transmission-files - "p" 'transmission-peers - "i" 'transmission-info - - "a" 'transmission-add - "D" 'transmission-delete - "r" 'transmission-move ; "r" for "[r]ename" - "R" 'transmission-remove - "x" 'transmission-toggle ; EMMS has "x" for pause. - "t" 'transmission-trackers-add - "c" 'transmission-verify ; "c" for "[c]heck". - "d" 'transmission-set-download - "u" 'transmission-set-upload - "S" 'transmission-set-ratio ; "S" for "[S]eed" - "P" 'transmission-set-bandwidth-priority - "I" 'transmission-label ; "I" for "[I]nput labels" - - ;; mark - "m" 'transmission-toggle-mark - "U" 'transmission-unmark-all - "~" 'transmission-invert-marks - - ;; refresh - "gr" 'revert-buffer - - ;; quit - "q" 'transmission-quit - "ZQ" 'evil-quit - "ZZ" 'transmission-quit) - - (evil-collection-inhibit-insert-state 'transmission-files-mode-map) - (evil-set-initial-state 'transmission-files-mode 'normal) - (evil-collection-define-key 'normal 'transmission-files-mode-map - (kbd "SPC") 'scroll-up-command - (kbd "S-SPC") 'scroll-down-command - (kbd "") 'scroll-down-command - - ;; sort - "o" 'tabulated-list-sort - - "p" 'transmission-peers - "i" 'transmission-info - - "r" 'transmission-move - "P" 'transmission-files-priority - - ;; mark - "u" 'transmission-files-unwant - "m" 'transmission-files-want - - ;; open - (kbd "RET") 'transmission-find-file - (kbd "S-") 'transmission-find-file-other-window - (kbd "M-") 'transmission-display-file - "go" 'transmission-find-file-other-window - - "v" 'transmission-view-file - - "!" 'transmission-files-command - ;; "X" 'transmission-files-command - "t" 'transmission-trackers-add - "T" 'transmission-trackers-remove - - ;; goto URL - "gx" 'transmission-browse-url-of-file ; See mu4e. - - ;; quit - "q" 'transmission-quit - "ZQ" 'evil-quit - "ZZ" 'transmission-quit) - - (evil-collection-define-key 'visual 'transmission-files-mode-map - "r" 'transmission-move - "P" 'transmission-files-priority - "u" 'transmission-files-unwant - "m" 'transmission-files-want) - - (evil-collection-set-readonly-bindings 'transmission-info-mode-map) - (evil-set-initial-state 'transmission-info-mode 'normal) - (evil-collection-define-key 'normal 'transmission-info-mode-map - "p" 'transmission-peers - - "t" 'transmission-trackers-add - "T" 'transmission-trackers-remove - "D" 'transmission-set-torrent-download - "U" 'transmission-set-torrent-upload - "S" 'transmission-set-torrent-ratio ; "S" for "[S]eed" - "I" 'transmission-label ; "I" for "[I]nput labels" - "P" 'transmission-set-bandwidth-priority - "r" 'transmission-move) - - ;; yu, Like `eww'. - (evil-collection-define-operator-key 'yank 'transmission-info-mode-map - "u" 'transmission-copy-magnet) - - (evil-collection-set-readonly-bindings 'transmission-peers-mode-map) - (evil-set-initial-state 'transmission-peers-mode 'normal) - (evil-collection-define-key 'normal 'transmission-peers-mode-map - ;; sort - "o" 'tabulated-list-sort - - "i" 'transmission-info)) - -(provide 'evil-collection-transmission) -;;; evil-collection-transmission.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/trashed/evil-collection-trashed.el b/.config/emacs/lisp/evil-collection/modes/trashed/evil-collection-trashed.el deleted file mode 100644 index 89c014c..0000000 --- a/.config/emacs/lisp/evil-collection/modes/trashed/evil-collection-trashed.el +++ /dev/null @@ -1,87 +0,0 @@ -;;; evil-collection-trashed.el --- Evil bindings for trashed.el -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.3 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, files, convenience, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `trashed'. - -;;; Code: -(require 'evil-collection) -(require 'trashed nil t) - -(defconst evil-collection-trashed-maps '(trashed-mode-map)) - -;;;###autoload -(defun evil-collection-trashed-setup () - "Set up `evil' bindings for `trashed'." - (evil-collection-set-readonly-bindings 'trashed-mode-map) - (evil-collection-define-key 'normal 'trashed-mode-map - ;; motion - (kbd "SPC") 'scroll-up-command - (kbd "S-SPC") 'scroll-down-command - (kbd "") 'trashed-forward-column - (kbd "") 'trashed-backward-column - - (kbd "RET") 'trashed-find-file - (kbd "S-RET") 'trashed-find-file-other-window - (kbd "go") 'trashed-find-file-other-window - (kbd "gO") 'trashed-display-file - (kbd "gw") 'trashed-browse-url-of-file - (kbd "M-RET") 'trashed-display-file - - "S" 'tabulated-list-sort - - "m" 'trashed-mark - "M" 'trashed-mark-all - "u" 'trashed-unmark - "U" 'trashed-unmark-all - "~" 'trashed-toggle-marks - - "$ m" 'trashed-mark-files-by-date - "$ u" 'trashed-unmark-files-by-date - "$ d" 'trashed-flag-delete-files-by-date - "$ r" 'trashed-flag-restore-files-by-date - - "% m" 'trashed-mark-files-regexp - "% u" 'trashed-unmark-files-regexp - "% d" 'trashed-flag-delete-files-regexp - "% r" 'trashed-flag-restore-files-regexp - - "d" 'trashed-flag-delete - "r" 'trashed-flag-restore - - "zb" 'trashed-flag-backup-files - "za" 'trashed-flag-auto-save-files - - "x" 'trashed-do-execute - "D" 'trashed-do-delete - "R" 'trashed-do-restore - - "v" 'trashed-view-file - - "g?" 'describe-mode - "gr" 'revert-buffer)) - -(provide 'evil-collection-trashed) -;;; evil-collection-trashed.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/tuareg/README.org b/.config/emacs/lisp/evil-collection/modes/tuareg/README.org deleted file mode 100644 index 589da60..0000000 --- a/.config/emacs/lisp/evil-collection/modes/tuareg/README.org +++ /dev/null @@ -1,9 +0,0 @@ -* tuareg - - Evil bindings for [[https://github.com/ocaml/tuareg][tuareg-mode]] (OCaml). - -** Key bindings - - | Command | Original | Evil | - |--------------------+-----------+------| - | =tuareg-run-ocaml= | =C-c C-s= | =gz= | diff --git a/.config/emacs/lisp/evil-collection/modes/tuareg/evil-collection-tuareg.el b/.config/emacs/lisp/evil-collection/modes/tuareg/evil-collection-tuareg.el deleted file mode 100644 index b283fb1..0000000 --- a/.config/emacs/lisp/evil-collection/modes/tuareg/evil-collection-tuareg.el +++ /dev/null @@ -1,44 +0,0 @@ -;;; evil-collection-tuareg.el --- Evil bindings for `tuareg-mode' -*- lexical-binding: t -*- - -;; Copyright (C) 2021 Zhiwei Chen - -;; Author: Zhiwei Chen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `tuareg-mode'. - -;;; Code: - -(require 'evil-collection) -(require 'tuareg nil t) - -(defconst evil-collection-tuareg-maps '(tuareg-mode-map)) - -;;;###autoload -(defun evil-collection-tuareg-setup () - "Set up `evil' bindings for `tuareg'." - (evil-collection-define-key 'normal 'tuareg-mode-map - "gz" 'tuareg-run-ocaml)) - -(provide 'evil-collection-tuareg) - -;;; evil-collection-tuareg.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/typescript-mode/README.org b/.config/emacs/lisp/evil-collection/modes/typescript-mode/README.org deleted file mode 100644 index f6bdc37..0000000 --- a/.config/emacs/lisp/evil-collection/modes/typescript-mode/README.org +++ /dev/null @@ -1,13 +0,0 @@ -* typescript-mode - - Evil integration for [[https://github.com/emacs-typescript/typescript.el][typescript-mode]]. - - No key bindings are added. The setup installs a hook that sets - =evil-shift-width= to =typescript-indent-level= in =typescript-mode= - buffers so that evil shift operators match the mode's indentation. - -** New commands - - - =evil-collection-typescript-mode-set-evil-shift-width= — sync - =evil-shift-width= with =typescript-indent-level= (added to - =typescript-mode-hook=). diff --git a/.config/emacs/lisp/evil-collection/modes/typescript-mode/evil-collection-typescript-mode.el b/.config/emacs/lisp/evil-collection/modes/typescript-mode/evil-collection-typescript-mode.el deleted file mode 100644 index 47366e6..0000000 --- a/.config/emacs/lisp/evil-collection/modes/typescript-mode/evil-collection-typescript-mode.el +++ /dev/null @@ -1,46 +0,0 @@ -;;; evil-collection-typescript-mode.el --- Bindings for `typescript-mode' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: emacs, evil, tools, typescript - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `typescript-mode'. - -;;; Code: -(require 'evil-collection) -(require 'typescript-mode nil t) - -(defvar typescript-indent-level) - -(defun evil-collection-typescript-mode-set-evil-shift-width () - "Set `evil-shift-width' according to `typescript-indent-level'." - (setq-local evil-shift-width typescript-indent-level)) - -;;;###autoload -(defun evil-collection-typescript-mode-setup () - "Set up `evil' bindings for `typescript-mode'." - (add-hook 'typescript-mode-hook - #'evil-collection-typescript-mode-set-evil-shift-width)) - -(provide 'evil-collection-typescript-mode) -;;; evil-collection-typescript-mode.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/ultra-scroll/evil-collection-ultra-scroll.el b/.config/emacs/lisp/evil-collection/modes/ultra-scroll/evil-collection-ultra-scroll.el deleted file mode 100644 index fcc4aec..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ultra-scroll/evil-collection-ultra-scroll.el +++ /dev/null @@ -1,58 +0,0 @@ -;;; evil-collection-ultra-scroll.el --- Evil integration for ultra-scroll -*- lexical-binding: t -*- - -;; Copyright (C) 2025 Steven Allen - -;; Author: Steven Allen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "27.1")) -;; Keywords: evil, ultra-scroll, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil integration for ultra-scroll. - -;;; Code: - -(require 'evil-collection) -(require 'ultra-scroll nil t) - -(defvar evil-collection-ultra-scroll-hide-cursor-states - '(evil-motion-state-cursor evil-normal-state-cursor) - "States in which to hide the cursor when scrolling.") - -(defun evil-collection-ultra-scroll--hide-cursor () - "A special Evil cursor type that simply hides the cursor." - (setq cursor-type nil)) - -(defun evil-collection-ultra-scroll--set-cursor-visible (arg) - "Make the cursor invisible when called with ARG < 1, or visible otherwise." - (when (bound-and-true-p evil-local-mode) - (if (and (numberp arg) (< arg 1)) - (dolist (var evil-collection-ultra-scroll-hide-cursor-states) - (make-local-variable var) - (set var #'evil-collection-ultra-scroll--hide-cursor)) - (mapc #'kill-local-variable evil-collection-ultra-scroll-hide-cursor-states) - (evil-refresh-cursor)))) - -(defun evil-collection-ultra-scroll-setup () - "Set up `evil' integration for `ultra-scroll'." - (add-hook 'ultra-scroll-hide-functions #'evil-collection-ultra-scroll--set-cursor-visible)) - -(provide 'evil-collection-ultra-scroll) - -;;; evil-collection-ultra-scroll.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/unimpaired/evil-collection-unimpaired.el b/.config/emacs/lisp/evil-collection/modes/unimpaired/evil-collection-unimpaired.el deleted file mode 100644 index 4d9710f..0000000 --- a/.config/emacs/lisp/evil-collection/modes/unimpaired/evil-collection-unimpaired.el +++ /dev/null @@ -1,313 +0,0 @@ -;;; evil-collection-unimpaired.el --- Evil Collection port of Unimpaired -*- lexical-binding: t -*- - -;; Copyright (C) 2019 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, unimpaired, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; `evil' port of unimpaired for `evil-collection'. -;; https://github.com/tpope/vim-unimpaired - -;;; Code: -(require 'evil-collection) - -;; Externals -(defvar flycheck-current-errors) - -(defgroup evil-collection-unimpaired nil - "Evil port of unimpaired for `evil-collection'." - :group 'evil-collection) - -(defcustom evil-collection-unimpaired-want-repeat-mode-integration nil - "Whether or not to enable `repeat-mode' integration." - :type 'boolean - :group 'evil-collection) - -(defconst evil-collection-unimpaired-maps '(evil-collection-unimpaired-mode-map)) - -(defvar evil-collection-unimpaired-mode-map (make-sparse-keymap) - "Keymap for `evil-collection-unimpaired-mode'.") - -(define-minor-mode evil-collection-unimpaired-mode - "Evil port of unimpaired." - :lighter " unimpaired" - :group 'evil-collection-unimpaired) - -;;;###autoload -(define-globalized-minor-mode global-evil-collection-unimpaired-mode - evil-collection-unimpaired-mode evil-collection-unimpaired-mode-on - :group 'evil-collection-unimpaired) - -(defun evil-collection-unimpaired-mode-on () - "Turn on `evil-collection-unimpaired-mode'." - (evil-collection-unimpaired-mode 1)) - -(evil-define-motion evil-collection-unimpaired-next-error (count) - "Go to next error." - :jump t - (setq count (or count 1)) - (cond - ((and (bound-and-true-p flycheck-mode) - (fboundp 'flycheck-next-error)) - (flycheck-next-error count)) - ((and (bound-and-true-p flymake-mode) - (fboundp 'flymake-goto-next-error)) - (flymake-goto-next-error count)) - (:default - (message "No linting modes are on.")))) - -(evil-define-motion evil-collection-unimpaired-previous-error (count) - "Go to previous error." - :jump t - (evil-collection-unimpaired-next-error (- (or count 1)))) - -(defun evil-collection-unimpaired--flycheck-count-errors () - "Count the number of flycheck errors." - (length (delete-dups (mapcar 'flycheck-error-line flycheck-current-errors)))) - -(evil-define-motion evil-collection-unimpaired-first-error () - "Go to the first error." - :jump t - (cond - ((and (bound-and-true-p flycheck-mode) - (fboundp 'flycheck-first-error)) - (flycheck-first-error)) - ((bound-and-true-p flymake-mode) - (message "flymake unsupported.")) - (:default - (message "No linting modes are on.")))) - -(evil-define-motion evil-collection-unimpaired-last-error () - "Go to the last error." - :jump t - (cond - ((and (bound-and-true-p flycheck-mode) - (fboundp 'flycheck-first-error)) - (flycheck-first-error (evil-collection-unimpaired--flycheck-count-errors))) - ((bound-and-true-p flymake-mode) - (message "flymake unsupported.")) - (:default - (message "No linting modes are on.")))) - -(defconst evil-collection-unimpaired--SCM-conflict-marker "^\\(@@@ .* @@@\\|[<=>]\\{7\\}\\)" - "A regexp to match SCM conflict marker.") - -(evil-define-motion evil-collection-unimpaired-previous-SCM-conflict-marker (count) - "Go to the previous SCM conflict marker or diff/patch hunk." - :jump t - (evil-collection-unimpaired-next-SCM-conflict-marker (- (or count 1)))) - -(evil-define-motion evil-collection-unimpaired-next-SCM-conflict-marker (count) - "Go to the next SCM conflict marker or diff/patch hunk." - :jump t - (evil-motion-loop (dir (or count 1)) - (cond - ((> dir 0) - (forward-line 1) - (when (not (search-forward-regexp evil-collection-unimpaired--SCM-conflict-marker nil t)) - (forward-line -1)) - (move-beginning-of-line nil)) - (t - (search-backward-regexp evil-collection-unimpaired--SCM-conflict-marker nil t) - (move-beginning-of-line nil))))) - -(defun evil-collection-unimpaired-paste-above () - "Paste above current line with preserving indentation." - (interactive) - (let ((indent (current-indentation)) - (column (current-column))) - (evil-insert-newline-above) - (indent-to indent) - (evil-paste-after 1) - (move-to-column column))) - -(defun evil-collection-unimpaired-paste-below () - "Paste below current line with preserving indentation." - (interactive) - (let ((indent (current-indentation)) - (column (current-column))) - (evil-insert-newline-below) - (indent-to indent) - (evil-paste-after 1) - (move-to-column column))) - -(defun evil-collection-unimpaired-insert-newline-above (count) - "Insert COUNT blank line(s) above current line." - (interactive "p") - (save-excursion (dotimes (_ count) (evil-insert-newline-above))) - (when (bolp) (forward-char count))) - -(defun evil-collection-unimpaired-insert-newline-below (count) - "Insert COUNT blank line(s) below current line." - (interactive "p") - (save-excursion (dotimes (_ count) (evil-insert-newline-below)))) - -(defun evil-collection-unimpaired--encode (beg end fn) - "Apply FN from BEG to END." - (save-excursion - (goto-char beg) - (let* ((end (if (eq evil-this-type 'line) (1- end) end)) - (text (buffer-substring-no-properties beg end))) - (delete-region beg end) - (insert (funcall fn text))))) - -(evil-define-operator evil-collection-unimpaired-url-encode (count &optional beg end) - "Encode a URL string." - (interactive "") - (ignore count) - (evil-collection-unimpaired--encode beg end #'url-encode-url)) - -(evil-define-operator evil-collection-unimpaired-url-decode (count &optional beg end) - "Decode a URL string." - (interactive "") - (ignore count) - (evil-collection-unimpaired--encode beg end #'url-unhex-string)) - -(evil-define-operator evil-collection-unimpaired-b64-encode (count &optional beg end) - "Encode a base64 string." - (interactive "") - (ignore count) - (evil-collection-unimpaired--encode beg end #'base64-encode-string)) - -(evil-define-operator evil-collection-unimpaired-b64-decode (count &optional beg end) - "Decode a base64 string." - (interactive "") - (ignore count) - (evil-collection-unimpaired--encode beg end #'base64-decode-string)) - -;; https://stackoverflow.com/questions/2423834/move-line-region-up-and-down-in-emacs -(defun evil-collection-unimpaired--move-text (arg) - "Move text down if ARG is positive, otherwise move text up." - (cond - ((and mark-active transient-mark-mode) - (when (> (point) (mark)) - (exchange-point-and-mark)) - (let ((column (current-column)) - (text (delete-and-extract-region (point) (mark)))) - (forward-line arg) - (move-to-column column :force) - (set-mark (point)) - (insert text) - (exchange-point-and-mark) - (setq deactivate-mark nil))) - (t - (let ((column (current-column))) - (beginning-of-line) - (when (or (> arg 0) (not (bobp))) - (forward-line) - (when (or (< arg 0) (not (eobp))) - (transpose-lines arg)) - (forward-line -1)) - (move-to-column column))))) - -(defun evil-collection-unimpaired-move-text-down (arg) - "Move region (transient-mark-mode active) or current line ARG lines down." - (interactive "*p") - (evil-collection-unimpaired--move-text arg)) - -(defun evil-collection-unimpaired-move-text-up (arg) - "Move region (transient-mark-mode active) or current line ARG lines up." - (interactive "*p") - (evil-collection-unimpaired--move-text (- arg))) - -;;; 'repeat-mode' integration. Emacs 28+ -(defmacro evil-collection-unimpaired-defvar-keymap (name &rest bindings) - "Define NAME a keymap with BINDINGS." - (declare (indent 1)) - (cl-assert (cl-evenp (length bindings))) - `(progn - (defvar ,name - (let ((map (make-sparse-keymap))) - map)) - (evil-collection-define-key nil ',name ,@bindings))) - -;; "[b" and "]b" -(evil-collection-unimpaired-defvar-keymap evil-prev-buffer-repeat-map - "b" #'evil-prev-buffer - "B" #'evil-next-buffer) -(evil-collection-unimpaired-defvar-keymap evil-next-buffer-repeat-map - "b" #'evil-next-buffer - "B" #'evil-prev-buffer) - -;; "[e" and "]e" -(evil-collection-unimpaired-defvar-keymap evil-collection-unimpaired-move-text-up-repeat-map - "e" #'evil-collection-unimpaired-move-text-up - "E" #'evil-collection-unimpaired-move-text-down) -(evil-collection-unimpaired-defvar-keymap evil-collection-unimpaired-move-text-down-repeat-map - "e" #'evil-collection-unimpaired-move-text-down - "E" #'evil-collection-unimpaired-move-text-up) - -;; "[q" and "]q" -(evil-collection-unimpaired-defvar-keymap evil-collection-unimpaired-previous-error-repeat-map - "q" #'evil-collection-unimpaired-previous-error - "Q" #'evil-collection-unimpaired-next-error) -(evil-collection-unimpaired-defvar-keymap evil-collection-unimpaired-next-error-repeat-map - "q" #'evil-collection-unimpaired-next-error - "Q" #'evil-collection-unimpaired-previous-error) - -;;;###autoload -(defun evil-collection-unimpaired-setup () - "Set up unimpaired-like bindings." - (global-evil-collection-unimpaired-mode 1) - (evil-collection-define-key 'normal 'evil-collection-unimpaired-mode-map - "[b" 'evil-prev-buffer - "]b" 'evil-next-buffer - "[e" 'evil-collection-unimpaired-move-text-up - "]e" 'evil-collection-unimpaired-move-text-down - "[l" 'evil-collection-unimpaired-previous-error - "]l" 'evil-collection-unimpaired-next-error - "[L" 'evil-collection-unimpaired-first-error - "]L" 'evil-collection-unimpaired-last-error - "[q" 'evil-collection-unimpaired-previous-error - "]q" 'evil-collection-unimpaired-next-error - "[Q" 'evil-collection-unimpaired-first-error - "]Q" 'evil-collection-unimpaired-last-error - "[n" 'evil-collection-unimpaired-previous-SCM-conflict-marker - "]n" 'evil-collection-unimpaired-next-SCM-conflict-marker - "[p" 'evil-collection-unimpaired-paste-above - "]p" 'evil-collection-unimpaired-paste-below - "[P" 'evil-collection-unimpaired-paste-above - "]P" 'evil-collection-unimpaired-paste-below - (kbd "[ SPC") 'evil-collection-unimpaired-insert-newline-above - (kbd "] SPC") 'evil-collection-unimpaired-insert-newline-below) - (evil-collection-define-key 'visual 'evil-collection-unimpaired-mode-map - "[e" 'evil-collection-unimpaired-move-text-up - "]e" 'evil-collection-unimpaired-move-text-down - "[n" 'evil-collection-unimpaired-previous-SCM-conflict-marker - "]n" 'evil-collection-unimpaired-next-SCM-conflict-marker) - (evil-collection-define-key 'motion 'evil-collection-unimpaired-mode-map - "[u" 'evil-collection-unimpaired-url-encode - "]u" 'evil-collection-unimpaired-url-decode - "[6" 'evil-collection-unimpaired-b64-encode - "]6" 'evil-collection-unimpaired-b64-decode) - - (when evil-collection-unimpaired-want-repeat-mode-integration - (dolist (cmd '(evil-prev-buffer - evil-next-buffer - evil-collection-unimpaired-move-text-up - evil-collection-unimpaired-move-text-down - evil-collection-unimpaired-previous-error - evil-collection-unimpaired-next-error)) - (put cmd 'repeat-map (intern (format "%s-repeat-map" cmd)))))) - -(provide 'evil-collection-unimpaired) -;;; evil-collection-unimpaired.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/vc-annotate/README.org b/.config/emacs/lisp/evil-collection/modes/vc-annotate/README.org deleted file mode 100644 index c53e62f..0000000 --- a/.config/emacs/lisp/evil-collection/modes/vc-annotate/README.org +++ /dev/null @@ -1,23 +0,0 @@ -* vc-annotate - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Old-Revisions.html][vc-annotate]] (=C-x v g=), Emacs' built-in - blame view. - -** Key bindings - - | Command | Original | Evil | - |----------------------------------------------------+----------+-------------------| - | =quit-window= | =q= | =q= | - | =vc-annotate-revision-previous-to-line= | =P= | =a= | - | =vc-annotate-show-diff-revision-at-line= | === | =d=, === | - | =vc-annotate-show-changeset-diff-revision-at-line= | =D= | =D= | - | =vc-annotate-find-revision-at-line= | =f= | =F= | - | =vc-annotate-revision-at-line= | =J= | =J= | - | =vc-annotate-show-log-revision-at-line= | =l= | =L= | - | =vc-annotate-next-revision= | =n= | =gj=, =]]=, =C-j= | - | =vc-annotate-prev-revision= | =p= | =gk=, =[[=, =C-k= | - | =vc-annotate-working-revision= | =w= | =W= | - | =vc-annotate-toggle-annotation-visibility= | =A= | =A= | - | =vc-annotate-goto-line= | =RET= | =RET= | - - Initial state is normal. diff --git a/.config/emacs/lisp/evil-collection/modes/vc-annotate/evil-collection-vc-annotate.el b/.config/emacs/lisp/evil-collection/modes/vc-annotate/evil-collection-vc-annotate.el deleted file mode 100644 index 4334be1..0000000 --- a/.config/emacs/lisp/evil-collection/modes/vc-annotate/evil-collection-vc-annotate.el +++ /dev/null @@ -1,59 +0,0 @@ -;;; evil-collection-vc-annotate.el --- Bindings for `vc-annotate' -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `vc-annotate' - -;;; Code: -(require 'evil-collection) -(require 'vc-annotate) - -(defconst evil-collection-vc-annotate-maps '(vc-annotate-mode-map)) - -;;;###autoload -(defun evil-collection-vc-annotate-setup () - "Set up `evil' bindings for `vc-annotate'." - (evil-set-initial-state 'vc-annotate-mode 'normal) - (evil-collection-define-key 'normal 'vc-annotate-mode-map - "q" 'quit-window - "a" 'vc-annotate-revision-previous-to-line - "d" 'vc-annotate-show-diff-revision-at-line - "=" 'vc-annotate-show-diff-revision-at-line - "D" 'vc-annotate-show-changeset-diff-revision-at-line - "F" 'vc-annotate-find-revision-at-line - "J" 'vc-annotate-revision-at-line - "L" 'vc-annotate-show-log-revision-at-line - "gj" 'vc-annotate-next-revision - "gk" 'vc-annotate-prev-revision - "]]" 'vc-annotate-next-revision - "[[" 'vc-annotate-prev-revision - (kbd "C-j") 'vc-annotate-next-revision - (kbd "C-k") 'vc-annotate-prev-revision - "W" 'vc-annotate-working-revision - "A" 'vc-annotate-toggle-annotation-visibility - (kbd "RET") 'vc-annotate-goto-line)) - -(provide 'evil-collection-vc-annotate) -;;; evil-collection-vc-annotate.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/vc-dir/README.org b/.config/emacs/lisp/evil-collection/modes/vc-dir/README.org deleted file mode 100644 index 98e36b4..0000000 --- a/.config/emacs/lisp/evil-collection/modes/vc-dir/README.org +++ /dev/null @@ -1,47 +0,0 @@ -* vc-dir - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/VC-Directory-Mode.html][vc-dir]] (=C-x v d=). - -** Key bindings - - Standard read-only motion / quit bindings come from - =evil-collection-set-readonly-bindings=. - - | Command | Original | Evil | - |----------------------------------+---------------+-------------------| - | =vc-next-action= | =v= | =c= | - | =vc-diff= | === | =d=, =TAB= | - | =vc-root-diff= | =D= | =D=, =S-TAB= | - | =vc-register= | =i= | =R=, =s= | - | =vc-update= | =+= | =gu=, =F= | - | =revert-buffer= | =g= | =gr= | - | =vc-push= | =P= | =p=, =P= | - | =vc-print-log= | =l= | =Lf=, =Ll= | - | =vc-print-root-log= | =L= | =Lr=, =LL= | - | =vc-log-incoming= | =Ii= | =Li= | - | =vc-log-outgoing= | =Io= | =Lo= | - | =vc-revert= | =N= | =x= | - | =vc-annotate= | =A= | =b= | - | =vc-dir-mark= | =m= | =m= | - | =vc-dir-mark-all-files= | =M m= | =M= | - | =vc-dir-unmark= | =u= | =u= | - | =vc-dir-unmark-all-files= | =M u= | =U= | - | =vc-dir-next-directory= | =M-n= | =]]=, =gj=, =C-j= | - | =vc-dir-previous-directory= | =M-p= | =[[=, =gk=, =C-k= | - | =vc-dir-find-file= | =f=, =RET= | =gf=, =RET= | - | =vc-dir-find-file-other-window= | =o= | =go=, =S-RET= | - | =vc-dir-display-file= | =SPC= | =gO=, =M-RET= | - | =vc-dir-kill-dir-status-process= | =C-c C-c= | =C-c C-c= | - | =vc-dir-toggle-mark= | =SPC= | =t= | - | =vc-dir-hide-up-to-date= | =x= | =(=, =o= | - | =vc-dir-kill-line= | =k= | =X= | - | =vc-dir-search= | =S= | =S= | - | =vc-dir-query-replace-regexp= | =Q= | =Q= | - | =vc-dir-isearch= | =M-s a C-s= | =M-s a C-s= | - | =vc-dir-isearch-regexp= | =M-s a M-C-s= | =M-s a M-C-s= | - | =vc-dir-ignore= | =G= | =i= | - | =vc-create-tag= | =B c= | =Bc= | - | =vc-print-branch-log= | =B l= | =Bl= | - | =vc-retrieve-tag= | =B s= | =Bs= | - - Initial state is normal. diff --git a/.config/emacs/lisp/evil-collection/modes/vc-dir/evil-collection-vc-dir.el b/.config/emacs/lisp/evil-collection/modes/vc-dir/evil-collection-vc-dir.el deleted file mode 100644 index a9d1504..0000000 --- a/.config/emacs/lisp/evil-collection/modes/vc-dir/evil-collection-vc-dir.el +++ /dev/null @@ -1,113 +0,0 @@ -;;; evil-collection-vc-dir.el --- Evil bindings for Vc-Dir -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, vc-dir, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for Vc-Dir. - -;;; Code: -(require 'vc-dir) -(require 'evil-collection) - -(defconst evil-collection-vc-dir-maps '(vc-dir-mode-map)) - -;;;###autoload -(defun evil-collection-vc-dir-setup () - "Set up `evil' bindings for `vc-dir'." - (evil-set-initial-state 'vc-dir-mode 'normal) - (evil-collection-set-readonly-bindings 'vc-dir-mode-map) - (evil-collection-define-key 'normal 'vc-dir-mode-map - ;; VC commands - "c" 'vc-next-action - - "d" 'vc-diff - "D" 'vc-root-diff - "\t" 'vc-diff - [backtab] 'vc-root-diff - - "R" 'vc-register - "s" 'vc-register ;; Like `magit-stage'? - "gu" 'vc-update - "gr" 'revert-buffer - - "F" 'vc-update ;; This is the same as `vc-update' bound to "gu". - "p" 'vc-push - "P" 'vc-push - - "Lf" 'vc-print-log ;; Log File. - "Ll" 'vc-print-log - "Lr" 'vc-print-root-log - "LL" 'vc-print-root-log - "Li" 'vc-log-incoming - "Lo" 'vc-log-outgoing - - "x" 'vc-revert - "b" 'vc-annotate ;; Like `magit-blame' - - ;; Marking. - "m" 'vc-dir-mark - "M" 'vc-dir-mark-all-files - "u" 'vc-dir-unmark - "U" 'vc-dir-unmark-all-files - - ;; Rebind paragraph-movement commands. - "]]" 'vc-dir-next-directory - "[[" 'vc-dir-previous-directory - "gj" 'vc-dir-next-directory - "gk" 'vc-dir-previous-directory - (kbd "C-j") 'vc-dir-next-directory - (kbd "C-k") 'vc-dir-previous-directory - - ;; The remainder. - "gf" 'vc-dir-find-file - "\C-m" 'vc-dir-find-file - - (kbd "S-") 'vc-dir-find-file-other-window - "go" 'vc-dir-find-file-other-window - "gO" 'vc-dir-display-file - (kbd "M-") 'vc-dir-display-file - - "\C-c\C-c" 'vc-dir-kill-dir-status-process - [down-mouse-3] 'vc-dir-menu - [mouse-2] 'vc-dir-find-file-other-window - "t" 'vc-dir-toggle-mark - [follow-link] 'mouse-face - - "(" 'vc-dir-hide-up-to-date - "o" 'vc-dir-hide-up-to-date - - "X" 'vc-dir-kill-line - "S" 'vc-dir-search - "Q" 'vc-dir-query-replace-regexp - (kbd "M-s a C-s") 'vc-dir-isearch - (kbd "M-s a M-C-s") 'vc-dir-isearch-regexp - "i" 'vc-dir-ignore - - ;; Branching - "Bc" 'vc-create-tag - "Bl" 'vc-print-branch-log - "Bs" 'vc-retrieve-tag)) - -(provide 'evil-collection-vc-dir) -;;; evil-collection-vc-dir.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/vc-git/README.org b/.config/emacs/lisp/evil-collection/modes/vc-git/README.org deleted file mode 100644 index 4d4e8bb..0000000 --- a/.config/emacs/lisp/evil-collection/modes/vc-git/README.org +++ /dev/null @@ -1,16 +0,0 @@ -* vc-git - - Evil bindings for the vc-git log view (=vc-git-log-view-mode=). - -** Key bindings - - | Command | Original | Evil | - |---------------------------------+----------+-------| - | =quit-window= | =q= | =q= | - | =log-view-diff= | ===, =d= | =d= | - | =log-view-diff-changeset= | =D= | =D= | - | =log-view-msg-next= | =n= | =C-j= | - | =log-view-msg-prev= | =p= | =C-k= | - | =log-view-toggle-entry-display= | =RET= | =TAB= | - - Initial state for =vc-git-log-view-mode= is normal. diff --git a/.config/emacs/lisp/evil-collection/modes/vc-git/evil-collection-vc-git.el b/.config/emacs/lisp/evil-collection/modes/vc-git/evil-collection-vc-git.el deleted file mode 100644 index 4f002be..0000000 --- a/.config/emacs/lisp/evil-collection/modes/vc-git/evil-collection-vc-git.el +++ /dev/null @@ -1,48 +0,0 @@ -;;; evil-collection-vc-git.el --- Evil bindings for Vc-Git -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, vc-git, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for Vc-Git. - -;;; Code: -(require 'vc-git) -(require 'evil-collection) - -(defconst evil-collection-vc-git-maps '(vc-git-mode-map)) - -;;;###autoload -(defun evil-collection-vc-git-setup () - "Set up `evil' bindings for `vc-git'." - (evil-set-initial-state 'vc-git-log-view-mode 'normal) - (evil-collection-define-key 'normal 'vc-git-log-view-mode-map - "q" 'quit-window - "d" 'log-view-diff - "D" 'log-view-diff-changeset - (kbd "C-j") 'log-view-msg-next - (kbd "C-k") 'log-view-msg-prev - (kbd "") 'log-view-toggle-entry-display)) - -(provide 'evil-collection-vc-git) -;;; evil-collection-vc-git.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/vdiff/README.org b/.config/emacs/lisp/evil-collection/modes/vdiff/README.org deleted file mode 100644 index 3ba3adf..0000000 --- a/.config/emacs/lisp/evil-collection/modes/vdiff/README.org +++ /dev/null @@ -1,18 +0,0 @@ -* vdiff - - Evil bindings for [[https://github.com/justbur/emacs-vdiff][vdiff]], a vimdiff-style diff/merge interface. - - Applied to both =vdiff-mode-map= and =vdiff-3way-mode-map=. - -** Key bindings - - | Command | Original | Evil | - |-------------------------+----------+------| - | =vdiff-next-hunk= | (varies) | =]c= | - | =vdiff-previous-hunk= | (varies) | =[c= | - | =vdiff-receive-changes= | =do= | =do= | - | =vdiff-send-changes= | =dp= | =dp= | - - =do= / =dp= are installed as evil operator-keys via - =evil-collection-define-operator-key= so they compose with motions like - vim's =do= (diff obtain) and =dp= (diff put). diff --git a/.config/emacs/lisp/evil-collection/modes/vdiff/evil-collection-vdiff.el b/.config/emacs/lisp/evil-collection/modes/vdiff/evil-collection-vdiff.el deleted file mode 100644 index 393061a..0000000 --- a/.config/emacs/lisp/evil-collection/modes/vdiff/evil-collection-vdiff.el +++ /dev/null @@ -1,54 +0,0 @@ -;;; evil-collection-vdiff.el --- Evil bindings for vdiff -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Evgeni Kolev -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, vdiff, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for vdiff.el https://github.com/justbur/emacs-vdiff - -;;; Code: -(require 'vdiff nil t) -(require 'evil-collection) - -(defconst evil-collection-vdiff-maps '(vdiff-mode-map - vdiff-3way-mode-map)) - -;;;###autoload -(defun evil-collection-vdiff-setup () - "Set up `evil' bindings for `vdiff-mode'." - (add-hook 'vdiff-mode-hook 'evil-normalize-keymaps) - (add-hook 'vdiff-3way-mode-hook 'evil-normalize-keymaps) - - (dolist (keymap evil-collection-vdiff-maps) - (evil-collection-define-key 'normal keymap - "]c" 'vdiff-next-hunk - "[c" 'vdiff-previous-hunk) - - ;; define `do' (diff obtain) and `dp' (diff put) bindings - (evil-collection-define-operator-key 'delete keymap - "o" 'vdiff-receive-changes - "p" 'vdiff-send-changes))) - -(provide 'evil-collection-vdiff) - -;;; evil-collection-vdiff.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/vertico/README.org b/.config/emacs/lisp/evil-collection/modes/vertico/README.org deleted file mode 100644 index 5ea5d14..0000000 --- a/.config/emacs/lisp/evil-collection/modes/vertico/README.org +++ /dev/null @@ -1,40 +0,0 @@ -* vertico - - Evil bindings for [[https://github.com/minad/vertico][vertico]]. - - Bindings only take effect when =evil-collection-setup-minibuffer= is non-nil - (excluding the global == → =abort-recursive-edit=). - -** Key bindings - -*** vertico-map (normal state) - - | Command | Original | Evil | - |--------------------------+-----------------+------------| - | =abort-recursive-edit= | =C-g= | == | - | =vertico-first= | =M-<= | =gg= | - | =vertico-last= | =M->= | =G= | - | =vertico-next= | ==, =C-n= | =j= | - | =vertico-previous= | ==, =C-p= | =k= | - | =vertico-next-group= | =M-}= | =gj= | - | =vertico-previous-group= | =M-{= | =gk= | - | =vertico-scroll-down= | =M-v= | =C-u= | - | =vertico-scroll-up= | =C-v= | =C-d= | - - =C-u= is gated on =evil-want-C-u-scroll=; =C-d= on =evil-want-C-d-scroll=. - -*** vertico-map (insert state) - - | Command | Original | Evil | - |--------------------+----------+-------| - | =vertico-next= | =C-n= | =C-n= | - | =vertico-previous= | =C-p= | =C-p= | - - With =evil-collection-vertico-want-want-C-u-in-insert= and - =evil-want-C-u-delete= unset, =C-u= → =vertico-scroll-down= in insert state. - -** Customization - - | Variable | Default | Purpose | - |---------------------------------------------------+---------+-------------------------------------| - | =evil-collection-vertico-want-want-C-u-in-insert= | =nil= | Allow =C-u= scroll in insert state. | diff --git a/.config/emacs/lisp/evil-collection/modes/vertico/evil-collection-vertico.el b/.config/emacs/lisp/evil-collection/modes/vertico/evil-collection-vertico.el deleted file mode 100644 index 521e1a1..0000000 --- a/.config/emacs/lisp/evil-collection/modes/vertico/evil-collection-vertico.el +++ /dev/null @@ -1,68 +0,0 @@ -;;; evil-collection-vertico.el --- Evil bindings for vertico -*- lexical-binding: t -*- - -;; Copyright (C) 2021 Kisaragi Hiu - -;; Author: Kisaragi Hiu -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, vertico, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `vertico'. - -;;; Code: -(require 'evil-collection) -(require 'vertico nil t) - -(defcustom evil-collection-vertico-want-want-C-u-in-insert nil - "When non nil, C-u may be bound in insert state." - :group 'evil-collection - :type 'boolean) - -;;;###autoload -(defun evil-collection-vertico-setup () - "Set up `evil' bindings for `vertico'." - (evil-collection-define-key nil 'vertico-map - (kbd "") 'abort-recursive-edit) - - (defvar evil-collection-setup-minibuffer) - (when evil-collection-setup-minibuffer - (when evil-want-C-u-scroll - (evil-collection-define-key 'normal 'vertico-map - (kbd "C-u") 'vertico-scroll-down)) - (when evil-collection-vertico-want-want-C-u-in-insert - (unless evil-want-C-u-delete - (evil-collection-define-key 'insert 'vertico-map - (kbd "C-u") 'vertico-scroll-down))) - (when evil-want-C-d-scroll - (evil-collection-define-key 'normal 'vertico-map - (kbd "C-d") 'vertico-scroll-up)) - - (evil-collection-define-key 'normal 'vertico-map - "gg" 'vertico-first - "G" 'vertico-last - "gj" 'vertico-next-group - "gk" 'vertico-previous-group - "j" 'vertico-next - "k" 'vertico-previous) - - (evil-collection-define-key 'insert 'vertico-map - (kbd "C-n") 'vertico-next - (kbd "C-p") 'vertico-previous))) - -(provide 'evil-collection-vertico) -;;; evil-collection-vertico.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/view/README.org b/.config/emacs/lisp/evil-collection/modes/view/README.org deleted file mode 100644 index 39a990c..0000000 --- a/.config/emacs/lisp/evil-collection/modes/view/README.org +++ /dev/null @@ -1,14 +0,0 @@ -* view - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/View-Mode.html][View mode]]. - -** Key bindings - - | Command | Original | Evil | - |-----------------------------+----------+---------| - | =View-quit= | =q= | =q= | - | =View-scroll-page-forward= | =SPC= | =SPC= | - | =View-scroll-page-backward= | =S-SPC= | =S-SPC= | - | =revert-buffer= | =g= | =gr= | - - View mode starts in evil normal state. diff --git a/.config/emacs/lisp/evil-collection/modes/view/evil-collection-view.el b/.config/emacs/lisp/evil-collection/modes/view/evil-collection-view.el deleted file mode 100644 index 70c66ed..0000000 --- a/.config/emacs/lisp/evil-collection/modes/view/evil-collection-view.el +++ /dev/null @@ -1,49 +0,0 @@ -;;; evil-collection-view.el --- Evil bindings for view -*- lexical-binding: t -*- - -;; Copyright (C) 2018 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, bindings, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for View. - -;;; Code: -(require 'evil-collection) -(require 'view) - -(defconst evil-collection-view-maps '(view-mode-map)) - -;;;###autoload -(defun evil-collection-view-setup () - "Set up `evil' bindings for `view'." - (add-hook 'view-mode-hook 'evil-normalize-keymaps) - (evil-set-initial-state 'view-mode 'normal) - (evil-collection-define-key 'normal 'view-mode-map - "q" 'View-quit - (kbd "SPC") 'View-scroll-page-forward - (kbd "S-SPC") 'View-scroll-page-backward - - ;; refresh - (kbd "gr") 'revert-buffer)) - -(provide 'evil-collection-view) -;;; evil-collection-view.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/vlf/README.org b/.config/emacs/lisp/evil-collection/modes/vlf/README.org deleted file mode 100644 index 05842c4..0000000 --- a/.config/emacs/lisp/evil-collection/modes/vlf/README.org +++ /dev/null @@ -1,46 +0,0 @@ -* vlf - - Evil bindings for [[https://github.com/m00natic/vlfi][vlf]] (View Large Files). Bindings are added to - =vlf-prefix-map= (the =C-c C-v= prefix). - -** Key bindings - - Always installed: - - | Command | Original | Evil | - |-------------------------------------------+----------+-------------------| - | =vlf-next-batch= | =n= | =gj=, =C-j=, =]]= | - | =vlf-prev-batch= | =p= | =gk=, =C-k=, =[[= | - | =vlf-change-batch-size= | =+= | =+= | - | =evil-collection-vlf-decrease-batch-size= | =-= | =-= | - | =vlf-next-batch-from-point= | =SPC= | === | - | =vlf-revert= | =g= | =gr= | - | =vlf-query-replace= | =%= | =g%= | - | =vlf-occur= | =o= | =go= | - - When =evil-collection-want-g-bindings= is non-nil: - - | Command | Original | Evil | - |--------------------------+----------+------| - | =vlf-re-search-forward= | =s= | =g/= | - | =vlf-re-search-backward= | =r= | =g?= | - | =vlf-jump-to-chunk= | =j= | =gJ= | - | =vlf-ediff-buffers= | =e= | =gE= | - | =vlf-goto-line= | =l= | =g:= | - | =vlf-toggle-follow= | =f= | =gF= | - - When =evil-collection-want-g-bindings= is nil: - - | Command | Original | Evil | - |--------------------------+----------+------| - | =vlf-re-search-forward= | =s= | =s= | - | =vlf-re-search-backward= | =r= | =S= | - | =vlf-jump-to-chunk= | =j= | =J= | - | =vlf-ediff-buffers= | =e= | =E= | - | =vlf-goto-line= | =l= | =L= | - | =vlf-toggle-follow= | =f= | =F= | - -** New commands - - - =evil-collection-vlf-decrease-batch-size= - Halve the vlf batch size - (mirror of =vlf-change-batch-size= with a prefix arg), bound to =-=. diff --git a/.config/emacs/lisp/evil-collection/modes/vlf/evil-collection-vlf.el b/.config/emacs/lisp/evil-collection/modes/vlf/evil-collection-vlf.el deleted file mode 100644 index b1482e2..0000000 --- a/.config/emacs/lisp/evil-collection/modes/vlf/evil-collection-vlf.el +++ /dev/null @@ -1,86 +0,0 @@ -;;; evil-collection-vlf.el --- Evil bindings for vlf -*- lexical-binding: t -*- - -;; Copyright (C) 2017 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, vlf, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `vlf'. - -;;; Code: -(require 'evil-collection) -(require 'vlf nil t) - -(defvar vlf-mode-map) -(declare-function vlf-change-batch-size "vlf") - -(defconst evil-collection-vlf-maps '(vlf-mode-map)) - -(define-obsolete-variable-alias 'evil-collection-vlf-want-g-bindings - 'evil-collection-want-g-bindings "0.0.11") - -(defun evil-collection-vlf-decrease-batch-size () - "Decrease vlf batch size by factor of 2." - (interactive) - (vlf-change-batch-size t)) - -;;; Code: -;;;###autoload -(defun evil-collection-vlf-setup () - "Set up `evil' bindings for `vlf'." - (evil-set-initial-state 'vlf-mode 'normal) - - (add-hook 'vlf-mode-hook #'evil-normalize-keymaps) - - (evil-collection-define-key 'normal 'vlf-prefix-map - "gj" 'vlf-next-batch - "gk" 'vlf-prev-batch - (kbd "C-j") 'vlf-next-batch - (kbd "C-k") 'vlf-prev-batch - "]]" 'vlf-next-batch - "[[" 'vlf-prev-batch - "+" 'vlf-change-batch-size - "-" 'evil-collection-vlf-decrease-batch-size - "=" 'vlf-next-batch-from-point - ;; refresh - "gr" 'vlf-revert - "g%" 'vlf-query-replace - "go" 'vlf-occur) - - (if evil-collection-want-g-bindings - (evil-collection-define-key 'normal 'vlf-prefix-map - "g/" 'vlf-re-search-forward - "g?" 'vlf-re-search-backward - "gJ" 'vlf-jump-to-chunk - "gE" 'vlf-ediff-buffers - "g:" 'vlf-goto-line - "gF" 'vlf-toggle-follow) - (evil-collection-define-key 'normal 'vlf-prefix-map - "s" 'vlf-re-search-forward - "S" 'vlf-re-search-backward - "J" 'vlf-jump-to-chunk - "E" 'vlf-ediff-buffers - "L" 'vlf-goto-line - "F" 'vlf-toggle-follow))) - -(provide 'evil-collection-vlf) -;;; evil-collection-vlf.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/vterm/README.org b/.config/emacs/lisp/evil-collection/modes/vterm/README.org deleted file mode 100644 index c6133fd..0000000 --- a/.config/emacs/lisp/evil-collection/modes/vterm/README.org +++ /dev/null @@ -1,55 +0,0 @@ -* vterm - - Evil bindings for [[https://github.com/akermu/emacs-libvterm][vterm]]. - - Initial state is =insert=. Normal state adds the bindings below and uses - vterm-aware operators that respect the prompt boundary. - -** Key bindings (normal state) - - | Command | Original | Evil | - |-----------------------------------------+-----------+------| - | =vterm-previous-prompt= | =C-c C-p= | =[[= | - | =vterm-next-prompt= | =C-c C-n= | =]]= | - | =vterm-yank= (paste before) | =C-y= | =P= | - | =evil-collection-vterm-paste-after= | n/a | =p= | - | =evil-collection-vterm-insert= | n/a | =i= | - | =evil-collection-vterm-insert-line= | n/a | =I= | - | =evil-collection-vterm-append= | n/a | =a= | - | =evil-collection-vterm-append-line= | n/a | =A= | - | =evil-collection-vterm-first-non-blank= | n/a | =^= | - | =vterm-undo= | n/a | =u= | - | =vterm-reset-cursor-point= | =C-c C-r= | =G= | - - =RET= sends to the terminal in the state named by =evil-collection-repl-submit-state=. - -** Insert state - - To preserve terminal control sequences, the following are forwarded raw to - the terminal via =vterm--self-insert=: =C-a=, =C-b=, =C-d=, =C-e=, =C-f=, - =C-k=, =C-l=, =C-n=, =C-o=, =C-p=, =C-q=, =C-r=, =C-s=, =C-t=, =C-u=, =C-v=, - =C-w=, =C-y=, =C-z=. =C-c= (prefix) and =C-h= (help) are not forwarded. - - == → =vterm-send-delete=. - -** New commands - - | Command | Key | | - |----------------------------------------------+-----------+--------------------------------------------| - | =evil-collection-vterm-delete= | =d= | delete operator, clamped to current line | - | =evil-collection-vterm-delete-line= | =D= | delete to end-of-line | - | =evil-collection-vterm-delete-char= | =x= | delete forward char | - | =evil-collection-vterm-delete-backward-char= | =X= | delete backward char | - | =evil-collection-vterm-change= | =c= | change operator | - | =evil-collection-vterm-change-line= | =C= | change to end-of-line | - | =evil-collection-vterm-substitute= | =s= | | - | =evil-collection-vterm-substitute-line= | =S= | | - | =evil-collection-vterm-replace= | =r= | | - | =evil-collection-vterm-next-line= | =j= | won't move below last prompt line | - | =evil-collection-vterm-toggle-send-escape= | =C-c C-z= | toggle whether =ESC= goes to vterm or evil | - -** Customization - - | Variable | Default | Purpose | - |------------------------------------------+---------+--------------------------------------------------------| - | =evil-collection-vterm-move-cursor-back= | =nil= | Move cursor back one column when leaving insert state. | diff --git a/.config/emacs/lisp/evil-collection/modes/vterm/evil-collection-vterm.el b/.config/emacs/lisp/evil-collection/modes/vterm/evil-collection-vterm.el deleted file mode 100644 index d66dde8..0000000 --- a/.config/emacs/lisp/evil-collection/modes/vterm/evil-collection-vterm.el +++ /dev/null @@ -1,308 +0,0 @@ -;;; evil-collection-vterm.el --- Bindings for `vterm' -*- lexical-binding: t -*- - -;; Copyright (C) 2019 James Nguyen -;; Copyright (C) 2020 Alex Griffin - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, vterm, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `vterm'. - -;;; Code: -(require 'evil-collection) -(require 'vterm nil t) - -(defconst evil-collection-vterm-maps '(vterm-mode-map)) - -(declare-function vterm-goto-char "vterm") -(declare-function vterm--get-prompt-point "vterm") -(declare-function vterm--get-end-of-line "vterm") -(declare-function vterm-delete-region "vterm") - -(defvar vterm--process) - -(defcustom evil-collection-vterm-move-cursor-back nil - "Whether the cursor is moved backwards when exiting insert state." - :type 'boolean - :group 'vterm) - -(defun evil-collection-vterm-escape-stay () - "Go back to normal state but don't move cursor backwards. -Moving cursor backwards is the default vim behavior but -it is not appropriate in some cases like terminals." - (setq-local evil-move-cursor-back - evil-collection-vterm-move-cursor-back)) - -(defvar-local evil-collection-vterm-send-escape-to-vterm-p nil - "Track whether or not we send ESC to `vterm' or `emacs'.") - -(defun evil-collection-vterm-toggle-send-escape () - "Toggle where ESC is sent between `vterm' and `emacs'. - -This is needed for programs that use ESC, e.g. vim or an ssh'd emacs that -also uses `evil-mode'." - (interactive) - (if evil-collection-vterm-send-escape-to-vterm-p - (evil-collection-define-key 'insert 'vterm-mode-map (kbd "") - (lookup-key evil-insert-state-map (kbd ""))) - (evil-collection-define-key 'insert 'vterm-mode-map - (kbd "") 'vterm--self-insert)) - (setq evil-collection-vterm-send-escape-to-vterm-p - (not evil-collection-vterm-send-escape-to-vterm-p)) - (message (format "Sending ESC to %s." - (if evil-collection-vterm-send-escape-to-vterm-p - "vterm" - "emacs")))) - -(declare-function vterm-cursor-in-command-buffer-p "vterm") -(declare-function vterm-beginning-of-line "vterm") -(declare-function vterm-insert "vterm") - -(evil-define-motion evil-collection-vterm-first-non-blank () - "Move the cursor to the first non-blank character -after the prompt." - :type exclusive - (if (vterm-cursor-in-command-buffer-p (point)) - (vterm-beginning-of-line) - (evil-first-non-blank))) - -(defun evil-collection-vterm-insert () - "Insert character before cursor." - (interactive) - (vterm-goto-char (point)) - (call-interactively #'evil-insert)) - -(defun evil-collection-vterm-insert-line () - "Insert character at beginning of prompt." - (interactive) - (vterm-goto-char (vterm--get-prompt-point)) - (call-interactively #'evil-insert)) - -(defun evil-collection-vterm-append () - "Append character after cursor." - (interactive) - (vterm-goto-char (1+ (point))) - (call-interactively #'evil-insert)) - -(defun evil-collection-vterm-append-line () - "Append character at end-of-line." - (interactive) - (vterm-goto-char (vterm--get-end-of-line)) - (call-interactively #'evil-insert)) - -(declare-function vterm-yank "vterm") - -(defun evil-collection-vterm-paste-after (&optional arg) - (interactive "P") - (vterm-goto-char (+ 1 (point))) - (call-interactively #'vterm-yank arg)) - -(declare-function vterm-reset-cursor-point "vterm") - -(evil-define-operator evil-collection-vterm-delete (beg end type register yank-handler) - "Modification of evil-delete to work in vterm buffer. -Delete text from BEG to END with TYPE. -Save in REGISTER or in the kill-ring with YANK-HANDLER." - (interactive "") - (let* ((beg (max (or beg (point)) (vterm--get-prompt-point))) - (end (min (or end beg) (vterm--get-end-of-line)))) - (unless register - (let ((text (filter-buffer-substring beg end))) - (unless (string-match-p "\n" text) - ;; set the small delete register - (evil-set-register ?- text)))) - (let ((evil-was-yanked-without-register nil)) - (evil-yank beg end type register yank-handler)) - (cond - ((eq type 'block) - (evil-apply-on-block #'vterm-delete-region beg end nil)) - ((and (eq type 'line) - (= end (point-max)) - (or (= beg end) - (/= (char-before end) ?\n)) - (/= beg (point-min)) - (= (char-before beg) ?\n)) - (vterm-delete-region (1- beg) end)) - (t - (vterm-delete-region beg end))) - ;; place cursor on beginning of line - (when (and (called-interactively-p 'any) - (eq type 'line)) - (vterm-reset-cursor-point)))) - -(evil-define-operator evil-collection-vterm-delete-backward-char (beg end type register) - "Delete previous character." - :motion evil-backward-char - (interactive "") - (evil-collection-vterm-delete beg end type register)) - -(evil-define-operator evil-collection-vterm-delete-char (beg end type register) - "Delete current character." - :motion evil-forward-char - (interactive "") - (evil-collection-vterm-delete beg end type register)) - -(evil-define-operator evil-collection-vterm-delete-line (beg end type register yank-handler) - "Modification of evil-delete line to work in vterm bufer. Delete to end of line." - :motion nil - :keep-visual t - (interactive "") - ;; act linewise in Visual state - (let* ((beg (or beg (point))) - (end (or end beg)) - (visual-line-mode (and evil-respect-visual-line-mode - visual-line-mode)) - (line-end (if visual-line-mode - (save-excursion - (end-of-visual-line) - (point)) - (line-end-position)))) - (when (evil-visual-state-p) - (unless (memq type '(line screen-line block)) - (let ((range (evil-expand beg end - (if visual-line-mode - 'screen-line - 'line)))) - (setq beg (evil-range-beginning range) - end (evil-range-end range) - type (evil-type range)))) - (evil-exit-visual-state)) - (cond - ((eq type 'block) - ;; equivalent to $d, i.e., we use the block-to-eol selection and - ;; call `evil-collection-vterm-delete'. In this case we fake the call to - ;; `evil-end-of-line' by setting `temporary-goal-column' and - ;; `last-command' appropriately as `evil-end-of-line' would do. - (let ((temporary-goal-column most-positive-fixnum) - (last-command 'next-line)) - (evil-collection-vterm-delete beg end 'block register yank-handler))) - ((memq type '(line screen-line)) - (evil-collection-vterm-delete beg end type register yank-handler)) - (t - (evil-collection-vterm-delete beg line-end type register yank-handler))))) - -(evil-define-operator evil-collection-vterm-replace (beg end type register yank-handler) - :motion evil-forward-char - (interactive "") - (let ((replacement (make-string (- end beg) (read-char)))) - (evil-collection-vterm-delete beg end type register yank-handler) - (vterm-insert replacement) - (vterm-goto-char (1- end)))) - -(evil-define-operator evil-collection-vterm-change (beg end type register yank-handler) - (evil-collection-vterm-delete beg end type register yank-handler) - (evil-collection-vterm-insert)) - -(evil-define-operator evil-collection-vterm-change-line (beg end type register yank-handler) - :motion evil-end-of-line-or-visual-line - (evil-collection-vterm-delete-line beg end type register yank-handler) - (evil-collection-vterm-insert)) - -(evil-define-operator evil-collection-vterm-substitute (beg end type register) - :motion evil-forward-char - (interactive "") - (evil-collection-vterm-change beg end type register)) - -(evil-define-operator evil-collection-vterm-substitute-line (beg end register yank-handler) - :motion evil-line-or-visual-line - :type line - (interactive "") - (evil-collection-vterm-change beg end 'line register yank-handler)) - -(evil-define-motion evil-collection-vterm-next-line (count) - "Move the cursor COUNT lines down. -But don't allow the cursor to move bellow the last prompt line." - :type line - ;; This successfully prevents the `j' button from moving to an empty line - ;; bellow the last prompt. However, it still can be bugged for example by - ;; going to the one line above the last prompt and doing `10j'. - (when (> (count-words (point) (point-max)) 0) - (evil-next-line count))) - -;;;###autoload -(defun evil-collection-vterm-setup () - "Set up `evil' bindings for `vterm'." - (evil-set-initial-state 'vterm-mode 'insert) - - (add-hook 'vterm-mode-hook #'evil-collection-vterm-escape-stay) - - ;; Open to a better binding... - (evil-collection-define-key '(normal insert) 'vterm-mode-map - (kbd "C-c C-z") 'evil-collection-vterm-toggle-send-escape) - - ;; Evil has some "C-" bindings in insert state that shadow regular terminal - ;; bindings. Don't raw-send "C-c" (prefix key) nor "C-h" (help prefix). - (evil-collection-define-key 'insert 'vterm-mode-map - (kbd "C-a") 'vterm--self-insert - (kbd "C-b") 'vterm--self-insert ; Should not be necessary. - (kbd "C-d") 'vterm--self-insert - (kbd "C-e") 'vterm--self-insert - (kbd "C-f") 'vterm--self-insert ; Should not be necessary. - (kbd "C-k") 'vterm--self-insert - (kbd "C-l") 'vterm--self-insert ; Should not be necessary. - (kbd "C-n") 'vterm--self-insert - (kbd "C-o") 'vterm--self-insert - (kbd "C-p") 'vterm--self-insert - (kbd "C-q") 'vterm--self-insert ; Should not be necessary. - (kbd "C-r") 'vterm--self-insert - (kbd "C-s") 'vterm--self-insert ; Should not be necessary. - (kbd "C-t") 'vterm--self-insert - (kbd "C-u") 'vterm--self-insert ; Should not be necessary. - (kbd "C-v") 'vterm--self-insert ; Should not be necessary. - (kbd "C-w") 'vterm--self-insert - (kbd "C-y") 'vterm--self-insert - (kbd "C-z") 'vterm--self-insert - (kbd "") 'vterm-send-delete) - - (let* ((submit evil-collection-repl-submit-state)) - (evil-collection-define-key submit 'vterm-mode-map - (kbd "RET") 'vterm-send-return)) - - (evil-collection-define-key 'normal 'vterm-mode-map - "[[" 'vterm-previous-prompt - "]]" 'vterm-next-prompt - "p" 'evil-collection-vterm-paste-after - "P" 'vterm-yank - "a" 'evil-collection-vterm-append - "A" 'evil-collection-vterm-append-line - "d" 'evil-collection-vterm-delete - "D" 'evil-collection-vterm-delete-line - "x" 'evil-collection-vterm-delete-char - "X" 'evil-collection-vterm-delete-backward-char - "^" 'evil-collection-vterm-first-non-blank - "i" 'evil-collection-vterm-insert - "I" 'evil-collection-vterm-insert-line - "u" 'vterm-undo - "r" 'evil-collection-vterm-replace - "c" 'evil-collection-vterm-change - "C" 'evil-collection-vterm-change-line - "s" 'evil-collection-vterm-substitute - "S" 'evil-collection-vterm-substitute-line - "j" 'evil-collection-vterm-next-line - "G" 'vterm-reset-cursor-point) - - (evil-collection-define-key 'visual 'vterm-mode-map - "d" 'evil-collection-vterm-delete - "x" 'evil-collection-vterm-delete-backward-char)) - -(provide 'evil-collection-vterm) -;;; evil-collection-vterm.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/vundo/README.org b/.config/emacs/lisp/evil-collection/modes/vundo/README.org deleted file mode 100644 index 04e505b..0000000 --- a/.config/emacs/lisp/evil-collection/modes/vundo/README.org +++ /dev/null @@ -1,31 +0,0 @@ -* vundo - - Evil bindings for [[https://github.com/casouri/vundo][vundo]], visual undo tree. - - Upstream defaults to emacs state; evil-collection forces normal state on - entry, hides the evil cursor, and disables =hl-line-mode= locally. - -** Key bindings - - | Command | Original | Evil | - |---------------------+--------------+--------------------------------| - | =vundo-forward= | =f=, =right= | =l=, =C-f=, =right= | - | =vundo-backward= | =b=, =left= | =h=, =C-b=, =left=, =DEL= | - | =vundo-next= | =n= | =j=, =C-n=, =C-j=, =M-j= | - | =vundo-previous= | =p= | =k=, =C-p=, =C-k=, =M-k= | - | =vundo-stem-root= | =a= | =H= (evil-window-top remap) | - | =vundo-stem-end= | =e= | =L= (evil-window-bottom remap) | - | =vundo-next-root= | =w= | =w= | - | =vundo-confirm= | =RET= | =RET=, =ZZ= | - | =vundo-quit= | =q=, =C-g= | =q=, =ZQ= | - | =vundo-diff= | =d= | =d= | - | =vundo-diff-mark= | =m= | =m= | - | =vundo-diff-unmark= | =u= | =u= | - | =vundo--inspect= | =i= | =i= | - | =vundo--debug= | =D= | =D= | - - Direction keys are wired via =[remap]= against the corresponding evil - motion command (=evil-backward-char=, =evil-forward-char=, etc.) so they - follow any user rebinding of those motions. =vundo-goto-last-saved= (=l= - upstream) and =vundo-goto-next-saved= (=r= upstream) are shadowed by the - evil motion remaps; call them via =M-x= if needed. diff --git a/.config/emacs/lisp/evil-collection/modes/vundo/evil-collection-vundo.el b/.config/emacs/lisp/evil-collection/modes/vundo/evil-collection-vundo.el deleted file mode 100644 index e02c110..0000000 --- a/.config/emacs/lisp/evil-collection/modes/vundo/evil-collection-vundo.el +++ /dev/null @@ -1,93 +0,0 @@ -;;; evil-collection-vundo.el --- Bindings for `vundo-mode' -*- lexical-binding: t -*- - -;; Copyright (C) 2022 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "27.1")) -;; Keywords: evil, vundo, convenience - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `vundo-mode'. - -;;; Code: -(require 'vundo nil t) -(require 'evil-collection) - -(defgroup evil-collection-vundo nil - "Evil bindings for `vundo-mode'." - :group 'evil-collection) - -(defvar vundo-mode-map) - -(defconst evil-collection-vundo-maps '(vundo-mode-map)) - -(defun evil-collection-vundo--hide-evil-cursor () - "Hide the evil cursor." - (setq-local evil-default-cursor '(nil)) - (setq-local evil-motion-state-cursor nil) - (setq-local evil-visual-state-cursor nil) - (setq-local evil-normal-state-cursor nil) - (setq-local evil-insert-state-cursor nil) - (setq-local evil-emacs-state-cursor nil)) - -(defun evil-collection-vundo--disable-hl-line-mode () - "Disable `hl-line-mode'." - (setq-local global-hl-line-mode nil)) - -;;;###autoload -(defun evil-collection-vundo-setup () - "Set up `evil' bindings for `vundo'." - (add-hook 'vundo-mode-hook #'evil-normalize-keymaps) - ;; `vundo' defaults to emacs state. - (add-hook 'vundo-mode-hook #'evil-normal-state) - ;; hide evil cursor - (add-hook 'vundo-mode-hook #'evil-collection-vundo--hide-evil-cursor) - ;; disable hl-line-mode - (add-hook 'vundo-mode-hook #'evil-collection-vundo--disable-hl-line-mode) - - (evil-collection-define-key 'normal 'vundo-mode-map - [remap evil-backward-char] 'vundo-backward - [remap evil-forward-char] 'vundo-forward - [remap evil-next-line] 'vundo-next - [remap evil-previous-line] 'vundo-previous - [remap evil-window-top] 'vundo-stem-root - [remap evil-window-bottom] 'vundo-stem-end - [remap evil-ret] 'vundo-confirm - [remap evil-quit] 'vundo-quit - [remap evil-save-and-close] 'vundo-confirm - [remap evil-save-modified-and-close] 'vundo-confirm - [remap evil-delete-backward-char] 'vundo-backward - (kbd "C-n") 'vundo-next - (kbd "C-p") 'vundo-previous - (kbd "C-j") 'vundo-next - (kbd "C-k") 'vundo-previous - (kbd "M-j") 'vundo-next - (kbd "M-k") 'vundo-previous - "i" 'vundo--inspect - "D" 'vundo--debug - "d" 'vundo-diff - "m" 'vundo-diff-mark - "u" 'vundo-diff-unmark - "w" 'vundo-next-root - "q" 'vundo-quit - "ZZ" 'vundo-quit - "ZQ" 'vundo-quit)) - -(provide 'evil-collection-vundo) -;;; evil-collection-vundo.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/w3m/evil-collection-w3m.el b/.config/emacs/lisp/evil-collection/modes/w3m/evil-collection-w3m.el deleted file mode 100644 index ecdff0d..0000000 --- a/.config/emacs/lisp/evil-collection/modes/w3m/evil-collection-w3m.el +++ /dev/null @@ -1,87 +0,0 @@ -;;; evil-collection-w3m.el --- Evil bindings for w3m -*- lexical-binding: t -*- - -;; Copyright (C) 2018 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, w3m, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for `w3m'. - -;;; Code: -(require 'evil-collection) -(require 'w3m nil t) - -(defconst evil-collection-w3m-maps '(w3m-mode-map)) - -;;;###autoload -(defun evil-collection-w3m-setup () - "Set up `evil' bindings for `w3m'." - (evil-set-initial-state 'w3m-mode 'normal) - (evil-collection-define-key 'normal 'w3m-mode-map - (kbd "S-SPC") 'w3m-scroll-down-or-previous-url - (kbd "SPC") 'w3m-scroll-up-or-next-url - - (kbd "RET") 'w3m-view-this-url - "o" 'w3m-goto-url - "O" 'w3m-goto-url-new-session - - "]]" 'w3m-next-form - "[[" 'w3m-previous-form - - "H" 'w3m-view-previous-page - "L" 'w3m-view-next-page - "^" 'w3m-view-parent-page - - "gf" 'w3m-view-source - "gh" 'w3m-view-header - - "d" 'w3m-download-this-url - "M-d" 'w3m-download - - "I" 'w3m-view-image - "M-i" 'w3m-save-image - "zi" 'w3m-toggle-inline-image - "zI" 'w3m-toggle-inline-images - "M-T" 'w3m-turnoff-inline-images - - ;; bookmarks - "gb" 'w3m-bookmark-view - "gB" 'w3m-bookmark-view-new-session - "a" 'w3m-bookmark-add-current-url - - ;; refresh - "gr" 'w3m-reload-this-page - "gR" 'w3m-reload-all-pages - - ;; quit - "q" 'w3m-close-window - "ZQ" 'w3m-quit - "ZZ" 'quit-window) - - (evil-collection-define-operator-key 'yank 'w3m-mode-map - ;; yt - "t" 'w3m-print-this-url - ;; yu - "u" 'w3m-print-current-url)) - -(provide 'evil-collection-w3m) -;;; evil-collection-w3m.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/wdired/README.org b/.config/emacs/lisp/evil-collection/modes/wdired/README.org deleted file mode 100644 index 9a16e3d..0000000 --- a/.config/emacs/lisp/evil-collection/modes/wdired/README.org +++ /dev/null @@ -1,14 +0,0 @@ -* wdired - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Wdired.html][Wdired]] (writable Dired). - -** Key bindings - - | Command | Original | Evil | - |------------------------+-----------+------------| - | =wdired-finish-edit= | =C-c C-c= | =ZZ=, =:w= | - | =wdired-abort-changes= | =C-c C-k= | =ZQ= | - | =wdired-exit= | =C-x C-q= | == | - - =wdired-finish-edit= is also bound to =[remap evil-write]= so =:w= commits - the rename. Initial state in wdired-mode is normal. diff --git a/.config/emacs/lisp/evil-collection/modes/wdired/evil-collection-wdired.el b/.config/emacs/lisp/evil-collection/modes/wdired/evil-collection-wdired.el deleted file mode 100644 index e968b1e..0000000 --- a/.config/emacs/lisp/evil-collection/modes/wdired/evil-collection-wdired.el +++ /dev/null @@ -1,49 +0,0 @@ -;;; evil-collection-wdired.el --- Bindings for `wdired' -*- lexical-binding: t -*- - -;; Copyright (C) 2018 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `wdired'. - -;;; Code: -(require 'evil-collection) -(require 'wdired) - -(defconst evil-collection-wdired-maps '(wdired-mode-map)) - -;;;###autoload -(defun evil-collection-wdired-setup () - "Set up `evil' bindings for `wdired'." - (evil-set-initial-state 'wdired-mode 'normal) - - (evil-collection-define-key nil 'wdired-mode-map - [remap evil-write] 'wdired-finish-edit) - - (evil-collection-define-key 'normal 'wdired-mode-map - "ZQ" 'wdired-abort-changes - "ZZ" 'wdired-finish-edit - (kbd "") 'wdired-exit)) - -(provide 'evil-collection-wdired) -;;; evil-collection-wdired.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/wgrep/README.org b/.config/emacs/lisp/evil-collection/modes/wgrep/README.org deleted file mode 100644 index ca985ae..0000000 --- a/.config/emacs/lisp/evil-collection/modes/wgrep/README.org +++ /dev/null @@ -1,19 +0,0 @@ -* wgrep - - Evil bindings for [[https://github.com/mhayashi1120/Emacs-wgrep][wgrep]] (writable grep buffers). - - Upstream only binds finish / abort / toggle commands under =C-c= and - =C-x= prefixes. evil-collection layers the usual evil quit-and-save - bindings on top and remaps =evil-write= to finish the edit. - -** Key bindings - - | Command | Original | Evil | - |------------------------------+---------------------------------+------------| - | =wgrep-finish-edit= | =C-c C-c=, =C-c C-e=, =C-x C-s= | =ZZ=, =:w= | - | =wgrep-abort-changes= | =C-c C-k= | =ZQ= | - | =wgrep-exit= | =C-x C-q= | == | - | =wgrep-mark-deletion= | =C-c C-d= | =C-c C-d= | - | =wgrep-remove-change= | =C-c C-r= | =C-c C-r= | - | =wgrep-remove-all-change= | =C-c C-u= | =C-c C-u= | - | =wgrep-toggle-readonly-area= | =C-c C-p= | =C-c C-p= | diff --git a/.config/emacs/lisp/evil-collection/modes/wgrep/evil-collection-wgrep.el b/.config/emacs/lisp/evil-collection/modes/wgrep/evil-collection-wgrep.el deleted file mode 100644 index fd4d73a..0000000 --- a/.config/emacs/lisp/evil-collection/modes/wgrep/evil-collection-wgrep.el +++ /dev/null @@ -1,49 +0,0 @@ -;;; evil-collection-wgrep.el --- Bindings for `wgrep' -*- lexical-binding: t -*- - -;; Copyright (C) 2018 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `wgrep'. - -;;; Code: -(require 'evil-collection) -(require 'wgrep nil t) - -(defvar wgrep-mode-map) - -(defconst evil-collection-wgrep-maps '(wgrep-mode-map)) - -;;;###autoload -(defun evil-collection-wgrep-setup () - "Set up `evil' bindings for `wgrep'." - (evil-collection-define-key nil 'wgrep-mode-map - [remap evil-write] 'wgrep-finish-edit) - - (evil-collection-define-key 'normal 'wgrep-mode-map - "ZQ" 'wgrep-abort-changes - "ZZ" 'wgrep-finish-edit - (kbd "") 'wgrep-exit)) - -(provide 'evil-collection-wgrep) -;;; evil-collection-wgrep.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/which-key/README.org b/.config/emacs/lisp/evil-collection/modes/which-key/README.org deleted file mode 100644 index 17dd24a..0000000 --- a/.config/emacs/lisp/evil-collection/modes/which-key/README.org +++ /dev/null @@ -1,17 +0,0 @@ -* which-key - - Evil bindings for [[https://github.com/justbur/emacs-which-key][which-key]] paging popup. - - Only =which-key-C-h-map= (the paging popup invoked from inside a prefix) - is modified; the global which-key triggers themselves are untouched. - -** Key bindings - - | Command | Original | Evil | - |--------------------------------------+------------+------------| - | =which-key-abort= | =a=, =C-a= | =q= | - | =which-key-show-next-page-cycle= | =n=, =C-n= | =j=, =C-n= | - | =which-key-show-previous-page-cycle= | =p=, =C-p= | =k=, =C-p= | - | =which-key-show-standard-help= | =h=, =C-h= | =?=, =C-h= | - | =which-key-undo-key= | =u=, =C-u= | =u=, =C-u= | - | =which-key-toggle-docstrings= | =d=, =C-d= | =d=, =C-d= | diff --git a/.config/emacs/lisp/evil-collection/modes/which-key/evil-collection-which-key.el b/.config/emacs/lisp/evil-collection/modes/which-key/evil-collection-which-key.el deleted file mode 100644 index e0b8b9d..0000000 --- a/.config/emacs/lisp/evil-collection/modes/which-key/evil-collection-which-key.el +++ /dev/null @@ -1,52 +0,0 @@ -;;; evil-collection-which-key.el --- Evil bindings for which-key -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Maximiliano Sandoval -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, which-key, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for `which-key' - -;;; Code: - -(require 'evil-collection) -(require 'which-key nil t) - -(defvar which-key-C-h-map) - -(defconst evil-collection-which-key-maps '(which-key-C-h-map)) - -;; `which-key'is coded so that the prompt properly shows j and k as -;; the bindings. -;;;###autoload -(defun evil-collection-which-key-setup () - "Set up `evil' bindings for `which-key'." - - ;; (evil-collection-define-key nil 'which-key-C-h-map "u" 'which-key-undo-key) - (evil-collection-define-key nil 'which-key-C-h-map - "q" 'which-key-abort - "j" 'which-key-show-next-page-cycle - "k" 'which-key-show-previous-page-cycle - "?" 'which-key-show-standard-help)) - -(provide 'evil-collection-which-key) -;;; evil-collection-which-key.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/with-editor/README.org b/.config/emacs/lisp/evil-collection/modes/with-editor/README.org deleted file mode 100644 index 7007a69..0000000 --- a/.config/emacs/lisp/evil-collection/modes/with-editor/README.org +++ /dev/null @@ -1,17 +0,0 @@ -* with-editor - - Evil bindings for [[https://github.com/magit/with-editor][with-editor]], used for editing git commit messages - and similar =$EDITOR= sessions inside Emacs. - - Upstream already remaps =evil-quit=, =evil-save-and-close= and - =evil-save-modified-and-close= to =with-editor-cancel= / - =with-editor-finish=, so =:q=, =:wq= and =ZZ=/=ZQ= work out of the box. - evil-collection adds explicit normal-state =ZQ= and =ZZ= so they are - not subject to evil's save-modified semantics. - -** with-editor-mode-map (normal state) - - | Command | Original | Evil | - |----------------------+-----------+------| - | =with-editor-cancel= | =C-c C-k= | =ZQ= | - | =with-editor-finish= | =C-c C-c= | =ZZ= | diff --git a/.config/emacs/lisp/evil-collection/modes/with-editor/evil-collection-with-editor.el b/.config/emacs/lisp/evil-collection/modes/with-editor/evil-collection-with-editor.el deleted file mode 100644 index 91199a1..0000000 --- a/.config/emacs/lisp/evil-collection/modes/with-editor/evil-collection-with-editor.el +++ /dev/null @@ -1,45 +0,0 @@ -;;; evil-collection-with-editor.el --- Bindings for `with-editor' -*- lexical-binding: t -*- - -;; Copyright (C) 2024 Tianshu Wang - -;; Author: Tianshu Wang -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Bindings for `with-editor'. - -;;; Code: -(require 'evil-collection) -(require 'with-editor nil t) - -(defvar with-editor-mode-map) - -(defconst evil-collection-with-editor-maps '(with-editor-mode-map)) - -;;;###autoload -(defun evil-collection-with-editor-setup () - "Set up `evil' bindings for `with-editor'." - (evil-collection-define-key 'normal 'with-editor-mode-map - "ZQ" 'with-editor-cancel - "ZZ" 'with-editor-finish)) - -(provide 'evil-collection-with-editor) -;;; evil-collection-with-editor.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/woman/README.org b/.config/emacs/lisp/evil-collection/modes/woman/README.org deleted file mode 100644 index c929d47..0000000 --- a/.config/emacs/lisp/evil-collection/modes/woman/README.org +++ /dev/null @@ -1,13 +0,0 @@ -* woman - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/woman/index.html][WoMan]] (manpage viewer, no external tools). - -** Key bindings - - | Command | Original | Evil | - |----------------------------+----------+------| - | =WoMan-next-manpage= | =n= | =]]= | - | =WoMan-previous-manpage= | =p= | =[[= | - | =woman-reformat-last-file= | =R= | =gr= | - - Standard motion / quit bindings are inherited from =evil-collection-man=. diff --git a/.config/emacs/lisp/evil-collection/modes/woman/evil-collection-woman.el b/.config/emacs/lisp/evil-collection/modes/woman/evil-collection-woman.el deleted file mode 100644 index d7e889c..0000000 --- a/.config/emacs/lisp/evil-collection/modes/woman/evil-collection-woman.el +++ /dev/null @@ -1,51 +0,0 @@ -;;; evil-collection-woman.el --- Evil bindings for WoMan -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, woman, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for `woman'. - -;;; Code: -(require 'evil-collection) -(evil-collection-require 'man) -(require 'woman) - -(defconst evil-collection-woman-maps '(woman-mode-map)) - -;;;###autoload -(defun evil-collection-woman-setup () - "Set up `evil' bindings for `woman'." - (evil-set-initial-state 'woman-mode 'normal) - (evil-collection-define-key 'normal 'woman-mode-map - (kbd "]]") 'WoMan-next-manpage - (kbd "[[") 'WoMan-previous-manpage - - ;; goto - ;; "gm" 'woman - - ;; refresh - "gr" 'woman-reformat-last-file)) - -(provide 'evil-collection-woman) -;;; evil-collection-woman.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/xref/README.org b/.config/emacs/lisp/evil-collection/modes/xref/README.org deleted file mode 100644 index 36e32c9..0000000 --- a/.config/emacs/lisp/evil-collection/modes/xref/README.org +++ /dev/null @@ -1,26 +0,0 @@ -* xref - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Xref.html][xref]]. - -** xref--xref-buffer-mode-map - - | Command | Original | Evil | - |----------------------------------+----------+--------------------------| - | =xref-next-line= | =n=, =.= | =gj=, =C-j=, =C-n=, =]]= | - | =xref-prev-line= | =p=, =,= | =gk=, =C-k=, =C-p=, =[[= | - | #ERROR | =N= | =]]= | - | =xref-prev-group= (Emacs 28+) | =P= | =[[= | - | =xref-query-replace-in-results= | =r= | =r=, =Q= | - | =xref-goto-xref= | =RET= | =RET= | - | =xref-quit-and-goto-xref= | =TAB= | =S-RET= | - | =xref-show-location-at-point= | =C-o= | =o=, =go= | - | =xref-revert-buffer= (Emacs 27+) | n/a | =gr= | - #+TBLFM: $1=xref-next-group= (Emacs 28+) - -** xref--transient-buffer-mode-map - - (Emacs 27+) - - | Command | Original | Evil | - |---------------------------+--------------+-------| - | =xref-quit-and-goto-xref= | =RET=, =TAB= | =RET= | diff --git a/.config/emacs/lisp/evil-collection/modes/xref/evil-collection-xref.el b/.config/emacs/lisp/evil-collection/modes/xref/evil-collection-xref.el deleted file mode 100644 index 1c9ea17..0000000 --- a/.config/emacs/lisp/evil-collection/modes/xref/evil-collection-xref.el +++ /dev/null @@ -1,76 +0,0 @@ -;;; evil-collection-xref.el --- Evil bindings for xref -*- lexical-binding: t -*- - -;; Copyright (C) 2017, 2021 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, xref, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; Evil bindings for `xref'. - -;;; Code: -(require 'evil-collection) -(require 'xref) - -(defconst evil-collection-xref-maps `(xref--xref-buffer-mode-map - ,@(when (>= emacs-major-version 27) '(xref--transient-buffer-mode-map)))) - -;;;###autoload -(defun evil-collection-xref-setup () - "Set up `evil' bindings for `xref'." - (evil-set-initial-state 'xref--xref-buffer-mode 'normal) - (evil-collection-set-readonly-bindings 'xref--xref-buffer-mode-map) - (evil-collection-define-key 'normal 'xref--xref-buffer-mode-map - "gj" 'xref-next-line - "gk" 'xref-prev-line - (kbd "C-j") 'xref-next-line - (kbd "C-k") 'xref-prev-line - (kbd "C-n") 'xref-next-line - (kbd "C-p") 'xref-prev-line - "]]" 'xref-next-line - "[[" 'xref-prev-line - "r" 'xref-query-replace-in-results - - ;; Match `dired''s `dired-do-find-regexp-and-replace'. - "Q" 'xref-query-replace-in-results - - ;; open - (kbd "RET") 'xref-goto-xref - (kbd "S-") 'xref-quit-and-goto-xref ;; In Emacs mode map, TAB binds to `xref-quit-and-goto-xref' - "o" 'xref-show-location-at-point - "go" 'xref-show-location-at-point) - - (when (>= emacs-major-version 27) - (evil-collection-define-key 'normal 'xref--xref-buffer-mode-map - "gr" 'xref-revert-buffer)) - - (when (>= emacs-major-version 28) - (evil-collection-define-key 'normal 'xref--xref-buffer-mode-map - "[[" 'xref-prev-group - "]]" 'xref-next-group)) - - (when (>= emacs-major-version 27) - (evil-set-initial-state 'xref--transient-buffer-mode 'normal) - (evil-collection-define-key 'normal 'xref--transient-buffer-mode-map - (kbd "RET") 'xref-quit-and-goto-xref))) - -(provide 'evil-collection-xref) -;;; evil-collection-xref.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/xwidget/README.org b/.config/emacs/lisp/evil-collection/modes/xwidget/README.org deleted file mode 100644 index 5825785..0000000 --- a/.config/emacs/lisp/evil-collection/modes/xwidget/README.org +++ /dev/null @@ -1,43 +0,0 @@ -* xwidget - - Evil bindings for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Embedded-WebKit-Widgets.html][xwidget-webkit]], modeled after vimium. - -** Key bindings - - Standard read-only motion / quit bindings come from - =evil-collection-set-readonly-bindings=. - - | Command | Original | Evil | - |--------------------------------------------------+----------+----------------| - | =xwidget-webkit-scroll-up-line= | =C-n= | =j= | - | =xwidget-webkit-scroll-down-line= | =C-p= | =k= | - | =xwidget-webkit-scroll-top= | =M-<= | =gg= | - | =xwidget-webkit-scroll-bottom= | =M->= | =G= | - | =xwidget-webkit-scroll-backward= | =B= | =h= | - | =xwidget-webkit-scroll-forward= | =F= | =l= | - | =xwidget-webkit-scroll-up= | =SPC= | =C-f= | - | =xwidget-webkit-scroll-down= | =S-SPC= | =C-b= | - | =xwidget-webkit-back= | =r= | =H=, =<= | - | =xwidget-webkit-forward= | =R= | =L=, =>= | - | =xwidget-webkit-reload= | =g= | =r=, =gr= | - | =xwidget-webkit-current-url= | =u= | =yy= | - | =xwidget-webkit-browse-url= | =a= | =o=, =gu=, =J= | - | =xwidget-webkit-copy-selection-as-kill= (visual) | =w= | =y= | - | =xwidget-webkit-insert-string= | =i= | =RET= | - | =xwidget-webkit-zoom-in= | =+= | =+=, === | - | =xwidget-webkit-zoom-out= | =-= | =-= | - | =describe-mode= | =C-h m= | =?= | - -** New commands - - | Command | Key | Notes | - |----------------------------------------------------------+-----------+--------------------------------| - | =evil-collection-xwidget-webkit-scroll-half-page-up= | =d= | half-page down (vim semantics) | - | =evil-collection-xwidget-webkit-scroll-half-page-down= | =u= | half-page up (vim semantics) | - | =evil-collection-xwidget-webkit-new-tab= | =t= | prompt URL in new buffer | - | =evil-collection-xwidget-webkit-close-tab= | =x= | kill current buffer | - | =evil-collection-xwidget-webkit-restore-last-closed-tab= | =X= | reopen last closed | - | =evil-collection-xwidget-webkit-search-tabs= | =T=, =gt= | switch via =completing-read= | - - When =evil-want-C-d-scroll= / =evil-want-C-u-scroll= are non-nil, =C-d= and - =C-u= scroll the page. diff --git a/.config/emacs/lisp/evil-collection/modes/xwidget/evil-collection-xwidget.el b/.config/emacs/lisp/evil-collection/modes/xwidget/evil-collection-xwidget.el deleted file mode 100644 index ab197f1..0000000 --- a/.config/emacs/lisp/evil-collection/modes/xwidget/evil-collection-xwidget.el +++ /dev/null @@ -1,184 +0,0 @@ -;;; evil-collection-xwidget.el --- Evil bindings for Xwidget -*- lexical-binding: t -*- - -;; Copyright (C) 2020, 2022, 2024 Ruslan Kamashev - -;; Author: Ruslan Kamashev -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, xwidget, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for Xwidget. - -;;; Code: -(require 'xwidget) -(require 'evil-collection) - -(defvar evil-collection-xwidget-maps '(xwidget-webkit-mode-map)) - -;; Silence compile errors -(declare-function xwidget-webkit-uri "xwidget") -(declare-function xwidget-window-inside-pixel-height "xwidget") - -;; HACK: elisp byte-opt can't optimize 'format' out, so it's checked at runtime. -(defun evil-collection-xwidget-webkit--scroll-trampoline (f n) - "Compatible wrapper for `xwidget-webkit-scroll-up' and so on. - -F is the name of function, N is the pixel height." - (let ((realf (intern (format "%s" f)))) - (if (>= emacs-major-version 28) - (funcall realf n) - (funcall realf)))) - -(defun evil-collection-xwidget-webkit-scroll-half-page-up () - "Compatible wrapper for `xwidget-webkit-scroll-up'." - (interactive) - (evil-collection-xwidget-webkit--scroll-trampoline - "xwidget-webkit-scroll-up" - (/ (xwidget-window-inside-pixel-height (selected-window)) 2))) - -(defun evil-collection-xwidget-webkit-scroll-half-page-down () - "Compatible wrapper for `xwidget-webkit-scroll-down'." - (interactive) - (evil-collection-xwidget-webkit--scroll-trampoline - "xwidget-webkit-scroll-down" - (/ (xwidget-window-inside-pixel-height (selected-window)) 2))) - -(defun evil-collection-xwidget-webkit-new-tab (url) - "New tab (new buffer) of URL." - (interactive "s(New Tab) xwidget-webkit URL: ") - (xwidget-webkit-browse-url url :new-session)) - -(defvar evil-collection-xwidget-webkit-last-closed-tab-url nil) -(defun evil-collection-xwidget-webkit-close-tab () - "Close tab (kill buffer) without confirmation." - (interactive) - (setq evil-collection-xwidget-webkit-last-closed-tab-url - (xwidget-webkit-uri (xwidget-webkit-current-session))) - (let ((kill-buffer-query-functions nil)) - (kill-current-buffer))) - -(defun evil-collection-xwidget-webkit-restore-last-closed-tab () - "Restore last closed tab." - (interactive) - (if (null evil-collection-xwidget-webkit-last-closed-tab-url) - (message "No url to restore.") - (message (format "Restoring last closed tab %s" - evil-collection-xwidget-webkit-last-closed-tab-url)) - (xwidget-webkit-browse-url - evil-collection-xwidget-webkit-last-closed-tab-url :new-session) - (setq evil-collection-xwidget-webkit-last-closed-tab-url nil))) - -(defun evil-collection-xwidget-webkit-search-tabs () - "Search tabs (buffers) with `buffer-name'." - (interactive) - (cl-flet ((is-xwidget-webkit-buffer? - (b) (with-current-buffer b - (equal major-mode 'xwidget-webkit-mode)))) - (let ((bufs (cl-loop for b in (buffer-list) - when (is-xwidget-webkit-buffer? b) - collect (buffer-name b)))) - (switch-to-buffer (completing-read "Switch to Tab: " bufs nil t))))) - -;;;###autoload -(defun evil-collection-xwidget-setup () - "Set up `evil' bindings for `xwidget'." - (evil-collection-set-readonly-bindings 'xwidget-webkit-mode-map) - - (evil-collection-define-key 'visual 'xwidget-webkit-mode-map - "y" 'xwidget-webkit-copy-selection-as-kill) - - (evil-collection-define-key 'normal 'xwidget-webkit-mode-map - ;; Mimic vimium (a browser extension) - ;; - ;; Since xwidget has no tab concept, `open-url-new-tab' etc are not - ;; supported. - ;; - ;; TODO: edit-mode, visual-mode - ;; - ;; Navigating the page - "j" 'xwidget-webkit-scroll-up-line - "k" 'xwidget-webkit-scroll-down-line - "gg" 'xwidget-webkit-scroll-top - "G" 'xwidget-webkit-scroll-bottom - "d" 'evil-collection-xwidget-webkit-scroll-half-page-up - "u" 'evil-collection-xwidget-webkit-scroll-half-page-down - "h" 'xwidget-webkit-scroll-backward - "l" 'xwidget-webkit-scroll-forward - "r" 'xwidget-webkit-reload - "yy" 'xwidget-webkit-current-url - ;; TODO `first-text-input', `open-link-in-current-tab' - "gi" 'undefined - "f" 'undefined - - ;; Using the vomnibar - ;; - ;; For bookmark, use C-x r m, C-x r j. - "o" 'xwidget-webkit-browse-url - "T" 'evil-collection-xwidget-webkit-search-tabs - - ;; Using find - ;; - ;; TODO - - ;; Navigating history - "H" 'xwidget-webkit-back - "L" 'xwidget-webkit-forward - - ;; Manipulating tabs (actually buffers) - ;; - ;; Only `new-tab' and `close-tab' are supported. - "t" 'evil-collection-xwidget-webkit-new-tab - "x" 'evil-collection-xwidget-webkit-close-tab - "X" 'evil-collection-xwidget-webkit-restore-last-closed-tab - - ;; Miscellaneous - "?" 'describe-mode - - ;; Evil style - - "<" 'xwidget-webkit-back - ">" 'xwidget-webkit-forward - - ;; Additional bindings to browse url. - "gu" 'xwidget-webkit-browse-url - "J" 'xwidget-webkit-browse-url - - ;; Additional binding to browse tabs. - "gt" 'evil-collection-xwidget-webkit-search-tabs - - "gr" 'xwidget-webkit-reload - (kbd "C-f") 'xwidget-webkit-scroll-up - (kbd "C-b") 'xwidget-webkit-scroll-down - (kbd "RET") 'xwidget-webkit-insert-string - - ;; zoom - "+" 'xwidget-webkit-zoom-in - "=" 'xwidget-webkit-zoom-in - "-" 'xwidget-webkit-zoom-out) - - (when evil-want-C-d-scroll - (evil-collection-define-key 'normal 'xwidget-webkit-mode-map - (kbd "C-d") 'xwidget-webkit-scroll-up)) - (when evil-want-C-u-scroll - (evil-collection-define-key 'normal 'xwidget-webkit-mode-map - (kbd "C-u") 'xwidget-webkit-scroll-down))) - -(provide 'evil-collection-xwidget) -;;; evil-collection-xwidget.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/yaml-mode/README.org b/.config/emacs/lisp/evil-collection/modes/yaml-mode/README.org deleted file mode 100644 index 33d13ad..0000000 --- a/.config/emacs/lisp/evil-collection/modes/yaml-mode/README.org +++ /dev/null @@ -1,15 +0,0 @@ -* yaml-mode - - Evil setup for [[https://github.com/yoshiki/yaml-mode][yaml-mode]]. - - No keys are rebound. =evil-shift-width= is set buffer-locally to - =yaml-indent-offset= so that =>>= / =<<= produce indentation that - matches yaml-mode's own electric keys. - -** New commands - - | Command | Purpose | - |--------------------------------------------------+-------------------------------------------------| - | =evil-collection-yaml-mode-set-evil-shift-width= | Set =evil-shift-width= to =yaml-indent-offset=. | - - Installed on =yaml-mode-hook=. diff --git a/.config/emacs/lisp/evil-collection/modes/yaml-mode/evil-collection-yaml-mode.el b/.config/emacs/lisp/evil-collection/modes/yaml-mode/evil-collection-yaml-mode.el deleted file mode 100644 index 3bf6667..0000000 --- a/.config/emacs/lisp/evil-collection/modes/yaml-mode/evil-collection-yaml-mode.el +++ /dev/null @@ -1,42 +0,0 @@ -;;; evil-collection-yaml-mode.el --- Bindings for `yaml-mode' -*- lexical-binding: t -*- - -;; Author: Frédéric Giquel -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: emacs, tools, yaml - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for `yaml-mode'. - -;;; Code: -(require 'evil-collection) -(require 'yaml-mode nil t) - -(defconst evil-collection-yaml-mode-maps nil) - -(defvar yaml-indent-offset) -(defun evil-collection-yaml-mode-set-evil-shift-width () - "Set `evil-shift-width' according to `yaml-indent-offset'." - (setq-local evil-shift-width yaml-indent-offset)) - -;;;###autoload -(defun evil-collection-yaml-mode-setup () - "Set up `evil' bindings for `yaml'." - (add-hook 'yaml-mode-hook #'evil-collection-yaml-mode-set-evil-shift-width)) - -(provide 'evil-collection-yaml-mode) -;;; evil-collection-yaml-mode.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/youtube-dl/evil-collection-youtube-dl.el b/.config/emacs/lisp/evil-collection/modes/youtube-dl/evil-collection-youtube-dl.el deleted file mode 100644 index d9337ca..0000000 --- a/.config/emacs/lisp/evil-collection/modes/youtube-dl/evil-collection-youtube-dl.el +++ /dev/null @@ -1,67 +0,0 @@ -;;; evil-collection-youtube-dl.el --- Evil bindings for youtube-dl -*- lexical-binding: t -*- - -;; Copyright (C) 2018 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen , Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, youtube, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for youtube-dl. - -;;; Code: -(require 'evil-collection) -(require 'youtube-dl nil t) - -(defvar youtube-dl-list-mode-map) - -(defconst evil-collection-youtube-dl-maps '(youtube-dl-list-mode-map)) - -;;;###autoload -(defun evil-collection-youtube-dl-setup () - "Set up `evil' bindings for `youtube-dl'." - - (evil-collection-set-readonly-bindings 'youtube-dl-list-mode-map) - (evil-collection-define-key 'normal 'youtube-dl-list-mode-map - (kbd "S-SPC") 'scroll-down-command - - "gr" 'youtube-dl-list-redisplay - - "g?" 'describe-mode - - "p" 'youtube-dl-list-toggle-pause - "s" 'youtube-dl-list-toggle-slow - "S" 'youtube-dl-list-toggle-slow-all - "y" 'youtube-dl-list-yank - - "i" 'youtube-dl-list-log - "I" 'youtube-dl-list-kill-log - - "a" 'youtube-dl - "d" 'youtube-dl-list-kill - - "[[" 'youtube-dl-list-priority-down - "]]" 'youtube-dl-list-priority-up - "gj" 'youtube-dl-list-priority-down - "gk" 'youtube-dl-list-priority-up - (kbd "C-j") 'youtube-dl-list-priority-down - (kbd "C-k") 'youtube-dl-list-priority-up)) - -(provide 'evil-collection-youtube-dl) -;;; evil-collection-youtube-dl.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/zmusic/evil-collection-zmusic.el b/.config/emacs/lisp/evil-collection/modes/zmusic/evil-collection-zmusic.el deleted file mode 100644 index 4fb06a8..0000000 --- a/.config/emacs/lisp/evil-collection/modes/zmusic/evil-collection-zmusic.el +++ /dev/null @@ -1,49 +0,0 @@ -;;; evil-collection-zmusic.el --- Bindings for `zmusic' -*- lexical-binding: t -*- - -;; Copyright (C) 2020 Carla Cao - -;; Author: Carla Cao -;; Maintainer: James Nguyen -;; Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, emacs, tools, minimalist, presentation - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for`zmusic'. - -;;; Code: -(require 'evil-collection) -(require 'zmusic nil t) - -(defvar zmusic-mode-map) - -(defconst evil-collection-zmusic-maps '(zmusic-mode-map)) - -;;;###autoload -(defun evil-collection-zmusic-setup () - "Set up `evil' bindings for `zmusic'." - (evil-collection-define-key 'normal 'zmusic-mode-map - (kbd "RET") 'zmusic/toggle-play - "j" 'zmusic/next-beat - "k" 'zmusic/previous-beat - "h" 'zmusic/backward-degree - "l" 'zmusic/forward-degree - "d" 'zmusic/kill-beat)) - -(provide 'evil-collection-zmusic) -;;; evil-collection-zmusic.el ends here diff --git a/.config/emacs/lisp/evil-collection/modes/ztree/evil-collection-ztree.el b/.config/emacs/lisp/evil-collection/modes/ztree/evil-collection-ztree.el deleted file mode 100644 index 4dfd324..0000000 --- a/.config/emacs/lisp/evil-collection/modes/ztree/evil-collection-ztree.el +++ /dev/null @@ -1,68 +0,0 @@ -;;; evil-collection-ztree.el --- Evil bindings for ztree -*- lexical-binding: t -*- - -;; Copyright (C) 2017 Pierre Neidhardt - -;; Author: Pierre Neidhardt -;; Maintainer: James Nguyen , Pierre Neidhardt -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.3")) -;; Keywords: evil, ztree, tools - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . - -;;; Commentary: -;; Evil bindings for ztree. - -;;; Code: -(require 'evil-collection) -(require 'ztree nil t) - -(defvar ztree-mode-map) -(defvar ztreediff-mode-map) - -(defconst evil-collection-ztree-maps '(ztree-mode-map ztreediff-mode-map)) - -;;;###autoload -(defun evil-collection-ztree-setup () - "Set up `evil' bindings for `ztree'." - - (evil-collection-set-readonly-bindings 'ztree-mode-map) - (evil-set-initial-state 'ztree-mode 'normal) - (evil-collection-define-key 'normal 'ztree-mode-map - (kbd "") 'ztree-jump-side - (kbd "RET") 'ztree-perform-action - (kbd "SPC") 'ztree-perform-soft-action - - "x" 'ztree-toggle-expand-subtree - - ;; refresh - "gr" 'ztree-refresh-buffer) - - (evil-collection-set-readonly-bindings 'ztreediff-mode-map) - (evil-set-initial-state 'ztree-mode 'normal) - (evil-define-minor-mode-key 'normal 'ztreediff-mode - "C" 'ztree-diff-copy - "D" 'ztree-diff-delete-file - "zH" 'ztree-diff-toggle-show-filtered-files - "d" 'ztree-diff-simple-diff-files - "zh" 'ztree-diff-toggle-show-equal-files - "gf" 'ztree-diff-view-file - - ;; refresh - "gr" 'ztree-diff-partial-rescan - "gR" 'ztree-diff-full-rescan)) - -(provide 'evil-collection-ztree) -;;; evil-collection-ztree.el ends here diff --git a/.config/emacs/lisp/evil-collection/test/evil-collection-magit-tests.el b/.config/emacs/lisp/evil-collection/test/evil-collection-magit-tests.el deleted file mode 100644 index 9b4c892..0000000 --- a/.config/emacs/lisp/evil-collection/test/evil-collection-magit-tests.el +++ /dev/null @@ -1,112 +0,0 @@ -;;; evil-collection-magit-tests.el --- evil-based key bindings for magit - -;; Copyright (C) 2015-2016 Justin Burkett - -;; Author: Justin Burkett -;; Homepage: https://github.com/emacs-evil/evil-collection - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; For a full copy of the GNU General Public License -;; see . -(require 'evil-collection) -(evil-collection-require 'magit) - -(ert-deftest evil-collection-magit-mode-map-tests () - "Test that original bindings in `evil-collection-magit-mode-map-bindings' -are correct." - (dolist (binding evil-collection-magit-mode-map-bindings) - (when (nth 4 binding) - (should (eq (lookup-key (symbol-value (nth 1 binding)) (kbd (nth 4 binding))) - (nth 3 binding))))) - (dolist (binding evil-collection-magit-minor-mode-map-bindings) - (when (nth 4 binding) - (should (eq (lookup-key (symbol-value (nth 1 binding)) (kbd (nth 4 binding))) - (nth 3 binding)))))) - -(ert-deftest evil-collection-magit-section-map-tests () - "Test that original bindings in -`evil-collection-magit-original-section-bindings' are correct." - (dolist (binding evil-collection-magit-original-section-bindings) - (should (eq (lookup-key (nth 0 binding) (nth 1 binding)) - (nth 2 binding))))) - -;; (ert-deftest evil-collection-magit-popup-action-tests () -;; "Test that bindings are as expected in popups." -;; (when evil-collection-magit-popup-keys-changed -;; (dolist (change evil-collection-magit-popup-changes) -;; (let ((alist (plist-get (symbol-value (nth 0 change)) (nth 1 change)))) -;; (should -;; (eq (nth 2 (assoc (string-to-char (nth 3 change)) alist)) -;; (nth 4 change))))))) - -(defun evil-collection-magit-collect-magit-section-maps () - (let (res) - (mapatoms - (lambda (sym) - (when (string-match-p "^magit-.*-section-map$" (symbol-name sym)) - (push sym res)))) - res)) - -(setq evil-collection-magit-section-maps-test (evil-collection-magit-collect-magit-section-maps)) -;; (setq evil-collection-magit-commands-in-section-maps -;; (let (res) -;; (dolist (map evil-collection-magit-section-maps-test) -;; (when (and (boundp map) (keymapp (symbol-value map))) -;; (map-keymap -;; (lambda (_ def) -;; (when (commandp def) -;; (if res -;; (add-to-list 'res def) -;; (setq res (list def))))) -;; (symbol-value map)))) -;; res)) - -(ert-deftest evil-collection-magit-section-maps-accounted-for () - "Check that `evil-collection-magit-section-maps' includes all section-maps -we can find." - (dolist (map evil-collection-magit-section-maps-test) - (when (and (boundp map) (keymapp (symbol-value map))) - (should (memq map evil-collection-magit-section-maps))))) - -(defun evil-collection-magit-collect-git-magit-modes () - (let (res) - (mapatoms - (lambda (sym) - (when (and (or (boundp sym) - (fboundp sym)) - (string-match-p "^\\(git\\|magit\\)-.*-mode$" (symbol-name sym))) - (push sym res)))) - res)) - -(ert-deftest evil-collection-magit-all-modes-accounted-for () - "Check that mode lists include all modes we can find." - (let ((modes (evil-collection-magit-collect-git-magit-modes)) - res) - (dolist (mode modes) - (when (boundp mode) - (should (memq mode - (append - evil-collection-magit-emacs-to-default-state-modes - evil-collection-magit-emacs-to-evil-collection-magit-state-modes - evil-collection-magit-default-to-evil-collection-magit-state-modes - evil-collection-magit-untouched-modes - evil-collection-magit-ignored-modes))))))) - -(ert-deftest evil-collection-magit-expand-region-arg-number () - "Check that the number of args accepted by -`evil-visual-expand-region' does not change." - (should-not (evil-visual-expand-region)) - (should-not (evil-visual-expand-region t)) - (should-error (evil-visual-expand-region t t) :type - 'wrong-number-of-arguments)) - -;;; evil-collection-magit-tests.el ends here diff --git a/.config/emacs/lisp/evil-collection/test/evil-collection-test.el b/.config/emacs/lisp/evil-collection/test/evil-collection-test.el deleted file mode 100644 index a88fce4..0000000 --- a/.config/emacs/lisp/evil-collection/test/evil-collection-test.el +++ /dev/null @@ -1,41 +0,0 @@ -;;; evil-collection-test.el --- Tests for evil-collection -*- lexical-binding: t -*- -(require 'evil-collection) - -(ert-deftest evil-collection-zero-test () - "Zero check blank test." - (should (equal 0 0))) - -(ert-deftest evil-collection-filtering-states-test () - "Test `evil-collection--filter-states'." - (let ((evil-collection-state-denylist '()) - (evil-collection-state-passlist '())) - (should - (equal nil - (evil-collection--filter-states nil))) - (should - (equal '(normal) - (evil-collection--filter-states 'normal))) - (should - (equal '(normal) - (evil-collection--filter-states '(normal))))) - (let ((evil-collection-state-denylist '(insert)) - (evil-collection-state-passlist '())) - (should - (equal '() - (evil-collection--filter-states 'insert))) - (should - (equal '(visual) - (evil-collection--filter-states '(visual insert))))) - (let ((evil-collection-state-denylist '(insert)) - (evil-collection-state-passlist '(normal visual))) - (should - (equal '() - (evil-collection--filter-states '()))) - (should - (equal '(visual) - (evil-collection--filter-states '(insert visual)))) - (should - (seq-set-equal-p '(visual normal) - (evil-collection--filter-states '(motion normal visual insert)))))) - -;;; evil-collection-test.el ends here diff --git a/.config/emacs/lisp/evil-collection/test/test-helper.el b/.config/emacs/lisp/evil-collection/test/test-helper.el deleted file mode 100644 index b5d9e63..0000000 --- a/.config/emacs/lisp/evil-collection/test/test-helper.el +++ /dev/null @@ -1,9 +0,0 @@ -;;; test-helper.el --- Helpers for evil-collection-test.el -*- lexical-binding: t -*- -(require 'ert) - -;; FIXME: Adding `f' as a dependency just for this line. -(require 'f) -(let ((evil-collection-dir (f-parent (f-dirname (f-this-file))))) - (add-to-list 'load-path evil-collection-dir)) -(require 'evil-collection) -;;; test-helper.el ends here diff --git a/.config/emacs/lisp/evil-collection/yasnippet_evil-collection b/.config/emacs/lisp/evil-collection/yasnippet_evil-collection deleted file mode 100644 index b57c8f8..0000000 --- a/.config/emacs/lisp/evil-collection/yasnippet_evil-collection +++ /dev/null @@ -1,45 +0,0 @@ -# -*- mode: snippet -*- -# name: yasnippet_evil-collection -# key: yasnippet_evil-collection -# -- -;;; ${1:`(file-name-sans-extension (file-name-nondirectory buffer-file-name))`}.el --- Bindings for \`${2:`(string-trim-left (file-name-sans-extension (file-name-nondirectory buffer-file-name)) "evil-collection-")`}' -*- lexical-binding: t -*- - -;; Copyright (C) 2022 James Nguyen - -;; Author: James Nguyen -;; Maintainer: James Nguyen -;; URL: https://github.com/emacs-evil/evil-collection -;; Version: 0.0.2 -;; Package-Requires: ((emacs "27.1")) -;; Keywords: evil, emacs, convenience, tools - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;;; Bindings for $2. - -;;; Code: -(require 'evil-collection) -(require '$2 nil t) - -(defvar $2-mode-map) -(defconst evil-collection-$2-maps '($2-mode-map)) - -(defun $1-setup () - "Set up `evil' bindings for $2." - (evil-collection-define-key 'normal '$2-mode-map - $0)) - -(provide '$1) -;;; $1.el ends here \ No newline at end of file diff --git a/.config/emacs/lisp/evil-nerd-commenter/evil-nerd-commenter-operator.el b/.config/emacs/lisp/evil-nerd-commenter/evil-nerd-commenter-operator.el deleted file mode 100644 index 15739a1..0000000 --- a/.config/emacs/lisp/evil-nerd-commenter/evil-nerd-commenter-operator.el +++ /dev/null @@ -1,402 +0,0 @@ -;;; evil-nerd-commenter-operator.el --- evil operator for this program -*- lexical-binding: t -*- - -;; Author: Chen Bin - -;; This file is not part of GNU Emacs. - -;;; License: - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program; if not, write to the Free Software -;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -;;; Commentary: - -;; Provides operators for evil-mode. - -;;; Code: - -(require 'evil) -(require 'evil-nerd-commenter-sdk) - -(defvar evilnc-c-style-comment-modes - '(awk-mode - c++-mode - c-mode - css-mode - dart-mode - ess-mode - go-mode - java-mode - javascript-mode - js-mode - js2-mode - perl-mode - php-mode - swift-mode - web-mode) - "Major modes using C comment syntax.") - -(defvar evilnc-current-text-object nil - "Internal variable to detect current object working on.") - -(defvar evilnc-whole-line-text-objects - '(evil-forward-paragraph - evil-backward-paragraph) - "Comment operator operates on wholes when dealing with these text objects.") - -(defvar evilnc-temporary-goal-column 0 - "Value of`temporary-goal-column' specifying right edge of rectangle yank.") - -(defadvice evil-visual-highlight-block (around evil-visual-highlight-block-hack activate) - "Show overlay over inner comment text object." - ad-do-it - (when (eq this-command 'evilnc-inner-commenter) - (dolist (overlay evil-visual-block-overlays) - (let* ((b (overlay-start overlay)) - (e (save-excursion - (goto-char (overlay-end overlay)) - (line-end-position)))) - (move-overlay overlay b e))))) - -(defadvice evil-apply-on-block (around evil-apply-on-block-around-hack activate) - "Yank correct region of inner comment text object." - (let* ((tmp-command last-command)) - ;; force `evil-apply-on-block' use our temporary-goal-column - (when (> evilnc-temporary-goal-column 0) - (setq temporary-goal-column (max temporary-goal-column - evilnc-temporary-goal-column)) - ;; Read `evil-apply-on-block'. Note `temporary-goal-column' is used - ;; if and only if `last-command' is `next-line' or `previous-line' - (setq last-command 'next-line)) - ad-do-it - ;; restore last command - (setq last-command tmp-command) - (setq evilnc-temporary-goal-column 0))) - -(defun evilnc-expand-to-whole-comment-or-line (start end) - "Expand the comment region defined by START and END. -Make sure all comment is included. -Or expand the region to contain whole lines." - - (cond - ((evilnc-pure-comment-p start) - (save-excursion - (let* ((newstart start) - (newend end)) - - ;; expand the beginning - (goto-char newstart) - (while (and (>= (1- newstart) (line-beginning-position)) (evilnc-pure-comment-p (1- newstart))) - (setq newstart (1- newstart))) - - ;; expand the end - (goto-char newend) - (while (and (<= newend (line-end-position)) (evilnc-pure-comment-p newend)) - (setq newend (1+ newend))) - - (cons newstart newend)))) - - ;; try to expand region to contain whole line if, - ;; - currently more than one line text in the region, - ;; - a specific text object is touched just before the operator - ((and (not (evilnc-sdk-inside-one-line-p start end)) - evilnc-current-text-object - (member (car evilnc-current-text-object) evilnc-whole-line-text-objects) - ;; 0.5 second - (< (- (float-time (current-time)) (cdr evilnc-current-text-object)) 0.5)) - (evilnc-sdk-expand-to-contain-whole-lines start end)) - (t - (cons start end)))) - -;; {{ know text object type to operate on -(defun evilnc-set-current-text-object (text-object) - "Set current TEXT-OBJECT." - (setq evilnc-current-text-object - (cons text-object (float-time (current-time))))) - -(defadvice evil-select-an-object (before evilnc-evil-select-an-object-hack activate) - "Figure out text object type." - (let* ((thing (car (ad-get-args 0)))) - ;; record the thing and timestamp `evil-select-an-object' is called - (evilnc-set-current-text-object thing))) - -(defadvice evil-backward-paragraph (before evilnc-evil-backward-paragraph-hack activate) - "Record current text object." - (evilnc-set-current-text-object 'evil-backward-paragraph)) - -(defadvice evil-forward-paragraph (before evilnc-evil-forward-paragraph-hack activate) - "Record current text object." - (evilnc-set-current-text-object 'evil-forward-paragraph)) -;; }} - -(evil-define-operator evilnc-comment-operator (start end type) - "Comments text from START to END with TYPE." - (interactive "") - (cond - ((eq type 'block) - (let* ((newpos (evilnc-expand-to-whole-comment-or-line start end) )) - (evil-apply-on-block #'evilnc-comment-or-uncomment-region - (car newpos) - (cdr newpos) - nil))) - - ((and (eq type 'line) - (= end (point-max)) - (or (= start end) - (/= (char-before end) ?\n)) - (/= start (point-min)) - (= (char-before start) ?\n)) - (evilnc-comment-or-uncomment-region (1- start) end)) - - ((eq type 'line) - ;; comment whole line, for now - (evilnc-comment-or-uncomment-region start - (save-excursion - (goto-char (1- end)) - (line-end-position)))) - - (t - (when (and start end) - (let* ((newpos (evilnc-expand-to-whole-comment-or-line start end))) - (evilnc-comment-or-uncomment-region (car newpos) (cdr newpos)))))) - - ;; place cursor on beginning of line - (if (and (called-interactively-p 'any) (eq type 'line)) - (evil-first-non-blank))) - -(defun evilnc-comment-or-uncomment-region-then-action (start end commenter &optional action) - "Comment/uncomment between START and END using COMMENTER, then take ACTION." - (evil-with-single-undo - ;; yank original text - (evil-yank-lines start end nil 'lines) - - (when (evil-visual-state-p) - ;; `evil-paste-before' does not work in visual state. - (evil-normal-state)) - - (cond - (evilnc-original-above-comment-when-copy-and-comment - (let* ((p (point))) - (funcall commenter start end) - (goto-char start) - (when action (funcall action)) - (goto-char p))) - - (t - (goto-char end) - (when action (funcall action)) - ;; actual comment operation should happen at last - ;; or else "(start end)" is screwed up - (funcall commenter start end))))) - -(evil-define-operator evilnc-yank-and-comment-operator (start end) - "(Un)comment and yank the text from START to END." - :move-point (not evilnc-original-above-comment-when-copy-and-comment) - (interactive "") - (evilnc-comment-or-uncomment-region-then-action start - end - evilnc-comment-or-uncomment-region-function)) - -(evil-define-operator evilnc-copy-and-comment-operator (start end) - "Inserts a commented copy of the text from START to END." - :move-point (not evilnc-original-above-comment-when-copy-and-comment) - (interactive "") - (evilnc-comment-or-uncomment-region-then-action start - end - 'comment-region - (lambda () (evil-paste-before 1)))) - -(defun evilnc-one-line-comment-p (start end) - "Test if text between START and END is one line comment." - (save-excursion - (goto-char start) - (and (<= (line-beginning-position) start) - ;; end is the upper limit great than (line-end-position) - (<= end (1+ (line-end-position)))))) - -(defun evilnc-get-comment-bounds () - "Return bounds like (cons start end)." - (let* ((b (point)) - (e (point)) - (col 0) - rlt) - ;; decrease start position - (while (evilnc-comment-p (- b 1)) - (setq b (- b 1))) - - ;; increase end - (while (evilnc-comment-p (+ e 1)) - (setq e (+ e 1))) - - ;; we could select extra spaces at the end of comment - ;; so we need go back - (let* ((str (save-excursion - (goto-char e) - (evilnc-sdk-cur-line e))) - (empty-line-p (string-match "^[ \t]*$" str))) - (when empty-line-p - ;; empty line plus line feed - (setq e (- e (length str) 1)))) - (cond - ((>= b e) - (setq rlt nil)) - ((evilnc-one-line-comment-p b e) - ;; contract from start position - (while (not (evilnc-pure-comment-p b)) - (setq b (+ b 1))) - - ;; contract from end position - (while (not (evilnc-pure-comment-p e)) - (setq e (- e 1))) - - (if (< b e) (setq rlt (cons b e)))) - (t - ;; multi-line comment - (setq rlt (cons b e)))) - rlt)) - -(defun evilnc-adjusted-comment-end (b e) - "Adjust comment end of region between B and E." - (let* ((next-end-char (evilnc-get-char (- e 2))) - (end-char (evilnc-get-char (- e 1)))) - ;; avoid selecting CR/LF at the end of comment - (while (and (< b e) - (memq (evilnc-get-char (- e 1)) '(10 13))) - (setq e (- e 1))) - - ;; avoid selecting comment limiter - (cond - ((and (memq major-mode evilnc-c-style-comment-modes) - (= end-char ?/) - (= next-end-char ?*)) - ;; avoid selecting the ending comment limiter "*/" - (setq e (- e 2)) - (while (and (> e b) - (= (evilnc-get-char (- e 1)) ?*)) - (setq e (- e 1)))) - (t - ;; other languages we can safely use font face - (while (and (> e b) - (evilnc-comment-delimiter-p (- e 1))) - (setq e (- e 1))))) - e)) - -(defun evilnc-c-style-comment-p (pos) - "Is C style comment at POS?" - (and (memq major-mode evilnc-c-style-comment-modes) - (= (evilnc-get-char pos) ?/) - (= (memq (evilnc-get-char (1+ pos)) '(?/ ?*))))) - -(defun evilnc-comment-column-bounds (start end &optional c-style) - "From START to END find column bounds of rectangle selection. -Return (cons col-min col-max) or nil. If C-STYLE is t, -we are processing C like language." - (let* ((col-min most-positive-fixnum) - (col-max 0)) - (while (< start end) - (when (and (not (evilnc-whitespace-p start)) - (evilnc-pure-comment-p start) - (not (or (evilnc-comment-delimiter-p start) - (and c-style - (memq (evilnc-get-char start) '(?/ ?*)))))) - (let* ((col (evil-column start))) - (if (< col col-min) - (setq col-min col)) - (if (> col col-max) - (setq col-max col)))) - (setq start (1+ start))) - (if (< col-min col-max) - (cons col-min col-max)))) - -(evil-define-text-object evilnc-inner-commenter (&optional count start end type) - "An inner comment text object." - (let* ((bounds (evilnc-get-comment-bounds)) - b - e - c-style) - (cond - (bounds - (setq b (car bounds)) - (setq e (cdr bounds)) - (cond - ((setq c-style (evilnc-c-style-comment-p b)) - (while (and (< b e) - (or (evilnc-whitespace-p b) - (evilnc-line-end-p b) - (memq (evilnc-get-char b) '(?/ ?*)))) - (setq b (1+ b))) - (while (and (< b e) - (or (evilnc-whitespace-p e) - (evilnc-line-end-p e) - (memq (evilnc-get-char e) '(?/ ?*)))) - (setq e (1- e))) - (setq e (1+ e)) - (setq b (save-excursion - (goto-char b) - (forward-word 1) - (forward-word -1) - (point)))) - (t - (setq b (save-excursion - (goto-char (car bounds)) - (forward-word 1) - (forward-word -1) - (point))) - (setq e (save-excursion - (goto-char (cdr bounds)) - (goto-char (evilnc-adjusted-comment-end b (line-end-position))) - (point))))) - (cond - ((evilnc-one-line-comment-p b e) - ;; keep move e to the end of comment - (evil-range b ;; (if c-style (1+ e) e) - e)) - (t - ;; multi-line comment - (let* ((col-b (evil-column b)) - (col-bounds (evilnc-comment-column-bounds b e c-style))) - (cond - (col-bounds - (if (> col-b (car col-bounds)) - (setq b (- b (- col-b (car col-bounds))))) - (setq evilnc-temporary-goal-column (cdr col-bounds))) - (t - (setq evilnc-temporary-goal-column (evil-column e))))) - (evil-range b e 'block :expanded t)))) - (t - (error "Not inside a comment"))))) - -(evil-define-text-object evilnc-outer-commenter (&optional count start end type) - "An outer comment text object." - (let* ((bounds (evilnc-get-comment-bounds))) - (cond - (bounds - (evil-range (car bounds) (cdr bounds) 'exclusive :expanded t)) - (t - (error "Not inside a comment"))))) - -(evil-define-text-object evilnc-inner-comment (&optional count start end type) - "An inner comment text object." - (evilnc-inner-commenter count start end type)) - -(evil-define-text-object evilnc-outer-comment (&optional count start end type) - "An outer comment text object." - (evilnc-outer-commenter count start end type)) - -(provide 'evil-nerd-commenter-operator) -;;; evil-nerd-commenter-operator.el ends here - -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/.config/emacs/lisp/evil-nerd-commenter/evil-nerd-commenter-sdk.el b/.config/emacs/lisp/evil-nerd-commenter/evil-nerd-commenter-sdk.el deleted file mode 100644 index 60d31dc..0000000 --- a/.config/emacs/lisp/evil-nerd-commenter/evil-nerd-commenter-sdk.el +++ /dev/null @@ -1,127 +0,0 @@ -;;; evil-nerd-commenter-sdk.el --- SDK used by other files -*- lexical-binding: t -*- - -;; Author: Chen Bin - -;;; License: - -;; This file is not part of GNU Emacs. - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program; if not, write to the Free Software -;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -;;; Commentary: -;; SDK used internally - -;;; Code: - -(require 'evil nil t) -(defvar evil-state) - -(defun evilnc--check-fonts (fonts-under-cursor fonts-list) - "Check whether FONTS-UNDER-CURSOR among FONTS-LIST." - (delq nil - (mapcar #'(lambda (f) - ;; learn this trick from flyspell - (member f fonts-list)) - fonts-under-cursor))) - -(defun evilnc-web-mode-comment-p (&optional pos) - "Check whether the code at POS is comment. -`web-mode' removes its API, so create our own." - (unless pos (setq pos (point))) - (not (null (or (eq (get-text-property pos 'tag-type) 'comment) - (eq (get-text-property pos 'block-token) 'comment) - (eq (get-text-property pos 'part-token) 'comment))))) - -(defun evilnc-fonts-at-point (pos) - "Get font faces at POS." - (let* ((fontfaces (if (> pos 0) (get-text-property pos 'face)))) - (if (listp fontfaces) fontfaces (list fontfaces)))) - -(defun evilnc-pure-comment-p (pos) - "Check character at POS is pure comment." - (or (and (eq major-mode 'web-mode) - (evilnc-web-mode-comment-p pos)) - (evilnc--check-fonts (evilnc-fonts-at-point pos) - '(font-lock-comment-face - tree-sitter-hl-face:comment - font-lock-comment-delimiter-face)))) - -(defmacro evilnc-get-char (position) - "Get character at POSITION." - `(char-after ,position)) - -(defmacro evilnc-whitespace-p (position) - "Character at POSITION is white space." - `(member (evilnc-get-char ,position) '(32 9))) - -(defmacro evilnc-line-end-p (position) - "Character at POSITION is line end." - `(member (evilnc-get-char ,position) '(10 11))) - -(defun evilnc-comment-p (pos) - "Check whether the code at POS is comment by comparing font face. -Please note the white spaces out of comment is treated as comment, -or else we can't select multiple lines comment." - (cond - ((or (< pos (point-min)) (> pos (point-max))) - nil) - ((not (evilnc-fonts-at-point pos)) - ;; character under cursor is SPACE or TAB - ;; and out of comment - (evilnc-whitespace-p pos)) - (t - (evilnc-pure-comment-p pos)))) - -(defun evilnc-comment-delimiter-p (position) - "Is character at POSITION a comment delimiter?" - (let* ((fontfaces (evilnc-fonts-at-point position))) - (and fontfaces - (evilnc--check-fonts fontfaces - '(font-lock-comment-delimiter-face))))) - -(defun evilnc-sdk-inside-one-line-p (start end) - "Test START and END is inside one line." - (and (<= (line-beginning-position) start) - (<= end (line-end-position)))) - -(defun evilnc-sdk-cur-line (&optional end) - "String from line beginning to END or line end." - (buffer-substring-no-properties (line-beginning-position) - (or end (line-end-position)))) - -(defun evilnc-sdk-expand-to-contain-whole-lines (start end) - "Expand region between START and END so the region contain whole lines. -Return new range like '(region_begin . region_end)." - (save-excursion - ;; Another work around for evil-visual-line bug: - ;; In `evil-mode', if we use hotkey V or `evil-visual-line' to select line, - ;; the (line-beginning-position) of the line which is after the last selected - ;; line is always (region-end)! Don't know why. - (when (and (> end start) - (save-excursion - (goto-char end) - (= end (line-beginning-position))) - (boundp 'evil-state) - (eq evil-state 'visual)) - (setq end (1- end))) - - (goto-char start) - (setq start (line-beginning-position)) - (goto-char end) - (setq end (line-end-position))) - (cons start end)) - -(provide 'evil-nerd-commenter-sdk) -;;; evil-nerd-commenter-sdk.el ends here diff --git a/.config/emacs/lisp/evil-nerd-commenter/evil-nerd-commenter.el b/.config/emacs/lisp/evil-nerd-commenter/evil-nerd-commenter.el deleted file mode 100644 index 21498c4..0000000 --- a/.config/emacs/lisp/evil-nerd-commenter/evil-nerd-commenter.el +++ /dev/null @@ -1,1013 +0,0 @@ -;;; evil-nerd-commenter.el --- Comment/uncomment lines efficiently. Like Nerd Commenter in Vim -*- lexical-binding: t -*- - -;; Author: Chen Bin - -;; URL: http://github.com/redguardtoo/evil-nerd-commenter -;; Version: 3.6.1 -;; Package-Requires: ((emacs "26.1")) -;; Keywords: convenience evil -;; -;; This file is not part of GNU Emacs. - -;;; Credits: - -;; - Lally Oppenheimer added the support for text-object in Evil -;; - Tom Willemse provided the fix to make Emacs 24.4 work - -;;; License: - -;; This program is free software: you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as published -;; by the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; -;; This program emulates nerd-commenter.vim by Marty Grenfell. -;; -;; It helps you comment/uncomment multiple lines without selecting them. -;; -;; `M-x evilnc-default-hotkeys` assigns hotkey `M-;` to -;; `evilnc-comment-or-uncomment-lines' -;; -;; `M-x evilnc-comment-or-uncomment-lines` comment or uncomment lines. -;; -;; `M-x evilnc-quick-comment-or-uncomment-to-the-line` will comment/uncomment -;; from current line to specified line. -;; The last digit(s) of line number is parameter of the command. -;; -;; For example, `C-u 9 evilnc-quick-comment-or-uncomment-to-the-line` comments -;; code from current line to line 99 if you current line is 91. -;; -;; Though this program could be used *independently*, it's recommended to -;; us it with Evil. -;; -;; Evil makes you take advantage of power of Vi to comment lines. -;; For example, you can press key `99,ci` to comment out 99 lines. -;; -;; Setup: -;; -;; If comma is your leader key, as most Vim users do, setup is one liner, -;; (evilnc-default-hotkeys) -;; -;; Or else you can set up key bindings of below commands by yourself. -;; `evilnc-comment-or-uncomment-lines' -;; `evilnc-quick-comment-or-uncomment-to-the-line' -;; `evilnc-comment-and-kill-ring-save' -;; `evilnc-copy-and-comment-lines' -;; `evilnc-comment-or-uncomment-paragraphs' -;; `evilnc-comment-box' -;; `evilnc-toggle-invert-comment-line-by-line' -;; `evilnc-copy-and-comment-operator' -;; `evilnc-comment-operator' -;; `evilnc-comment-or-uncomment-html-tag' -;; `evilnc-comment-or-uncomment-html-paragraphs' -;; -;; Set up `evilnc-original-above-comment-when-copy-and-comment' -;; to decide which style to use in `evilnc-copy-and-comment-lines' -;; and `evilnc-copy-and-comment-operator', -;; - Place the commented out text above original text -;; - Or place the original text above commented out text -;; -;; `evilnc-yank-and-comment-operator' (un)comment&yank text in one shot. -;; -;; Comment text object "c" is defined. It can have multi-lines. -;; Press "vac" to select outer object (comment with limiters). -;; Press "vic" to select inner object (comment without limiter). -;; You can assign other key instead of "c" to the text object by -;; customizing `evilnc-comment-text-object'. Either, -;; (setq evilnc-comment-text-object "c") -;; (evilnc-default-hotkeys) -;; -;; Or, -;; (setq evilnc-comment-text-object "a") -;; (define-key evil-inner-text-objects-map evilnc-comment-text-object 'evilnc-inner-commenter) -;; (define-key evil-outer-text-objects-map evilnc-comment-text-object 'evilnc-outer-commenter) -;; -;; You can list of comments in current buffer through using imenu. -;; by setup `imenu-create-index-function' to `evilnc-imenu-create-index-function', -;; -;; (defun counsel-imenu-comments () -;; (interactive) -;; (let* ((imenu-create-index-function 'evilnc-imenu-create-index-function)) -;; (unless (featurep 'counsel) (require 'counsel)) -;; (counsel-imenu))) -;; -;; For certain major modes, you need manual setup to override its original -;; keybindings, -;; -;; (defun matlab-mode-hook-config () -;; (local-set-key (kbd "M-;") 'evilnc-comment-or-uncomment-lines)) -;; (add-hook 'matlab-mode-hook 'matlab-mode-hook-config) -;; -;; Most commands call `evilnc-comment-or-uncomment-region-function'. -;; You can modify this variable to customize the comment style, -;; -;; (with-eval-after-load 'evil-nerd-commenter -;; (defun my-comment-or-uncomment-region (start end) -;; (let* ((comment-start "aaa") -;; (comment-end "bbb")) -;; (evilnc-comment-or-uncomment-region-internal start end))) -;; (setq evilnc-comment-or-uncomment-region-function -;; 'my-comment-or-uncomment-region)) -;; -;; See "Options Controlling Comments" in Emacs manual for comment options. -;; -;; See https://github.com/redguardtoo/evil-nerd-commenter for detail. -;; -;;; Code: - -(require 'subr-x) ; required by `string-trim' -(require 'sgml-mode) -(require 'newcomment) -(require 'evil-nerd-commenter-sdk) - -(autoload 'count-lines "simple") - -(defvar evilnc-original-above-comment-when-copy-and-comment nil - "Keep the original text above the commented copy, when using either: -`evilnc-copy-and-comment-lines' or `evilnc-copy-and-comment-operator'.") - -(defvar evilnc-invert-comment-line-by-line nil - "If t then invert region comment status line by line. -Please note it has NOT effect on evil text object!") - -(defvar evilnc-comment-or-uncomment-region-function - 'evilnc-comment-or-uncomment-region-internal - "Comment or uncomment region.") - -(defvar evilnc-cpp-like-comment-syntax-modes - '(java-mode - javascript-mode - js-mode - js2-mode - js3-mode - rjsx-mode - js2-jsx-mode - rust-mode - c++-mode - c-mode - objc-mode) - "Major modes which has C++ like comment syntax.") - -(defvar evilnc-comment-text-object "c" - "The comment object. -`vic` to select inner object. -`vac` to select outer object.") - -(defvar evilnc-use-comment-object-setup t - "Use evil text object setup when calling `evilnc-default-hotkeys'.") - -(defvar evilnc-min-comment-length-for-imenu 8 - "Minimum length of comment to display in imenu.") - -(defvar evilnc-html-comment-delimiters - '((evilnc-html-jsx-p "{/* " " */}") - ("js-mode" "{/* " " */}") - (("web-mode" "html-mode") "")) - "List of html tag comment rules. -The 1st item of each rule is the major mode(s) to match current `major-mode'. -Current `major-mode' could equal or derive from the listed major mode(s). -The 2nd and 3rd item is the comment start and comment end.") - -(defun evilnc-html-jsx-p () - "Test if current file is jsx." - (and buffer-file-name - (string-match-p "\.[tj]sx?$" buffer-file-name))) - -(defun evilnc-html-match-comment-delimiters-p (target-mode) - "Use `major-mode' to match TARGET-MODE which could be: -One major mode. -List of major modes. -A function to return t or nil." - (let* (rlt) - (cond - ((functionp target-mode) - (setq rlt (funcall target-mode))) - ((stringp target-mode) - ;; convert name of `major-mode' to symbol - (when (or (eq major-mode (intern target-mode)) - (derived-mode-p (intern target-mode))) - (setq rlt t))) - ((listp target-mode) - (while (and (not rlt) target-mode) - (unless (setq rlt (evilnc-html-match-comment-delimiters-p (nth 0 target-mode))) - ;; continue looping - (setq target-mode (cdr target-mode)))))) - rlt)) - -(defun evilnc-html-find-comment-delimiter () - "Found comment delimiter from `evilnc-html-find-comment-delimiter'." - (let* (found - (delimiters evilnc-html-comment-delimiters) - rule) - (while (and (not found) delimiters) - (setq rule (car delimiters)) - (cond - ((evilnc-html-match-comment-delimiters-p (nth 0 rule)) - (setq found rule)) - (t - ;; keep looping - (setq delimiters (cdr delimiters))))) - found)) - -(defun evilnc-html-comment-start () - "Return start of html comment." - (let* ((s (evilnc-html-find-comment-delimiter))) - (if s (nth 1 s) ""))) - -(defun evilnc--goto-line (line-num) - "Shamelessly copied from `goto-line'. Goto line with LINE-NUM." - (save-restriction - (widen) - (goto-char (point-min)) - (if (eq selective-display t) - (re-search-forward "[\n\C-m]" nil 'end (1- line-num)) - (forward-line (1- line-num))))) - -(defun evilnc--fix-buggy-major-modes () - "Fix major modes whose comment regex is buggy. -See http://lists.gnu.org/archive/html/bug-gnu-emacs/2013-03/msg00891.html." - (cond - ((eq major-mode 'autoconf-mode) - ;; since comment-use-syntax is nil in autoconf.el, the comment-start-skip need - ;; make sure its first parenthesized expression match the string exactly before - ;; the "dnl", check the comment-start-skip in lisp-mode for sample. - ;; See code in (defun comment-search-forward) from emacs 24.2: - ;; (if (not comment-use-syntax) - ;; (if (re-search-forward comment-start-skip limit noerror) - ;; (or (match-end 1) (match-beginning 0))) - ;; (do-something)) - ;; My regex makes sure (match-end 1) return the position of comment starter - (when (and (boundp 'comment-use-syntax) (not comment-use-syntax)) - ;; Maybe autoconf.el will (setq comment-use-syntax t) in the future? - (setq comment-start-skip "^\\(\\s*\\)\\(dnl\\|#\\) +"))) - ((eq major-mode 'haml-mode) - (setq comment-use-syntax nil) - (setq comment-start "-# ") - (setq comment-start-skip "-##*[ \t]*")))) - -(defun evilnc--forward-line (num) - "Move NUM source or screen lines forward, depending on visual-line settings." - (cond - ((or (and visual-line-mode - (or (not (bound-and-true-p evil-mode)) - (bound-and-true-p evil-respect-visual-line-mode))) - (and (boundp 'display-line-numbers-type) - (eq display-line-numbers-type 'visual))) - (vertical-motion num)) - (t - (forward-line num)))) - -(defun evilnc--operation-on-lines-or-region (fn &optional num) - "Apply FN on NUM lines or selected region." - (cond - ;; NO region is selected - ((not (region-active-p)) - (let* ((b (line-beginning-position)) e) - (save-excursion - (evilnc--forward-line (- num 1)) - (setq e (line-end-position))) - (funcall fn b e))) - - ((evilnc-sdk-inside-one-line-p (region-beginning) (region-end)) - (cond - ;; current comment syntax is NOT fit to comment out a region. - ;; So we also need hack the `comment-start' and `comment-end'. - ((and (string= "" comment-end) - (member major-mode evilnc-cpp-like-comment-syntax-modes)) - (let* ((comment-start-old comment-start) - (comment-end-old comment-end) - (comment-start-skip-old comment-start-skip) - (comment-end-skip-old comment-end-skip)) - - ;; use C comment syntax temporarily - (setq comment-start "/* ") - (setq comment-end " */") - (setq comment-start-skip "\\(//+\\|/\\*+\\)\\s *") - (setq comment-end-skip "[ ]*\\(\\s>\\|\\*+/\\)") - - (funcall fn (region-beginning) (region-end)) - - ;; Restore the original comment syntax - (setq comment-start comment-start-old) - (setq comment-end comment-end-old) - (setq comment-start-skip comment-start-skip-old) - (setq comment-end-skip comment-end-skip-old))) - ;; just comment out the region - (t (funcall fn (region-beginning) (region-end))))) - - ;; Select more than one line - (t - ;; selected region spans MORE than one line - (let* ((range (evilnc-sdk-expand-to-contain-whole-lines (region-beginning) - (region-end))) - (b (car range)) - (e (cdr range))) - (save-excursion - (funcall fn b e)))))) - -(defun evilnc--get-one-paragraph-region () - "Select a paragraph which has NO empty line." - (let* ((b (save-excursion - (cond - ((re-search-backward "^[ \t]*$" nil t) - (forward-line) - (line-beginning-position)) - (t - 1)))) - (e (save-excursion - (cond - ((re-search-forward "^[ \t]*$" nil t) - (forward-line -1) - (line-end-position)) - (t - (point-max)))))) - (list b e))) - -(defun evilnc--invert-comment (start end) - "Scan the region from START to END line by line, invert its comment status." - (let* (done b e) - (save-excursion - (goto-char end) - (while (not done) - (setq b (line-beginning-position)) - (setq e (line-end-position)) - (funcall (if (comment-only-p b e) - 'uncomment-region 'comment-region) - b e) - - (forward-line -1) - (if (or (= (line-beginning-position) b) - (< (line-end-position) start)) - (setq done t)))))) - -(defvar org-src-lang-modes) -(declare-function org-show-subtree "org") -(declare-function outline-up-heading "outline") -(declare-function org-element-property "org-element") - -(defun evilnc--org-src-block-info () - "Return src-block info in org. It's like (start end language)." - (cond - ;; Emacs 24.4+ - ((fboundp 'org-edit-src-find-region-and-lang) - (let* ((info (org-edit-src-find-region-and-lang))) - (list (nth 0 info) - (1+ (nth 1 info)) - (nth 2 info)))) - - ;; Emacs 26.1 - ((fboundp 'org-element-at-point) - (let* ((elem (org-element-at-point)) - (b (org-element-property :begin elem)) - (e (org-element-property :end elem)) - (lang (org-element-property :language elem)) - (str (buffer-substring-no-properties b e)) - (case-fold-search t)) - (when (string-match ".\+BEGIN_SRC .*$" str) - (setq b (+ b (length (match-string 0 str)) 1))) - (save-excursion - (goto-char b) - (search-forward "#+END_SRC" e t) - ;; - 1 to remove line feed - (setq e (- (point) (length "#+END_SRC")))) - ;; Now Emacs 24.4 and Emacs 26.1 return same result - (list b e lang))))) - -(defun evilnc--org-lang-major-mode (info) - "Get `major-mode' from INFO of org source block." - (let* ((lang (nth 2 info))) - (cond - ((setq lang (or (cdr (assoc lang org-src-lang-modes)) - lang)) - (intern (concat (if (symbolp lang) (symbol-name lang) lang) - "-mode"))) - (t - nil)))) - -(defun evilnc--working-on-region (start end fn) - "Region from START to END is applied with operation FN. -Code snippets embedded in Org-mode is identified and right `major-mode' is used." - (let* ((old-pos (point)) - (info (if (eq major-mode 'org-mode) (evilnc--org-src-block-info))) - (lang-f (and info (evilnc--org-lang-major-mode info)))) - - ;; turn on 3rd party language's major-mode temporarily - (cond - (lang-f - (let* ((src-beg (nth 0 info)) - (src-end (nth 1 info)) - (comment-beg-in-buf (1+ (- start src-beg))) - (comment-end-in-buf (1+ (- end src-beg))) - (new-pos (1+ (- old-pos src-beg))) - (old-code (buffer-substring-no-properties src-beg src-end)) - new-code) - (with-temp-buffer - (goto-char (point-min)) - (insert old-code) - (funcall lang-f) - (goto-char new-pos) - - (cond - (evilnc-invert-comment-line-by-line - (evilnc--invert-comment comment-beg-in-buf comment-end-in-buf)) - (t - (funcall fn comment-beg-in-buf comment-end-in-buf))) - - (setq new-code (buffer-substring-no-properties (point-min) (point-max)))) - - (delete-region src-beg src-end) - (insert new-code) - ;; go back to original position when comment inside org src-block - (goto-char old-pos))) - (t - (cond - (evilnc-invert-comment-line-by-line - (evilnc--invert-comment start end)) - (t - (funcall fn start end))))))) - -(declare-function web-mode-comment-or-uncomment "ext:web-mode") -(declare-function web-mode-uncomment-erb-block "ext:web-mode") -(declare-function web-mode-comment-erb-block "ext:web-mode") -(defvar web-mode-engine) - -(defun evilnc--warn-on-web-mode (is-comment) - "Check certain part of html code IS-COMMENT." - (let* ((comment-operation (concat "web-mode-" - (if is-comment "comment-" "uncomment-") - web-mode-engine - "-block"))) - (unless (intern-soft comment-operation) - (message "defun %s NOT implemented in web-mode! Fix it or report to its maintainer." - comment-operation)) - is-comment)) - -;;;###autoload -(defun evilnc-comment-or-uncomment-region-internal (start end) - "Comment or uncomment region from START to END." - (cond - ((eq major-mode 'web-mode) - ;; elixir is not supported in web-mode for now - (unless (fboundp 'web-mode-comment-elixir-block) - (defun web-mode-comment-elixir-block (pos) - (funcall 'web-mode-comment-erb-block pos)) - (defun web-mode-uncomment-elixir-block (pos) - (funcall 'web-mode-uncomment-erb-block pos))) - (web-mode-comment-or-uncomment-region start end)) - (t - (evilnc--working-on-region start end 'comment-or-uncomment-region)))) - -;;;###autoload -(defun evilnc-comment-or-uncomment-region (start end) - "Comment or uncomment region from START to END." - (funcall evilnc-comment-or-uncomment-region-function start end)) - -(defun evilnc--current-line-num () - "Get current line number." - (save-restriction - (widen) - (save-excursion - (beginning-of-line) - (1+ (count-lines 1 (point)))))) - -(defun evilnc--get-line-num (position) - "Get line number at POSITION." - (save-excursion - (goto-char position) - (evilnc--current-line-num))) - -(defun evilnc--find-destination-linenum (last-digits) - "Find closest line whose line number ends with digit LAST-DIGITS. -If LAST-DIGITS is 16, line 16, line 116, and line 216 are candidates. -Then if current line is 17, 16 is the final result." - (let* ((cur-line-num (evilnc--current-line-num)) - (r 1) - (l (length (number-to-string last-digits)))) - (while (> l 0) - (setq r (* r 10)) - (setq l (- l 1))) - (if (>= (mod cur-line-num r) last-digits) - (setq last-digits (+ last-digits r))) - (+ cur-line-num (- last-digits (mod cur-line-num r))))) - -(defun evilnc-do-paragraphs (action num) - "Apply ACTION on NUM paragraphs." - (let* ((i 0) - rlt - (b (point-max)) - (e 0) - linenum) - (catch 'break - (while (< i num) - (when (setq rlt (evilnc--get-one-paragraph-region)) - (setq b (nth 0 rlt)) - (setq e (nth 1 rlt)) - (setq linenum (evilnc--get-line-num e))) - - ;; Original algorithm select all paragraph and comment once - ;; New algorithm comment paragraph by paragraph - (when (<= b e) - (save-excursion - (funcall action b e))) - - ;; prepare for the next paragraph - (cond - ((and rlt (< i num)) - (evilnc--goto-line linenum) - - ;; move to an empty line - (forward-line) - - ;; move to next non-empty line - (re-search-forward "^[ \t]*[^ \t]" nil t) - (if (<= (line-beginning-position) e) - (throw 'break i))) - - (t - (throw 'break i))) - - (setq i (1+ i)))))) - -;;;###autoload -(defun evilnc-comment-or-uncomment-paragraphs (&optional num) - "Comment or uncomment NUM paragraph(s). -A paragraph is a continuation non-empty lines. -Paragraphs are separated by empty lines." - (interactive "p") - (evilnc-do-paragraphs - (lambda (b e) - (evilnc--fix-buggy-major-modes) - (evilnc-comment-or-uncomment-region b e)) - num)) - -;;;###autoload -(defun evilnc-comment-or-uncomment-to-the-line (&optional line-num) - "Comment or uncomment from current line to LINE-NUM line." - (interactive "nLine: ") - (if (not (region-active-p)) - (let* ((b (line-beginning-position)) - (e (line-end-position))) - (save-excursion - (evilnc--goto-line line-num) - (if (< (line-beginning-position) b) - (setq b (line-beginning-position))) - (if (> (line-end-position) e) - (setq e (line-end-position))) - (evilnc--fix-buggy-major-modes) - (evilnc-comment-or-uncomment-region b e))))) - -;;;###autoload -(defun evilnc-quick-comment-or-uncomment-to-the-line (&optional last-digits) - "Comment/uncomment to line number by LAST-DIGITS. -For example, you can use either \ -\\\\[evilnc-quick-comment-or-uncomment-to-the-line] \ -or \\\\[evilnc-quick-comment-or-uncomment-to-the-line] \ -to comment to the line 6453" - (interactive "p") - (let* ((l (evilnc--find-destination-linenum last-digits))) - (evilnc-comment-or-uncomment-to-the-line l) - (evilnc--goto-line (+ 1 l)))) - -;;;###autoload -(defun evilnc-toggle-invert-comment-line-by-line () - "Please note this command may NOT work on complex evil text objects." - (interactive) - (if evilnc-invert-comment-line-by-line - (setq evilnc-invert-comment-line-by-line nil) - (setq evilnc-invert-comment-line-by-line t)) - (message (if evilnc-invert-comment-line-by-line - "Each line's comment status will be inverted" - "Each line's comment status will NOT be inverted"))) - -;;;###autoload -(defun evilnc-toggle-comment-empty-lines () - "Toggle the flag which decide if empty line will be commented." - (interactive) - (if comment-empty-lines - (setq comment-empty-lines nil) - (setq comment-empty-lines t)) - (message (if comment-empty-lines - "Empty line(s) will be commented" - "Empty line(s) will NOT be commented"))) - -(defun evilnc-visual-line-p () - "In Evil visual line mode." - (and (fboundp 'evil-visual-type) (eq (evil-visual-type) 'line))) - -(defun evilnc-guess-position-at-point () - "Guess current position when evil visual line state is on or off." - (cond - ((and (evilnc-visual-line-p) - (eq (point) (nth 1 (evil-visual-range)))) - ;; In evil visual line state, point is beginning or end visual range - (cons (line-number-at-pos) (1- (current-column)))) - (t - (cons (line-number-at-pos) (current-column))))) - -;;;###autoload -(defun evilnc-comment-or-uncomment-lines (&optional num) - "Comment or uncomment NUM lines. NUM could be negative. - -Case 1: If no region selected, comment/uncomment on current line. -If NUM>1, comment/uncomment extra N-1 lines from next line. - -Case 2: Selected region is expanded to make it contain whole lines. -Then we comment/uncomment the expanded region. NUM is ignored. - -Case 3: If a region inside of ONE line is selected, -we comment/uncomment that region. -CORRECT comment syntax will be used for C++/Java/Javascript." - (interactive "p") - (let* ((orig-pos (evilnc-guess-position-at-point))) - ;; donot move the cursor - ;; support negative number - (cond - ((and (= 1 num) (string-match "^[ \t]*$" (evilnc-sdk-cur-line))) - ;; comment on current empty line - (comment-dwim nil)) - (t - (save-excursion - (when (< num 0) - (evilnc--forward-line (1+ num)) - (setq num (- 0 num))) - (evilnc--operation-on-lines-or-region - (lambda (b e) - (evilnc--fix-buggy-major-modes) - ;; when comment in evil visual state, the cursor may be rogue - (when (evilnc-visual-line-p) (evil-normal-state)) - (evilnc-comment-or-uncomment-region b e)) - num)) - - (evilnc--goto-line (car orig-pos)) - ;; make sure we stay on original line - (goto-char (min (+ (line-beginning-position) (cdr orig-pos)) - (1- (line-end-position)))))))) - -;;;###autoload -(defun evilnc-copy-and-comment-lines (&optional num) - "Copy&paste NUM lines and comment out original lines. -NUM could be negative. - -Case 1: If no region selected, operate on current line. -if NUM>1, comment/uncomment extra N-1 lines from next line - -Case 2: Selected region is expanded to make it contain whole lines. -Then we operate the expanded region. NUM is ignored." - (interactive "p") - ;; support negative number - (when (< num 0) - (evilnc--forward-line (1+ num)) - (setq num (- 0 num))) - - (let* ((original-column (current-column))) - (evilnc--operation-on-lines-or-region - '(lambda (start end) - (evilnc--fix-buggy-major-modes) - (let* ((str (buffer-substring-no-properties start end))) - (cond - (evilnc-original-above-comment-when-copy-and-comment - (let* ((p (point))) - (comment-region start end) - (goto-char start) - (insert-before-markers (concat str "\n")) - (goto-char p))) - (t - (goto-char end) - (newline 1) - (insert-before-markers str) - (comment-region start end))))) - num) - ;; Go to original column after evilnc-copy-and-comment-lines - ;; @see https://github.com/redguardtoo/evil-nerd-commenter/issues/79 - ;; Thanks for Kevin Brubeck (AKA unhammer) for idea/implementation - (move-to-column original-column))) - -;;;###autoload -(defun evilnc-comment-and-kill-ring-save (&optional num) - "Comment lines save origin lines into `kill-ring'. -NUM could be negative. - -Case 1: If no region selected, operate on current line. -;; if NUM>1, comment/uncomment extra N-1 lines from next line - -Case 2: Selected region is expanded to make it contain whole lines. -Then we operate the expanded region. NUM is ignored." - (interactive "p") - ;; support negative number - (when (< num 0) - (evilnc--forward-line (1+ num)) - (setq num (- 0 num))) - - (evilnc--operation-on-lines-or-region - '(lambda (start end) - (evilnc--fix-buggy-major-modes) - (kill-new (buffer-substring-no-properties start end)) - (comment-region start end)) - num)) - -;; {{ for non-evil user only -;;;###autoload -(defun evilnc-copy-to-line (&optional LINENUM) - "Copy from current line to LINENUM line. For non-evil user only." - (interactive "nCopy to line: ") - (if (not (region-active-p)) - (let* ((b (line-beginning-position)) - (e (line-end-position))) - (save-excursion - (evilnc--goto-line LINENUM) - (if (< (line-beginning-position) b) - (setq b (line-beginning-position))) - (if (> (line-end-position) e) - (setq e (line-end-position))) - (kill-new (buffer-substring-no-properties b e)))))) - -;;;###autoload -(defun evilnc-kill-to-line (&optional linenum) - "Kill from the current line to the LINENUM line. For non-evil user only." - (interactive "NKill to line: ") - (if (not (region-active-p)) - (let* ((b (line-beginning-position)) - (e (line-end-position))) - (save-excursion - (evilnc--goto-line linenum) - (if (< (line-beginning-position) b) - (setq b (line-beginning-position))) - (if (> (line-end-position) e) - (setq e (line-end-position))) - ;; +1 because we need remove the CR - (setq e (+ 1 e)) - (if (> e (point-max)) (setq e (point-max))) - (kill-region b e))))) -;; }} - -;;;###autoload -(defun evilnc-version () - "The version number." - (interactive) - (message "3.5.8")) - -(defvar evil-normal-state-map) -(defvar evil-visual-state-map) -(defvar evil-inner-text-objects-map) -(defvar evil-outer-text-objects-map) - -;;;###autoload -(defun evilnc-default-hotkeys (&optional no-evil-keybindings no-emacs-keybindings) - "Setup the key bindings of evil-nerd-comment. -If NO-EVIL-KEYBINDINGS is t, we don't define keybindings in EVIL, -if NO-EMACS-KEYBINDINGS is t, we don't define keybindings in EMACS mode." - (interactive) - ;; Install hotkeys for Emacs mode - (unless no-emacs-keybindings - (global-set-key (kbd "M-;") 'evilnc-comment-or-uncomment-lines) - (global-set-key (kbd "C-c l") 'evilnc-quick-comment-or-uncomment-to-the-line) - (global-set-key (kbd "C-c c") 'evilnc-copy-and-comment-lines) - (global-set-key (kbd "C-c p") 'evilnc-comment-or-uncomment-paragraphs)) - - ;; Install key bindings for evil - (when (and (not no-evil-keybindings) (fboundp 'evil-mode)) - (define-key evil-normal-state-map ",ci" 'evilnc-comment-or-uncomment-lines) - (define-key evil-visual-state-map ",ci" 'evilnc-comment-or-uncomment-lines) - (define-key evil-normal-state-map ",cl" 'evilnc-quick-comment-or-uncomment-to-the-line) - (define-key evil-normal-state-map ",ll" 'evilnc-quick-comment-or-uncomment-to-the-line) - (define-key evil-normal-state-map ",cc" 'evilnc-copy-and-comment-lines) - (define-key evil-visual-state-map ",cc" 'evilnc-copy-and-comment-lines) - (define-key evil-normal-state-map ",cp" 'evilnc-comment-or-uncomment-paragraphs) - (define-key evil-normal-state-map ",cs" 'evilnc-comment-box) - (define-key evil-visual-state-map ",cs" 'evilnc-comment-box) - (define-key evil-normal-state-map ",cr" 'comment-or-uncomment-region) - (define-key evil-normal-state-map ",cv" 'evilnc-toggle-invert-comment-line-by-line) - - ;; comment itself is text object - (define-key evil-inner-text-objects-map evilnc-comment-text-object 'evilnc-inner-commenter) - (define-key evil-outer-text-objects-map evilnc-comment-text-object 'evilnc-outer-commenter) - - (when evilnc-use-comment-object-setup - ;; Install operator for evil text objects - (define-key evil-normal-state-map ",." 'evilnc-copy-and-comment-operator) - (define-key evil-visual-state-map ",." 'evilnc-copy-and-comment-operator) - (define-key evil-normal-state-map ",," 'evilnc-comment-operator) - (define-key evil-visual-state-map ",," 'evilnc-comment-operator)))) - -(defun evilnc-frame-wide-string (s) - "Build summary from S." - (let* ((w (frame-width)) - ;; display kill ring item in one line - (key (replace-regexp-in-string "[ \t]*[\n\r]+[ \t]*" "\\\\n" s))) - ;; strip the whitespace - (setq key (replace-regexp-in-string "^[ \t]+" "" key)) - ;; fit to the minibuffer width - (if (> (length key) w) - (setq key (concat (substring key 0 (- w 4)) "..."))) - key)) - -;;;###autoload -(defun evilnc-imenu-create-index-function () - "Imenu function find comments." - (let* (start end linenum str searching cands) - (save-excursion - (goto-char (point-min)) - ;; learn this skill from etags-select - ;; use simple string search to speed up searching - (setq searching t) - (while searching - ;; C/C++ might use "/* " as comment-start - (setq start (search-forward (string-trim comment-start) (point-max) t)) - ;; OK, it's comment - (cond - ((not start) - (setq searching nil)) - - (t - (setq start (1+ start)))) - - (when (and searching (evilnc-comment-p start)) - (setq linenum (line-number-at-pos start) ) - - (cond - ((string= comment-end "") - (setq end (line-end-position))) - - (t - (setq end (search-forward comment-end (point-max) t)))) - - (cond - ((and end (> end start)) - (setq str (string-trim (buffer-substring-no-properties start end))) - ;; no empty line - (setq str (replace-regexp-in-string "[\r\n]+" "\n" str)) - ;; could be multi-lines comment - (let* ((a (split-string str "[\r\n]+")) - (pre-pattern (concat "^[ \t]*[" - (string-trim comment-start) - "]*[ \t]*")) - (post-pattern (concat "[ \t]*[" - (string-trim comment-end) - "]*[ \t]*$"))) - ;; remove empty lines - (setq a (delq nil (mapcar (lambda (s) - (setq s (replace-regexp-in-string pre-pattern "" s)) - (setq s (replace-regexp-in-string post-pattern "" s)) - (setq s (string-trim s)) - (unless (string-match-p "^[ \t]*$" s) s)) - a))) - (setq str (mapconcat 'identity a "\n" ))) - - - (when (and (not (string-match-p "^[ \t\n\r]*$" str)) - (> (length str) evilnc-min-comment-length-for-imenu)) - (let* ((m (make-marker))) - (set-marker m start) - (push (cons (evilnc-frame-wide-string (format "%d:%s" linenum str)) m) - cands))) - - (goto-char (min (1+ end) (point-max)))) - - (t - (setq searching nil)))))) - (nreverse cands))) - -(defun evilnc-html-comment-region (start end) - "Comment region between START and END." - (save-excursion - (goto-char end) - (insert (evilnc-html-comment-end)) - (goto-char start) - (insert (evilnc-html-comment-start)))) - -(defun evilnc-html-uncomment-region (start end) - "Uncomment HTML tag between START and END." - (let* (mark-start-pos - mark-end-pos - (len-comment-start (length (evilnc-html-comment-start)))) - (save-excursion - (goto-char start) - (setq mark-start-pos (search-forward (evilnc-html-comment-start) end t)) - (goto-char end) - (setq mark-end-pos (search-backward (evilnc-html-comment-end) start t)) - (when (and mark-start-pos mark-end-pos) - (goto-char mark-end-pos) - (delete-char (length (evilnc-html-comment-end))) - (goto-char (- mark-start-pos len-comment-start)) - (delete-char len-comment-start))))) - -(defun evilnc-html-tag-comment-p (start) - "Test if html tag comment is at position START position." - (save-excursion - (goto-char start) - (string-match-p (concat "^[ \t]*" (regexp-quote (evilnc-html-comment-start))) - (evilnc-sdk-cur-line)))) - -;;;###autoload -(defun evilnc-comment-or-uncomment-html-tag () - "Comment or uncomment html tag(s). -If no region is selected, current tag under focus is automatically selected. -In this case, only one tag is selected. -If users manually select region, the region could cross multiple sibling tags -and automatically expands to include complete tags. -Users can press \"v\" key in evil mode to select multiple tags. -This command is not dependent on any 3rd party package." - (interactive) - (let* (beg end beg-line-beg end-line-end) - (cond - ((region-active-p) - (setq beg (region-beginning)) - (setq end (region-end)) - (save-excursion - (goto-char beg) - (setq beg-line-beg (line-beginning-position)) - (goto-char end) - (setq end-line-end (line-end-position)) - (when (< beg-line-beg (line-beginning-position)) - ;; it's multiple lines region - (goto-char beg-line-beg) - (setq beg (re-search-forward "^[ \t]*" end t)) - (setq end end-line-end)))) - (t - (save-excursion - (sgml-skip-tag-backward 1) - (setq beg (point)) - (setq beg-line-beg (line-beginning-position)) - (sgml-skip-tag-forward 1) - (setq end (point)) - (setq end-line-end (line-end-position))))) - - (cond - ((evilnc-html-tag-comment-p beg) - ;; make sure all tags plus comment marks are selected - (evilnc-html-uncomment-region beg-line-beg end-line-end)) - (t - ;; the whole tags is already selected - (evilnc-html-comment-region beg end))))) - -;;;###autoload -(defun evilnc-comment-or-uncomment-html-paragraphs (&optional num) - "Comment or uncomment NUM paragraphs contain html tag. -A paragraph is a continuation non-empty lines. -Paragraphs are separated by empty lines." - (interactive "p") - (evilnc-do-paragraphs - (lambda (b e) - (ignore e) - ;; {{ make sure tag is focused - (goto-char b) - (sgml-skip-tag-forward 1) - ;; }} - (evilnc-comment-or-uncomment-html-tag)) - num)) - -(defun evilnc-comment-box (&optional num) - "Comment out NUM lines, putting it inside a box. NUM could be negative. -If NUM is nil, comment out current paragraph. This command uses `comment-box'." - (interactive "P") - (let* ((orig-pos (evilnc-guess-position-at-point)) - range) - - (cond - ((or (not num)) - (when (setq range (bounds-of-thing-at-point 'paragraph)) - (evilnc--fix-buggy-major-modes) - (when (evilnc-visual-line-p) (evil-normal-state)) - (comment-box (car range) (cdr range) 1))) - (t - (save-excursion - (when (< num 0) - (evilnc--forward-line (1+ num)) - (setq num (- 0 num))) - (evilnc--operation-on-lines-or-region - (lambda (b e) - (evilnc--fix-buggy-major-modes) - ;; when comment in evil visual state, the cursor may be rogue - (when (evilnc-visual-line-p) (evil-normal-state)) - (comment-box b e 1)) - num)))) - - (unless (eq (evilnc-guess-position-at-point) orig-pos) - (evilnc--goto-line (car orig-pos)) - ;; make sure we stay on original line - (goto-char (min (+ (line-beginning-position) (cdr orig-pos)) - (1- (line-end-position))))))) - -;; Attempt to define the operator on first load. -;; Will only work if evil has been loaded -(with-eval-after-load 'evil - (require 'evil-nerd-commenter-operator)) - -(provide 'evil-nerd-commenter) -;;; evil-nerd-commenter.el ends here diff --git a/.config/emacs/lisp/evil-paste-indent.el b/.config/emacs/lisp/evil-paste-indent.el deleted file mode 100644 index c682bc7..0000000 --- a/.config/emacs/lisp/evil-paste-indent.el +++ /dev/null @@ -1,166 +0,0 @@ -;;; evil-paste-indent.el --- Automatically indent text that is pasted with evil mode -*- lexical-binding: t -*- - -;; Author: Jim Myhrberg , Pascal Jaeger -;; URL: https://github.com/Schievel1/evil-paste-indent -;; Keywords: convenience, paste, indent -;; Package-Requires: ((emacs "29.1") (evil "1.14.0")) -;; x-release-please-start-version -;; Version: 0.0.1 -;; x-release-please-end - -;; This file is not part of GNU Emacs. - -;;; License: -;; -;; Copyright (c) 2023 Jim Myhrberg, Pascal Jaeger -;; -;; Permission is hereby granted, free of charge, to any person obtaining a copy -;; of this software and associated documentation files (the "Software"), to deal -;; in the Software without restriction, including without limitation the rights -;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -;; copies of the Software, and to permit persons to whom the Software is -;; furnished to do so, subject to the following conditions: -;; -;; The above copyright notice and this permission notice shall be included in -;; all copies or substantial portions of the Software. -;; -;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -;; SOFTWARE. - -;;; Commentary: -;; -;; Automatically indent pasted regions when evil-paste-indent-mode is enabled. - -;;; Code: - -(defgroup evil-paste-indent nil - "Customization options for the evil-paste-indent package. - -The evil-paste-indent package provides functionality to automatically -indent pasted text according to the current mode's indentation -rules. This group contains customization options for controlling -the behavior of `evil-paste-indent-mode' and `global-evil-paste-indent-mode'." - :group 'editing) - -(defcustom evil-paste-indent-threshold 5000 - "Max characters in pasted region to trigger auto indentation. - -If the pasted region contains more characters than the value -specified by `evil-paste-indent-threshold', the automatic indentation -will not occur. This helps prevent performance issues when -working with large blocks of text." - :type 'number) - -(defcustom evil-paste-indent-global-derived-modes '(prog-mode tex-mode) - "Derived major modes where `global-evil-paste-indent-mode' enables `evil-paste-indent-mode'. - -When `global-evil-paste-indent-mode' is enabled, it activates -`evil-paste-indent-mode' in buffers with major modes derived from those -listed in this variable. This is useful when you want to enable -`evil-paste-indent-mode' for all modes that inherit from a specific -mode, such as `prog-mode' for programming modes or `text-mode' -for text editing modes." - :type '(repeat symbol)) - -(defcustom evil-paste-indent-global-exact-modes '() - "Major modes where `global-evil-paste-indent-mode' enables `evil-paste-indent-mode'. - -When `global-evil-paste-indent-mode' is enabled, it activates -`evil-paste-indent-mode' in buffers with major modes listed in this -variable. Unlike `evil-paste-indent-global-derived-modes', -`evil-paste-indent-mode' will not be activated in modes derived from -those listed here. Use this variable to list specific modes where -you want `evil-paste-indent-mode' to be enabled without affecting their -derived modes." - :type '(repeat symbol)) - -(defcustom evil-paste-indent-global-excluded-modes '(cmake-ts-mode - coffee-mode - conf-mode - haml-mode - makefile-automake-mode - makefile-bsdmake-mode - makefile-gmake-mode - makefile-imake-mode - makefile-makepp-mode - makefile-mode - python-mode - python-ts-mode - slim-mode - yaml-mode - yaml-ts-mode) - "Major modes where `global-evil-paste-indent-mode' does not enable `evil-paste-indent-mode'. - -`global-evil-paste-indent-mode' will not activate `evil-paste-indent-mode' in -buffers with major modes listed in this variable or their derived -modes. This list takes precedence over -`evil-paste-indent-global-derived-modes' and -`evil-paste-indent-global-exact-modes'. Use this variable to exclude -specific modes and their derived modes from having -`evil-paste-indent-mode' enabled." - :type '(repeat symbol)) - -(defun evil-paste-indent--should-enable-p () - "Return non-nil if current mode should be indented." - (and (not (minibufferp)) - (not (member major-mode evil-paste-indent-global-excluded-modes)) - (or (member major-mode evil-paste-indent-global-exact-modes) - (apply #'derived-mode-p evil-paste-indent-global-derived-modes)))) - -;;;###autoload -(define-minor-mode evil-paste-indent-mode - "Minor mode for automatically indenting pasted text. - -When enabled, this mode indents the pasted region according to -the current mode's indentation rules, provided that the region -size is less than or equal to `evil-paste-indent-threshold' and no -prefix argument is given during pasting." - :lighter " EPI" - :group 'evil-paste-indent - (unless global-evil-paste-indent-mode - (user-error "evil-paste-indent-mode is deactivated when global-evil-paste-indent-mode is not active.") - (evil-paste-indent-mode -1))) - -;;;###autoload -(define-globalized-minor-mode global-evil-paste-indent-mode - evil-paste-indent-mode - (lambda () - (when (evil-paste-indent--should-enable-p) - (evil-paste-indent-mode 1))) ;; turn-on function - (if global-evil-paste-indent-mode - (progn - (advice-add 'evil-paste-after :around #'evil-paste-indent--advice) - (advice-add 'evil-paste-before :around #'evil-paste-indent--advice)) - (progn - (advice-remove 'evil-paste-after #'evil-paste-indent--advice) - (advice-remove 'evil-paste-after #'evil-paste-indent--advice)))) - - -(defun evil-paste-indent--advice (orig-fun &rest args) - "Conditionally indent pasted text. - -Indentation is triggered only if all of the following conditions -are met: - -- `this-command' is `evil-paste-after' or `evil-paste-before'. -- `evil-paste-indent-mode' is enabled. -- Prefix argument was not provided. -- Region size that was pasted is less than or equal to - `evil-paste-indent-threshold'." - (with-undo-amalgamate - (apply orig-fun args) - (if (and evil-paste-indent-mode - (not current-prefix-arg)) - (let ((beg (evil-get-marker ?\[)) - (end (evil-get-marker ?\])) - (mark-even-if-inactive transient-mark-mode)) - (if (<= (- end beg) evil-paste-indent-threshold) - (indent-region beg end)))))) - -(provide 'evil-paste-indent) -;;; evil-paste-indent.el ends here diff --git a/.config/emacs/lisp/evil/.dir-locals.el b/.config/emacs/lisp/evil/.dir-locals.el deleted file mode 100644 index d79ba71..0000000 --- a/.config/emacs/lisp/evil/.dir-locals.el +++ /dev/null @@ -1,3 +0,0 @@ -;; Don't use tabs for el files -((emacs-lisp-mode . - ((indent-tabs-mode . nil)))) diff --git a/.config/emacs/lisp/evil/.gitattributes b/.config/emacs/lisp/evil/.gitattributes deleted file mode 100644 index b362cfa..0000000 --- a/.config/emacs/lisp/evil/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.el diff=lisp diff --git a/.config/emacs/lisp/evil/.github/ISSUE_TEMPLATE.md b/.config/emacs/lisp/evil/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 53cbe14..0000000 --- a/.config/emacs/lisp/evil/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Issue type - - -- Bug report -- Enhancement request -- Question -- Other - -# Environment - -Emacs version: -Operating System: -Evil version: -Evil installation type: -Graphical/Terminal: -Tested in a `make emacs` session (see [CONTRIBUTING.md](https://github.com/emacs-evil/evil/blob/master/CONTRIBUTING.md#bug-reports)): - -# Reproduction steps -- Start Emacs - - -# Expected behavior - - -# Actual behavior - - -# Further notes diff --git a/.config/emacs/lisp/evil/.github/workflows/test.yml b/.config/emacs/lisp/evil/.github/workflows/test.yml deleted file mode 100644 index d73cf73..0000000 --- a/.config/emacs/lisp/evil/.github/workflows/test.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: CI - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build: - runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.experimental }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - emacs-version: - - 26.3 - - 27.2 - - 28.2 - - 29.4 - experimental: [false] - include: - - os: ubuntu-latest - emacs-version: snapshot - experimental: true - - os: macos-latest - emacs-version: snapshot - experimental: true - exclude: - - os: macos-latest - emacs-version: 26.3 - - os: macos-latest - emacs-version: 27.2 - - steps: - - uses: jcs090218/setup-emacs@master - with: - version: ${{ matrix.emacs-version }} - - - uses: actions/checkout@v4 - - - name: Print emacs version - run: | - emacs --version - - - uses: emacs-eask/setup-eask@master - with: - version: 'snapshot' - - - name: Run tests - run: | - make test - - - name: Print results - if: ${{ always() }} - run: | - cat test-results.txt diff --git a/.config/emacs/lisp/evil/.gitignore b/.config/emacs/lisp/evil/.gitignore deleted file mode 100644 index c5b19d7..0000000 --- a/.config/emacs/lisp/evil/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -*.elc -*.cp -*.ky -*.pg -*.tp -.depend -/evil-autoloads.el -/evil-pkg.el -test-results.txt -typescript - -/doc/dir -/doc/*.aux -/doc/*.fn -/doc/*.fns -/doc/*.info -/doc/*.log -/doc/*.toc -/doc/*.vr -/doc/*.vrs -/doc/docstringdb.json -/doc/build/*/ -!/doc/build/texinfo/evil.texi -*.pyc - -/.eask -/dist diff --git a/.config/emacs/lisp/evil/.readthedocs.yaml b/.config/emacs/lisp/evil/.readthedocs.yaml deleted file mode 100644 index f4b346b..0000000 --- a/.config/emacs/lisp/evil/.readthedocs.yaml +++ /dev/null @@ -1,17 +0,0 @@ -version: 2 - -build: - os: ubuntu-22.04 - tools: - python: "3.12" - apt_packages: [emacs-nox] - jobs: - pre_build: - - scripts/evil-extract-docstrings - -sphinx: - configuration: doc/source/conf.py - -python: - install: - - requirements: doc/requirements.txt diff --git a/.config/emacs/lisp/evil/CHANGES.org b/.config/emacs/lisp/evil/CHANGES.org deleted file mode 100644 index 102c6ab..0000000 --- a/.config/emacs/lisp/evil/CHANGES.org +++ /dev/null @@ -1,56 +0,0 @@ -* Changes and New Features in Evil - -** News in 1.0.7 - - * Fix #319. - -** News in 1.0.6 - - * Fix bug induced in emacs trunk due to changed behaviour of - `overriding-terminal-local-map` (fixes #309). - -** News in 1.0.5 - - * Fix bug in `show-paren-mode` due to variable renaming in latest - emacs. - - * Fix bug in isearch module due to variable renaming in latest - emacs. - -** News in 1.0.4 - - * Undo one restriction when argument is read in operator state. - -** News in 1.0.3 - - * Fix `evil-delete-backward-word` at first non-blank in a line. - -** News in 1.0.2 - - * Fix #290. - -** News in 1.0.1 - -*** Improvements - - * An ELPA package built by =make elpa= contains COPYING file. - - * Bind =[tab]= like =\t= in =evil-ex-completion-map=, so that it - cannot be overwritten by a =[tab]= binding in the parent keymap - =minibuffer-local-completion-map=. - - * Improve worst case performance of internal functions - =evil-in-string-p=, =evil-string-beginning= and - =evil-string-end=. This functions are used, e.g., in certain text - objects to detect whether point is within a string. - - * Update authors list. - -*** Fixes - - * The interactive code == is fixed and used correctly in - =evil-ex-set-initial-state=. - - * =evil-ex-global= always generates a single undo-step. - - * Resolved issues: #249, #250, #253 and #257. diff --git a/.config/emacs/lisp/evil/CONTRIBUTING.md b/.config/emacs/lisp/evil/CONTRIBUTING.md deleted file mode 100644 index 913a5e2..0000000 --- a/.config/emacs/lisp/evil/CONTRIBUTING.md +++ /dev/null @@ -1,56 +0,0 @@ -# Bug reports - -Bug reports and feature requests should be made on the -[issue tracker](https://github.com/emacs-evil/evil/issues) here on github. - -**Before** sending a bug report, please take note of the following comments. - -1. Please provide a full description of the configuration of your - system. This includes - - - Emacs version, - - Evil version (e.g., the hash in the git repository), - - Whether you use Emacs/Evil in X mode or in terminal mode, - - Whether you use Emacs/Evil in terminal mode with some terminal multiplexer - like **tmux** or **screen** (and see below). - -2. Test the bug in a clean Emacs environment without any additional - packages loaded (besides Evil itself). You can easily get such an - environment by executing either `make emacs` (for X) or `make - terminal` (for terminal mode) in Evil's source directory. If your - bug is related to some other package, try to load only this package - from the clean environment after using `M-x package-initialize` - first. - -3. If you've just updated your Evil from the repository, **do not forget to - recompile** Evil by executing `make` in Evil's source directory. - -4. If possible, try to give a minimal example how to reproduce the error - starting from a fresh Emacs. The minimal example could be some buffer content - and a sequence of key-strokes that show up the error. - -5. If the bug you want to report is related to the behavior of some commands or - motions, please note the following. One goal of Evil is to get a behavior as - close to **Vim** as possible unless there is a good reason not to do so. The - reason is that many users come from Vim or use both, Vim and Evil, and we - want to keep the number of annoying differences between both as small as - possible, especially in common commands. In case you get an unexpected - behavior, please compare the behavior with plain Vim (i.e., without any - customization), if there's a difference please file the bug with a - description of this difference (and possibly a reference to Vim's - documentation). If you realize that both, Vim and Evil, behave the same but - you want a different behavior, you may make a **feature request** for some - customization option (but the default behavior will probably not be changed - in favor for Vim compatibility). Evil already contains several customization - options and sometimes the desired changes can be achieved as easily as - redefining some key-bindings. - -# Pull Requests - -1. Please follow the - [Emacs Lisp Style Guide](https://github.com/bbatsov/emacs-lisp-style-guide/) -2. When in doubt, adhere to the style conventions in the source code, - but don't be afraid of suggesting code enhancements in case you - encounter suboptimal code. -3. If your pull requests adds a feature or fixes a regression, add - tests covering it to `evil-tests.el`. diff --git a/.config/emacs/lisp/evil/COPYING b/.config/emacs/lisp/evil/COPYING deleted file mode 100644 index 94a9ed0..0000000 --- a/.config/emacs/lisp/evil/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/.config/emacs/lisp/evil/Eask b/.config/emacs/lisp/evil/Eask deleted file mode 100644 index 77bf0c7..0000000 --- a/.config/emacs/lisp/evil/Eask +++ /dev/null @@ -1,57 +0,0 @@ -;; -*- mode: eask; lexical-binding: t -*- - -(package "evil" - "1.15.0" - "Extensible vi layer") - -(website-url "https://github.com/emacs-evil/evil") -(keywords "emulations") - -(package-file "evil.el") -(files "evil-*.el" '(:exclude "*-tests.el" "*-pkg.el")) - -(script "test" "echo \"Error: no test specified\" && exit 1") - -(source 'gnu) -(source 'melpa) - -(depends-on "emacs" "24.1") -(depends-on "cl-lib") -(depends-on "goto-chg") -(depends-on "nadvice") - -(setq network-security-level 'low) ; see https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-932956432 - -(eask-defcommand test - "Basic tests." - (require 'evil-tests) - (evil-tests-initialize nil nil)) - -(eask-defcommand terminal - "Load Evil in a terminal Emacs and run all tests." - (require 'evil-tests) - (evil-tests-initialize nil nil t)) - -(eask-defcommand profiler - "Run all tests with profiler." - (require 'evil-tests) - (evil-mode 1) - (evil-tests-initialize nil t)) - -(eask-defcommand indent - "Re-indent all Evil code." - (setq vc-handled-backends nil) - (dolist (file (eask-package-el-files)) (load file)) - (dolist (buffer (reverse (buffer-list))) - (when (buffer-file-name buffer) - (set-buffer buffer) - (message "Indenting %s" (current-buffer)) - (setq-default indent-tabs-mode nil) - (untabify (point-min) (point-max)) - (indent-region (point-min) (point-max)) - (delete-trailing-whitespace) - (untabify (point-min) (point-max)) - (goto-char (point-min)) - (while (re-search-forward "\\n\\\\{3,\\\\}" nil t) - (replace-match "\\n\\n")) - (when (buffer-modified-p) (save-buffer 0))))) diff --git a/.config/emacs/lisp/evil/Makefile b/.config/emacs/lisp/evil/Makefile deleted file mode 100644 index 6dd8f25..0000000 --- a/.config/emacs/lisp/evil/Makefile +++ /dev/null @@ -1,80 +0,0 @@ -EMACS ?= emacs -SED ?= sed -FILES = $(filter-out evil-test-helpers.el evil-tests.el evil-pkg.el,$(wildcard evil*.el)) -VERSION := $(shell $(SED) -n '/^;\+ \+Version: *\(.*\)/{s//\1/p;q}' evil.el) -PROFILER = -TAG = -EASK ?= eask - -ELCFILES = $(FILES:.el=.elc) - -.PHONY: all compile docstrings doc clean tests test emacs term terminal profiler indent elpa version - -# Byte-compile Evil. -all: compile - -compile: - $(EASK) compile - -# Documentation. -docstrings: - @$(EMACS) --script scripts/evil-extract-docstrings - -doc: docstrings - @$(MAKE) -C doc texinfo - -info: doc - @$(MAKE) -C doc info - -# Delete byte-compiled files etc. -clean: - $(EASK) clean all - -# Run tests. -# The TAG variable may specify a test tag or a test name: -# make test TAG=repeat -# This will only run tests pertaining to the repeat system. -test: - $(EASK) run command test - -# Byte-compile Evil and run all tests. -tests: compile - $(EASK) run command test - $(EASK) clean elc - rm -f .depend - -# Load Evil in a fresh instance of Emacs and run all tests. -emacs: - $(EMACS) -Q -L . -l evil-tests.el \ - --eval "(evil-mode 1)" \ - --eval "(evil-tests-initialize '(${TAG}) '(${PROFILER}) t)" - -# Load Evil in a terminal Emacs and run all tests. -term terminal: - $(EASK) run command terminal - -# Run all tests with profiler. -profiler: - $(EASK) run command profiler - -# Re-indent all Evil code. -# Loads Evil into memory in order to indent macros properly. -# Also removes trailing whitespace, tabs and extraneous blank lines. -indent: clean - $(EASK) run command indent - -evil-pkg.el: evil.el - $(EMACS) --batch -l package $^ \ - --eval "(package-generate-description-file (package-buffer-info) \"$@\")" - -# Create an ELPA package. -elpa: evil-pkg.el - $(EASK) package - -# Change the version using make VERSION=x.y.z -version: - @$(EMACS) --script scripts/evilupdate "${VERSION}" - -# Change the version using make VERSION=x.y.z, but do not post to the newsgroup -nversion: - @$(EMACS) --script scripts/evilupdate nonews "${VERSION}" diff --git a/.config/emacs/lisp/evil/README.md b/.config/emacs/lisp/evil/README.md deleted file mode 100644 index b753ef5..0000000 --- a/.config/emacs/lisp/evil/README.md +++ /dev/null @@ -1,83 +0,0 @@ -![An extensible vi layer for Emacs](https://raw.githubusercontent.com/emacs-evil/evil/master/doc/logo.png) - -[![Build status](https://github.com/emacs-evil/evil/actions/workflows/test.yml/badge.svg)](https://github.com/emacs-evil/evil/actions/workflows/test.yml) -[![MELPA](https://melpa.org/packages/evil-badge.svg)](https://melpa.org/#/evil) -[![MELPA Stable](https://stable.melpa.org/packages/evil-badge.svg)](https://stable.melpa.org/#/evil) -[![NonGNU ELPA](http://elpa.nongnu.org/nongnu/evil.svg)](http://elpa.nongnu.org/nongnu/evil.html) -[![Documentation Status](https://readthedocs.org/projects/evil/badge/?version=latest)](https://evil.readthedocs.io/en/latest/?badge=latest) -[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) - -Evil is an **e**xtensible **vi** **l**ayer -for [Emacs](http://www.gnu.org/software/emacs/). It emulates the main features -of [Vim](http://www.vim.org/), and provides facilities for writing custom -extensions. Also see our page on [EmacsWiki](http://emacswiki.org/emacs/Evil). - -# Installation - -See the -[official documentation](https://evil.readthedocs.io/en/latest/overview.html#installation-via-package-el) -for installation instructions. We recommend using *package.el*. - -As a quickstart, you can add the following code to your Emacs init -file. - -```elisp -;; Set up package.el to work with MELPA -(require 'package) -(add-to-list 'package-archives - '("melpa" . "https://melpa.org/packages/")) -(package-initialize) -(package-refresh-contents) - -;; Download Evil -(unless (package-installed-p 'evil) - (package-install 'evil)) - -;; Enable Evil -(require 'evil) -(evil-mode 1) -``` - -## Dependencies - -* Evil requires Emacs 24.1 or later. - -* Evil requires any of the following for `C-r`: - * `undo-redo` from Emacs 28 - * The [undo-tree] package (available via GNU ELPA) - * The [undo-fu] package (available via MELPA and NonGNU ELPA) - -* For the motions `g;` `g,` and for the last-change-register `.`, Evil - requires the [goto-chg.el](https://github.com/emacs-evil/goto-chg) - package (available via MELPA and NonGNU ELPA), which provides the - functions `goto-last-change` and `goto-last-change-reverse`. - -* For Emacs 24.1 and 24.2 Evil also requires - [cl-lib](https://elpa.gnu.org/packages/cl-lib.html). - -# Documentation - -The latest version of the documentation is readable online -[here](https://evil.readthedocs.io/en/latest/index.html). It is also -available as -[PDF](https://evil.readthedocs.io/_/downloads/en/stable/pdf/) and -as [EPUB](https://evil.readthedocs.io/_/downloads/en/stable/epub/). - -# Mailing list - -Evil is discussed at the -[gmane.emacs.vim-emulation](http://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list) -mailing list. - -# IRC - -Visit us on `irc.libera.chat #evil-mode`. - -# Contribution - -See -[CONTRIBUTING.md](https://github.com/emacs-evil/evil/blob/master/CONTRIBUTING.md) -for guidelines for issues and pull requests. - -[undo-tree]: https://gitlab.com/tsc25/undo-tree -[undo-fu]: https://codeberg.org/ideasman42/emacs-undo-fu diff --git a/.config/emacs/lisp/evil/doc/Makefile b/.config/emacs/lisp/evil/doc/Makefile deleted file mode 100644 index d0c3cbf..0000000 --- a/.config/emacs/lisp/evil/doc/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = source -BUILDDIR = build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/.config/emacs/lisp/evil/doc/front.png b/.config/emacs/lisp/evil/doc/front.png deleted file mode 100644 index f79a67e..0000000 Binary files a/.config/emacs/lisp/evil/doc/front.png and /dev/null differ diff --git a/.config/emacs/lisp/evil/doc/logo.png b/.config/emacs/lisp/evil/doc/logo.png deleted file mode 100644 index 842a49d..0000000 Binary files a/.config/emacs/lisp/evil/doc/logo.png and /dev/null differ diff --git a/.config/emacs/lisp/evil/doc/logo.svg b/.config/emacs/lisp/evil/doc/logo.svg deleted file mode 100644 index ff833c2..0000000 --- a/.config/emacs/lisp/evil/doc/logo.svg +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - EVIL - - - - - - diff --git a/.config/emacs/lisp/evil/doc/make.bat b/.config/emacs/lisp/evil/doc/make.bat deleted file mode 100644 index 6247f7e..0000000 --- a/.config/emacs/lisp/evil/doc/make.bat +++ /dev/null @@ -1,35 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=source -set BUILDDIR=build - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% - -:end -popd diff --git a/.config/emacs/lisp/evil/doc/requirements.txt b/.config/emacs/lisp/evil/doc/requirements.txt deleted file mode 100644 index 4e09d9c..0000000 --- a/.config/emacs/lisp/evil/doc/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -Sphinx==7.3.7 -sphinx-rtd-theme==2.0.0 diff --git a/.config/emacs/lisp/evil/doc/source/_ext/elisp.py b/.config/emacs/lisp/evil/doc/source/_ext/elisp.py deleted file mode 100644 index ab82105..0000000 --- a/.config/emacs/lisp/evil/doc/source/_ext/elisp.py +++ /dev/null @@ -1,289 +0,0 @@ -import re -from os import path -import json - -from sphinx import addnodes -from sphinx.domains import Domain, ObjType, Index -from sphinx.domains.std import StandardDomain -from sphinx.directives import ObjectDescription -from sphinx.roles import XRefRole -from sphinx.util.nodes import make_refnode - - -with open(path.join(path.dirname(__file__), '..', '..', 'docstringdb.json')) as f: - DATA = json.load(f) - - -re_evilcode = re.compile(r"‘(evil-[^’]*)’") -re_code = re.compile(r"‘([^:][^ ’]*)’") -re_kwd = re.compile(r"‘(:[^’]*)’") -re_item = re.compile(r"([^\n])\n- ") -re_sexp = re.compile(r"\([A-Z \-\.‘’\[\]]+\)|[A-Z\-]+") -re_capitals = re.compile(r"[A-Z\-]+") -re_nonspace = re.compile(r"[^ ]") -re_signature = re.compile(r'\(fn (.*)\)') - -emphasis = [ - 'thing-at-point', -] - -def emacs_is_local(var): - return DATA[var]['local'] - -def emacs_default_value(var): - default = DATA[var]['default'] - tp = DATA[var]['default-type'] - if tp == 'string': - rep = repr(default)[1:-1] - return f'"{rep}"' - return str(default) - -def process_docstring(docstring, capitals=None): - # Remove explicit signature - docstring = re_signature.sub('', docstring) - - # Add code blocks to indented sections - def blockified_lines(lines): - in_block = False - for line in lines: - try: - indented = next(re_nonspace.finditer(line)).start(0) >= 4 - except StopIteration: - indented = None - if indented is True and not in_block: - yield '.. code-block:: elisp' - yield '' - in_block = True - elif indented is False: - in_block = False - yield line - docstring = '\n'.join(blockified_lines(docstring.split('\n'))) - - # Substitute `evil-alpha' with :elisp:ref:`evil-alpha` - docstring = re_evilcode.sub(r':elisp:ref:`\1`', docstring) - - # Substitute `alpha' with ``alpha`` - docstring = re_code.sub(r'``\1``', docstring) - - # Substitute `:alpha' with ``alpha`` - docstring = re_kwd.sub(r'``\1``', docstring) - - # Add empty line between list items - docstring = re_item.sub(r'\1\n\n- ', docstring) - - if capitals is None: - capitals = [] - else: - capitals = list(capitals) - - # Find things that look like sexps - def substitute_sexp(match): - s = match.group(0) - if re_capitals.match(s): - if s in capitals: - return f'*{s}*' - return s - else: - capitals.extend(re_capitals.findall(s)) - return f'``{s}``' - docstring = re_sexp.sub(substitute_sexp, docstring) - - # Italicize some words - for s in emphasis: - docstring = docstring.replace(s, f'*{s}*') - - return docstring - -def emacs_variable_docstring(var): - docstring = DATA[var]['var-docstring'] - return process_docstring(docstring) - -def emacs_function_docstring(var): - docstring = DATA[var]['fn-docstring'] - return process_docstring(docstring, capitals=emacs_argnames(var)) - -def emacs_argnames(var): - arglist = emacs_arglist(var) - return re_capitals.findall(arglist) - -def emacs_arglist(var): - docstring = DATA[var]['fn-docstring'] - match = re_signature.search(docstring) - if match: - return match.group(1) - - arglist = [arg.upper() for arg in DATA[var]['arglist']] - state = None - ret = '' - for arg in arglist: - if arg in ('&REST', '&OPTIONAL'): - if state == '&OPTIONAL': - ret += ']' - state = arg - ret += ' [' - continue - ret += ('' if state in ('&REST', '&OPTIONAL') else ' ') + arg - if state == '&OPTIONAL': - state += '-CONT' - if state is not None and state.startswith('&OPTIONAL'): - ret += ']' - if state == '&REST': - ret += '...]' - return ret - - -class AbstractElisp(ObjectDescription): - - def add_target_and_index(self, name, sig, signode): - anchor = f'elispobj-{sig}' - signode['ids'].append(anchor) - - objs = self.env.domaindata['elisp']['objects'] - objs[sig] = { - 'docname': self.env.docname, - 'anchor': f'elispobj-{sig}', - 'type': self.object_type, - } - - -class AbstractVariable(AbstractElisp): - object_type = 'variable' - - def handle_signature(self, sig, signode): - signode += addnodes.desc_annotation(sig, sig) - return sig - - def run(self): - extra = [] - - default = self.default_value() - if default: - extra.append(f'Default: ``{default}``') - if self.is_buffer_local(): - extra.append('buffer-local') - - self.content.data.extend(['', ', '.join(extra)]) - retval = super().run() - return retval - - -class Variable(AbstractVariable): - required_arguments = 1 - optional_arguments = 2 - - def default_value(self): - try: - return self.arguments[1] - except IndexError: - return None - - def is_buffer_local(self): - return 'bufloc' in self.arguments[1:] - - -class AutoVariable(AbstractVariable): - required_arguments = 1 - - def is_buffer_local(self): - return emacs_is_local(self.arguments[0]) - - def default_value(self): - return emacs_default_value(self.arguments[0]) - - def run(self): - docstring = emacs_variable_docstring(self.arguments[0]) - self.content.data.extend(docstring.split('\n')) - return super().run() - - -class AutoFunction(AbstractElisp): - required_arguments = 1 - - @property - def object_type(self): - return 'macro' if DATA[self.arguments[0]]['macrop'] else 'function' - - def handle_signature(self, sig, signode): - args = emacs_arglist(sig) - signode += addnodes.desc_annotation(sig, f'({sig} {args})') - return sig - - def run(self): - docstring = emacs_function_docstring(self.arguments[0]) - self.content.data.extend(docstring.split('\n')) - return super().run() - - -class ElispIndex(Index): - name = 'index' - localname = 'Emacs lisp functions and variables' - shortname = 'Elisp' - - def generate(self, docnames=None): - index = {} - for name, item in self.domain.data['objects'].items(): - if name.startswith('evil-'): - letter = name[5].upper() - else: - letter = name[0].upper() - index.setdefault(letter, []).append(( - name, - 0, - item['docname'], - item['anchor'], - item['type'], - '', - '', - )) - - index = {k: sorted(v, key=lambda k: k[0].lower()) for k, v in index.items()} - index = list(index.items()) - index = sorted(index, key=lambda k: k[0]) - return index, True - - -class Elisp(Domain): - name = 'elisp' - label = 'Emacs lisp' - - object_types = { - 'variable': ObjType('variable', 'variable', 'obj'), - 'autovariable': ObjType('autovariable', 'autovariable', 'obj'), - 'autofunction': ObjType('autofunction', 'autofunction', 'obj'), - } - - directives = { - 'variable': Variable, - 'autovariable': AutoVariable, - 'autofunction': AutoFunction, - } - - roles = { - 'ref': XRefRole(), - } - - initial_data = { - 'objects': {}, - } - - indices = { - ElispIndex, - } - - def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode): - obj = self.data['objects'].get(target, None) - if obj is None: - return None - return make_refnode(builder, fromdocname, obj['docname'], obj['anchor'], contnode, obj['anchor']) - - -def setup(app): - app.add_domain(Elisp) - StandardDomain.initial_data['labels']['elispindex'] = ('elisp-index', '', 'Emacs lisp functions and variables') - StandardDomain.initial_data['anonlabels']['elispindex'] = ('elisp-index', '') - - return { - 'version': '0.1', - 'parallel_read_safe': True, - 'parallel_write_safe': True, - } diff --git a/.config/emacs/lisp/evil/doc/source/conf.py b/.config/emacs/lisp/evil/doc/source/conf.py deleted file mode 100644 index 5b1b6f5..0000000 --- a/.config/emacs/lisp/evil/doc/source/conf.py +++ /dev/null @@ -1,85 +0,0 @@ -# Configuration file for the Sphinx documentation builder. -# -# This file only contains a selection of the most common options. For a full -# list see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html - -# -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -# import os -# import sys -# - -import os, sys -sys.path.append(os.path.abspath("./_ext")) - - -# -- Project information ----------------------------------------------------- - -project = 'Evil' -copyright = '2011-2019, Eivind Fonn, Frank Fischer, Vegard Øye' -author = 'Eivind Fonn, Frank Fischer, Vegard Øye' - -# The full version, including alpha/beta/rc tags -release = '1.15.0' - -master_doc = 'index' - - -latex_elements = { - 'fontpkg': r'\usepackage{palatino} \usepackage{inconsolata}', - 'maketitle': r""" - \newcommand\sphinxbackoftitlepage{{ - Copyright {copyright}. - - \begin{{quote}} - Permission is granted to copy, distribute and/or modify this - document under the terms of the GNU Free Documentation License, - Version 1.3 or any later version published by the Free Software - Foundation; with no Invariant Sections, no Front-Cover Texts, - and no Back-Cover Texts. A copy of the license is included in - the section entitled ``GNU Free Documentation License''. - \end{{quote}} - - The Evil team thanks everyone at gmane.emacs.vim-emulation for - their feedback and contributions. - }} - \sphinxmaketitle - """.format(copyright=copyright), -} - - -texinfo_documents = [ - (master_doc, 'evil', 'Evil documentation', author, 'evil', - 'Extensible vi layer for Emacs', 'Emacs'), -] - - -# -- General configuration --------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - 'elisp', -] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path. -exclude_patterns = [] - - -# -- Options for HTML output ------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'sphinx_rtd_theme' diff --git a/.config/emacs/lisp/evil/doc/source/extension.rst b/.config/emacs/lisp/evil/doc/source/extension.rst deleted file mode 100644 index 444502f..0000000 --- a/.config/emacs/lisp/evil/doc/source/extension.rst +++ /dev/null @@ -1,146 +0,0 @@ -Extension -========= - -The main functionality of Evil is implemented in terms of reusable -macros. Package writers can use these to define new commands. - - -Motions -------- - -A *motion* is a command which moves the cursor, such as :kbd:`w` or -:kbd:`e`. Motions are defined with the macro -:elisp:ref:`evil-define-motion`. Motions not defined in this way -should be declared with :elisp:ref:`evil-declare-motion`. - -.. elisp:autofunction:: evil-declare-motion - -.. elisp:autofunction:: evil-define-motion - -For example, this is a motion that moves the cursor forward by a -number of characters: - -.. code-block:: elisp - - (evil-define-motion foo-forward (count) - "Move to the right by COUNT characters." - :type inclusive - (forward-char (or count 1))) - -The *type* of a motion determines how it works when used together with -an operator. Inclusive motions include the endpoint in the range -being operated on, while exclusive motions do not. Line motions -extend the whole range to linewise positions, effectively behaving as -if the endpoint were really at the end of the line. Blockwise ranges -behave as a "rectangle" on screen rather than a contiguous range of -characters. - - -Operators ---------- - -An operator is a command that acts on the text moved over by a motion, -such as :kbd:`c` (change), :kbd:`d` (delete) or :kbd:`y` (yank or -copy, not to be confused with "yank" in Emacs terminology which means -*paste*). - -.. elisp:autofunction:: evil-define-operator - -For example, this is an operator that performs ROT13 encryption on the -text under consideration: - -.. code-block:: elisp - - (evil-define-operator evil-rot13 (beg end) - "ROT13 encrypt text." - (rot13-region beg end)) - -Binding this to :kbd:`g?` (where it is by default) will cause a key -sequence such as :kbd:`g?w` to encrypt from the current cursor to the -end of the word. - - -Text objects ------------- - -Text objects are like motions in that they define a range over which -an operator may act. Unlike motions, text objects can set both a -beginning and an endpoint. In visual state, text objects alter both -ends of the selection. - -Text objects are not directly usable in normal state. Instead, they -are bound in the two keymaps ``evil-inner-text-ojects-map`` and -``evil-outer-text-objects-map``, which are available in visual and -operator-pending state under the keys :kbd:`i` and :kbd:`a` -respectively. - -.. elisp:autofunction:: evil-define-text-object - -For example, this is a text object which selects the next three -characters after the current location: - -.. code-block:: elisp - - (evil-define-text-object foo (count) - "Select three characters." - (list (point) (+ 3 (point)))) - -For convenience, Evil provides several functions returning a list of -positions which can be used for defining text objects. All of them -follow the convention that a positive *count* selects text after the -current location, while negative *count* selects text before it. - -.. note:: - - The *thingatpt* library is used quite extensively in Evil to define - text objects, and this dependency leaks through in the following - functions. A *thing* in this context is any symbol for which there - is a function called ``forward-THING`` [#thing]_ which moves past a - number of *things*. - -.. elisp:autofunction:: evil-select-inner-object - -.. elisp:autofunction:: evil-select-an-object - -.. elisp:autofunction:: evil-select-paren - - -Range types ------------ - -A *type* is a transformation acting on a pair of buffer positions. -Evil defines the types ``inclusive``, ``line``, ``block`` and -``exclusive``, which are used for motion ranges and visual selection. -New types may be defined with the macro *evil-define-type*. - -.. elisp:autofunction:: evil-define-type - - -States ------- - -States are defined with the macro :elisp:ref:`evil-define-state`, -which takes care to define the necessary hooks, keymaps and variables, -as well as a toggle function ``evil-NAME-state`` and a predicate -function ``evil-NAME-state-p`` for checking whether the state is -active. - -.. elisp:autofunction:: evil-define-state - -For example: - -.. code-block:: elisp - - (evil-define-state test - "Test state." - :tag " " - (message (if (evil-test-state-p) - "Enabling test state." - "Disabling test state."))) - - -.. rubric:: Footnotes - -.. [#thing] There are many more ways that a *thing* can be defined, - but the definition of ``forward-THING`` is perhaps the most - straightforward way to go about it. diff --git a/.config/emacs/lisp/evil/doc/source/faq.rst b/.config/emacs/lisp/evil/doc/source/faq.rst deleted file mode 100644 index d389df0..0000000 --- a/.config/emacs/lisp/evil/doc/source/faq.rst +++ /dev/null @@ -1,118 +0,0 @@ -Frequently Asked Questions -========================== - -Problems with the escape key in the terminal --------------------------------------------- - -A common problem when using Evil in terminal mode is a certain delay -after pressing the escape key. Even more, when pressing the escape key -followed quickly by another key the command is recognized as -:kbd:`M-` instead of two separate keys: :kbd:`ESC` followed by -:kbd:``. In fact, it is perfectly valid to simulate -:kbd:`M-` by pressing :kbd:`ESC ` quickly (but see below). - -The reason for this is that in terminal mode a key sequence involving -the meta key (or alt key) always generates a so called "escape -sequence", i.e. a sequence of two events sent to Emacs, the first -being :kbd:`ESC` and the second the key pressed simultaneously. The -problem is that pressing the escape key itself also generates the -:kbd:`ESC` event. Thus, if Emacs (and therefore Evil) receives an -:kbd:`ESC` event there is no way to tell whether the escape key has -been pressed (and no further event will arrive) or a :kbd:`M-` -combination has been pressed (and the :kbd:`` event will arrive -soon). In order to distinguish both situations Evil does the -following. After receiving an :kbd:`ESC` event Evil waits for a short -time period (specified by the variable :elisp:ref:`evil-esc-delay` -which defaults to 0.01 seconds) for another event. If no other event -arrives Evil assumes that the plain escape key has been pressed, -otherwise it assumes a :kbd:`M-` combination has been pressed and -combines the :kbd:`ESC` event with the second one. Because a -:kbd:`M-` sequence usually generates both events in very quick -succession, 0.01 seconds are usually enough and the delay is hardly -noticeable by the user. - -If you use a terminal multiplexer like *tmux* or *screen* the -situation may be worse. These multiplexers have exactly the same -problem recognizing :kbd:`M-` sequences and often introduce their -own delay for the :kbd:`ESC` key. There is no way for Evil to -influence this delay. In order to reduce it you must reconfigure your -terminal multiplexer. - -Note that this problem should not arise when using Evil in graphical -mode. The reason is that in this case the escape key itself generates -a different command, namely ``escape`` (a symbol) and hence Evil can -distinguish whether the escape key or a :kbd:`M-` combination has -been pressed. But this also implies that pressing :kbd:`ESC` followed -by cannot be used to simulate :kbd:`M-` in graphical mode! - - -Underscore is not a word character ----------------------------------- - -An underscore ``_`` is a word character in Vim. This means that word -motions like :kbd:`w` skip over underlines in a sequence of letters as -if it was a letter itself. In contrast, in Evil the underscore is -often a non-word character like operators, e.g. ``+``. - -The reason is that Evil uses Emacs' definition of a word and this -definition does often not include the underscore. In Emacs word -characters are determined by the syntax-class of the buffer. The -syntax-class usually depends on the major-mode of this buffer. This -has the advantage that the definition of a "word" may be adapted to -the particular type of document being edited. Evil uses Emacs' -definition and does not simply use Vim's definition in order to be -consistent with other Emacs functions. For example, word characters -are exactly those characters that are matched by the regular -expression character class ``[:word:]``. - -If you would be satisfied by having the :kbd:`*` and :kbd:`#` searches -use symbols instead of words, this can be achieved by setting the -:elisp:ref:`evil-symbol-word-search` variable to ``t``. - -If you want the underscore to be recognised as word character for other -motions, you can modify its entry in the syntax-table: - -.. code-block:: elisp - - (modify-syntax-entry ?_ "w") - -This gives the underscore the 'word' syntax class. You can use a -mode-hook to modify the syntax-table in all buffers of some mode, -e.g.: - -.. code-block:: elisp - - (add-hook 'c-mode-common-hook - (lambda () (modify-syntax-entry ?_ "w"))) - -This gives the underscore the word syntax-class in all C-like buffers. - -Similarly to Emacs' definition of a word, the definition of a "symbol" is also -dependent on the syntax-class of the buffer, which often includes the -underscore. The default text objects keymap associates kbd::`o` with the symbol -object, making kbd::`cio` a good alternative to Vim's kbd::`ciw`, for example. -The following will swap between the word and symbol objects in the keymap: - -.. code-block:: elisp - - (define-key evil-outer-text-objects-map "w" 'evil-a-symbol) - (define-key evil-inner-text-objects-map "w" 'evil-inner-symbol) - (define-key evil-outer-text-objects-map "o" 'evil-a-word) - (define-key evil-inner-text-objects-map "o" 'evil-inner-word) - -This will not change the motion keys, however. One way to make word motions -operate as symbol motions is to alias the ``evil-word`` *thing* [#thingatpt]_ to -the ``evil-symbol`` thing: - -.. code-block:: elisp - - (defalias 'forward-evil-word 'forward-evil-symbol) - - -.. rubric:: Footnotes - -.. [#thingatpt] Many of Evil's text objects and motions are defined in - terms of the *thingatpt* library, which in this case are defined - entirely in terms of ``forward-THING`` functions. Thus aliasing - one to another should make all motions and text objects implemented - in terms of that *thing* behave the same. diff --git a/.config/emacs/lisp/evil/doc/source/hooks.rst b/.config/emacs/lisp/evil/doc/source/hooks.rst deleted file mode 100644 index 28ade72..0000000 --- a/.config/emacs/lisp/evil/doc/source/hooks.rst +++ /dev/null @@ -1,16 +0,0 @@ -Hooks -===== - -A *hook* is a list of functions that are executed when certain events -happen. Hooks are modified with the Emacs function ``add-hook``. -Evil provides entry and exit hooks for all its states. For example, -when switching from normal state to insert state, all functions in -``evil-normal-state-exit-hook`` and ``evil-insert-state-entry-hook`` -are executed. - -It is guaranteed that the exit hook will be executed before the entry -hook on all state switches. - -During the hook execution, the variables ``evil-next-state`` and -``evil-previous-state`` contain information about the states being -switched to and from, respectively. diff --git a/.config/emacs/lisp/evil/doc/source/index.rst b/.config/emacs/lisp/evil/doc/source/index.rst deleted file mode 100644 index 95da7b7..0000000 --- a/.config/emacs/lisp/evil/doc/source/index.rst +++ /dev/null @@ -1,21 +0,0 @@ -.. Evil documentation master file, created by - sphinx-quickstart on Thu Dec 12 10:34:49 2019. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Evil -==== - -.. toctree:: - :maxdepth: 2 - :caption: Contents - - overview - settings - keymaps - hooks - extension - faq - internals - license - indices diff --git a/.config/emacs/lisp/evil/doc/source/indices.rst b/.config/emacs/lisp/evil/doc/source/indices.rst deleted file mode 100644 index 46f687e..0000000 --- a/.config/emacs/lisp/evil/doc/source/indices.rst +++ /dev/null @@ -1,6 +0,0 @@ -.. only:: html - - Index - ===== - - - :ref:`elispindex` diff --git a/.config/emacs/lisp/evil/doc/source/internals.rst b/.config/emacs/lisp/evil/doc/source/internals.rst deleted file mode 100644 index 9984f7c..0000000 --- a/.config/emacs/lisp/evil/doc/source/internals.rst +++ /dev/null @@ -1,36 +0,0 @@ -Internals -========= - -Command properties ------------------- - -Evil defines *command properties* to store information about commands -[#command]_, such as whether they should be repeated. A command -property is a ``:keyword`` with an associated value, e.g. -``:repeat nil``. - -.. elisp:autofunction:: evil-add-command-properties - -.. elisp:autofunction:: evil-set-command-properties - -.. elisp:autofunction:: evil-get-command-properties - -.. elisp:autofunction:: evil-get-command-property - -.. elisp:autofunction:: evil-define-command - - -For setting repeat properties, use the following functions: - -.. elisp:autofunction:: evil-declare-repeat - -.. elisp:autofunction:: evil-declare-not-repeat - -.. elisp:autofunction:: evil-declare-change-repeat - - -.. rubric:: Footnotes - -.. [#command] In this context, a *command* may mean any Evil motion, - text object, operator or indeed other Emacs commands, which have - not been defined through the Evil machinery. diff --git a/.config/emacs/lisp/evil/doc/source/keymaps.rst b/.config/emacs/lisp/evil/doc/source/keymaps.rst deleted file mode 100644 index 36f8141..0000000 --- a/.config/emacs/lisp/evil/doc/source/keymaps.rst +++ /dev/null @@ -1,145 +0,0 @@ -.. _chapter-keymaps: - -Keymaps -======= - -Evil's key bindings are stored in a number of different keymaps. Each -state has a *global keymap*, where the default bindings for that state -are stored. They are named ``evil-normal-state-map``, -``evil-insert-state-map``, and so on. The bindings in these maps are -visible in all buffers currently in the corresponding state. - -These keymaps function like ordinary Emacs keymaps and may be modified -using the Emacs function ``define-key``: - -.. code-block:: elisp - - (define-key evil-normal-state-map (kbd "w") 'some-function) - -This binds the key :kbd:`w` to the command ``some-function`` in normal -state. The use of ``kbd`` is optional for simple key sequences, like -this one, but recommended in general. - -Most of Evil's bindings are defined in the file ``evil-maps.el``. - -To facilitate shared keybindings between states, some states may -activate keybindings from other states as well. For example, motion -state bindings are visible in normal and visual state, and normal -state bindings are also visible in visual state. - -Each state also has a *buffer-local keymap* which is specific to the -current buffer, and which takes precedence over the global keymap. -These maps are most suitably modified by a mode hook. They are named -``evil-normal-state-local-map``, ``evil-insert-state-local-map``, and -so on. - -.. code-block:: elisp - - (add-hook 'some-mode-hook - (lambda () - (define-key evil-normal-state-local-map - (kbd "w") 'some-function))) - -For convenience, the functions :elisp:ref:`evil-global-set-key` and -:elisp:ref:`evil-local-set-key` are available for setting global and -local state keys. - -.. elisp:autofunction:: evil-global-set-key - -.. elisp:autofunction:: evil-local-set-key - -The above examples could therefore have been written as follows: - -.. code-block:: elisp - - (evil-global-set-key 'normal (kbd "w") 'some-function) - - (add-hook 'some-mode-hook - (lambda () - (evil-local-set-key 'normal (kbd "w") 'some-function))) - - -evil-define-key ---------------- - -Evil provides the macro :elisp:ref:`evil-define-key` for adding state -bindings to ordinary keymaps. It is quite powerful, and is the -preferred method for fine-tuning bindings to activate in specific -circumstances. - -.. elisp:autofunction:: evil-define-key - -There follows a brief overview of the main functions of this macro. - -- Define a binding in a given state - - .. code-block:: elisp - - (evil-define-key 'state 'global (kbd "key") 'target) - -- Define a binding in a given state in the current buffer - - .. code-block:: elisp - - (evil-define-key 'state 'local (kbd "key") 'target) - -- Define a binding in a given state under the *foo-mode* major mode. - - .. code-block:: elisp - - (evil-define-key 'state foo-mode-map (kbd "key") 'target) - - Note that ``foo-mode-map`` is unquoted, and that this form is safe - before ``foo-mode-map`` is loaded. - -- Define a binding in a given state under the *bar-mode* minor mode. - - .. code-block:: elisp - - (evil-define-key 'state 'bar-mode (kbd "key") 'target) - - Note that ``bar-mode`` is quoted, and that this form is safe before - ``bar-mode`` is loaded. - - -The macro :elisp:ref:`evil-define-key` can be used to augment existing -modes with state bindings, as well as creating packages with custom -bindings. For example, the following will create a minor mode -``foo-mode`` with normal state bindings for the keys :kbd:`w` and -:kbd:`e`: - -.. code-block:: elisp - - (define-minor-mode foo-mode - "Foo mode." - :keymap (make-sparse-keymap)) - - (evil-define-key 'normal 'foo-mode "w" 'bar) - (evil-define-key 'normal 'foo-mode "e" 'baz) - -This minor mode can then be enabled in any buffers where the custom -bindings are desired: - -.. code-block:: elisp - - (add-hook 'text-mode-hook 'foo-mode) ; enable alongside text-mode - - -Leader keys ------------ - -Evil supports a simple implementation of Vim's *leader* keys. To bind -a function to a leader key you can use the expression ```` in -a key mapping, e.g. - -.. code-block:: elisp - - (evil-define-key 'normal 'global (kbd "fs") 'save-buffer) - -Likewise, you can use the expression ```` to mimic Vim's -local leader, which is designed for mode-specific key bindings. - -You can use the function :elisp:ref:`evil-set-leader` to designate -which key acts as the leader and the local leader. - -.. elisp:autofunction:: evil-set-leader diff --git a/.config/emacs/lisp/evil/doc/source/license.rst b/.config/emacs/lisp/evil/doc/source/license.rst deleted file mode 100644 index 39d6701..0000000 --- a/.config/emacs/lisp/evil/doc/source/license.rst +++ /dev/null @@ -1,447 +0,0 @@ -The GNU Free Documentation License -================================== - -Version 1.3, 3 November 2008 - - Copyright (c) 2000, 2001, 2002, 2007, 2008 Free Software - Foundation, Inc. http://fsf.org/ - - Everyone is permitted to copy and distribute verbatim copies of - this license document, but changing it is not allowed. - - -0. PREAMBLE - - The purpose of this License is to make a manual, textbook, or other - functional and useful document *free* in the sense of freedom: to - assure everyone the effective freedom to copy and redistribute it, - with or without modifying it, either commercially or - noncommercially. Secondarily, this License preserves for the - author and publisher a way to get credit for their work, while not - being considered responsible for modifications made by others. - - This License is a kind of "copyleft", which means that derivative - works of the document must themselves be free in the same sense. - It complements the GNU General Public License, which is a copyleft - license designed for free software. - - We have designed this License in order to use it for manuals for - free software, because free software needs free documentation: a - free program should come with manuals providing the same freedoms - that the software does. But this License is not limited to - software manuals; it can be used for any textual work, regardless - of subject matter or whether it is published as a printed book. We - recommend this License principally for works whose purpose is - instruction or reference. - -1. APPLICABILITY AND DEFINITIONS - - This License applies to any manual or other work, in any medium, - that contains a notice placed by the copyright holder saying it can - be distributed under the terms of this License. Such a notice - grants a world-wide, royalty-free license, unlimited in duration, - to use that work under the conditions stated herein. The - "Document", below, refers to any such manual or work. Any member - of the public is a licensee, and is addressed as "you". You accept - the license if you copy, modify or distribute the work in a way - requiring permission under copyright law. - - A "Modified Version" of the Document means any work containing the - Document or a portion of it, either copied verbatim, or with - modifications and/or translated into another language. - - A "Secondary Section" is a named appendix or a front-matter section - of the Document that deals exclusively with the relationship of the - publishers or authors of the Document to the Document's overall - subject (or to related matters) and contains nothing that could - fall directly within that overall subject. (Thus, if the Document - is in part a textbook of mathematics, a Secondary Section may not - explain any mathematics.) The relationship could be a matter of - historical connection with the subject or with related matters, or - of legal, commercial, philosophical, ethical or political position - regarding them. - - The "Invariant Sections" are certain Secondary Sections whose - titles are designated, as being those of Invariant Sections, in the - notice that says that the Document is released under this License. - If a section does not fit the above definition of Secondary then it - is not allowed to be designated as Invariant. The Document may - contain zero Invariant Sections. If the Document does not identify - any Invariant Sections then there are none. - - The "Cover Texts" are certain short passages of text that are - listed, as Front-Cover Texts or Back-Cover Texts, in the notice - that says that the Document is released under this License. A - Front-Cover Text may be at most 5 words, and a Back-Cover Text may - be at most 25 words. - - A "Transparent" copy of the Document means a machine-readable copy, - represented in a format whose specification is available to the - general public, that is suitable for revising the document - straightforwardly with generic text editors or (for images composed - of pixels) generic paint programs or (for drawings) some widely - available drawing editor, and that is suitable for input to text - formatters or for automatic translation to a variety of formats - suitable for input to text formatters. A copy made in an otherwise - Transparent file format whose markup, or absence of markup, has - been arranged to thwart or discourage subsequent modification by - readers is not Transparent. An image format is not Transparent if - used for any substantial amount of text. A copy that is not - "Transparent" is called "Opaque". - - Examples of suitable formats for Transparent copies include plain - ASCII without markup, Texinfo input format, LaTeX input format, - SGML or XML using a publicly available DTD, and standard-conforming - simple HTML, PostScript or PDF designed for human modification. - Examples of transparent image formats include PNG, XCF and JPG. - Opaque formats include proprietary formats that can be read and - edited only by proprietary word processors, SGML or XML for which - the DTD and/or processing tools are not generally available, and - the machine-generated HTML, PostScript or PDF produced by some word - processors for output purposes only. - - The "Title Page" means, for a printed book, the title page itself, - plus such following pages as are needed to hold, legibly, the - material this License requires to appear in the title page. For - works in formats which do not have any title page as such, "Title - Page" means the text near the most prominent appearance of the - work's title, preceding the beginning of the body of the text. - - The "publisher" means any person or entity that distributes copies - of the Document to the public. - - A section "Entitled XYZ" means a named subunit of the Document - whose title either is precisely XYZ or contains XYZ in parentheses - following text that translates XYZ in another language. (Here XYZ - stands for a specific section name mentioned below, such as - "Acknowledgements", "Dedications", "Endorsements", or "History".) - To "Preserve the Title" of such a section when you modify the - Document means that it remains a section "Entitled XYZ" according - to this definition. - - The Document may include Warranty Disclaimers next to the notice - which states that this License applies to the Document. These - Warranty Disclaimers are considered to be included by reference in - this License, but only as regards disclaiming warranties: any other - implication that these Warranty Disclaimers may have is void and - has no effect on the meaning of this License. - -2. VERBATIM COPYING - - You may copy and distribute the Document in any medium, either - commercially or noncommercially, provided that this License, the - copyright notices, and the license notice saying this License - applies to the Document are reproduced in all copies, and that you - add no other conditions whatsoever to those of this License. You - may not use technical measures to obstruct or control the reading - or further copying of the copies you make or distribute. However, - you may accept compensation in exchange for copies. If you - distribute a large enough number of copies you must also follow the - conditions in section 3. - - You may also lend copies, under the same conditions stated above, - and you may publicly display copies. - -3. COPYING IN QUANTITY - - If you publish printed copies (or copies in media that commonly - have printed covers) of the Document, numbering more than 100, and - the Document's license notice requires Cover Texts, you must - enclose the copies in covers that carry, clearly and legibly, all - these Cover Texts: Front-Cover Texts on the front cover, and - Back-Cover Texts on the back cover. Both covers must also clearly - and legibly identify you as the publisher of these copies. The - front cover must present the full title with all words of the title - equally prominent and visible. You may add other material on the - covers in addition. Copying with changes limited to the covers, as - long as they preserve the title of the Document and satisfy these - conditions, can be treated as verbatim copying in other respects. - - If the required texts for either cover are too voluminous to fit - legibly, you should put the first ones listed (as many as fit - reasonably) on the actual cover, and continue the rest onto - adjacent pages. - - If you publish or distribute Opaque copies of the Document - numbering more than 100, you must either include a machine-readable - Transparent copy along with each Opaque copy, or state in or with - each Opaque copy a computer-network location from which the general - network-using public has access to download using public-standard - network protocols a complete Transparent copy of the Document, free - of added material. If you use the latter option, you must take - reasonably prudent steps, when you begin distribution of Opaque - copies in quantity, to ensure that this Transparent copy will - remain thus accessible at the stated location until at least one - year after the last time you distribute an Opaque copy (directly or - through your agents or retailers) of that edition to the public. - - It is requested, but not required, that you contact the authors of - the Document well before redistributing any large number of copies, - to give them a chance to provide you with an updated version of the - Document. - -4. MODIFICATIONS - - You may copy and distribute a Modified Version of the Document - under the conditions of sections 2 and 3 above, provided that you - release the Modified Version under precisely this License, with the - Modified Version filling the role of the Document, thus licensing - distribution and modification of the Modified Version to whoever - possesses a copy of it. In addition, you must do these things in - the Modified Version: - - A. Use in the Title Page (and on the covers, if any) a title - distinct from that of the Document, and from those of previous - versions (which should, if there were any, be listed in the - History section of the Document). You may use the same title as - a previous version if the original publisher of that version - gives permission. - - B. List on the Title Page, as authors, one or more persons or - entities responsible for authorship of the modifications in the - Modified Version, together with at least five of the principal - authors of the Document (all of its principal authors, if it has - fewer than five), unless they release you from this requirement. - - C. State on the Title page the name of the publisher of the - Modified Version, as the publisher. - - D. Preserve all the copyright notices of the Document. - - E. Add an appropriate copyright notice for your modifications - adjacent to the other copyright notices. - - F. Include, immediately after the copyright notices, a license - notice giving the public permission to use the Modified Version - under the terms of this License, in the form shown in the - Addendum below. - - G. Preserve in that license notice the full lists of Invariant - Sections and required Cover Texts given in the Document's - license notice. - - H. Include an unaltered copy of this License. - - I. Preserve the section Entitled "History", Preserve its Title, and - add to it an item stating at least the title, year, new authors, - and publisher of the Modified Version as given on the Title - Page. If there is no section Entitled "History" in the - Document, create one stating the title, year, authors, and - publisher of the Document as given on its Title Page, then add - an item describing the Modified Version as stated in the - previous sentence. - - J. Preserve the network location, if any, given in the Document for - public access to a Transparent copy of the Document, and - likewise the network locations given in the Document for - previous versions it was based on. These may be placed in the - "History" section. You may omit a network location for a work - that was published at least four years before the Document - itself, or if the original publisher of the version it refers to - gives permission. - - K. For any section Entitled "Acknowledgements" or "Dedications", - Preserve the Title of the section, and preserve in the section - all the substance and tone of each of the contributor - acknowledgements and/or dedications given therein. - - L. Preserve all the Invariant Sections of the Document, unaltered - in their text and in their titles. Section numbers or the - equivalent are not considered part of the section titles. - - M. Delete any section Entitled "Endorsements". Such a section may - not be included in the Modified Version. - - N. Do not retitle any existing section to be Entitled - "Endorsements" or to conflict in title with any Invariant - Section. - - O. Preserve any Warranty Disclaimers. - - If the Modified Version includes new front-matter sections or - appendices that qualify as Secondary Sections and contain no - material copied from the Document, you may at your option designate - some or all of these sections as invariant. To do this, add their - titles to the list of Invariant Sections in the Modified Version's - license notice. These titles must be distinct from any other - section titles. - - You may add a section Entitled "Endorsements", provided it contains - nothing but endorsements of your Modified Version by various - parties---for example, statements of peer review or that the text - has been approved by an organization as the authoritative - definition of a standard. - - You may add a passage of up to five words as a Front-Cover Text, - and a passage of up to 25 words as a Back-Cover Text, to the end of - the list of Cover Texts in the Modified Version. Only one passage - of Front-Cover Text and one of Back-Cover Text may be added by (or - through arrangements made by) any one entity. If the Document - already includes a cover text for the same cover, previously added - by you or by arrangement made by the same entity you are acting on - behalf of, you may not add another; but you may replace the old - one, on explicit permission from the previous publisher that added - the old one. - - The author(s) and publisher(s) of the Document do not by this - License give permission to use their names for publicity for or to - assert or imply endorsement of any Modified Version. - -5. COMBINING DOCUMENTS - - You may combine the Document with other documents released under - this License, under the terms defined in section 4 above for - modified versions, provided that you include in the combination all - of the Invariant Sections of all of the original documents, - unmodified, and list them all as Invariant Sections of your - combined work in its license notice, and that you preserve all - their Warranty Disclaimers. - - The combined work need only contain one copy of this License, and - multiple identical Invariant Sections may be replaced with a single - copy. If there are multiple Invariant Sections with the same name - but different contents, make the title of each such section unique - by adding at the end of it, in parentheses, the name of the - original author or publisher of that section if known, or else a - unique number. Make the same adjustment to the section titles in - the list of Invariant Sections in the license notice of the - combined work. - - In the combination, you must combine any sections Entitled - "History" in the various original documents, forming one section - Entitled "History"; likewise combine any sections Entitled - "Acknowledgements", and any sections Entitled "Dedications". You - must delete all sections Entitled "Endorsements." - -6. COLLECTIONS OF DOCUMENTS - - You may make a collection consisting of the Document and other - documents released under this License, and replace the individual - copies of this License in the various documents with a single copy - that is included in the collection, provided that you follow the - rules of this License for verbatim copying of each of the documents - in all other respects. - - You may extract a single document from such a collection, and - distribute it individually under this License, provided you insert - a copy of this License into the extracted document, and follow this - License in all other respects regarding verbatim copying of that - document. - -7. AGGREGATION WITH INDEPENDENT WORKS - - A compilation of the Document or its derivatives with other - separate and independent documents or works, in or on a volume of a - storage or distribution medium, is called an "aggregate" if the - copyright resulting from the compilation is not used to limit the - legal rights of the compilation's users beyond what the individual - works permit. When the Document is included in an aggregate, this - License does not apply to the other works in the aggregate which - are not themselves derivative works of the Document. - - If the Cover Text requirement of section 3 is applicable to these - copies of the Document, then if the Document is less than one half - of the entire aggregate, the Document's Cover Texts may be placed - on covers that bracket the Document within the aggregate, or the - electronic equivalent of covers if the Document is in electronic - form. Otherwise they must appear on printed covers that bracket - the whole aggregate. - -8. TRANSLATION - - Translation is considered a kind of modification, so you may - distribute translations of the Document under the terms of - section 4. Replacing Invariant Sections with translations requires - special permission from their copyright holders, but you may - include translations of some or all Invariant Sections in addition - to the original versions of these Invariant Sections. You may - include a translation of this License, and all the license notices - in the Document, and any Warranty Disclaimers, provided that you - also include the original English version of this License and the - original versions of those notices and disclaimers. In case of a - disagreement between the translation and the original version of - this License or a notice or disclaimer, the original version will - prevail. - - If a section in the Document is Entitled "Acknowledgements", - "Dedications", or "History", the requirement (section 4) to - Preserve its Title (section 1) will typically require changing the - actual title. - -9. TERMINATION - - You may not copy, modify, sublicense, or distribute the Document - except as expressly provided under this License. Any attempt - otherwise to copy, modify, sublicense, or distribute it is void, - and will automatically terminate your rights under this License. - - However, if you cease all violation of this License, then your - license from a particular copyright holder is reinstated (a) - provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and (b) permanently, if the - copyright holder fails to notify you of the violation by some - reasonable means prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is - reinstated permanently if the copyright holder notifies you of the - violation by some reasonable means, this is the first time you have - received notice of violation of this License (for any work) from - that copyright holder, and you cure the violation prior to 30 days - after your receipt of the notice. - - Termination of your rights under this section does not terminate - the licenses of parties who have received copies or rights from you - under this License. If your rights have been terminated and not - permanently reinstated, receipt of a copy of some or all of the - same material does not give you any rights to use it. - -10. FUTURE REVISIONS OF THIS LICENSE - - The Free Software Foundation may publish new, revised versions of - the GNU Free Documentation License from time to time. Such new - versions will be similar in spirit to the present version, but may - differ in detail to address new problems or concerns. See - http://www.gnu.org/copyleft. - - Each version of the License is given a distinguishing version - number. If the Document specifies that a particular numbered - version of this License "or any later version" applies to it, you - have the option of following the terms and conditions either of - that specified version or of any later version that has been - published (not as a draft) by the Free Software Foundation. If the - Document does not specify a version number of this License, you may - choose any version ever published (not as a draft) by the Free - Software Foundation. If the Document specifies that a proxy can - decide which future versions of this License can be used, that - proxy's public statement of acceptance of a version permanently - authorizes you to choose that version for the Document. - -11. RELICENSING - - "Massive Multiauthor Collaboration Site" (or "MMC Site") means any - World Wide Web server that publishes copyrightable works and also - provides prominent facilities for anybody to edit those works. A - public wiki that anybody can edit is an example of such a server. - A "Massive Multiauthor Collaboration" (or "MMC") contained in the - site means any set of copyrightable works thus published on the MMC - site. - - "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 - license published by Creative Commons Corporation, a not-for-profit - corporation with a principal place of business in San Francisco, - California, as well as future copyleft versions of that license - published by that same organization. - - "Incorporate" means to publish or republish a Document, in whole or - in part, as part of another Document. - - An MMC is "eligible for relicensing" if it is licensed under this - License, and if all works that were first published under this - License somewhere other than this MMC, and subsequently - incorporated in whole or in part into the MMC, (1) had no cover - texts or invariant sections, and (2) were thus incorporated prior - to November 1, 2008. - - The operator of an MMC Site may republish an MMC contained in the - site under CC-BY-SA on the same site at any time before August 1, - 2009, provided the MMC is eligible for relicensing. diff --git a/.config/emacs/lisp/evil/doc/source/overview.rst b/.config/emacs/lisp/evil/doc/source/overview.rst deleted file mode 100644 index 96af183..0000000 --- a/.config/emacs/lisp/evil/doc/source/overview.rst +++ /dev/null @@ -1,117 +0,0 @@ -Overview -======== - -Evil is an extensible vi layer for Emacs. It emulates the main -features of Vim, [#vim]_ turning Emacs into a modal editor. Like Emacs in -general, Evil is extensible in Emacs Lisp. - - -Installation via package.el ---------------------------- - -Evil is available as a package from MELPA stable, MELPA unstable and -NonGNU ELPA. This is the recommended way of installing Evil. - -To set up `package.el` to work with one of the MELPA repositories, you -can follow the instructions on `melpa.org -`_. - -Alternatively you can use NonGNU ELPA. It is part of the default -package archives as of Emacs 28. For older Emacs versions you'll need -to add it yourself: - -.. code-block:: elisp - - (add-to-list 'package-archives - (cons "nongnu" (format "http%s://elpa.nongnu.org/nongnu/" - (if (gnutls-available-p) "s" "")))) - -Once that is done, you can execute the following commands:: - - M-x package-refresh-contents - M-x package-install RET evil RET - -Finally, add the following lines to your Emacs init file: - -.. code-block:: elisp - - (require 'evil) - (evil-mode 1) - - -Manual installation -------------------- - -First, install `goto-chg` and `cl-lib`. If you have an Emacs version -of 24.3 or newer, you should already have `cl-lib`. - -Evil lives in a git repository. To download Evil, do:: - - git clone --depth 1 https://github.com/emacs-evil/evil.git - -Then add the following lines to your Emacs init file: - -.. code-block:: elisp - - (add-to-list 'load-path "path/to/evil") - (require 'evil) - (evil-mode 1) - -Ensure that your replace ``path/to/evil`` with the actual path to -where you cloned Evil. - - -Modes and states ----------------- - -The next time Emacs is started, it will come up in *normal state*, -denoted by ```` in the mode line. This is where the main vi -bindings are defined. Note that you can always disable normal state -with :kbd:`C-z`, which switches to an "Emacs state" (denoted by -````) in which vi keys are completely disabled. Press :kbd:`C-z` -again to switch back to normal state. - -state - Evil uses the term *state* for what is called a "mode" in regular vi - usage, because *modes* are understood in Emacs terms to mean - something else. - -Evil defines a number of states by default: - -normal state (````) - This is the default "resting state" of Evil, in which the main body - of vi bindings are defined. - -insert state (````) - This is the state for insertion of text, where non-modified keys - will insert the corresponding character in the buffer. - -visual state (````) - A state for selecting text regions. Motions are available for - modifying the selected region, and operators are available for - acting on it. - -replace state (````) - A special state mostly similar to insert state, except it replaces - text instead of inserting. - -operator-pending state (````) - A special state entered after launching an operator, but before - specifying the corresponding motion or text object. - -motion state (````) - A special state useful for buffers that are read-only, where motions - are available but editing operations are not. - -Emacs state (````) - A state that as closely as possible mimics default Emacs behaviour, - by eliminating all vi bindings, except for :kbd:`C-z`, to re-enter - normal state. - - -.. rubric:: Footnotes - -.. [#vim] Vim is the most popular version of *vi*, a modal text editor - with many implementations. Vim also adds some functions of its - own, like visual selection and text objects. For more information - see `the official Vim website `_. diff --git a/.config/emacs/lisp/evil/doc/source/settings.rst b/.config/emacs/lisp/evil/doc/source/settings.rst deleted file mode 100644 index 8ca78e6..0000000 --- a/.config/emacs/lisp/evil/doc/source/settings.rst +++ /dev/null @@ -1,199 +0,0 @@ -Settings -======== - -Evil's behaviour can be adjusted by setting some variables. The list -of all available variables and their current values can be inspected -by doing:: - - M-x customize-group RET evil RET - -To change the value of a variable, you can use this interface, or add -a ``setq`` form to your Emacs init file, preferably before Evil is -loaded. [#order]_ - -.. code-block:: elisp - - (setq evil-shift-width 0) - ;; Load Evil - (require 'evil) - -What follows is a non-exhaustive list of the most relevant -customization options. - - -The initial state ------------------ - -The initial state of a buffer is determined by its major mode. Evil -maintains an association between major modes and their corresponding -states, which is most easily modified using the function -:elisp:ref:`evil-set-initial-state`. - -.. elisp:autofunction:: evil-set-initial-state - -If no state can be found, Evil uses the default initial state. - -.. elisp:autovariable:: evil-default-state - -Alternatively, it is possible to select the initial state based on the -buffer *name* rather than its major mode. This is checked first, so -it takes precedence over the other methods for setting the state. - -.. elisp:autovariable:: evil-buffer-regexps - - -Keybindings and other behaviour -------------------------------- - -Evil comes with a rich system for modifying its key bindings -:ref:`chapter-keymaps`. For the most common tweaks, the following -variables are available. - -.. elisp:autovariable:: evil-toggle-key - -.. elisp:autovariable:: evil-want-C-i-jump - -.. elisp:autovariable:: evil-want-C-u-delete - -.. elisp:autovariable:: evil-want-C-u-scroll - -.. elisp:autovariable:: evil-want-C-d-scroll - -.. elisp:autovariable:: evil-want-C-w-delete - -.. elisp:autovariable:: evil-want-C-w-in-emacs-state - -.. elisp:autovariable:: evil-want-Y-yank-to-eol - -.. elisp:autovariable:: evil-disable-insert-state-bindings - - -Search ------- - -.. elisp:autovariable:: evil-search-module - -.. elisp:autovariable:: evil-regexp-search - -.. elisp:autovariable:: evil-search-wrap - -.. elisp:autovariable:: evil-flash-delay - -.. elisp:autovariable:: evil-ex-hl-update-delay - -.. elisp:autovariable:: evil-ex-search-incremental - - -Indentation ------------ - -.. elisp:autovariable:: evil-auto-indent - -.. elisp:autovariable:: evil-shift-width - -.. elisp:autovariable:: evil-shift-round - -.. elisp:autovariable:: evil-indent-convert-tabs - - -Cursor movement ---------------- - -In standard Emacs terms, the cursor is generally understood to be -located between two characters. In Vim, and therefore also Evil, this -is the case in insert state, but in other states the cursor is -understood to be *on* a character, and that this character is not a -newline. - -Forcing this behaviour in Emacs is the source of some potentially -surprising results (especially for traditional Emacs users---users -used to Vim may find the default behavior to their satisfaction). Many -of them can be tweaked using the following variables. - -.. elisp:autovariable:: evil-repeat-move-cursor - -.. elisp:autovariable:: evil-move-cursor-back - -.. elisp:autovariable:: evil-move-beyond-eol - -.. elisp:autovariable:: evil-v$-excludes-newline - -.. elisp:autovariable:: evil-cross-lines - -.. elisp:autovariable:: evil-respect-visual-line-mode - -.. elisp:autovariable:: evil-track-eol - -.. elisp:autovariable:: evil-start-of-line - - -Cursor display --------------- - -A state may change the appearance of the cursor. Use the variable -:elisp:ref:`evil-default-cursor` to set the default cursor, and the -variables ``evil-normal-state-cursor``, ``evil-insert-state-cursor`` -etc. to set the cursors for specific states. The acceptable values -for all of them are the same. - -.. elisp:autovariable:: evil-default-cursor - - -Window management ------------------ - -.. elisp:autovariable:: evil-auto-balance-windows - -.. elisp:autovariable:: evil-split-window-below - -.. elisp:autovariable:: evil-vsplit-window-right - - -Parenthesis highlighting ------------------------- - -These settings concern the integration between Evil and -``show-paren-mode``. They take no effect if this mode is not enabled. - -.. elisp:autovariable:: evil-show-paren-range - -.. elisp:autovariable:: evil-highlight-closing-paren-at-point-states - - -Miscellaneous -------------- - -.. elisp:autovariable:: evil-want-fine-undo - -.. elisp:autovariable:: evil-undo-system - -.. elisp:autovariable:: evil-backspace-join-lines - -.. elisp:autovariable:: evil-kbd-macro-suppress-motion-error - -.. elisp:autovariable:: evil-mode-line-format - -.. elisp:autovariable:: evil-mouse-word - -.. elisp:autovariable:: evil-transient-mouse-selection - -.. elisp:autovariable:: evil-bigword - -.. elisp:autovariable:: evil-esc-delay - -.. elisp:autovariable:: evil-intercept-esc - -.. elisp:autovariable:: evil-kill-on-visual-paste - -.. elisp:autovariable:: evil-echo-state - -.. elisp:autovariable:: evil-complete-all-buffers - -.. elisp:autovariable:: evil-want-empty-ex-last-command - - -.. rubric:: Footnotes - -.. [#order] Strictly speaking, the order only matters if the variable - affects the way Evil is loaded. This is the case with some - variables. diff --git a/.config/emacs/lisp/evil/evil-command-window.el b/.config/emacs/lisp/evil/evil-command-window.el deleted file mode 100644 index ef22be0..0000000 --- a/.config/emacs/lisp/evil/evil-command-window.el +++ /dev/null @@ -1,191 +0,0 @@ -;;; evil-command-window.el --- Evil command-line window -*- lexical-binding: t -*- -;; Author: Emanuel Evans -;; Maintainer: Vegard Øye - -;; Version: 1.15.0 - -;; -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -;;; Commentary: - -;; This provides an implementation of the Vim command-line window for -;; editing and repeating past Ex commands and searches. - -;;; Code: - -(require 'evil-vars) -(require 'evil-common) -(require 'evil-ex) -(require 'evil-search) - -(defvar evil-search-module) - -(defvar evil-command-window-current-buffer nil - "The buffer from which the command-line window was called.") - -(defvar evil-command-window-execute-fn nil - "The command to execute when exiting the command-line window.") - -(defvar evil--command-window-prompt nil - "The key for the command that opened the command-line window (:, /, or ?).") - -(define-derived-mode evil-command-window-mode fundamental-mode "Evil-cmd" - "Major mode for the Evil command-line window." - (add-hook 'after-change-functions #'evil--command-window-draw-prefix nil t) - (auto-fill-mode 0)) - -(defun evil-command-window (history prompt execute-fn) - "Open a command-line window for HISTORY with PROMPT and EXECUTE-FN. -HISTORY should be a list of commands. PROMPT should be the -command-line prompt (one of \":\", \"/\" or \"?\"). EXECUTE-FN should -be a unary function to execute on the result that the user selects. - -If called interactively, edit this minibuffer argument." - (interactive - (list (cons (minibuffer-contents) (minibuffer-history-value)) - (or (minibuffer-prompt) (user-error "Minibuffer is inactive")) - #'evil--command-window-minibuffer-execute)) - (when (derived-mode-p 'evil-command-window-mode) - (user-error "Command-line window is already open")) - (when (evil-ex-p) (evil-ex-teardown)) - (let ((previous-buffer (current-buffer)) - (buffer (get-buffer-create "*Command Line*"))) - (with-current-buffer buffer - (erase-buffer) - (evil-command-window-mode) - (setq-local evil-command-window-current-buffer previous-buffer) - (setq-local evil-command-window-execute-fn execute-fn) - (setq-local evil--command-window-prompt prompt) - (evil--command-window-insert-commands history)) - - (let* ((action - `((display-buffer-reuse-window display-buffer-at-bottom) - ,@(unless (zerop evil-command-window-height) - `((window-height body-lines . ,evil-command-window-height) - (preserve-size nil . t))) - (dedicated . t))) - (window (display-buffer buffer action)) - (delete-window-fun - (lambda (window) - (set-window-parameter window 'delete-window nil) - (delete-window window) - (switch-to-minibuffer)))) - (when (minibufferp) - (set-window-parameter window 'delete-window delete-window-fun)) - (select-window window))) - (goto-char (point-max)) - (unless (bobp) (backward-char) (evil-adjust-cursor))) - -(defun evil--command-window-draw-prefix (beg end _old-len) - "Display `evil--command-window-prompt' as a prefix of the changed lines." - (let ((prefix (propertize evil--command-window-prompt - 'font-lock-face 'minibuffer-prompt))) - (put-text-property beg end 'line-prefix prefix))) - -(defun evil--command-window-insert-commands (history) - "Insert the commands in HISTORY." - (let ((inhibit-modification-hooks t)) - (dolist (cmd (reverse history)) (insert cmd "\n")) - (evil--command-window-draw-prefix (point-min) (point-max) nil))) - -(defun evil-command-window-execute () - "Execute the command on the current line in the appropriate buffer. -The local variable `evil-command-window-execute-fn' determines which -function to execute." - (interactive) - (let ((result (buffer-substring-no-properties - (line-beginning-position) (line-end-position))) - (original-buffer evil-command-window-current-buffer) - (execute-fn evil-command-window-execute-fn)) - (let ((ignore-window-parameters t)) - (ignore-errors (kill-buffer-and-window))) - (unless (buffer-live-p original-buffer) - (user-error "Originating buffer is no longer active")) - (let ((window (get-buffer-window original-buffer))) - (when window (select-window window))) - (with-current-buffer original-buffer (funcall execute-fn result)))) - -(defun evil--command-window-minibuffer-execute (result) - "Terminate this minibuffer argument with RESULT." - (delete-minibuffer-contents) - (insert result) - (exit-minibuffer)) - -(defun evil-command-window-ex (&optional current-command) - "Open a command-line window for editing and executing Ex commands. -If CURRENT-COMMAND is present, it will be inserted under the cursor as -the current command to be edited." - (interactive) - (evil-command-window (cons (or current-command "") evil-ex-history) - ":" - #'evil-command-window-ex-execute)) - -(define-obsolete-function-alias - 'evil-ex-command-window #'evil-command-window "1.15.0" - "Start command window with Ex history and current minibuffer content.") - -(define-obsolete-function-alias - 'evil-ex-search-command-window #'evil-command-window "1.15.0" - "Start command window with search history and current minibuffer content.") - -(defun evil-command-window-ex-execute (result) - "Execute RESULT as an Ex command." - (unless (string-match-p "\\`[ \t\n\r]*\\'" result) - (unless (equal result (car evil-ex-history)) - (push result evil-ex-history)) - (evil-ex-execute result))) - -(defun evil--command-window-search (forward) - "Open a command-line window for searches." - (evil-command-window - (cons "" (cond ((eq evil-search-module 'evil-search) - evil-ex-search-history) - (forward evil-search-forward-history) - (t evil-search-backward-history))) - (evil-search-prompt forward) - (lambda (result) (evil-command-window-search-execute result forward)))) - -(defun evil-command-window-search-forward () - "Open a command-line window for forward searches." - (interactive) - (evil--command-window-search t)) - -(defun evil-command-window-search-backward () - "Open a command-line window for backward searches." - (interactive) - (evil--command-window-search nil)) - -(defun evil-command-window-search-execute (result forward) - "Search for RESULT using FORWARD to determine direction." - (unless (string= result "") - (if (eq evil-search-module 'evil-search) - (progn - (setq evil-ex-search-pattern (evil-ex-make-search-pattern result) - evil-ex-search-direction (if forward 'forward 'backward)) - (unless (equal result (car evil-ex-search-history)) - (push result evil-ex-search-history)) - (evil-ex-search)) - (evil-push-search-history result forward) - (evil-search result forward evil-regexp-search)))) - -(provide 'evil-command-window) - -;;; evil-command-window.el ends here diff --git a/.config/emacs/lisp/evil/evil-commands.el b/.config/emacs/lisp/evil/evil-commands.el deleted file mode 100644 index 5dbda83..0000000 --- a/.config/emacs/lisp/evil/evil-commands.el +++ /dev/null @@ -1,5288 +0,0 @@ -;;; evil-commands.el --- Evil commands and operators -*- lexical-binding: t -*- -;; Author: Vegard Øye -;; Maintainer: Vegard Øye - -;; Version: 1.15.0 - -;; -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -;;; Code: - -(require 'evil-common) -(require 'evil-search) -(require 'evil-states) -(require 'evil-ex) -(require 'evil-types) -(require 'evil-command-window) -(require 'evil-jumps) -(require 'evil-vars) -(require 'cl-lib) -(require 'reveal) - -(declare-function imenu--in-alist "imenu") - -;;; Motions - -;; Movement commands, or motions, are defined with the macro -;; `evil-define-motion'. A motion is a command with an optional -;; argument COUNT (interactively accessed by the code ""). -;; It may specify the :type command property (e.g., :type line), -;; which determines how it is handled by an operator command. -;; Furthermore, the command must have the command properties -;; :keep-visual t and :repeat motion; these are automatically -;; set by the `evil-define-motion' macro. - -(evil-define-motion evil-forward-char (count &optional crosslines noerror) - "Move cursor to the right by COUNT characters. -Movement is restricted to the current line unless CROSSLINES is non-nil. -If NOERROR is non-nil, don't signal an error upon reaching the end -of the line or the buffer; just return nil." - :type exclusive - (interactive "" (list evil-cross-lines - (evil-kbd-macro-suppress-motion-error))) - (cond - ((not crosslines) - ;; For efficiency, narrow the buffer to the projected - ;; movement before determining the current line - (evil-with-restriction nil (min (+ (point) (or count 1) 1) (point-max)) - (condition-case err - (evil-narrow-to-line (forward-char count)) - (error - ;; Restore the previous command (this one never happened). - ;; This preserves the current column if the previous command - ;; was `evil-next-line' or `evil-previous-line'. - (setq this-command last-command) - (unless noerror (signal (car err) (cdr err))))))) - (noerror (ignore-errors (evil-forward-char count crosslines))) - (t (evil-motion-loop (nil (or count 1)) - (forward-char) - ;; don't put the cursor on a newline - (or evil-move-beyond-eol - (evil-visual-state-p) (evil-operator-state-p) - (not (eolp)) (bolp) - (forward-char)))))) - -(evil-define-motion evil-backward-char (count &optional crosslines noerror) - "Move cursor to the left by COUNT characters. -Movement is restricted to the current line unless CROSSLINES is non-nil. -If NOERROR is non-nil, don't signal an error upon reaching the beginning -of the line or the buffer; just return nil." - :type exclusive - (interactive "" (list evil-cross-lines - (evil-kbd-macro-suppress-motion-error))) - (cond - ((not crosslines) - ;; Restrict movement to the current line - (evil-with-restriction - (max (- (point) (or count 1)) (point-min)) - (min (1+ (point)) (point-max)) - (condition-case err - (evil-narrow-to-line (backward-char count)) - (error - ;; Restore the previous command (this one never happened). - ;; This preserves the current column if the previous command - ;; was `evil-next-line' or `evil-previous-line'. - (setq this-command last-command) - (unless noerror (signal (car err) (cdr err))))))) - (noerror (ignore-errors (evil-backward-char count crosslines))) - (t (evil-motion-loop (nil (or count 1)) - (backward-char) - ;; don't put the cursor on a newline - (unless (or (evil-visual-state-p) (evil-operator-state-p)) - (evil-adjust-cursor)))))) - -(evil-define-motion evil-next-line (count) - "Move the cursor COUNT lines down." - :type line - (let (line-move-visual) - (evil-line-move (or count 1)))) - -(evil-define-motion evil-previous-line (count) - "Move the cursor COUNT lines up." - :type line - (let (line-move-visual) - (evil-line-move (- (or count 1))))) - -(evil-define-motion evil-next-visual-line (count) - "Move the cursor COUNT screen lines down." - :type exclusive - (let ((line-move-visual t)) - (evil-line-move (or count 1)))) - -(evil-define-motion evil-previous-visual-line (count) - "Move the cursor COUNT screen lines up." - :type exclusive - (let ((line-move-visual t)) - (evil-line-move (- (or count 1))))) - -;; Used for repeated commands like "dd" -(evil-define-motion evil-line (count) - "Move COUNT - 1 lines down." - :type line - (let (line-move-visual) - (evil-line-move (1- (or count 1)) t))) - -(evil-define-motion evil-line-or-visual-line (count) - "Move COUNT - 1 lines down." - :type screen-line - (let ((line-move-visual (and evil-respect-visual-line-mode - visual-line-mode))) - (evil-line-move (1- (or count 1)) t))) - -(evil-define-motion evil-beginning-of-line () - "Move the cursor to the beginning of the current line." - :type exclusive - (move-beginning-of-line nil)) - -(evil-define-motion evil-end-of-line (count) - "Move the cursor to the end of the current line. -If COUNT is given, move COUNT - 1 lines downward first." - :type inclusive - (move-end-of-line count) - (when evil-track-eol - (setq temporary-goal-column most-positive-fixnum - this-command 'next-line)) - (let ((evil-move-beyond-eol - (if (evil-visual-state-p) (not evil-v$-excludes-newline) - evil-move-beyond-eol))) - (evil-adjust-cursor)) - ;; Prevent "c$" and "d$" from deleting blank lines - (when (eolp) (setq evil-this-type 'exclusive))) - -(evil-define-motion evil-beginning-of-visual-line () - "Move the cursor to the first character of the current screen line." - :type exclusive - (beginning-of-visual-line)) - -(evil-define-motion evil-end-of-visual-line (count) - "Move the cursor to the last character of the current screen line. -If COUNT is given, move COUNT - 1 screen lines downward first." - :type inclusive - (end-of-visual-line count) - (evil-move-cursor-back t)) - -(evil-define-motion evil-end-of-line-or-visual-line (count) - "Move the cursor to the last character of the current screen -line if `visual-line-mode' is active and -`evil-respect-visual-line-mode' is non-nil. If COUNT is given, -move COUNT - 1 screen lines downward first." - :type inclusive - (if (and evil-respect-visual-line-mode - visual-line-mode) - (evil-end-of-visual-line count) - (evil-end-of-line count))) - -(evil-define-motion evil-middle-of-visual-line () - "Move the cursor to the middle of the current visual line." - :type exclusive - (beginning-of-visual-line) - (evil-with-restriction - nil - (save-excursion (end-of-visual-line) (point)) - (move-to-column - (+ (current-column) -1 (/ (window-body-width) 2))))) - -(evil-define-motion evil-percentage-of-line (count) - "Move the cursor to COUNT % of the width of the current line. -If no COUNT is given, default to 50%." - :type exclusive - (let ((line-length (- (line-end-position) (line-beginning-position) - (if evil-move-beyond-eol -1 0)))) - (move-to-column (truncate (* line-length (or count 50)) 100)))) - -(evil-define-motion evil-first-non-blank () - "Move the cursor to the first non-blank character of the current line." - :type exclusive - (evil-narrow-to-line (back-to-indentation))) - -(evil-define-motion evil-last-non-blank (count) - "Move the cursor to the last non-blank character of the current line. -If COUNT is given, move COUNT - 1 lines downward first." - :type inclusive - (evil-move-end-of-line count) - (skip-chars-backward " \t") - (unless (bolp) (backward-char))) - -(evil-define-motion evil-first-non-blank-of-visual-line () - "Move the cursor to the first non blank character -of the current screen line." - :type exclusive - (evil-beginning-of-visual-line) - (skip-chars-forward " \t\r")) - -(evil-define-motion evil-next-line-first-non-blank (count) - "Move the cursor COUNT lines down on the first non-blank character." - :type line - (let ((this-command this-command)) - (evil-next-line (or count 1))) - (evil-first-non-blank)) - -(evil-define-motion evil-next-line-1-first-non-blank (count) - "Move the cursor COUNT-1 lines down on the first non-blank character." - :type line - (let ((this-command this-command)) - (evil-next-line (1- (or count 1)))) - (evil-first-non-blank)) - -(evil-define-motion evil-previous-line-first-non-blank (count) - "Move the cursor COUNT lines up on the first non-blank character." - :type line - (let ((this-command this-command)) - (evil-previous-line (or count 1))) - (evil-first-non-blank)) - -(evil-define-motion evil-goto-line (count) - "Go to line COUNT. By default the last line." - :jump t - :type line - (evil-ensure-column - (if (null count) - (progn - (goto-char (point-max)) - (when (and (eq (current-buffer) (window-buffer)) - (> (point) (window-end nil t))) - ;; If the end of the buffer is not already on the screen, scroll to - ;; position it near the bottom. - (overlay-recenter (point)) - (recenter (and (< 100 scroll-conservatively) -1)))) - (goto-char (point-min)) - (forward-line (1- count))))) - -(evil-define-motion evil-goto-first-line (count) - "Go to line COUNT. By default the first line." - :jump t - :type line - (evil-goto-line (or count 1))) - -(evil-define-motion evil-forward-word-begin (count &optional bigword) - "Move the cursor to the beginning of the COUNT-th next word. -If BIGWORD is non-nil, move by WORDS. - -If this command is called in operator-pending state it behaves -differently. If point reaches the beginning of a word on a new -line point is moved back to the end of the previous line. - -If called after a change operator, i.e. cw or cW, -`evil-want-change-word-to-end' is non-nil and point is on a word, -then both behave like ce or cE. - -If point is at the end of the buffer and cannot be moved then -`end-of-buffer' is signaled." - :type exclusive - (let ((thing (if bigword 'evil-WORD 'evil-word)) - (orig (point)) - (count (or count 1))) - (evil-signal-at-bob-or-eob count) - (cond - ;; default motion, beginning of next word - ((not (evil-operator-state-p)) - (evil-forward-beginning thing count)) - ;; the evil-change operator, maybe behave like ce or cE - ((and evil-want-change-word-to-end - (memq evil-this-operator evil-change-commands) - (< orig (or (cdr-safe (bounds-of-thing-at-point thing)) orig))) - ;; forward-thing moves point to the correct position because - ;; this is an exclusive motion - (forward-thing thing count)) - ;; operator state - (t - (prog1 (evil-forward-beginning thing count) - ;; if we reached the beginning of a word on a new line in - ;; Operator-Pending state, go back to the end of the previous - ;; line - (when (and (> (line-beginning-position) orig) - (looking-back "^[[:space:]]*" (line-beginning-position))) - ;; move cursor back as long as the line contains only - ;; whitespaces and is non-empty - (evil-move-end-of-line 0) - ;; skip non-empty lines containing only spaces - (while (and (looking-back "^[[:space:]]+$" (line-beginning-position)) - (not (<= (line-beginning-position) orig))) - (evil-move-end-of-line 0)) - ;; but if the previous line is empty, delete this line - (when (bolp) (forward-char)))))))) - -(evil-define-motion evil-forward-word-end (count &optional bigword) - "Move the cursor to the end of the COUNT-th next word. -If BIGWORD is non-nil, move by WORDS." - :type inclusive - (let ((thing (if bigword 'evil-WORD 'evil-word)) - (count (or count 1))) - (evil-signal-at-bob-or-eob count) - ;; Evil special behaviour: e or E on a one-character word in - ;; operator state does not move point - (unless (and (evil-operator-state-p) - (= 1 count) - (let ((bnd (bounds-of-thing-at-point thing))) - (and bnd - (= (car bnd) (point)) - (= (cdr bnd) (1+ (point))))) - (looking-at "[[:word:]]")) - (evil-forward-end thing count)))) - -(evil-define-motion evil-backward-word-begin (count &optional bigword) - "Move the cursor to the beginning of the COUNT-th previous word. -If BIGWORD is non-nil, move by WORDS." - :type exclusive - (let ((thing (if bigword 'evil-WORD 'evil-word))) - (evil-signal-at-bob-or-eob (- (or count 1))) - (evil-backward-beginning thing count))) - -(evil-define-motion evil-backward-word-end (count &optional bigword) - "Move the cursor to the end of the COUNT-th previous word. -If BIGWORD is non-nil, move by WORDS." - :type inclusive - (let ((thing (if bigword 'evil-WORD 'evil-word))) - (evil-signal-at-bob-or-eob (- (or count 1))) - (evil-backward-end thing count))) - -(evil-define-motion evil-forward-WORD-begin (count) - "Move the cursor to the beginning of the COUNT-th next WORD." - :type exclusive - (evil-forward-word-begin count t)) - -(evil-define-motion evil-forward-WORD-end (count) - "Move the cursor to the end of the COUNT-th next WORD." - :type inclusive - (evil-forward-word-end count t)) - -(evil-define-motion evil-backward-WORD-begin (count) - "Move the cursor to the beginning of the COUNT-th previous WORD." - :type exclusive - (evil-backward-word-begin count t)) - -(evil-define-motion evil-backward-WORD-end (count) - "Move the cursor to the end of the COUNT-th previous WORD." - :type inclusive - (evil-backward-word-end count t)) - -;; section movement -(evil-define-motion evil-forward-section-begin (count) - "Move the cursor to the beginning of the COUNT-th next section." - :jump t - :type exclusive - (evil-signal-at-bob-or-eob count) - (evil-forward-beginning 'evil-defun count)) - -(evil-define-motion evil-forward-section-end (count) - "Move the cursor to the end of the COUNT-th next section." - :jump t - :type inclusive - (evil-signal-at-bob-or-eob count) - (evil-forward-end 'evil-defun count) - (unless (eobp) (forward-line))) - -(evil-define-motion evil-backward-section-begin (count) - "Move the cursor to the beginning of the COUNT-th previous section." - :jump t - :type exclusive - (evil-signal-at-bob-or-eob (- (or count 1))) - (evil-backward-beginning 'evil-defun count)) - -(evil-define-motion evil-backward-section-end (count) - "Move the cursor to the end of the COUNT-th previous section." - :jump t - :type inclusive - (evil-signal-at-bob-or-eob (- (or count 1))) - (end-of-line -1) - (evil-backward-end 'evil-defun count) - (unless (eobp) (forward-line))) - -(evil-define-motion evil-forward-sentence-begin (count) - "Move to the next COUNT-th beginning of a sentence or end of a paragraph." - :jump t - :type exclusive - (evil-signal-at-bob-or-eob count) - (evil-forward-nearest count - #'(lambda (_cnt) - (evil-forward-beginning 'evil-sentence)) - #'evil-forward-paragraph)) - -(evil-define-motion evil-backward-sentence-begin (count) - "Move to the previous COUNT-th beginning of a sentence or paragraph." - :jump t - :type exclusive - (evil-signal-at-bob-or-eob (- (or count 1))) - (evil-forward-nearest (- (or count 1)) - #'(lambda (_cnt) - (evil-backward-beginning 'evil-sentence)) - #'(lambda (_cnt) - (evil-backward-paragraph)))) - -(evil-define-motion evil-forward-paragraph (count) - "Move to the end of the COUNT-th next paragraph." - :jump t - :type exclusive - (evil-signal-at-bob-or-eob count) - (evil-forward-end 'evil-paragraph count) - (unless (eobp) (forward-line))) - -(evil-define-motion evil-backward-paragraph (count) - "Move to the beginning of the COUNT-th previous paragraph." - :jump t - :type exclusive - (evil-signal-at-bob-or-eob (- (or count 1))) - (unless (eobp) (forward-line)) - (evil-backward-beginning 'evil-paragraph count) - (unless (bobp) (forward-line -1))) - -(defvar hif-ifx-else-endif-regexp) -(evil-define-motion evil-jump-item (count) - "Find the next item in this line after or under the cursor -and jump to the corresponding one." - :jump t - :type inclusive - (cond - ;; COUNT% jumps to a line COUNT percentage down the file - (count - (evil-ensure-column - (goto-char - (let ((size (- (point-max) (point-min)))) - (+ (point-min) - (if (> size 80000) - (* count (/ size 100)) - (/ (* count size) 100)))))) - (setq evil-this-type 'line)) - ((and (evil-looking-at-start-comment t) - (let ((pnt (point))) - (forward-comment 1) - (or (not (bolp)) - (prog1 nil (goto-char pnt))))) - (backward-char)) - ((and (not (eolp)) (evil-looking-at-end-comment t)) - (forward-comment -1)) - ((and - (memq major-mode '(c-mode c++-mode c-ts-mode c++-ts-mode)) - (require 'hideif nil t) - (with-no-warnings - (let* ((hif-else-regexp (concat hif-cpp-prefix "\\(?:else\\|elif[ \t]+\\)")) - (hif-ifx-else-endif-regexp - (concat hif-ifx-regexp "\\|" hif-else-regexp "\\|" hif-endif-regexp))) - (cond - ((save-excursion (beginning-of-line) (or (hif-looking-at-ifX) (hif-looking-at-else))) - (hif-find-next-relevant) - (while (hif-looking-at-ifX) - (hif-ifdef-to-endif) - (hif-find-next-relevant)) - t) - ((save-excursion (beginning-of-line) (hif-looking-at-endif)) - (hif-endif-to-ifdef) - t)))))) - (t - (let* ((open (point-max)) - (close (point-max)) - (open-pair (ignore-errors - (save-excursion - ;; consider the character right before eol given that - ;; point may be placed there, e.g. in visual state - (when (and (eolp) (not (bolp))) - (backward-char)) - (setq open (1- (scan-lists (point) 1 -1))) - (when (< open (line-end-position)) - (goto-char open) - (forward-list) - (1- (point)))))) - (close-pair (ignore-errors - (save-excursion - ;; consider the character right before eol given that - ;; point may be placed there, e.g. in visual state - (when (and (eolp) (not (bolp))) - (backward-char)) - (setq close (1- (scan-lists (point) 1 1))) - (when (< close (line-end-position)) - (goto-char (1+ close)) - (backward-list) - (point)))))) - (cond - ((not (or open-pair close-pair)) - ;; nothing found, check if we are inside a string - (let ((pnt (point)) - (bnd (bounds-of-thing-at-point 'evil-string))) - (if (not (and bnd (< (point) (cdr bnd)))) - ;; no, then we really failed - (user-error "No matching item found on the current line") - ;; yes, go to the end of the string and try again - (let ((endstr (cdr bnd))) - (when (or (save-excursion - (goto-char endstr) - (let ((b (bounds-of-thing-at-point 'evil-string))) - (and b (< (point) (cdr b))))) ; not at end of string - (condition-case nil - (progn - (goto-char endstr) - (evil-jump-item) - nil) - (error t))) - ;; failed again, go back to original point - (goto-char pnt) - (user-error "No matching item found on the current line")))))) - ((< open close) (goto-char open-pair)) - (t (goto-char close-pair))))))) - -(declare-function flyspell-overlay-p "flyspell") -(evil-define-motion evil-next-flyspell-error (count) - "Go to the COUNT'th spelling mistake after point." - :jump t - (unless (bound-and-true-p flyspell-mode) (signal 'search-failed nil)) - (let ((fwd (> (or count 1) 0)) (start (point)) (pos (point)) ov) - (dotimes (_ (abs (or count 1))) - (let ((limit (if fwd (point-max) (point-min))) wrappedp) - (when fwd (setq pos (save-excursion (goto-char pos) - (skip-syntax-forward "w") (point)))) - (while (progn (if (if fwd (>= pos limit) (<= pos limit)) - (if (or wrappedp (not evil-search-wrap)) - (signal 'search-failed nil) - (setq wrappedp t - limit start - pos (if fwd (point-min) - (previous-overlay-change (point-max))))) - (setq pos (if fwd (next-overlay-change pos) - (previous-overlay-change pos)))) - (not (setq ov (seq-find #'flyspell-overlay-p - (overlays-at pos)))))) - (when wrappedp (let (message-log-max) (message "Search wrapped"))))) - (goto-char (overlay-start ov)))) - -(evil-define-motion evil-prev-flyspell-error (count) - "Go to the COUNT'th spelling mistake preceding point." - :jump t - (evil-next-flyspell-error (- (or count 1)))) - -(evil-define-motion evil-previous-open-paren (count) - "Go to COUNT previous unmatched \"(\"." - :jump t - :type exclusive - (evil-up-paren ?\( ?\) (- (or count 1)))) - -(evil-define-motion evil-next-close-paren (count) - "Go to COUNT next unmatched \")\"." - :jump t - :type exclusive - (forward-char) - (evil-up-paren ?\( ?\) (or count 1)) - (backward-char)) - -(evil-define-motion evil-previous-open-brace (count) - "Go to COUNT previous unmatched \"{\"." - :jump t - :type exclusive - (evil-up-paren ?{ ?} (- (or count 1)))) - -(evil-define-motion evil-next-close-brace (count) - "Go to COUNT next unmatched \"}\"." - :jump t - :type exclusive - (forward-char) - (evil-up-paren ?{ ?} (or count 1)) - (backward-char)) - -(defun evil--lowercase-markers () - "Get all lowercase markers." - (cl-remove-if-not (lambda (x) (and (markerp (cdr x)) - (<= ?a (car x) ?z))) - evil-markers-alist)) - -(defun evil--next-mark (forwardp) - "Move to next lowercase mark. -Move forward if FORWARDP is non-nil, and backward otherwise. Loop back -to the beginning of buffer if the end is reached." - (let* ((pos (if forwardp (1+ (point)) (point))) - (centered-markers - (cl-sort - (or (evil--lowercase-markers) (user-error "No marks in this buffer")) - (if forwardp #'< #'>) - :key (lambda (x) (+ (if (< (cdr x) pos) 0 most-negative-fixnum) - (cdr x)))))) - (goto-char (cdar centered-markers)))) - -(evil-define-motion evil-next-mark (count) - "Go to COUNT next lowercase mark." - :keep-visual t - :repeat nil - :type exclusive - :jump t - (dotimes (_ (or count 1)) - (evil--next-mark t))) - -(evil-define-motion evil-next-mark-line (count) - "Go to COUNT line of next lowercase mark after current line." - :keep-visual t - :repeat nil - :type exclusive - :jump t - (unless (evil--lowercase-markers) (user-error "No marks in this buffer")) - (dotimes (_ (or count 1)) - (move-end-of-line nil) - (evil--next-mark t)) - (evil-first-non-blank)) - -(evil-define-motion evil-previous-mark (count) - "Go to COUNT previous lowercase mark." - :keep-visual t - :repeat nil - :type exclusive - :jump t - (dotimes (_ (or count 1)) - (evil--next-mark nil))) - -(evil-define-motion evil-previous-mark-line (count) - "Go to COUNT line of previous lowercase mark before current line." - :keep-visual t - :repeat nil - :type exclusive - :jump t - (unless (evil--lowercase-markers) (user-error "No marks in this buffer")) - (dotimes (_ (or count 1)) - (move-beginning-of-line nil) - (evil--next-mark nil)) - (evil-first-non-blank)) - -(evil-define-command evil-set-col-0-mark (_beg end mark) - "Set MARK at column 0 of line of END. -Default is cursor line." - (interactive "") - (if (< 1 (length mark)) - (user-error "Trailing characters") - (save-excursion - (goto-char (if (eobp) end (1- end))) - (evil-beginning-of-line) - (evil-set-marker (string-to-char mark))))) - -(evil-define-motion evil-find-char (count char) - "Move to the next COUNT'th occurrence of CHAR. -Movement is restricted to the current line unless `evil-cross-lines' -is non-nil." - :type inclusive - (interactive "") - (setq count (or count 1)) - (let ((fwd (> count 0)) - (visual (and evil-respect-visual-line-mode - visual-line-mode)) - case-fold-search) - (setq evil-last-find (list #'evil-find-char char fwd)) - (when fwd (evil-forward-char 1 evil-cross-lines)) - (unless (prog1 - (search-forward - (char-to-string char) - (cond (evil-cross-lines nil) - ((and fwd visual) - (save-excursion - (end-of-visual-line) - (point))) - (fwd (line-end-position)) - (visual - (save-excursion - (beginning-of-visual-line) - (point))) - (t (line-beginning-position))) - t count) - (when fwd (backward-char))) - (user-error "Can't find `%c'" char)))) - -(evil-define-motion evil-find-char-backward (count char) - "Move to the previous COUNT'th occurrence of CHAR." - :type exclusive - (interactive "") - (evil-find-char (- (or count 1)) char)) - -(evil-define-motion evil-find-char-to (count char) - "Move before the next COUNT'th occurrence of CHAR." - :type inclusive - (interactive "") - (unwind-protect - (evil-find-char count char) - (setcar evil-last-find #'evil-find-char-to)) - (if (> (or count 1) 0) - (backward-char) - (forward-char))) - -(evil-define-motion evil-find-char-to-backward (count char) - "Move before the previous COUNT'th occurrence of CHAR." - :type exclusive - (interactive "") - (evil-find-char-to (- (or count 1)) char)) - -(evil-define-motion evil-repeat-find-char (count) - "Repeat the last find COUNT times." - :type inclusive - (setq count (or count 1)) - (cl-destructuring-bind (cmd char fwd) - (or evil-last-find (user-error "No previous search")) - ;; ensure count is non-negative - (when (< count 0) - (setq count (- count) - fwd (not fwd))) - ;; skip next character when repeating t or T - (and (eq cmd #'evil-find-char-to) - evil-repeat-find-to-skip-next - (= count 1) - (eql (if fwd (char-after (1+ (point))) (char-before)) char) - (setq count (1+ count))) - (let (evil-last-find) - (funcall cmd (if fwd count (- count)) char) - (unless (nth 2 evil-last-find) - (setq evil-this-type 'exclusive))))) - -(evil-define-motion evil-repeat-find-char-reverse (count) - "Repeat the last find COUNT times in the opposite direction." - :type inclusive - (evil-repeat-find-char (- (or count 1)))) - -;; ceci n'est pas une pipe -(evil-define-motion evil-goto-column (count) - "Go to column COUNT on the current line. -Columns are counted from zero." - :type exclusive - (move-to-column (or count 0))) - -(evil-define-command evil-goto-mark (char &optional noerror) - "Go to the marker specified by CHAR." - :keep-visual t - :repeat nil - :type exclusive - :jump t - (interactive (list (read-char))) - (let ((marker (evil-get-marker char))) - (cond - ((markerp marker) - (switch-to-buffer (marker-buffer marker)) - (goto-char marker)) - ((numberp marker) (goto-char marker)) - ((consp marker) - (when (or (find-buffer-visiting (car marker)) - (and (y-or-n-p (format "Visit file %s again? " - (car marker))) - (find-file (car marker)))) - (goto-char (cdr marker)))) - ((not noerror) - (user-error "Marker `%c' is not set%s" char - (if (evil-global-marker-p char) "" - " in this buffer")))))) - -(evil-define-command evil-goto-mark-line (char &optional noerror) - "Go to the line of the marker specified by CHAR." - :keep-visual t - :repeat nil - :type line - :jump t - (interactive (list (read-char))) - (evil-goto-mark char noerror) - (evil-first-non-blank)) - -(declare-function goto-last-change "ext:goto-chg") -(declare-function goto-last-change-reverse "ext:goto-chg") - -(evil-define-motion evil-goto-last-change (count) - "Like `goto-last-change' but takes a COUNT rather than a span." - (setq this-command 'goto-last-change) - (dotimes (_ (or count 1)) - (goto-last-change nil))) - -(evil-define-motion evil-goto-last-change-reverse (count) - "Like `goto-last-change-reverse' but takes a COUNT rather than a span." - (setq this-command 'goto-last-change-reverse) - (dotimes (_ (or count 1)) - (goto-last-change-reverse nil))) - -(evil-define-motion evil-jump-backward (count) - "Go to older position in jump list. -To go the other way, press \ -\\\\[evil-jump-forward]." - (evil--jump-backward count)) - -(evil-define-motion evil-jump-forward (count) - "Go to newer position in jump list. -To go the other way, press \ -\\\\[evil-jump-backward]." - (evil--jump-forward count)) - -(evil-define-motion evil-jump-backward-swap (_count) - "Go to the previous position in jump list. -The current position is placed in the jump list." - (let ((pnt (point))) - (evil--jump-backward 1) - (evil-set-jump pnt))) - -(defvar xref-prompt-for-identifier) -(evil-define-motion evil-jump-to-tag (arg) - "Jump to tag under point. -If called with a prefix argument, provide a prompt -for specifying the tag." - :jump t - (interactive "P") - (cond - ((fboundp 'xref-find-definitions) - (let ((xref-prompt-for-identifier arg)) - (call-interactively #'xref-find-definitions))) - ((fboundp 'find-tag) - (if arg (call-interactively #'find-tag) - (let ((tag (funcall (or find-tag-default-function - (get major-mode 'find-tag-default-function) - #'find-tag-default)))) - (find-tag (or tag (user-error "No tag found around point")))))))) - -(evil-define-motion evil-lookup () - "Look up the keyword at point. -Calls `evil-lookup-func'." - (funcall evil-lookup-func)) - -(defun evil-ret-gen (count indent?) - (let ((widget (or (get-char-property (point) 'field) - (get-char-property (point) 'button) - (get-char-property (point) 'widget-doc)))) - (cond - ((and widget - (fboundp 'widget-type) - (fboundp 'widget-button-press) - (or (and (symbolp widget) - (get widget 'widget-type)) - (and (consp widget) - (get (widget-type widget) 'widget-type)))) - (when (evil-operator-state-p) - (setq evil-inhibit-operator t)) - (when (fboundp 'widget-button-press) - (widget-button-press (point)))) - ((and (fboundp 'button-at) - (fboundp 'push-button) - (button-at (point))) - (when (evil-operator-state-p) - (setq evil-inhibit-operator t)) - (push-button)) - ((or (evil-emacs-state-p) - (and (evil-insert-state-p) - (not buffer-read-only))) - (if (not indent?) - (newline count) - (delete-horizontal-space t) - (newline count) - (indent-according-to-mode))) - (t (evil-next-line-first-non-blank count))))) - -(evil-define-motion evil-ret (count) - "Move the cursor COUNT lines down. -If point is on a widget or a button, click on it. -In Insert state, insert a newline." - :type line - (evil-ret-gen count nil)) - -(evil-define-motion evil-ret-and-indent (count) - "Move the cursor COUNT lines down. -If point is on a widget or a button, click on it. -In Insert state, insert a newline and indent." - :type line - (evil-ret-gen count t)) - -(evil-define-motion evil-window-top (count) - "Move the cursor to line COUNT from the top of the window." - :jump t - :type line - (evil-ensure-column - (move-to-window-line - (max (or count 0) - (if (or (zerop scroll-margin) - (= (point-min) (window-start)) - (< (count-screen-lines (window-start) (point)) - scroll-margin)) - 0 - scroll-margin))))) - -(evil-define-motion evil-window-middle () - "Move the cursor to the middle line in the window." - :jump t - :type line - (evil-ensure-column (move-to-window-line nil))) - -(evil-define-motion evil-window-bottom (count) - "Move the cursor to line COUNT from the bottom of the window." - :jump t - :type line - (evil-ensure-column - (move-to-window-line - (- (max (or count 1) - (if (or (zerop scroll-margin) - (< (count-screen-lines (point) (window-end)) - scroll-margin)) - 1 - (1+ scroll-margin))))))) - -;; scrolling -(evil-define-command evil-scroll-line-up (count) - "Scroll the window COUNT lines upwards." - :repeat nil - :keep-visual t - (interactive "p") - (let (scroll-preserve-screen-position) (scroll-down count))) - -(evil-define-command evil-scroll-line-down (count) - "Scroll the window COUNT lines downwards." - :repeat nil - :keep-visual t - (interactive "p") - (let (scroll-preserve-screen-position) (scroll-up count))) - -(evil-define-command evil-scroll-count-reset () - "Set `evil-scroll-count' to 0. -`evil-scroll-up' and `evil-scroll-down' will then scroll by half of -the screen (the default)." - :repeat nil - :keep-visual t - (interactive) - (setq evil-scroll-count 0)) - -(defun evil--get-scroll-count (count) - "Given a user-supplied COUNT, return scroll count." - (cl-flet ((posint (x) (and (natnump x) (< 0 x) x))) - (or (posint count) - (posint evil-scroll-count) - (/ (window-body-height) 2)))) - -;; With `scroll-preserve-screen-position' `scroll-up'/`scroll-down' -;; target the same cursor pixel Y-coordinate while `last-command' has -;; the `scroll-command' property. However the target needs updating -;; when e.g. scrolling maximally to the first or last line and then -;; switching scroll direction. Do this by resetting `last-command' -;; when `real-this-command' (`evil-ensure-column' modifies -;; `this-command') changed from last value: - -(evil-define-command evil-scroll-up (count) - "Scroll the window and the cursor COUNT lines upwards. -If COUNT is not specified the function scrolls up `evil-scroll-count' -lines, which is the last used count. -If the scroll count is zero the command scrolls half the screen." - :repeat nil - :keep-visual t - (interactive "") - (when (= (line-beginning-position) (point-min)) - (signal 'beginning-of-buffer nil)) - (setq count (evil--get-scroll-count count)) - (evil-ensure-column - (let ((opoint (point))) - (condition-case nil - (let ((scroll-preserve-screen-position 'always) - (last-command (when (eq real-last-command real-this-command) - real-last-command))) - (scroll-down count)) - (:success - ;; Redo if `scroll-down' only did partial scroll up to BOB - (when (<= (window-start) (point-min)) - (goto-char opoint) - (vertical-motion (- count)))) - (beginning-of-buffer (vertical-motion (- count))))))) -(put 'evil-scroll-up 'scroll-command t) - -(evil-define-command evil-scroll-down (count) - "Scroll the window and the cursor COUNT lines downwards. -If COUNT is not specified the function scrolls down -`evil-scroll-count' lines, which is the last used count. -If the scroll count is zero the command scrolls half the screen." - :repeat nil - :keep-visual t - (interactive "") - (when (= (line-end-position) (point-max)) - (signal 'end-of-buffer nil)) - (setq count (evil--get-scroll-count count)) - (evil-ensure-column - ;; BUG #660: First check whether the eob is visible. - ;; In that case we do not scroll but merely move point. - (if (<= (point-max) (window-end)) - (vertical-motion count) - (condition-case nil - (let ((scroll-preserve-screen-position 'always) - (last-command (when (eq real-last-command real-this-command) - real-last-command))) - (scroll-up count)) - (:success - ;; If EOB became visible: Scroll it to the bottom - (save-excursion - (goto-char (window-start)) - (vertical-motion (max 0 (- (window-height) 1 scroll-margin))) - (when (<= (point-max) (point)) (recenter -1)))) - (end-of-buffer (goto-char (point-max)) (recenter -1)))))) -(put 'evil-scroll-down 'scroll-command t) - -(evil-define-command evil-scroll-page-up (count) - "Scroll the window COUNT pages upwards." - :repeat nil - :keep-visual t - (interactive "p") - (evil-ensure-column - (dotimes (i count) - (condition-case err - (scroll-down nil) - (beginning-of-buffer - (if (and (bobp) (zerop i)) - (signal (car err) (cdr err)) - (goto-char (point-min)))))))) - -(evil-define-command evil-scroll-page-down (count) - "Scroll the window COUNT pages downwards." - :repeat nil - :keep-visual t - (interactive "p") - (evil-ensure-column - (dotimes (i count) - (condition-case err - (scroll-up nil) - (end-of-buffer - (if (and (eobp) (zerop i)) - (signal (car err) (cdr err)) - (goto-char (point-max)))))))) - -(evil-define-command evil-scroll-line-to-top (count) - "Scroll line number COUNT (or the cursor line) to the top of the window." - :repeat nil - :keep-visual t - (interactive "") - (when count - (evil-save-column - (goto-char (point-min)) - (forward-line (1- count)))) - (recenter 0)) - -(evil-define-command evil-scroll-line-to-top-first-non-blank (count) - "Scroll line number COUNT (or the cursor line) to the top of the window. -Then move the cursor to the first non-blank character of that line." - :repeat nil - :keep-visual t - (interactive "") - (evil-scroll-line-to-top count) - (evil-first-non-blank)) - -(evil-define-command evil-scroll-line-to-center (count) - "Scroll line number COUNT (or the cursor line) to the center of the window." - :repeat nil - :keep-visual t - (interactive "") - (when count - (evil-save-column - (goto-char (point-min)) - (forward-line (1- count)))) - (recenter)) - -(evil-define-command evil-scroll-line-to-center-first-non-blank (count) - "Scroll line number COUNT (or the cursor line) to the center of the window. -Then move the cursor to the first non-blank character of that line." - :repeat nil - :keep-visual t - (interactive "") - (evil-scroll-line-to-center count) - (evil-first-non-blank)) - -(evil-define-command evil-scroll-line-to-bottom (count) - "Scroll line number COUNT (or the cursor line) to the bottom of the window." - :repeat nil - :keep-visual t - (interactive "") - (when count - (evil-save-column - (goto-char (point-min)) - (forward-line (1- count)))) - (recenter -1)) - -(evil-define-command evil-scroll-line-to-bottom-first-non-blank (count) - "Scroll line number COUNT (or the cursor line) to the bottom of the window. -Then move the cursor to the first non-blank character of that line." - :repeat nil - :keep-visual t - (interactive "") - (evil-scroll-line-to-bottom count) - (evil-first-non-blank)) - -(evil-define-command evil-scroll-bottom-line-to-top (count) - "Scroll the line right below the window, -or line COUNT to the top of the window." - :repeat nil - :keep-visual t - (interactive "") - (unless count - (goto-char (window-end)) - (evil-first-non-blank)) - (evil-scroll-line-to-top count)) - -(evil-define-command evil-scroll-top-line-to-bottom (count) - "Scroll the line right above the window, -or line COUNT to the bottom of the window." - :repeat nil - :keep-visual t - (interactive "") - (unless count - (goto-char (window-start)) - (evil-first-non-blank)) - (evil-scroll-line-to-bottom count)) - -(evil-define-command evil-scroll-left (count) - "Scroll the window COUNT half-screenwidths to the left." - :repeat nil - :keep-visual t - (interactive "p") - (evil-with-hproject-point-on-window - (scroll-right (* count (/ (window-width) 2))))) - -(evil-define-command evil-scroll-right (count) - "Scroll the window COUNT half-screenwidths to the right." - :repeat nil - :keep-visual t - (interactive "p") - (evil-with-hproject-point-on-window - (scroll-left (* count (/ (window-width) 2))))) - -(evil-define-command evil-scroll-column-left (count) - "Scroll the window COUNT columns to the left." - :repeat nil - :keep-visual t - (interactive "p") - (evil-with-hproject-point-on-window - (scroll-right count))) - -(evil-define-command evil-scroll-column-right (count) - "Scroll the window COUNT columns to the right." - :repeat nil - :keep-visual t - (interactive "p") - (evil-with-hproject-point-on-window - (scroll-left count))) - -(evil-define-command evil-scroll-end-column () - "Scroll the window to position the cursor at the end (right side) of the screen. -Warn if `hscroll-margin' > 0, as cursor will be `hscroll-margin' chars from -the right edge." - :repeat nil - :keep-visual t - (interactive) - (let* ((window-hpos (- (current-column) (window-hscroll))) - (dist-from-right-edge (- (window-width) window-hpos))) - (when (< 0 hscroll-margin) - (evil-echo "%s: hscroll-margin = %d" this-command hscroll-margin)) - (evil-scroll-column-left (- dist-from-right-edge (abs (* 2 hscroll-margin)))))) - -(evil-define-command evil-scroll-start-column () - "Scroll the window to position the cursor at the start (left side) of the screen. -Warn if `hscroll-margin' > 0, as cursor will be `hscroll-margin' chars from -the left edge." - :repeat nil - :keep-visual t - (interactive) - (let ((initial-column (current-column)) - (initial-hscroll (window-hscroll))) - (when (< 0 hscroll-margin) - (evil-echo "%s: hscroll-margin = %d" this-command hscroll-margin)) - (evil-scroll-column-right (- initial-column initial-hscroll hscroll-margin 1)))) - -;;; Text objects - -;; Text objects are defined with `evil-define-text-object'. In Visual -;; state, they modify the current selection; in Operator-Pending -;; state, they return a pair of buffer positions. Outer text objects -;; are bound in the keymap `evil-outer-text-objects-map', and inner -;; text objects are bound in `evil-inner-text-objects-map'. -;; -;; Common text objects like words, WORDS, paragraphs and sentences are -;; defined via a corresponding move-function. This function must have -;; the following properties: -;; -;; 1. Take exactly one argument, the count. -;; 2. When the count is positive, move point forward to the first -;; character after the end of the next count-th object. -;; 3. When the count is negative, move point backward to the first -;; character of the count-th previous object. -;; 4. If point is placed on the first character of an object, the -;; backward motion does NOT count that object. -;; 5. If point is placed on the last character of an object, the -;; forward motion DOES count that object. -;; 6. The return value is "count left", i.e., in forward direction -;; count is decreased by one for each successful move and in -;; backward direction count is increased by one for each -;; successful move, returning the final value of count. -;; Therefore, if the complete move is successful, the return -;; value is 0. -;; -;; A useful macro in this regard is `evil-motion-loop', which quits -;; when point does not move further and returns the count difference. -;; It also provides a "unit value" of 1 or -1 for use in each -;; iteration. For example, a hypothetical "foo-bar" move could be -;; written as such: -;; -;; (defun foo-bar (count) -;; (evil-motion-loop (var count) -;; (forward-foo var) ; `var' is 1 or -1 depending on COUNT -;; (forward-bar var))) -;; -;; If "forward-foo" and "-bar" didn't accept negative arguments, -;; we could choose their backward equivalents by inspecting `var': -;; -;; (defun foo-bar (count) -;; (evil-motion-loop (var count) -;; (cond -;; ((< var 0) -;; (backward-foo 1) -;; (backward-bar 1)) -;; (t -;; (forward-foo 1) -;; (forward-bar 1))))) -;; -;; After a forward motion, point has to be placed on the first -;; character after some object, unless no motion was possible at all. -;; Similarly, after a backward motion, point has to be placed on the -;; first character of some object. This implies that point should -;; NEVER be moved to eob or bob, unless an object ends or begins at -;; eob or bob. (Usually, Emacs motions always move as far as possible. -;; But we want to use the motion-function to identify certain objects -;; in the buffer, and thus exact movement to object boundaries is -;; required.) - -(evil-define-text-object evil-a-word (count &optional beg end _type) - "Select a word." - (evil-select-a-restricted-object 'evil-word beg end type count)) - -(evil-define-text-object evil-inner-word (count &optional beg end _type) - "Select inner word." - (evil-select-inner-restricted-object 'evil-word beg end type count)) - -(evil-define-text-object evil-a-WORD (count &optional beg end _type) - "Select a WORD." - (evil-select-a-restricted-object 'evil-WORD beg end type count)) - -(evil-define-text-object evil-inner-WORD (count &optional beg end _type) - "Select inner WORD." - (evil-select-inner-restricted-object 'evil-WORD beg end type count)) - -(evil-define-text-object evil-a-symbol (count &optional beg end _type) - "Select a symbol." - (evil-select-an-object 'evil-symbol beg end type count)) - -(evil-define-text-object evil-inner-symbol (count &optional beg end _type) - "Select inner symbol." - (evil-select-inner-object 'evil-symbol beg end type count)) - -(evil-define-text-object evil-a-sentence (count &optional beg end _type) - "Select a sentence." - (evil-select-an-object 'evil-sentence beg end type count)) - -(evil-define-text-object evil-inner-sentence (count &optional beg end _type) - "Select inner sentence." - (evil-select-inner-object 'evil-sentence beg end type count)) - -(evil-define-text-object evil-a-paragraph (count &optional beg end _type) - "Select a paragraph." - :type line - (evil-select-an-object 'evil-paragraph beg end type count t)) - -(evil-define-text-object evil-inner-paragraph (count &optional beg end _type) - "Select inner paragraph." - :type line - (evil-select-inner-object 'evil-paragraph beg end type count t)) - -(evil-define-text-object evil-a-paren (count &optional beg end _type) - "Select a parenthesis." - :extend-selection nil - (evil-select-paren ?\( ?\) beg end type count t)) - -(evil-define-text-object evil-inner-paren (count &optional beg end _type) - "Select inner parenthesis." - :extend-selection nil - (evil-select-paren ?\( ?\) beg end type count)) - -(evil-define-text-object evil-a-bracket (count &optional beg end _type) - "Select a square bracket." - :extend-selection nil - (evil-select-paren ?\[ ?\] beg end type count t)) - -(evil-define-text-object evil-inner-bracket (count &optional beg end _type) - "Select inner square bracket." - :extend-selection nil - (evil-select-paren ?\[ ?\] beg end type count)) - -(evil-define-text-object evil-a-curly (count &optional beg end _type) - "Select a curly bracket (\"brace\")." - :extend-selection nil - (evil-select-paren ?{ ?} beg end type count t)) - -(evil-define-text-object evil-inner-curly (count &optional beg end _type) - "Select inner curly bracket (\"brace\")." - :extend-selection nil - (evil-select-paren ?{ ?} beg end type count)) - -(evil-define-text-object evil-an-angle (count &optional beg end _type) - "Select an angle bracket." - :extend-selection nil - (evil-select-paren ?< ?> beg end type count t)) - -(evil-define-text-object evil-inner-angle (count &optional beg end _type) - "Select inner angle bracket." - :extend-selection nil - (evil-select-paren ?< ?> beg end type count)) - -(evil-define-text-object evil-a-single-quote (count &optional beg end _type) - "Select a single-quoted expression." - :extend-selection t - (evil-select-quote ?' beg end type count t)) - -(evil-define-text-object evil-inner-single-quote (count &optional beg end _type) - "Select inner single-quoted expression." - :extend-selection nil - (evil-select-quote ?' beg end type count)) - -(evil-define-text-object evil-a-double-quote (count &optional beg end _type) - "Select a double-quoted expression." - :extend-selection t - (evil-select-quote ?\" beg end type count t)) - -(evil-define-text-object evil-inner-double-quote (count &optional beg end _type) - "Select inner double-quoted expression." - :extend-selection nil - (evil-select-quote ?\" beg end type count)) - -(evil-define-text-object evil-a-back-quote (count &optional beg end _type) - "Select a back-quoted expression." - :extend-selection t - (evil-select-quote ?\` beg end type count t)) - -(evil-define-text-object evil-inner-back-quote (count &optional beg end _type) - "Select inner back-quoted expression." - :extend-selection nil - (evil-select-quote ?\` beg end type count)) - -(evil-define-text-object evil-a-tag (count &optional beg end _type) - "Select a tag block." - :extend-selection nil - (evil-select-xml-tag beg end type count t)) - -(evil-define-text-object evil-inner-tag (count &optional beg end _type) - "Select inner tag block." - :extend-selection nil - (evil-select-xml-tag beg end type count)) - -(defun evil-match (direction count) - "Find COUNTth next match in DIRECTION." - (defvar evil-search-module) - (unless (eq evil-search-module 'evil-search) - (user-error "Match text objects only work with Evil search module")) - (let ((pnt (point)) - (count (abs count)) ; Undo effect of evil-visual-direction - (evil-ex-search-direction 'backward) - (visual-state (evil-visual-state-p)) - on-start-match in-match on-end-match) - (save-excursion - (unless (eobp) (forward-char)) ; If on start of a match, stay there - (evil-ex-search 1) - (setq on-start-match (= evil-ex-search-match-beg pnt) - in-match (<= evil-ex-search-match-beg pnt (1- evil-ex-search-match-end)) - on-end-match (= (1- evil-ex-search-match-end) pnt) - evil-ex-search-direction direction) - (cond - ((and visual-state on-start-match (eq 'backward direction)) - (evil-ex-search count)) - ((and visual-state on-end-match (eq 'forward direction)) - (evil-ex-search count)) - ((or in-match (eq 'backward direction)) - (evil-ex-search (1- count))) - (t (evil-ex-search count))) - (setq pnt (point))) - (goto-char pnt) - (cond - ((evil-normal-state-p) - (evil-visual-select evil-ex-search-match-beg - evil-ex-search-match-end - 'inclusive - (pcase direction ('forward +1) ('backward -1)) - t) - (list evil-ex-search-match-beg evil-ex-search-match-end)) - ((and visual-state (eq 'forward direction)) - (goto-char (1- evil-ex-search-match-end))) - ((and visual-state (eq 'backward direction)) - (goto-char evil-ex-search-match-beg)) - ;; e.g. operator pending... - (t (list evil-ex-search-match-beg evil-ex-search-match-end))))) - -(evil-define-text-object evil-next-match (count &optional _beg _end _type) - "Select next match." - :extend-selection t - (evil-match 'forward count)) - -(evil-define-text-object evil-previous-match (count &optional _beg _end _type) - "Select previous match." - :extend-selection t - (evil-match 'backward count)) - -;;; Operator commands - -(evil-define-operator evil-yank (beg end type register yank-handler) - "Save the characters in motion into the kill-ring." - :move-point nil - :repeat nil - (interactive "") - (let ((evil-was-yanked-without-register - (and evil-was-yanked-without-register (not register)))) - (cond - ((and (fboundp 'cua--global-mark-active) - (fboundp 'cua-copy-region-to-global-mark) - (cua--global-mark-active)) - (cua-copy-region-to-global-mark beg end)) - ((eq type 'block) - (evil-yank-rectangle beg end register yank-handler)) - ((memq type '(line screen-line)) - (evil-yank-lines beg end register yank-handler)) - (t - (evil-yank-characters beg end register yank-handler) - (goto-char beg))))) - -(defun evil-expand-line-for-line-based-operators (beg end type) - "Expand to line when in visual mode possibly changing BEG, END and TYPE. -Avoids double expansion for line-based commands like \"V\" or \"D\"." - (when (evil-visual-state-p) - (unless (memq type '(line block screen-line)) - ;; Subtract 1 from end to avoid expanding to the next line - ;; when \n is part of the visually selected region. - ;; If removed (evil-expand beg end 'line) - ;; will expand to the end of the next line instead of the current - ;; line which will cause line expanding commands like 'Y' to - ;; misbehave when used in visual state. - (when (eq ?\n (char-before end)) - (cl-decf end)) - (let ((range (evil-expand beg end (if (and evil-respect-visual-line-mode - visual-line-mode) - 'screen-line - 'line)))) - (setq beg (evil-range-beginning range) - end (evil-range-end range) - type (evil-type range)))) - (evil-exit-visual-state)) - (list beg end type)) - -(evil-define-operator evil-yank-line (beg end type register) - "Save whole lines into the kill-ring." - :motion evil-line-or-visual-line - :move-point nil - (interactive "") - (cl-destructuring-bind - (beg end type) (evil-expand-line-for-line-based-operators beg end type) - (evil-yank beg end type register))) - -(evil-define-operator evil-delete (beg end type register yank-handler) - "Delete text from BEG to END with TYPE. -Save in REGISTER or in the kill-ring with YANK-HANDLER." - (interactive "") - (when (and (memq type '(inclusive exclusive)) - (not (evil-visual-state-p)) - (eq 'evil-delete evil-this-operator) - (save-excursion (goto-char beg) (bolp)) - (save-excursion (goto-char end) (eolp)) - (<= 1 (evil-count-lines beg end))) - ;; Imitate Vi strangeness: if motion meets above criteria, - ;; delete linewise. Not for change operator or visual state. - (let ((new-range (evil-line-expand beg end))) - (setq beg (car new-range) - end (cadr new-range) - type 'line))) - (unless register - (let ((text (filter-buffer-substring beg end))) - (unless (string-match-p "\n" text) - ;; set the small delete register - (evil-set-register ?- text)))) - (let ((evil-was-yanked-without-register nil)) - (evil-yank beg end type register yank-handler)) - (cond - ((eq type 'block) - (evil-apply-on-block #'delete-region beg end nil)) - ((and (eq type 'line) - (= end (point-max)) - (or (= beg end) - (/= (char-before end) ?\n)) - (/= beg (point-min)) - (= (char-before beg) ?\n)) - (delete-region (1- beg) end)) - (t (delete-region beg end))) - (when (and (eq type 'line) - (called-interactively-p 'any)) - (evil-first-non-blank) - (when (and (not evil-start-of-line) - evil-operator-start-col - ;; Special exceptions to ever saving column: - (not (memq evil-this-motion '(evil-forward-word-begin - evil-forward-WORD-begin)))) - (move-to-column (if (and (eq most-positive-fixnum temporary-goal-column) - (memq last-command '(next-line previous-line))) - temporary-goal-column - evil-operator-start-col))))) - -(evil-define-operator evil-delete-line (beg end type register yank-handler) - "Delete to end of line." - :motion evil-end-of-line-or-visual-line - (interactive "") - (cl-destructuring-bind - (beg end type) (evil-expand-line-for-line-based-operators beg end type) - (if (eq type 'block) - ;; Equivalent to $d, i.e., we use the block-to-eol selection and - ;; call `evil-delete'. In this case we fake the call to - ;; `evil-end-of-line' by setting `temporary-goal-column' and - ;; `last-command' appropriately as `evil-end-of-line' would do. - (let ((temporary-goal-column most-positive-fixnum) - (last-command 'next-line)) - (evil-delete beg end 'block register yank-handler)) - (evil-delete beg end type register yank-handler) - (when (eq 'line type) - (evil-first-non-blank) - (when (and (not evil-start-of-line) evil-operator-start-col) - (move-to-column (if (and (eq most-positive-fixnum temporary-goal-column) - (memq last-command '(next-line previous-line))) - temporary-goal-column - evil-operator-start-col))))))) - -(evil-define-operator evil-delete-whole-line - (beg end type register yank-handler) - "Delete whole line." - :motion evil-line-or-visual-line - (interactive "") - (evil-delete beg end type register yank-handler)) - -(evil-define-operator evil-delete-char (beg end type register) - "Delete next character." - :motion evil-forward-char - (interactive "") - (evil-delete beg end type register)) - -(evil-define-operator evil-delete-backward-char (beg end type register) - "Delete previous character." - :motion evil-backward-char - (interactive "") - (evil-delete beg end type register)) - -(evil-define-command evil-delete-backward-char-and-join (_count) - "Delete previous character and join lines. -If point is at the beginning of a line then the current line will -be joined with the previous line if and only if -`evil-backspace-join-lines'." - (interactive "p") - (if (or evil-backspace-join-lines (not (bolp))) - (call-interactively #'delete-backward-char) - (signal 'beginning-of-line nil))) - -(evil-define-command evil-delete-backward-word () - "Delete previous word." - (let ((beg (save-excursion (evil-backward-word-begin) (point))) - (end (point))) - (cond - ((evil-replace-state-p) (while (< beg (point)) - (evil-replace-backspace))) - ((or (not (bolp)) (bobp)) (delete-region (max beg (line-beginning-position)) - end)) - (evil-backspace-join-lines (delete-char -1)) - (t (signal 'beginning-of-line nil))))) - -(evil-define-command evil-delete-back-to-indentation () - "Delete back to the first non-whitespace character. -If point is before the first non-whitespace character of a -current line then delete from the point to the beginning of the -current line. If point is on the beginning of the line, behave -according to `evil-backspace-join-lines'." - (let ((beg (if (<= (current-column) (current-indentation)) - (line-beginning-position) - (save-excursion (evil-first-non-blank) (point))))) - (cond - ((and (bolp) (evil-replace-state-p)) (evil-replace-backspace)) - ((bolp) (evil-delete-backward-char-and-join 1)) - ((evil-replace-state-p) - (while (< beg (point)) (evil-replace-backspace))) - (t (delete-region beg (point)))))) - -(defun evil-ex-delete-or-yank (should-delete beg end type register count yank-handler) - "Execute evil-delete or evil-yank on the given region. -If SHOULD-DELETE is t, evil-delete will be executed, otherwise -evil-yank. -The region specified by BEG and END will be adjusted if COUNT is -given." - (when count - ;; with COUNT, the command should go the end of the region and delete/yank - ;; COUNT lines from there - (setq beg (save-excursion (goto-char end) - (line-beginning-position 0)) - end (save-excursion (goto-char end) - (line-beginning-position count)) - type 'line)) - (funcall (if should-delete #'evil-delete #'evil-yank) - beg end type register yank-handler)) - -(evil-define-operator evil-ex-delete (beg end type register count yank-handler) - "The Ex delete command. -\[BEG,END]delete [REGISTER] [COUNT]" - (interactive "") - (evil-ex-delete-or-yank t beg end type register count yank-handler)) - -(evil-define-operator evil-ex-yank (beg end type register count yank-handler) - "The Ex yank command. -\[BEG,END]yank [REGISTER] [COUNT]" - :restore-point t - (interactive "") - (evil-ex-delete-or-yank nil beg end type register count yank-handler)) - -(evil-define-command evil-ex-put (_beg end ex-arg &optional force) - (interactive "") - (let* ((arg-chars (remove ?\s (string-to-list ex-arg))) - (reg (or (car arg-chars) ?\")) - (text (cond - ((and (< 1 (length arg-chars)) - (/= ?= reg)) - (user-error "Trailing characters")) - ((eq ?= reg) - (evil--eval-expr (if (= 1 (length arg-chars)) - evil-last-=-register-input - (setq evil-last-=-register-input (substring ex-arg 1))))) - (t (evil-get-register reg))))) - (unless text (user-error "Nothing in register %c" reg)) - (evil-remove-yank-excluded-properties text) - (goto-char (if (= (point-max) end) end (1- end))) - (if force (evil-insert-newline-above) (evil-insert-newline-below)) - (evil-set-marker ?\[ (point)) - ;; `insert' rather than `insert-for-yank' as we want to ignore yank-handlers... - (insert (if (and (< 0 (length text)) - (eq ?\n (aref text (1- (length text))))) - (substring text 0 (1- (length text))) - text)) - (evil-set-marker ?\] (1- (point))) - (back-to-indentation) - (evil-normal-state))) - -(evil-define-operator evil-change - (beg end type register yank-handler delete-func) - "Change text from BEG to END with TYPE. -Save in REGISTER or the kill-ring with YANK-HANDLER. -DELETE-FUNC is a function for deleting text, default `evil-delete'. -If TYPE is `line', insertion starts on an empty line. -If TYPE is `block', the inserted text in inserted at each line -of the block." - (interactive "") - (let ((delete-func (or delete-func #'evil-delete)) - (nlines (1+ (evil-count-lines beg end))) - opoint leftmost-point) - (save-excursion - (goto-char beg) - (setq opoint (line-beginning-position)) - (setq leftmost-point - (let ((inhibit-field-text-motion t)) (line-beginning-position)))) - (unless (eq evil-want-fine-undo t) - (evil-start-undo-step)) - (funcall delete-func beg end type register yank-handler) - (cond - ((eq type 'line) - (setq this-command 'evil-change-whole-line) ; for evil-maybe-remove-spaces - (cond - ((/= opoint leftmost-point) (evil-insert 1)) ; deletion didn't delete line - ((= opoint (point)) (evil-open-above 1)) - (t (evil-open-below 1)))) - ((eq type 'block) - (evil-insert 1 nlines)) - (t (evil-insert 1))) - (setq evil-this-register nil))) - -(evil-define-operator evil-change-line (beg end type register yank-handler) - "Change to end of line, or change whole line if characterwise visual mode." - :motion evil-end-of-line-or-visual-line - (interactive "") - (if (and (evil-visual-state-p) (eq type 'inclusive)) - (cl-destructuring-bind - (beg end _type) (evil-expand-line-for-line-based-operators beg end type) - (evil-change-whole-line beg end register yank-handler)) - (evil-change beg end type register yank-handler #'evil-delete-line))) - -(evil-define-operator evil-change-whole-line - (beg end register yank-handler) - "Change whole line." - :motion evil-line-or-visual-line - :type line - (interactive "") - (evil-change beg end 'line register yank-handler)) - -(evil-define-command evil-copy (beg end address) - "Copy lines in BEG END below line given by ADDRESS." - :motion evil-line-or-visual-line - (interactive "") - (goto-char (point-min)) - (forward-line address) - (let* ((txt (buffer-substring-no-properties beg end)) - (len (length txt))) - ;; ensure text consists of complete lines - (when (or (zerop len) (/= (aref txt (1- len)) ?\n)) - (setq txt (concat txt "\n"))) - (when (and (eobp) (not (bolp))) (newline)) ; incomplete last line - (insert txt) - (forward-line -1))) - -(evil-define-command evil-move (beg end address) - "Move lines in BEG .. END below the line given by ADDRESS." - :motion evil-line-or-visual-line - (interactive "") - (unless (= (1+ address) (line-number-at-pos beg)) - (goto-char (point-min)) - (forward-line address) - (let* ((m (set-marker (make-marker) (point))) - (txt (buffer-substring-no-properties beg end)) - (len (length txt)) - (last-line-blank (progn (goto-char (point-max)) (bolp)))) - (delete-region beg end) - (unless last-line-blank ; as vim, preserve lack of blank last line - (progn (goto-char (point-max)) (when (bolp) (delete-char -1)))) - (goto-char m) - (set-marker m nil) - ;; ensure text consists of complete lines - (when (or (zerop len) (/= (aref txt (1- len)) ?\n)) - (setq txt (concat txt "\n"))) - (when (and (eobp) (not (bolp))) (newline)) ; incomplete last line - (when (evil-visual-state-p) - (move-marker evil-visual-mark (point))) - (insert txt) - (forward-line -1) - (when (evil-visual-state-p) - (move-marker evil-visual-point (point)))))) - -(defun evil--check-undo-system () - (when (and (eq evil-undo-system 'undo-tree) - (not (bound-and-true-p undo-tree-mode))) - (user-error "Enable `global-undo-tree-mode' to use undo-tree commands. -Add (add-hook 'evil-local-mode-hook 'turn-on-undo-tree-mode) to your init file for undo in non-file buffers."))) - -(evil-define-command evil-undo (count) - "Undo COUNT changes in buffer using `evil-undo-function'." - :repeat abort - :jump t - (interactive "*p") - (evil--check-undo-system) - (let ((state-before evil-state)) - (unless (memq state-before '(normal visual)) (evil-normal-state)) - (funcall evil-undo-function count) - (unless (memq state-before '(normal visual)) (evil-change-state state-before)))) - -(evil-define-command evil-redo (count) - "Undo COUNT changes in buffer using `evil-redo-function'." - :repeat abort - (interactive "*p") - (evil--check-undo-system) - (funcall evil-redo-function count)) - -(evil-define-operator evil-substitute (beg end type register) - "Change a character." - :motion evil-forward-char - (interactive "") - (evil-change beg end type register)) - -(evil-define-operator evil-upcase (beg end type) - "Convert text to upper case." - (if (eq type 'block) - (evil-apply-on-block #'evil-upcase beg end nil) - (upcase-region beg end))) - -(evil-define-operator evil-downcase (beg end type) - "Convert text to lower case." - (if (eq type 'block) - (evil-apply-on-block #'evil-downcase beg end nil) - (downcase-region beg end))) - -(evil-define-operator evil-invert-case (beg end type) - "Invert case of text." - (if (eq type 'block) - (evil-apply-on-block #'evil-invert-case beg end nil) - (save-excursion - (goto-char beg) - (while (< beg end) - (let ((char (following-char))) - (delete-char 1) - (insert-char - (if (eq (upcase char) char) (downcase char) (upcase char)))) - (setq beg (1+ beg)))))) - -(evil-define-operator evil-invert-char (beg end type) - "Invert case of character." - :motion evil-forward-char - (if (eq type 'block) - (evil-apply-on-block #'evil-invert-case beg end nil) - (evil-invert-case beg end) - (when evil-this-motion - (goto-char end) - (when (and evil-cross-lines - (not evil-move-beyond-eol) - (not (evil-visual-state-p)) - (not (evil-operator-state-p)) - (eolp) (not (eobp)) (not (bolp))) - (forward-char))))) - -(evil-define-operator evil-rot13 (beg end type) - "ROT13 encrypt text." - (if (eq type 'block) - (evil-apply-on-block #'rot13-region beg end nil) - (rot13-region beg end))) - -(evil-define-operator evil-join (beg end) - "Join the selected lines." - :motion evil-line - (let ((count (count-lines beg end)) - last-line-blank) - (when (> count 1) - (setq count (1- count))) - (goto-char beg) - (dotimes (i count) - (when (= (1+ i) count) ; i.e. we're just before the last join - (evil-move-beginning-of-line) - (setq last-line-blank (looking-at "[ \t]*$"))) - (join-line 1)) - (and last-line-blank (indent-according-to-mode)))) - -(evil-define-operator evil-join-whitespace (beg end) - "Join the selected lines without changing whitespace. -\\Like \\[evil-join], \ -but doesn't insert or remove any spaces." - :motion evil-line - (let ((count (count-lines beg end))) - (when (> count 1) - (setq count (1- count))) - (goto-char beg) - (dotimes (_ count) - (evil-move-end-of-line 1) - (unless (eobp) - (delete-char 1))))) - -(evil-define-operator evil-ex-join (beg end &optional count bang) - "Join the selected lines with optional COUNT and BANG." - (interactive "") - (let ((join-fn (if bang 'evil-join-whitespace 'evil-join))) - (if (not count) - ;; without count - just join the given region - (funcall join-fn beg end) - (unless (string-match-p "^[1-9][0-9]*$" count) - (user-error "Invalid count")) - ;; emulate Vim's :join when count is given - start from the - ;; end of the region and join COUNT lines from there - (save-excursion - (goto-char end) - (let ((beg-adjusted (line-beginning-position 0)) - (end-adjusted (line-beginning-position (string-to-number count)))) - (funcall join-fn beg-adjusted end-adjusted)))))) - -(defun evil--ex-string-for-print (beg end linump borderline) - "Return a string to be printed by :print etc. -Starts at line of BEG and end at line of END. -Include line number at the start of each line if LINUMP is non-nil. -Surround line denoted by BORDERLINE with dashes if non-nil." - (let ((result-string "") - (continue t) - (line-move-visual nil)) - (save-excursion - (goto-char beg) - (while continue - (let* ((line-num (line-number-at-pos)) - (border (and (natnump borderline) (= borderline line-num))) - (raw-line (thing-at-point 'line)) - (line (if (string= "\n" (substring raw-line -1)) - raw-line (concat raw-line "\n"))) - (border-length (1- (min (length line) (frame-width))))) - (when border - (setq result-string - (concat result-string (make-string border-length ?-) "\n"))) - (when linump - (setq result-string - (concat result-string - (propertize (number-to-string (line-number-at-pos)) - 'face 'line-number-current-line) - " "))) - (unless (eobp) - (setq result-string (concat result-string line))) - (when border - (setq result-string - (concat result-string (make-string border-length ?-) "\n"))) - (when (or (= (point) (progn (evil-line-move 1 t) (point))) - (> (line-end-position) end)) - (setq continue nil))))) - (string-trim-right result-string "\n"))) - -(defun evil--ex-print-to-minibuffer (string) - "Print STRING to the minibuffer for better persistence." - (let ((keymap (make-keymap)) - minibuffer-local-map) - (set-char-table-range (nth 1 keymap) t 'abort-recursive-edit) - (setq minibuffer-local-map keymap) - (read-from-minibuffer "" (propertize string 'read-only t)))) - -(defun evil--ex-print (beg end count &optional linump borderline) - "Print lines in range to the minibuffer. -Starting at BEG and ending at END + COUNT lines. -Include line number at the start of each line if LINUMP is non-nil. -Surround line denoted by BORDERLINE with dashes if non-nil." - (let* ((count (cond ((stringp count) (string-to-number count)) - ((natnump count) count) - (t 1))) - (end (save-excursion (goto-char (if (= (point-max) end) end (1- end))) - (line-end-position count))) - (substring (evil--ex-string-for-print beg end linump borderline))) - (cond ((> 1 count) (user-error "Positive count required")) - (evil--ex-global-active-p - (setq evil--ex-print-accumulator - (if (string= "" evil--ex-print-accumulator) - (concat evil--ex-print-accumulator substring) - (concat evil--ex-print-accumulator "\n" substring)))) - (t (evil--ex-print-to-minibuffer substring) - (when (string-match-p "\n" substring) - (goto-char end) - (evil-beginning-of-line)))))) - -(defun evil--global-print+clear () - "Print accumulated print output from :global print, and clear." - (let ((s evil--ex-print-accumulator)) - (unless (string= s "") - (setq evil--ex-print-accumulator "") - (evil--ex-print-to-minibuffer s)))) -(add-hook 'evil-after-global-hook #'evil--global-print+clear) - -(evil-define-command evil-ex-print (beg end &optional count) - (interactive "") - (evil--ex-print beg end count)) - -(evil-define-command evil-ex-numbered-print (beg end &optional count) - (interactive "") - (evil--ex-print beg end count t)) - -(evil-define-command evil-ex-z (_beg end &optional zmarks _bang) - "Display several lines of text surrounding the line specified by range. -BEG and END represent the range, ZMARKS represents the args in string form. -With a count supplied in the args, display that number of lines. Without a -count, display `evil-scroll-count' number of lines, or half the window height. -This table explains what each mark argument does. - -mark | first line | last line | new cursor line ------+-------------------------+----------------------------+---------------- -+ | current line | 1 scr (or 1 count) forward | last line -- | 1 scr (or 1 count) back | current line | last line -^ | 2 scr (or 2 count) back | 1 scr (or 1 count) back | last line -. | ½ scr (or ½ count) back | ½ scr (or ½ count) forward | last line -= | ½ scr (or ½ count) back | ½ scr (or ½ count) forward | current line - -Specifying no mark at all is the same as `+'. -If the mark is `=' a line of dashes is printed around the current line. -If a `#' is included before the mark args, the lines are numbered." - ;; TODO implement bang argument. - (interactive "") - (goto-char (setq end (1- end))) - (save-match-data - (string-match "\\(#?\\)\\([^0-9]*\\)\\([0-9]*\\)" (or zmarks "")) - (cl-destructuring-bind (_ _ hs he ms me cs ce) (match-data) - (let* ((linump (/= hs he)) - (mark-string (if (= ms me) "+" (substring zmarks ms me))) - (count-string (if (= cs ce) "" (substring zmarks cs ce))) - (count (evil--get-scroll-count (string-to-number count-string))) - (max-mini-window-height 0.5)) - (cond - ((< 1 (- me ms)) - (evil-beginning-of-line) - (user-error "Too many mark args (got %d, expected 1)" (- me ms))) - ((string= "+" mark-string) - (ignore-errors (beginning-of-line count)) - (evil--ex-print end end count linump)) - ((string= "-" mark-string) - (evil-beginning-of-line) - (evil--ex-print (line-beginning-position (- 2 count)) end 1 linump)) - ((string= "^" mark-string) - (let ((end* (progn (move-end-of-line (- 1 count)) (point))) - (beg* (line-beginning-position (- 2 count)))) - (evil-beginning-of-line) - (evil--ex-print beg* end* 1 linump))) - ((string= "." mark-string) - (let ((beg* (line-beginning-position (- 1 (floor count 2)))) - (end* (progn (move-end-of-line (ceiling count 2)) (point)))) - (evil-beginning-of-line) - (evil--ex-print beg* end* 1 linump))) - ((string= "=" mark-string) - (let ((beg* (line-beginning-position (- 1 (floor count 2)))) - (end* (line-end-position (ceiling count 2)))) - (evil-beginning-of-line) - (evil--ex-print beg* end* 1 linump (line-number-at-pos end)))) - (t (evil-beginning-of-line) - (user-error "Invalid mark arg: %s" mark-string))))))) - -(evil-define-operator evil-fill (beg end) - "Fill text." - :move-point nil - :type line - (save-excursion - (ignore-errors (fill-region beg end)))) - -(evil-define-operator evil-fill-and-move (beg end) - "Fill text and move point to the end of the filled region." - :move-point nil - :type line - (let ((marker (make-marker))) - (move-marker marker (1- end)) - (ignore-errors - (fill-region beg end) - (goto-char marker) - (evil-first-non-blank)))) - -(evil-define-operator evil-indent (beg end) - "Indent text." - :move-point nil - :type line - (evil-ensure-column - (setq this-command real-this-command) ; Reset change made by evil-ensure-column - (save-restriction - (narrow-to-region beg end) - (if (save-excursion (goto-char beg) (= end (line-beginning-position 2))) - ;; since some Emacs modes can only indent one line at a time, - ;; implement "==" as a call to `indent-according-to-mode' - (indent-according-to-mode) - (goto-char beg) - (indent-region beg end)) - ;; Tabify or untabify leading whitespace characters - (when evil-indent-convert-tabs - ;; Whether tab or space should be used is determined by indent-tabs-mode - (let ((convert-fun (if indent-tabs-mode #'tabify #'untabify))) - (save-excursion - (goto-char (point-min)) - (while (not (eolp)) - (funcall convert-fun (point) (progn (skip-chars-forward " \t") (point))) - (forward-line)))))))) - -(evil-define-operator evil-indent-line (beg end) - "Indent the line." - :motion evil-line - (evil-indent beg end)) - -(evil-define-operator evil-shift-left (beg end &optional count preserve-empty) - "Shift text from BEG to END to the left. -The text is shifted to the nearest multiple of `evil-shift-width' -\(the rounding can be disabled by setting `evil-shift-round'). -If PRESERVE-EMPTY is non-nil, lines that contain only spaces are -indented, too, otherwise they are ignored. Location of point -is preserved relative to text when called from insert state. -Otherwise, it is determined by `evil-start-of-line' and/or `evil-track-eol'. -See also `evil-shift-right'." - :type line - (interactive "") - (evil-shift-right beg end (- (or count 1)) preserve-empty)) - -(evil-define-operator evil-shift-right (beg end &optional count preserve-empty) - "Shift text from BEG to END to the right. -The text is shifted to the nearest multiple of `evil-shift-width' -\(the rounding can be disabled by setting `evil-shift-round'). -If PRESERVE-EMPTY is non-nil, lines that contain only spaces are -indented, too, otherwise they are ignored. Location of point -is preserved relative to text when called from insert or replace states. -Otherwise, it is determined by `evil-start-of-line' and/or `evil-track-eol'. -See also `evil-shift-left'." - :type line - :move-point nil ; point is moved according to `evil-start-of-line' and state - (interactive "") - (setq count (or count 1)) - (let ((beg (set-marker (make-marker) beg)) - (end (set-marker (make-marker) end)) - (col-for-insert (current-column)) - first-shift) ; shift of first line - (save-excursion - (goto-char beg) - (while (< (point) end) - (let* ((indent (current-indentation)) - (new-indent - (max 0 - (if (not evil-shift-round) - (+ indent (* count evil-shift-width)) - (* (+ (/ indent evil-shift-width) - count - (cond - ((> count 0) 0) - ((zerop (mod indent evil-shift-width)) 0) - (t 1))) - evil-shift-width))))) - (unless first-shift - (setq first-shift (- new-indent indent))) - (when (or preserve-empty - (save-excursion - (skip-chars-forward " \t") - (not (eolp)))) - (indent-to new-indent 0)) - (delete-region (point) (progn (skip-chars-forward " \t") (point))) - (forward-line 1)))) - ;; in case we're in an empty buffer first-shift is still unchanged - (unless first-shift - (if (< count 0) - (setq first-shift 0) - (setq first-shift (* count evil-shift-width)) - (indent-to first-shift))) - ;; When called from insert state (C-t or C-d) the cursor should shift with the line, - ;; otherwise (normal state) its position is determined by `evil-start-of-line'. - (cond - ((or (evil-insert-state-p) (evil-replace-state-p)) - (move-to-column (max 0 (+ col-for-insert first-shift)))) - (evil-start-of-line (evil-first-non-blank)) - ((evil--stick-to-eol-p) (move-end-of-line 1)) - (t (move-to-column (or goal-column evil-operator-start-col col-for-insert)))))) - -(defun evil-delete-indentation () - "Delete all indentation on current line." - (interactive) - (save-excursion - (move-beginning-of-line nil) - (delete-region (point) (progn (skip-chars-forward " \t") (point))))) - -(evil-define-command evil-shift-right-line (count) - "Shift the current line COUNT times to the right. -The text is shifted to the nearest multiple of -`evil-shift-width'. Like `evil-shift-right' but always works on -the current line." - (interactive "") - (evil-shift-right (line-beginning-position) (line-beginning-position 2) count t)) - -(evil-define-command evil-shift-left-line (count) - "Shift the current line COUNT times to the left. -The text is shifted to the nearest multiple of -`evil-shift-width'. Like `evil-shift-left' but always works on -the current line." - (interactive "") - (if (and (eq 'self-insert-command last-command) - (eq ?0 (char-before))) - (progn (delete-char -1) - (evil-delete-indentation)) - (evil-shift-left (line-beginning-position) (line-beginning-position 2) count t))) - -(evil-define-operator evil-align-left (beg end _type &optional width) - "Left-align lines in the region at WIDTH columns. -The default for width is the value of `fill-column'." - :motion evil-line - :type line - (interactive "") - (evil-justify-lines beg end 'left (if width - (string-to-number width) - 0))) - -(evil-define-operator evil-align-right (beg end _type &optional width) - "Right-align lines in the region at WIDTH columns. -The default for width is the value of `fill-column'." - :motion evil-line - :type line - (interactive "") - (evil-justify-lines beg end 'right (if width - (string-to-number width) - fill-column))) - -(evil-define-operator evil-align-center (beg end _type &optional width) - "Center lines in the region between WIDTH columns. -The default for width is the value of `fill-column'." - :motion evil-line - :type line - (interactive "") - (evil-justify-lines beg end 'center (if width - (string-to-number width) - fill-column))) - -(evil-define-operator evil-replace (beg end type char) - "Replace text from BEG to END with CHAR." - :motion evil-forward-char - (interactive "" - (unwind-protect - (let ((evil-force-cursor 'replace)) - (evil-refresh-cursor) - (list (evil-read-key))) - (evil-refresh-cursor))) - (when char - (if (eq type 'block) - (save-excursion - (evil-apply-on-rectangle - #'(lambda (begcol endcol char) - (let ((maxcol (evil-column (line-end-position)))) - (when (< begcol maxcol) - (setq endcol (min endcol maxcol)) - (let ((beg (evil-move-to-column begcol nil t)) - (end (evil-move-to-column endcol nil t))) - (delete-region beg end) - (insert (make-string (- endcol begcol) char)))))) - beg end char)) - (goto-char beg) - (cond - ((eq char ?\n) - (delete-region beg end) - (newline) - (when evil-auto-indent - (indent-according-to-mode))) - (t - (while (< (point) end) - (if (eq (char-after) ?\n) - (forward-char) - (delete-char 1) - (insert-char char 1))) - (goto-char (max beg (1- end)))))))) - -(evil-define-command evil-paste-before - (count &optional register yank-handler) - "Paste the latest yanked text before the cursor position. -The return value is the yanked text." - :suppress-operator t - (interactive "*P") - (setq count (prefix-numeric-value count)) - (if (evil-visual-state-p) - ;; This is the only difference with evil-paste-after in visual-state - (let ((evil-kill-on-visual-paste (not evil-kill-on-visual-paste))) - (evil-visual-paste count register)) - (evil-with-undo - (let* ((text (copy-sequence - (if register - (evil-get-register register) - (current-kill 0)))) - (yank-handler (or yank-handler - (when (stringp text) - (car-safe (get-text-property - 0 'yank-handler text))))) - (opoint (point))) - (when evil-paste-clear-minibuffer-first - (delete-minibuffer-contents) - (setq evil-paste-clear-minibuffer-first nil)) - (when text - (if (functionp yank-handler) - (let ((evil-paste-count count) - ;; for non-interactive use - (this-command #'evil-paste-before)) - (push-mark opoint t) - (insert-for-yank text)) - ;; no yank-handler, default - (when (vectorp text) - (setq text (evil-vector-to-string text))) - (set-text-properties 0 (length text) nil text) - (push-mark opoint t) - (dotimes (_ (or count 1)) - (insert-for-yank text)) - (setq evil-last-paste - (list #'evil-paste-before - count - opoint - opoint ; beg - (point))) ; end - (evil-set-marker ?\[ opoint) - (evil-set-marker ?\] (1- (point))) - (when (and evil-move-cursor-back - (> (length text) 0)) - (backward-char)))) - (when evil--cursor-after - (if (eq 'evil-yank-line-handler yank-handler) - (ignore-errors (evil-next-line-first-non-blank)) - (evil-forward-char 1 nil t)) - (setq evil--cursor-after nil)) - ;; no paste-pop after pasting from a register - (when register - (setq evil-last-paste nil)) - (and (> (length text) 0) text))))) - -(evil-define-command evil-paste-after - (count &optional register yank-handler) - "Paste the latest yanked text behind point. -The return value is the yanked text." - :suppress-operator t - (interactive "*P") - (setq count (prefix-numeric-value count)) - (if (evil-visual-state-p) - (evil-visual-paste count register) - (evil-with-undo - (let* ((text (copy-sequence - (if register - (evil-get-register register) - (current-kill 0)))) - (yank-handler (or yank-handler - (when (stringp text) - (car-safe (get-text-property - 0 'yank-handler text))))) - (opoint (point))) - (when text - (if (functionp yank-handler) - (let ((evil-paste-count count) - ;; for non-interactive use - (this-command #'evil-paste-after)) - (insert-for-yank text)) - ;; no yank-handler, default - (when (vectorp text) - (setq text (evil-vector-to-string text))) - (set-text-properties 0 (length text) nil text) - (unless (eolp) (forward-char)) - (push-mark (point) t) - ;; TODO: Perhaps it is better to collect a list of all - ;; (point . mark) pairs to undo the yanking for COUNT > 1. - ;; The reason is that this yanking could very well use - ;; `yank-handler'. - (let ((beg (point))) - (dotimes (_ (or count 1)) - (insert-for-yank text)) - (setq evil-last-paste - (list #'evil-paste-after - count - opoint - beg ; beg - (point))) ; end - (evil-set-marker ?\[ beg) - (evil-set-marker ?\] (1- (point))) - (when (evil-normal-state-p) - (evil-move-cursor-back))))) - (when evil--cursor-after - (if (eq 'evil-yank-line-handler yank-handler) - (ignore-errors (evil-next-line-first-non-blank 1)) - (evil-forward-char 1 nil t)) - (setq evil--cursor-after nil)) - (when register - (setq evil-last-paste nil)) - (and (> (length text) 0) text))))) - -(evil-define-command evil-paste-before-cursor-after - (count &optional register yank-handler) - "The same as `evil-paste-before' but -leave the cursor just after the new text." - :suppress-operator t - (interactive "*P") - (setq count (prefix-numeric-value count) - evil--cursor-after t) - (evil-paste-before count register yank-handler)) - -(evil-define-command evil-paste-after-cursor-after - (count &optional register yank-handler) - "The same as `evil-paste-after' but -leave the cursor just after the new text." - :suppress-operator t - (interactive "*P") - (setq count (prefix-numeric-value count) - evil--cursor-after t) - (evil-paste-after count register yank-handler)) - -(defun evil-insert-for-yank-at-col (startcol _endcol string count) - "Insert STRING at STARTCOL." - (move-to-column startcol) - (dotimes (_ (or count 1)) - (insert-for-yank string)) - (evil-set-marker ?\] (1- (point)))) - -(evil-define-command evil-visual-paste (count &optional register) - "Paste over Visual selection." - :suppress-operator t - (interactive "*P") - (setq count (prefix-numeric-value count)) - ;; evil-visual-paste is typically called from evil-paste-before or - ;; evil-paste-after, but we have to mark that the paste was from - ;; visual state - (setq this-command 'evil-visual-paste) - (let* ((text (if register - (evil-get-register register) - (current-kill 0))) - (yank-handler (car-safe (get-text-property - 0 'yank-handler text))) - (dir (evil-visual-direction)) - beg end type) - (evil-with-undo - (let ((kill-ring-yank-pointer (when kill-ring (list (current-kill 0))))) - (when (evil-visual-state-p) - (setq beg evil-visual-beginning - end evil-visual-end - type (evil-visual-type)) - ;; When pasting charwise text into linewise selection, keep trailing NL - (when (and text end - (eq 'line type) - (not (eq ?\n (aref text (1- (length text)))))) - (cl-decf end)) - (evil-visual-rotate 'upper-left) - (evil-delete beg end type (unless evil-kill-on-visual-paste ?_)) - (when (and (eq yank-handler #'evil-yank-line-handler) - (not (memq type '(line block))) - (/= end (point-max))) - (insert "\n")) - (evil-normal-state) - (when kill-ring (current-kill 1))) - ;; Effectively memoize `evil-get-register' because it can be - ;; side-effecting (e.g. for the "=" register)... - (cl-letf (((symbol-function #'evil-get-register) - (lambda (&rest _) text))) - (cond - ;; When replacing the last buffer line and it does not end - ;; in a newline, use `evil-paste-after' because - ;; `evil-delete' will have moved point to the line above. - ((cond ((eq type 'line) (= end (point-max))) - ((eq type 'block) (eq yank-handler #'evil-yank-line-handler))) - (goto-char end) - (evil-paste-after count register)) - ((and (eq type 'block) - (not (eq yank-handler #'evil-yank-block-handler)) - (not (string-match-p "\n" text))) - (evil-apply-on-block #'evil-insert-for-yank-at-col beg end t text count)) - (t (evil-paste-before count register))))) - (when evil-kill-on-visual-paste - (current-kill -1)) - ;; Ensure that gv can restore visually pasted area... - (set-marker evil-visual-point (evil-get-marker (if (< dir 0) ?\[ ?\]) t)) - (set-marker evil-visual-mark (evil-get-marker (if (< dir 0) ?\] ?\[) t)) - ;; mark the last paste as visual-paste - (setq evil-last-paste - (list (nth 0 evil-last-paste) - (nth 1 evil-last-paste) - (nth 2 evil-last-paste) - (nth 3 evil-last-paste) - (nth 4 evil-last-paste) - t))))) - -(defun evil-paste-from-register (register) - "Paste from REGISTER." - (interactive - (let ((ov (make-overlay (point) (+ (point) (if (evil-replace-state-p) 1 0))))) - (unwind-protect - (progn - (overlay-put ov 'invisible t) - (overlay-put ov 'after-string - #("\"" 0 1 (face minibuffer-prompt cursor 1))) - (list (or evil-this-register (read-char)))) - (delete-overlay ov)))) - (let ((opoint (point)) - evil-move-cursor-back) - (evil-paste-before nil register t) - (when (evil-replace-state-p) - (let* ((reg-length (- (point) opoint)) - (chars-to-delete (min (- (line-end-position) (point)) reg-length))) - ;; TODO: handle multi-line paste backspacing - (evil-update-replace-alist (point) reg-length chars-to-delete chars-to-delete) - (delete-char chars-to-delete))))) - -(defun evil-paste-last-insertion () - "Paste last insertion." - (interactive) - (evil-paste-from-register ?.)) - -(defun evil-paste-last-insertion-and-stop-insert () - "Paste last insertion and change to normal state." - (interactive) - (evil-paste-last-insertion) - (evil-normal-state)) - -(evil-define-command evil-use-register (register) - "Use REGISTER for the next command." - :keep-visual t - :repeat ignore - :suppress-operator t - (interactive "") - (setq evil-this-register register)) - -(defvar evil-macro-buffer nil - "The buffer that has been active on macro recording.") - -(defvar evil-execute-normal-keys nil - "The keys used to invoke the current `evil-execute-in-normal-state'. -Can be used to detect if we are currently in that quasi-state. -With current bindings, it will be \\\\[evil-execute-in-normal-state]") - -(defun evil-end-and-return-macro () - "Like `kmacro-end-macro' but also return the macro. -Remove \\\\[evil-execute-in-normal-state] from the end." - ;; `end-kbd-macro' rather than `kmacro-end-macro' to allow clearing registers - (end-kbd-macro nil #'kmacro-loop-setup-function) - (let ((end-keys-seq (append evil-execute-normal-keys nil)) - (last-kbd-macro-seq (append last-kbd-macro nil))) - (unless last-kbd-macro-seq - (setq last-kbd-macro nil)) - (if (and end-keys-seq last-kbd-macro-seq) - (apply #'vector (butlast last-kbd-macro-seq (length end-keys-seq))) - last-kbd-macro))) - -(evil-define-command evil-record-macro (register) - "Record a keyboard macro into REGISTER. -If REGISTER is :, /, or ?, the corresponding command line window -will be opened instead." - :keep-visual t - :suppress-operator t - (interactive - (list (unless (and evil-this-macro defining-kbd-macro) - (or evil-this-register (evil-read-key))))) - (let (last-macro) - (cond - ((eq register ?\C-g) - (keyboard-quit)) - ((and evil-this-macro defining-kbd-macro) - (setq evil-macro-buffer nil - last-macro (ignore-errors (evil-end-and-return-macro))) - (when last-macro - (evil-set-register evil-this-macro last-macro)) - (setq evil-this-macro nil)) - ((eq register ?:) - (evil-command-window-ex)) - ((eq register ?/) - (evil-command-window-search-forward)) - ((eq register ??) - (evil-command-window-search-backward)) - ((or (<= ?0 register ?9) - (<= ?a register ?z) - (<= ?A register ?Z)) - (when defining-kbd-macro (end-kbd-macro)) - (setq evil-this-macro register - evil-last-recorded-register register) - (evil-set-register evil-this-macro nil) - (kmacro-start-macro nil) - (setq evil-macro-buffer (current-buffer))) - (t (error "Invalid register `%s'" register))))) - -(defun evil-repeat-execute-macro (flag) - "Called to record a macro execution. -FLAG is either `pre' or `post' if the function is called before resp. -after executing the command." - (pcase flag - ('pre (evil-repeat-record (this-command-keys))) - ('post (evil-repeat-record (string evil-last-register))))) - -(evil-define-command evil-execute-macro (count macro) - "Execute keyboard macro MACRO, COUNT times. -When called with a non-numerical prefix \ -\(such as \\[universal-argument]), -COUNT is infinite. MACRO is read from a register -when called interactively." - :keep-visual t - :suppress-operator t - :repeat evil-repeat-execute-macro - (interactive - (let (count macro register) - (setq count (cond ((null current-prefix-arg) 1) - ((numberp current-prefix-arg) current-prefix-arg) - (t 0)) - register (or evil-this-register (read-char))) - (cond - ((or (eq register ?:) - (and (eq register ?@) (eq evil-last-register ?:))) - (setq macro #'evil-ex-repeat - evil-last-register ?:)) - ((eq register ?@) - (unless evil-last-register - (user-error "No previously executed keyboard macro.")) - (setq macro (evil-get-register evil-last-register t))) - (t - (setq macro (evil-get-register register t) - evil-last-register register))) - (list count macro))) - (cond - ((functionp macro) - (evil-repeat-abort) - (if (zerop count) - (while t (funcall macro)) - (dotimes (_ (or count 1)) (funcall macro)))) - ((or (and (not (stringp macro)) - (not (vectorp macro))) - (member macro '("" []))) - ;; allow references to currently empty registers - ;; when defining macro - (unless evil-this-macro (user-error "No previous macro"))) - (t - (condition-case err - (evil-with-single-undo - (let (pre-command-hook post-command-hook) ; For performance - (combine-after-change-calls - (execute-kbd-macro macro count) - (setq this-command 'evil-execute-macro)))) ; For repeatability - ;; enter Normal state if the macro fails - (error - (evil-normal-state) - (signal (car err) (cdr err))))))) - -(evil-define-command evil-execute-last-recorded-macro (count) - "Execute last recorded keyboard macro COUNT times. -When called with a non-numerical prefix \ -\(such as \\[universal-argument]), -COUNT is infinite." - :keep-visual t - :suppress-operator t - (interactive - (list (cond - ((and current-prefix-arg (numberp current-prefix-arg)) current-prefix-arg) - (current-prefix-arg 0) - (t 1)))) - (if evil-last-recorded-register - (evil-execute-macro count (evil-get-register evil-last-recorded-register t)) - (user-error "No previous macro")) - (setq evil-last-register evil-last-recorded-register)) - -;;; Visual commands - -(evil-define-motion evil-visual-restore () - "Restore previous selection." - (cond - ;; Called from visual state - ((and (evil-visual-state-p) - evil-prev-visual-mark evil-prev-visual-point evil-prev-visual-selection) - (let ((tmp-visual-mark (marker-position evil-visual-mark)) - (tmp-visual-point (marker-position evil-visual-point)) - (tmp-visual-selection evil-visual-selection)) - (evil-visual-make-selection evil-prev-visual-mark - evil-prev-visual-point - evil-prev-visual-selection - t) - (move-marker evil-prev-visual-mark tmp-visual-mark) - (move-marker evil-prev-visual-point tmp-visual-point) - (setq evil-prev-visual-selection tmp-visual-selection))) - ;; Called from other state - ((and evil-visual-selection evil-visual-mark evil-visual-point) - (evil-visual-make-selection evil-visual-mark - evil-visual-point - (evil-visual-type) - t)))) - -(evil-define-motion evil-visual-exchange-corners () - "Rearrange corners in Visual Block mode. - - M---+ +---M - | | <=> | | - +---P P---+ - -For example, if mark is in the upper left corner and point -in the lower right, this function puts mark in the upper right -corner and point in the lower left." - (cond - ((eq evil-visual-selection 'block) - (let* ((point (point)) - (mark (or (mark t) point)) - (point-col (evil-column point)) - (mark-col (evil-column mark)) - (mark (save-excursion - (goto-char mark) - (evil-move-to-column point-col) - (point))) - (point (save-excursion - (goto-char point) - (evil-move-to-column mark-col) - (point)))) - (evil-visual-refresh mark point))) - (t - (evil-exchange-point-and-mark) - (evil-visual-refresh)))) - -(evil-define-command evil-visual-rotate (corner &optional beg end type) - "Move point to CORNER of the Visual selection. -Corner may be one of `upper-left', `upper-right', `lower-left' and -`lower-right': - - upper-left +---+ upper-right - | | - lower-left +---+ lower-right - -When called interactively, the selection is rotated clockwise." - :keep-visual t - (interactive - (let ((corners '(#1=upper-left upper-right lower-right lower-left #1#))) - (list (cadr (memq (evil-visual-block-corner) corners))))) - (let* ((beg (or beg (point))) - (end (or end (mark t) beg)) - (type (or type evil-this-type)) - range) - (cond - ((memq type '(rectangle block)) - (setq range (evil-block-rotate beg end :corner corner) - beg (pop range) - end (pop range)) - (unless (eq corner (evil-visual-block-corner corner beg end)) - (evil-swap beg end)) - (goto-char beg) - (when (evil-visual-state-p) - (evil-move-mark end) - (evil-visual-refresh nil nil nil :corner corner))) - ((memq corner '(upper-right lower-right)) - (goto-char (max beg end)) - (when (evil-visual-state-p) - (evil-move-mark (min beg end)))) - (t - (goto-char (min beg end)) - (when (evil-visual-state-p) - (evil-move-mark (max beg end))))))) - -;;; Insertion commands - -(defun evil-insert (count &optional vcount skip-empty-lines) - "Switch to Insert state just before point. -The insertion will be repeated COUNT times on the next VCOUNT lines, -starting at the same column. -If SKIP-EMPTY-LINES is non-nil, the insertion will not be performed -on lines on which the insertion point would be after the end of the -lines. This is the default behaviour for Visual-state insertion." - (interactive - (if (not (evil-visual-state-p)) - (list (prefix-numeric-value current-prefix-arg)) - (evil-visual-rotate 'upper-left) - (list (prefix-numeric-value current-prefix-arg) - (when (memq (evil-visual-type) '(line block)) - (1+ (evil-count-lines evil-visual-point evil-visual-mark))) - t))) - (and evil-want-fine-undo vcount (evil-start-undo-step)) - (if (and (evil-visual-state-p) (eq (evil-visual-type) 'line)) - (evil-insert-line count vcount) - (setq evil-insert-count count - evil-insert-lines nil - evil-insert-vcount (and vcount - (> vcount 1) - (list (line-number-at-pos) - (current-column) - vcount)) - evil-insert-skip-empty-lines skip-empty-lines) - (evil-insert-state 1))) - -(defun evil-append (count &optional vcount skip-empty-lines) - "Switch to Insert state just after point. -The insertion will be repeated COUNT times and repeated once for -the next VCOUNT - 1 lines starting at the same column. If -SKIP-EMPTY-LINES is non-nil, the insertion will not be performed -on lines on which the insertion point would be after the end of -the lines." - (interactive - (list (prefix-numeric-value current-prefix-arg) - (and (evil-visual-state-p) - (memq (evil-visual-type) '(line block)) - (1+ (evil-count-lines evil-visual-point evil-visual-mark))))) - (if (and (called-interactively-p 'any) - (evil-visual-state-p)) - (cond - ((or (eq (evil-visual-type) 'line) - (and (eq (evil-visual-type) 'block) - (memq last-command '(next-line previous-line)) - (eq temporary-goal-column most-positive-fixnum))) - (evil-visual-rotate 'upper-left) - (evil-append-line count vcount)) - ((eq (evil-visual-type) 'block) - (let ((column (max (evil-column evil-visual-beginning) - (evil-column evil-visual-end)))) - (evil-visual-rotate 'upper-left) - (move-to-column column t) - (evil-insert count vcount skip-empty-lines))) - (t - (evil-visual-rotate 'lower-right) - (backward-char) - (evil-append count))) - (unless (eolp) (forward-char)) - (evil-insert count vcount skip-empty-lines) - (add-hook 'post-command-hook #'evil-maybe-remove-spaces))) - -(evil-define-command evil-insert-resume (count) - "Switch to Insert state at previous insertion point. -The insertion will be repeated COUNT times. If called from visual -state, only place point at the previous insertion position but do not -switch to insert state." - :keep-visual t - :type exclusive - :jump t - (interactive "p") - (evil-goto-mark ?^ t) - (unless (evil-visual-state-p) - (evil-insert count))) - -(defun evil-quoted-insert (count) - "Like `quoted-insert' but delete COUNT chars forward in replace state. -Adds a \"^\" overlay as an input prompt." - (interactive "p") - (let* ((opoint (point)) - chars-to-delete - (ov (if (not (evil-replace-state-p)) - (make-overlay opoint opoint) - (setq chars-to-delete (min (- (line-end-position) opoint) count)) - (evil-update-replace-alist opoint count chars-to-delete) - (make-overlay opoint (+ chars-to-delete opoint))))) - (unwind-protect - (progn - (overlay-put ov 'invisible t) - (overlay-put ov 'after-string #("^" 0 1 (face escape-glyph cursor 1))) - (let (overwrite-mode) ; Force `read-quoted-char' - (quoted-insert count)) - (when chars-to-delete (delete-char chars-to-delete))) - (delete-overlay ov)))) - -(evil-define-command evil-open-above (count) - "Insert a new line above point and switch to Insert state. -The insertion will be repeated COUNT times." - :suppress-operator t - (interactive "p") - (unless (eq evil-want-fine-undo t) - (evil-start-undo-step)) - (evil-insert-newline-above) - (setq evil-insert-count count - evil-insert-lines t - evil-insert-vcount nil) - (unwind-protect - (when evil-auto-indent - (indent-according-to-mode)) - (evil-insert-state 1))) - -(evil-define-command evil-open-below (count) - "Insert a new line below point and switch to Insert state. -The insertion will be repeated COUNT times." - :suppress-operator t - (interactive "p") - (unless (eq evil-want-fine-undo t) - (evil-start-undo-step)) - (push (point) buffer-undo-list) - (evil-insert-newline-below) - (setq evil-insert-count count - evil-insert-lines t - evil-insert-vcount nil) - (unwind-protect - (when evil-auto-indent - (indent-according-to-mode)) - (evil-insert-state 1))) - -(defun evil--insert-line (count vcount non-blank-p) - "Switch to insert state at the beginning of the current line. -If NON-BLANK-P is non-nil, point is placed at the first non-blank character -on the current line. If NON-BLANK-P is nil, point is placed at column 0, -or the beginning of visual line. The insertion will be repeated COUNT times. -If VCOUNT is non nil it should be number > 0. The insertion will be repeated -in the next VCOUNT - 1 lines below the current one." - (push (point) buffer-undo-list) - (let ((move-fn (if non-blank-p #'evil-first-non-blank #'evil-beginning-of-line))) - (if (and visual-line-mode - evil-respect-visual-line-mode) - (goto-char - (max (save-excursion - (funcall move-fn) - (point)) - (save-excursion - (beginning-of-visual-line) - (point)))) - (funcall move-fn)) - (setq evil-insert-count count - evil-insert-lines nil - evil-insert-vcount - (and vcount - (> vcount 1) - (list (line-number-at-pos) - move-fn - vcount)))) - (evil-insert-state 1)) - -(defun evil-insert-line (count &optional vcount) - "Switch to insert state at beginning of current line. -Point is placed at the first non-blank character on the current -line. The insertion will be repeated COUNT times. If VCOUNT is -non nil it should be number > 0. The insertion will be repeated -in the next VCOUNT - 1 lines below the current one." - (interactive "p") - (evil--insert-line count vcount t)) - -(evil-define-command evil-insert-0-line (count &optional vcount) - "Switch to insert state at beginning of current line. -Point is placed at column 0, or the beginning of the visual line. -The insertion will be repeated COUNT times. If VCOUNT is -non nil it should be number > 0. The insertion will be repeated -in the next VCOUNT - 1 lines below the current one." - :keep-visual t - :type exclusive - (interactive "p") - (if (evil-visual-state-p) - (evil-beginning-of-line) - (evil--insert-line count vcount nil))) - -(defun evil-append-line (count &optional vcount) - "Switch to Insert state at the end of the current line. -The insertion will be repeated COUNT times. If VCOUNT is non nil -it should be number > 0. The insertion will be repeated in the -next VCOUNT - 1 lines below the current one." - (interactive "p") - (if (and visual-line-mode - evil-respect-visual-line-mode) - (end-of-visual-line) - (evil-move-end-of-line)) - (setq evil-insert-count count - evil-insert-lines nil - evil-insert-vcount - (and vcount - (> vcount 1) - (list (line-number-at-pos) - #'end-of-line - vcount))) - (evil-insert-state 1)) - -(evil-define-command evil-insert-digraph (count) - "Insert COUNT digraphs." - :repeat change - (interactive "p") - (let ((opoint (point)) - chars-to-delete insert-prompt) - (if (evil-replace-state-p) - (progn - (setq chars-to-delete (min (- (line-end-position) opoint) count) - insert-prompt (make-overlay opoint (+ chars-to-delete opoint))) - (evil-update-replace-alist opoint count chars-to-delete)) - (setq insert-prompt (make-overlay opoint opoint))) - (insert-char (evil-read-digraph-char-with-overlay insert-prompt) count) - (when chars-to-delete (delete-char chars-to-delete)))) - -(evil-define-command evil-ex-show-digraphs () - "Show a list of all available digraphs." - :repeat nil - (eval-and-compile (require 'evil-digraphs)) - (let ((columns 3)) - (evil-with-view-list - :name "evil-digraphs" - :mode-name "Evil Digraphs" - :format - (cl-loop repeat columns vconcat [("Digraph" 8 nil) ("Sequence" 16 nil)]) - :entries - (cl-loop - with xs = (append evil-digraphs-table-user evil-digraphs-table) - while xs collect - (cl-loop - repeat columns vconcat - (cl-destructuring-bind (chars . digraph) (or (pop xs) '(() . ?\ )) - (list (char-to-string digraph) (concat chars))) - into row finally return (list nil row)))))) - -(defun evil--self-insert-string (string) - "Insert STRING as if typed interactively." - (let ((chars (append string nil))) - (dolist (char chars) - (let ((last-command-event char)) - (self-insert-command 1))))) - -(defun evil-copy-from-above (arg) - "Copy characters from preceding non-blank line. -The copied text is inserted before point. -ARG is the number of lines to move backward. -See also \\\\[evil-copy-from-below]." - (interactive - (cond - ;; if a prefix argument was given, repeat it for subsequent calls - ((and (null current-prefix-arg) - (eq last-command #'evil-copy-from-above)) - (setq current-prefix-arg last-prefix-arg) - (list (prefix-numeric-value current-prefix-arg))) - (t - (list (prefix-numeric-value current-prefix-arg))))) - (evil--self-insert-string (evil-copy-chars-from-line arg -1))) - -(defun evil-copy-from-below (arg) - "Copy characters from following non-blank line. -The copied text is inserted before point. -ARG is the number of lines to move forward. -See also \\\\[evil-copy-from-above]." - (interactive - (cond - ((and (null current-prefix-arg) - (eq last-command #'evil-copy-from-below)) - (setq current-prefix-arg last-prefix-arg) - (list (prefix-numeric-value current-prefix-arg))) - (t - (list (prefix-numeric-value current-prefix-arg))))) - (evil--self-insert-string (evil-copy-chars-from-line arg 1))) - -;; adapted from `copy-from-above-command' in misc.el -(defun evil-copy-chars-from-line (n num &optional col) - "Return N characters from line NUM, starting at column COL. -NUM is relative to the current line and can be negative. -COL defaults to the current column." - (interactive "p") - (let ((col (or col (current-column))) prefix) - (save-excursion - (forward-line num) - (when (looking-at "[[:space:]]*$") - (if (< num 0) - (skip-chars-backward " \t\n") - (skip-chars-forward " \t\n"))) - (evil-move-beginning-of-line) - (move-to-column col) - ;; if the column winds up in middle of a tab, - ;; return the appropriate number of spaces - (when (< col (current-column)) - (if (eq (preceding-char) ?\t) - (let ((len (min n (- (current-column) col)))) - (setq prefix (make-string len ?\s) - n (- n len))) - ;; if in middle of a control char, return the whole char - (backward-char 1))) - (concat prefix - (buffer-substring (point) - (min (line-end-position) - (+ n (point)))))))) - -(defun evil-enter-replace-state (count) - "Switch to Replace state at point. -The insertion will be repeated COUNT times." - (interactive "p") - (setq evil-insert-count count) - (setq evil-insert-count count - evil-insert-lines nil - evil-insert-vcount nil) - (evil-replace-state 1)) - -;; completion -(evil-define-command evil-complete-next (&optional arg) - "Complete to the nearest following word. -Search backward if a match isn't found. -Calls `evil-complete-next-func'." - :repeat change - (interactive "P") - (if (minibufferp) - (funcall evil-complete-next-minibuffer-func) - (funcall evil-complete-next-func arg))) - -(evil-define-command evil-complete-previous (&optional arg) - "Complete to the nearest preceding word. -Search forward if a match isn't found. -Calls `evil-complete-previous-func'." - :repeat change - (interactive "P") - (if (minibufferp) - (funcall evil-complete-previous-minibuffer-func) - (funcall evil-complete-previous-func arg))) - -(evil-define-command evil-complete-next-line (&optional arg) - "Complete a whole line. -Calls `evil-complete-next-line-func'." - :repeat change - (interactive "P") - (if (minibufferp) - (funcall evil-complete-next-minibuffer-func) - (funcall evil-complete-next-line-func arg))) - -(evil-define-command evil-complete-previous-line (&optional arg) - "Complete a whole line. -Calls `evil-complete-previous-line-func'." - :repeat change - (interactive "P") - (if (minibufferp) - (funcall evil-complete-previous-minibuffer-func) - (funcall evil-complete-previous-line-func arg))) - -;;; Search - -(defun evil-repeat-search (flag) - "Called to record a search command. -FLAG is either `pre' or `post' if the function is called before resp. -after executing the command." - (cond - ((and (evil-operator-state-p) (eq flag 'pre)) - (evil-repeat-record (this-command-keys)) - (evil-clear-command-keys)) - ((and (evil-operator-state-p) (eq flag 'post)) - ;; The value of (this-command-keys) at this point should be the - ;; key-sequence that called the last command that finished the - ;; search, usually RET. Therefore this key-sequence will be - ;; recorded in the post-command of the operator. Alternatively we - ;; could do it here. - (evil-repeat-record (if evil-regexp-search - (car-safe regexp-search-ring) - (car-safe search-ring)))) - (t (evil-repeat-motion flag)))) - -(evil-define-motion evil-search-forward () - (format "Search forward for user-entered text. -Searches for regular expression if `evil-regexp-search' is t.%s" - (if (and (fboundp 'isearch-forward) - (documentation 'isearch-forward)) - (format "\n\nBelow is the documentation string \ -for `isearch-forward',\nwhich lists available keys:\n\n%s" - (documentation 'isearch-forward)) "")) - :jump t - :type exclusive - :repeat evil-repeat-search - (evil-search-incrementally t evil-regexp-search)) - -(evil-define-motion evil-search-backward () - (format "Search backward for user-entered text. -Searches for regular expression if `evil-regexp-search' is t.%s" - (if (and (fboundp 'isearch-forward) - (documentation 'isearch-forward)) - (format "\n\nBelow is the documentation string \ -for `isearch-forward',\nwhich lists available keys:\n\n%s" - (documentation 'isearch-forward)) "")) - :jump t - :type exclusive - :repeat evil-repeat-search - (evil-search-incrementally nil evil-regexp-search)) - -(evil-define-motion evil-search-next (count) - "Repeat the last search." - :jump t - :type exclusive - (let ((orig (point)) - (search-string (if evil-regexp-search - (car-safe regexp-search-ring) - (car-safe search-ring)))) - (goto-char - ;; Wrap in `save-excursion' so that multiple searches have no visual effect. - (save-excursion - (evil-search search-string isearch-forward evil-regexp-search) - (when (and (> (point) orig) - (save-excursion - (evil-adjust-cursor) - (= (point) orig))) - ;; Point won't move after first attempt and `evil-adjust-cursor' takes - ;; effect, so start again. - (evil-search search-string isearch-forward evil-regexp-search)) - (point))) - (when (and count (> count 1)) - (dotimes (_ (1- count)) - (evil-search search-string isearch-forward evil-regexp-search))))) - -(evil-define-motion evil-search-previous (count) - "Repeat the last search in the opposite direction." - :jump t - :type exclusive - (dotimes (_ (or count 1)) - (evil-search (if evil-regexp-search - (car-safe regexp-search-ring) - (car-safe search-ring)) - (not isearch-forward) evil-regexp-search))) - -(evil-define-motion evil-search-word-backward (count &optional symbol) - "Search backward for symbol under point." - :jump t - :type exclusive - (interactive (list (prefix-numeric-value current-prefix-arg) - evil-symbol-word-search)) - (dotimes (_ (or count 1)) - (evil-search-word nil nil symbol))) - -(evil-define-motion evil-search-word-forward (count &optional symbol) - "Search forward for symbol under point." - :jump t - :type exclusive - (interactive (list (prefix-numeric-value current-prefix-arg) - evil-symbol-word-search)) - (dotimes (_ (or count 1)) - (evil-search-word t nil symbol))) - -(evil-define-motion evil-search-unbounded-word-backward (count &optional symbol) - "Search backward for symbol under point. -The search is unbounded, i.e., the pattern is not wrapped in -\\<...\\>." - :jump t - :type exclusive - (interactive (list (prefix-numeric-value current-prefix-arg) - evil-symbol-word-search)) - (dotimes (_ (or count 1)) - (evil-search-word nil t symbol))) - -(evil-define-motion evil-search-unbounded-word-forward (count &optional symbol) - "Search forward for symbol under point. -The search is unbounded, i.e., the pattern is not wrapped in -\\<...\\>." - :jump t - :type exclusive - (interactive (list (prefix-numeric-value current-prefix-arg) - evil-symbol-word-search)) - (dotimes (_ (or count 1)) - (evil-search-word t t symbol))) - -(defun evil-goto-definition-imenu (string _position) - "Find definition for STRING with imenu." - (require 'imenu nil t) - (let (ientry ipos) - (when (fboundp 'imenu--make-index-alist) - (ignore-errors (setq ientry (imenu--make-index-alist))) - (setq ientry (imenu--in-alist string ientry)) - (setq ipos (cdr ientry)) - (when (and (markerp ipos) - (eq (marker-buffer ipos) (current-buffer))) - (setq ipos (marker-position ipos)) - (when (numberp ipos) - (evil-search (format "\\_<%s\\_>" (regexp-quote string)) t t ipos) - t))))) - -(defun evil-goto-definition-semantic (_string position) - "Find definition for POSITION with semantic." - (and (fboundp 'semantic-ia-fast-jump) - (ignore-errors (semantic-ia-fast-jump position)))) - -(declare-function xref-backend-identifier-at-point "xref") - -(defun evil-goto-definition-xref (_string position) - "Find definition at POSITION with xref." - (when (fboundp 'xref-find-definitions) - (let ((identifier (save-excursion - (goto-char position) - (xref-backend-identifier-at-point (xref-find-backend))))) - (condition-case nil - (progn (xref-find-definitions identifier) - t) - (user-error nil))))) - -(defun evil-goto-definition-search (string _position) - "Find definition for STRING with evil-search." - (evil-search (format "\\_<%s\\_>" (regexp-quote string)) t t (point-min)) - t) - -(evil-define-motion evil-goto-definition () - "Go to definition or first occurrence of symbol under point. -See also `evil-goto-definition-functions'." - :jump t - :type exclusive - (let* ((match (evil--find-thing t 'symbol)) - (string (car match)) - (position (cdr match))) - (if (null string) - (user-error "No symbol under cursor") - (setq isearch-forward t) - (run-hook-with-args-until-success 'evil-goto-definition-functions - string position)))) - -;;; Folding -(defun evil-fold-action (list action) - "Perform fold ACTION for each matching major or minor mode in LIST. - -ACTION will be performed for the first matching handler in LIST. For more -information on its features and format, see the documentation for -`evil-fold-list'. - -If no matching ACTION is found in LIST, an error will signaled. - -Handler errors will be demoted, so a problem in one handler will (hopefully) -not interfere with another." - (if (null list) - (user-error - "Enable one of the following modes for folding to work: %s" - (mapconcat #'symbol-name (mapcar #'caar evil-fold-list) ", ")) - (let* ((modes (caar list))) - (if (evil--mode-p modes) - (let* ((actions (cdar list)) - (fn (plist-get actions action))) - (when fn - (with-demoted-errors "Error: %S" (funcall fn)))) - (evil-fold-action (cdr list) action))))) - -(defun evil--mode-p (modes) - "Determine whether any symbol in MODES represents the current -buffer's major mode or any of its minors." - (unless (eq modes '()) - (let ((mode (car modes))) - (or (eq major-mode mode) - (and (boundp mode) (symbol-value mode)) - (evil--mode-p (cdr modes)))))) - -(evil-define-command evil-toggle-fold () - "Open or close a fold under point. -See also `evil-open-fold' and `evil-close-fold'." - (evil-fold-action evil-fold-list :toggle)) - -(evil-define-command evil-open-folds () - "Open all folds. -See also `evil-close-folds'." - (evil-fold-action evil-fold-list :open-all)) - -(evil-define-command evil-close-folds () - "Close all folds. -See also `evil-open-folds'." - (evil-fold-action evil-fold-list :close-all)) - -(evil-define-command evil-open-fold () - "Open fold at point. -See also `evil-close-fold'." - (evil-fold-action evil-fold-list :open)) - -(evil-define-command evil-open-fold-rec () - "Open fold at point recursively. -See also `evil-open-fold' and `evil-close-fold'." - (evil-fold-action evil-fold-list :open-rec)) - -(evil-define-command evil-close-fold () - "Close fold at point. -See also `evil-open-fold'." - (evil-fold-action evil-fold-list :close)) - -;;; Ex - -(evil-define-operator evil-write (beg end _type file-or-append &optional bang) - "Save the current buffer, from BEG to END, to FILE-OR-APPEND. -If FILE-OR-APPEND is of the form \">> FILE\", append to FILE -instead of overwriting. The current buffer's filename is not -changed unless it has no associated file and no region is -specified. If the file already exists and the BANG argument is -non-nil, it is overwritten without confirmation." - :motion nil - :move-point nil - :type line - :repeat nil - (interactive "") - (let* ((append-and-filename (evil-extract-append file-or-append)) - (append (car append-and-filename)) - (filename (cdr append-and-filename)) - (bufname (buffer-file-name (buffer-base-buffer)))) - (when (zerop (length filename)) - (setq filename bufname)) - (cond - ((zerop (length filename)) - (user-error "Please specify a file name for the buffer")) - ;; execute command on region - ((eq (aref filename 0) ?!) - (shell-command-on-region beg end (substring filename 1))) - ;; with region or append, always save to file without resetting - ;; modified flag - ((or append (and beg end)) - (write-region beg end filename append nil nil (not (or append bang)))) - ;; no current file - ((null bufname) - (write-file filename (not bang))) - ;; save current buffer to its file - ((string= filename bufname) - (if (not bang) (save-buffer) (write-file filename))) - ;; save to another file - (t - (write-region nil nil filename - nil (not bufname) nil - (not bang)))))) - -(evil-define-command evil-write-all (bang) - "Save all buffers visiting a file. -If BANG is non nil then read-only buffers are saved, too, -otherwise they are skipped. " - :repeat nil - :move-point nil - (interactive "") - (if bang - (save-some-buffers t) - ;; save only buffer that are not read-only and - ;; that are visiting a file - (save-some-buffers t - #'(lambda () - (and (not buffer-read-only) - (buffer-file-name)))))) - -(evil-define-command evil-update () - "Same as `evil-write', but only write when the buffer has been modified." - :motion nil - :move-point nil - :type line - :repeat nil - (when (buffer-modified-p) - (call-interactively #'evil-write))) - -(evil-define-command evil-save (filename &optional bang) - "Save the current buffer to FILENAME. -Changes the file name of the current buffer to FILENAME. If no -FILENAME is given, the current file name is used." - :repeat nil - :move-point nil - (interactive "") - (when (zerop (length filename)) - (setq filename (buffer-file-name (buffer-base-buffer)))) - (write-file filename (not bang))) - -(evil-define-command evil-edit (file &optional bang) - "Open FILE. -If no FILE is specified, reload the current buffer from disk." - :repeat nil - (interactive "") - (if file - (find-file file) - (revert-buffer bang (or bang (not (buffer-modified-p))) t) - (read-only-mode -1))) - -(evil-define-command evil-view (file &optional bang) - "Open FILE but don't allow changes. -If no FILE is specified, reload the current buffer from disk as read-only." - :repeat nil - (interactive "") - (if file - (find-file-read-only file) - (revert-buffer bang (or bang (not (buffer-modified-p))) t) - (read-only-mode +1))) - -(evil-define-command evil-buffer-add (file) - "Add FILE to the buffer list, but don't visit it. " - :repeat nil - (interactive "") - (if (or (not file) (string= "" file)) - (user-error "No file specified") - (find-file-noselect file))) - -(evil-define-command evil-read (count file) - "Insert the contents of FILE below the current line or line COUNT." - :repeat nil - :move-point nil - (interactive "P") - (when (and file (not (zerop (length file)))) - (when count (goto-char (point-min))) - (when (or (not (zerop (forward-line (or count 1)))) - (not (bolp))) - (insert "\n")) - (cond - ((/= (aref file 0) ?!) - (when (member file '("#" "%")) - (setq file (evil-ex-replace-special-filenames file))) - (let ((result (insert-file-contents file))) - (save-excursion - (forward-char (cadr result)) - (unless (bolp) (insert "\n"))))) - (t - (shell-command (evil-ex-replace-special-filenames (substring file 1)) t) - (goto-char (mark)) - (unless (bolp) (insert "\n")) - (forward-line -1))))) - -(evil-define-command evil-show-files () - "Show the file-list. -The same as `buffer-menu', but shows only buffers visiting -files." - :repeat nil - (buffer-menu 1)) - -(evil-define-command evil-goto-error (count) - "Go to error number COUNT. -If no COUNT is supplied, move to the current error. - -Acts like `first-error' other than when given no counts, goes -to the current error instead of the first, like in Vim's :cc -command." - :repeat nil - (interactive "") - (if count - (first-error (if (eql 0 count) 1 count)) - (next-error 0))) - -(evil-define-command evil-buffer (buffer) - "Switch to another buffer." - :repeat nil - (interactive "") - (cond - ;; no buffer given, switch to "other" buffer - ((null buffer) (switch-to-buffer (other-buffer))) - ;; we are given the name of an existing buffer - ((get-buffer buffer) (switch-to-buffer buffer)) - ;; try to complete the buffer - ((let ((all-buffers (internal-complete-buffer buffer nil t))) - (when (= (length all-buffers) 1) - (switch-to-buffer (car all-buffers))))) - (t - (when (y-or-n-p - (format "No buffer with name \"%s\" exists. Create new buffer? " - buffer)) - (switch-to-buffer buffer))))) - -(evil-define-command evil-next-buffer (&optional count) - "Go to the COUNTth next buffer in the buffer list." - :repeat nil - (interactive "p") - (next-buffer count)) - -(evil-define-command evil-prev-buffer (&optional count) - "Go to the COUNTth prev buffer in the buffer list." - :repeat nil - (interactive "p") - (previous-buffer count)) - -(evil-define-command evil-delete-buffer (buffer &optional bang) - "Delete a buffer. -All windows currently showing this buffer will be closed except -for the last window in each frame." - (interactive "") - (with-current-buffer (or buffer (current-buffer)) - (when bang - (set-buffer-modified-p nil) - (dolist (process (process-list)) - (when (eq (process-buffer process) (current-buffer)) - (set-process-query-on-exit-flag process nil)))) - ;; get all windows that show this buffer - (let ((wins (get-buffer-window-list (current-buffer) nil t))) - ;; if the buffer which was initiated by emacsclient, - ;; call `server-edit' from server.el to avoid - ;; "Buffer still has clients" message - (if (and (bound-and-true-p server-buffer-clients) - (fboundp 'server-edit)) - (server-edit) - (kill-buffer nil)) - ;; close all windows that showed this buffer - (dolist (w wins) (ignore-errors (delete-window w)))))) - -(evil-define-command evil-quit (&optional force) - "Close the current window, current frame, current tab, Emacs. -If the current frame belongs to some client the client connection -is closed." - :repeat nil - (interactive "") - (condition-case nil - (evil-window-delete) - (error - (if (and (bound-and-true-p server-buffer-clients) - (fboundp 'server-edit) - (fboundp 'server-buffer-done)) - (if force - (server-buffer-done (current-buffer)) - (server-edit)) - (condition-case nil - (delete-frame) - (error - (condition-case nil - (tab-bar-close-tab) - (error - (if force - (kill-emacs) - (save-buffers-kill-emacs)))))))))) - -(evil-define-command evil-quit-all (&optional bang) - "Exit Emacs, asking for saving." - :repeat nil - (interactive "") - (if (null bang) - (save-buffers-kill-terminal) - (let ((proc (frame-parameter (selected-frame) 'client))) - (if proc - (with-no-warnings - (server-delete-client proc)) - (dolist (process (process-list)) - (set-process-query-on-exit-flag process nil)) - (kill-emacs))))) - -(evil-define-command evil-quit-all-with-error-code (&optional err-code _force) - "Exit Emacs without saving, returning an non-zero error code. -The FORCE argument is only there for compatibility and is ignored. -This function fails with an error if Emacs is run in server mode." - :repeat nil - (interactive "") - (if (bound-and-true-p server-buffer-clients) - (user-error "Cannot exit client process with error code") - (kill-emacs (or err-code 1)))) - -(evil-define-command evil-save-and-quit () - "Save all buffers and exit Emacs." - (save-buffers-kill-terminal t)) - -(evil-define-command evil-save-and-close (file &optional bang) - "Save the current buffer and close the window." - :repeat nil - (interactive "") - (evil-write nil nil nil file bang) - (evil-quit)) - -(evil-define-command evil-save-modified-and-close (file &optional bang) - "Save the current buffer and close the window." - :repeat nil - (interactive "") - (when (buffer-modified-p) - (evil-write nil nil nil file bang)) - (evil-quit)) - -(evil-define-operator evil-shell-command - (beg end _type command &optional previous) - "Execute a shell command. -If BEG, END and TYPE is specified, COMMAND is executed on the region, -which is replaced with the command's output. Otherwise, the -output is displayed in its own buffer. If PREVIOUS is non-nil, -the previous shell command is executed instead." - (interactive "") - (if (not evil-called-from-ex-p) - (let ((current-prefix-arg - (if (or current-prefix-arg (evil-visual-state-p)) - current-prefix-arg - (goto-char (min beg end)) - (count-lines beg end))) - (evil-ex-initial-input "!")) - (call-interactively #'evil-ex)) - (if (zerop (length command)) - (when previous (setq command evil-previous-shell-command)) - (setq command (evil-ex-replace-special-filenames command) - evil-previous-shell-command command)) - (cond - ((zerop (length command)) - (user-error "No%s shell command" (if previous " previous" ""))) - (evil-ex-range - (if (not evil-display-shell-error-in-message) - (shell-command-on-region beg end command nil t) - (let ((output-buffer (generate-new-buffer " *temp*")) - (error-buffer (generate-new-buffer " *temp*"))) - (unwind-protect - (if (zerop (shell-command-on-region - beg end command - output-buffer nil error-buffer)) - (progn - (delete-region beg end) - (insert-buffer-substring output-buffer) - (goto-char beg) - (evil-first-non-blank)) - (display-message-or-buffer error-buffer)) - (kill-buffer output-buffer) - (kill-buffer error-buffer))))) - (t (shell-command command))))) - -(evil-define-command evil-make (arg) - "Call a build command in the current directory. -If ARG is nil this function calls `recompile', otherwise it calls -`compile' passing ARG as build command." - (interactive "") - (if (and (fboundp 'recompile) - (not arg)) - (recompile) - (compile arg))) - -;; TODO: escape special characters (currently only \n) ... perhaps -;; there is some Emacs function doing this? -(evil-define-command evil-show-registers (registers) - "Show the contents of REGISTERS, or all registers, if none supplied." - :repeat nil - (interactive "") - (let* ((all-registers (evil-register-list)) - (reg-chars (string-to-list registers)) - (display-regs (if reg-chars - (cl-remove-if-not (lambda (r) (memq (car r) reg-chars)) - all-registers) - all-registers))) - (evil-with-view-list - :name "evil-registers" - :mode-name "Evil Registers" - :format - [("Register" 10 nil) - ("Value" 1000 nil)] - :entries - (cl-loop for (key . val) in display-regs - collect `(nil [,(char-to-string key) - ,(cond ((stringp val) - (replace-regexp-in-string "\n" "^J" val)) - ((vectorp val) - (key-description val)) - (t ""))]))))) - -(evil-define-command evil-show-marks (mrks) - "Show all marks. -If MRKS is non-nil it should be a string and only registers -corresponding to the characters of this string are shown." - :repeat nil - (interactive "") - ;; To get markers and positions, we can't rely on 'global-mark-ring' - ;; provided by Emacs (although it will be much simpler and faster), - ;; because 'global-mark-ring' does not store mark characters, but - ;; only buffer name and position. Instead, 'evil-markers-alist' is - ;; used; this is list maintained by Evil for each buffer. - (let ((all-markers - ;; get global and local marks - (append (cl-remove-if (lambda (m) - (or (evil-global-marker-p (car m)) - (not (markerp (cdr m))))) - evil-markers-alist) - (cl-remove-if (lambda (m) - (or (not (evil-global-marker-p (car m))) - (not (markerp (cdr m))))) - (default-value 'evil-markers-alist))))) - (when mrks - (setq mrks (string-to-list mrks)) - (setq all-markers (cl-delete-if (lambda (m) - (not (member (car m) mrks))) - all-markers))) - ;; map marks to list of 4-tuples (char row col file) - (setq all-markers - (mapcar (lambda (m) - (with-current-buffer (marker-buffer (cdr m)) - (save-excursion - (goto-char (cdr m)) - (list (car m) - (line-number-at-pos (point)) - (current-column) - (buffer-name))))) - all-markers)) - (evil-with-view-list - :name "evil-marks" - :mode-name "Evil Marks" - :format [("Mark" 8 nil) - ("Line" 8 nil) - ("Column" 8 nil) - ("Buffer" 1000 nil)] - :entries (cl-loop for m in (sort all-markers (lambda (a b) (< (car a) (car b)))) - collect `(nil [,(char-to-string (nth 0 m)) - ,(number-to-string (nth 1 m)) - ,(number-to-string (nth 2 m)) - (,(nth 3 m))])) - :select-action #'evil--show-marks-select-action))) - -(defun evil--show-marks-select-action (entry) - (kill-buffer) - (switch-to-buffer (car (elt entry 3))) - (evil-goto-mark (string-to-char (elt entry 0)))) - -(defun evil--parse-delmarks (to-be-parsed &optional parsed) - "Where TO-BE-PARSED can contain ranges in the form `x-y'. -PARSED is a list of characters whose marks should be deleted. -Like vim, on invalid input, preceeding valid input is still parsed." - (cl-destructuring-bind (&optional a b c &rest) to-be-parsed - (cond - ((null to-be-parsed) parsed) - ;; single mark... - ((and (not (eq ?- b)) (or (<= ?a a ?z) (<= ?A a ?Z) (<= ?0 a ?9) - (memq a '(?\" ?^ ?. ?\[ ?\] ?< ?>)))) - (evil--parse-delmarks (cdr to-be-parsed) (cons a parsed))) - ;; range of marks... - ((and (eq ?- b) c (or (<= ?a a c ?z) (<= ?A a c ?Z) (<= ?0 a c ?9))) - (evil--parse-delmarks (nthcdr 3 to-be-parsed) - (append parsed (number-sequence a c)))) - (t (progn (evil-echo "Invalid input: %s" (apply #'string (remove nil to-be-parsed))) - parsed))))) - -(evil-define-command evil-delete-marks (marks &optional force) - "MARKS is a string denoting all marks to be deleted. Mark names are -either single characters or a range of characters in the form `x-y'. -If FORCE is non-nil and MARKS is blank, all local marks except 0-9 are removed." - (interactive "") - (let ((mark-chars (remove ?\s (append marks nil)))) - (cond - ((and force mark-chars) (evil-echo "Invalid input")) - (mark-chars - (let* ((delmarks (evil--parse-delmarks mark-chars)) - (delmarkp (lambda (m) (member (car m) delmarks)))) - ;; delete all parsed marks... - (setq evil-markers-alist - (cl-remove-if delmarkp evil-markers-alist)) - ;; ensure all parsed marks are deleted globally... - (set-default 'evil-markers-alist - (cl-remove-if delmarkp (default-value 'evil-markers-alist))))) - ;; delete local marks except 0-9... - (force (setq evil-markers-alist - (cl-remove-if-not (lambda (m) (<= ?0 (car m) ?9)) - evil-markers-alist)))))) - -(declare-function ffap-file-at-point "ffap") -(defvar ffap-string-at-point-region) -(evil-define-command evil-find-file-at-point-with-line () - "Open the file at point and go to position if present. -Supports positions in the following formats: \"path:line path(line)\", -\"path:line:col\" and \"path(line,col)\"." - (require 'ffap) - (let ((fname (ffap-file-at-point))) - (unless fname - (user-error "File does not exist.")) - (let* ((line-number-pattern ":\\([0-9]+\\)\\=" ) ; path:line format - (line-number-pattern-alt "\\=(\\([0-9]+\\))") ; path(line) format - (line-and-column-numbers-pattern ":\\([0-9]+\\):\\([0-9]+\\)\\=") ; path:line:col format - (line-and-column-numbers-pattern-alt "\\=(\\([0-9]+\\),\\([0-9]+\\))") ; file(line,col) format - (get-number (lambda (pattern match-number backward) - (save-excursion - (goto-char (cadr ffap-string-at-point-region)) - (and (if backward - (re-search-backward pattern (line-beginning-position) t) - (re-search-forward pattern (line-end-position) t)) - (string-to-number (match-string match-number)))))) - (line-number (or (funcall get-number line-and-column-numbers-pattern 1 t) - (funcall get-number line-and-column-numbers-pattern-alt 1 nil) - (funcall get-number line-number-pattern 1 t) - (funcall get-number line-number-pattern-alt 1 nil))) - (column-number (or (funcall get-number line-and-column-numbers-pattern 2 t) - (funcall get-number line-and-column-numbers-pattern-alt 2 nil)))) - (evil-echo "%s, %s" - (if line-number (format "line: %s" line-number) "no line") - (if column-number (format "column: %s" column-number) "no column")) - (find-file-at-point fname) - (when line-number - (goto-char (point-min)) - (forward-line (1- line-number)) - (when column-number - (move-to-column (1- column-number))))))) - -(evil-define-command evil-find-file-at-point-visual () - "Find the filename selected by the visual region. -Signal an error if the file does not exist." - (let ((region (buffer-substring (region-beginning) (region-end)))) - (if (file-exists-p region) - (find-file-at-point region) - (user-error "Can't find file \"%s\" in path" region)))) - -(evil-ex-define-argument-type state - "Define an argument type which can take state names." - :collection - (lambda (arg predicate flag) - (let ((completions (cons '(nil) evil-state-properties))) - (when arg - (cond - ((null flag) - (try-completion arg completions predicate)) - ((eq flag t) - (all-completions arg completions predicate)) - ((eq flag 'lambda) - (test-completion arg completions predicate)) - ((eq (car-safe flag) 'boundaries) - (cons 'boundaries - (completion-boundaries arg - completions - predicate - (cdr flag))))))))) - -(evil-define-interactive-code "" - "A valid evil state." - :ex-arg state - (list (and evil-called-from-ex-p evil-ex-argument - (intern-soft evil-ex-argument)))) - -;; TODO: should we merge this command with `evil-set-initial-state'? -(evil-define-command evil-ex-set-initial-state (state) - "Set the initial state for the current major mode to STATE. -This is the state the buffer comes up in. See `evil-set-initial-state'." - :repeat nil - (interactive "") - (if (not (or (assq state evil-state-properties) - (null state))) - (user-error "State %s cannot be set as initial Evil state" state) - (let ((current-initial-state (evil-initial-state major-mode))) - (unless (eq current-initial-state state) - ;; only if we selected a new mode - (when (y-or-n-p (format "Major-mode `%s' has initial mode `%s'. \ -Change to `%s'? " - major-mode - (or current-initial-state "DEFAULT") - (or state "DEFAULT"))) - (evil-set-initial-state major-mode state) - (when (y-or-n-p "Save setting in customization file? ") - (dolist (s (list current-initial-state state)) - (when s - (let ((var (intern (format "evil-%s-state-modes" s)))) - (customize-save-variable var (symbol-value var))))))))))) - -(evil-define-command evil-force-normal-state () - "Switch to normal state without recording current command." - :repeat abort - :suppress-operator t - (evil-normal-state)) - -(evil-define-motion evil-ex-search-next (count) - "Go to the next occurrence." - :jump t - :type exclusive - (evil-ex-search count)) - -(evil-define-motion evil-ex-search-previous (count) - "Go the the previous occurrence." - :jump t - :type exclusive - (let ((evil-ex-search-direction - (if (eq evil-ex-search-direction 'backward) 'forward 'backward))) - (evil-ex-search count))) - -(defun evil-repeat-ex-search (flag) - "Called to record a search command. -FLAG is either `pre' or `post' if the function is called before resp. -after executing the command." - (cond - ((and (evil-operator-state-p) (eq flag 'pre)) - (evil-repeat-record (this-command-keys)) - (evil-clear-command-keys)) - ((and (evil-operator-state-p) (eq flag 'post)) - (let ((search-separator (car (last evil-repeat-info)))) - (evil-repeat-record (evil-ex-pattern-regex evil-ex-search-pattern)) - (when evil-ex-search-offset - (evil-repeat-record (concat search-separator evil-ex-search-offset)))) - ;; If it weren't for the fact that `exit-minibuffer' throws an `exit' - ;; tag, which bypasses the source of `this-command-keys', we'd be able - ;; to capture the key(s) in the post-command of the operator as usual. - ;; Fortunately however, `last-input-event' can see the key (by default, `return') - (when (zerop (length (this-command-keys))) - (evil-repeat-record (vector last-input-event)))) - (t (evil-repeat-motion flag)))) - -(evil-define-motion evil-ex-search-forward (count) - "Start a forward search." - :jump t - :type exclusive - :repeat evil-repeat-ex-search - (evil-ex-start-search 'forward count)) - -(evil-define-motion evil-ex-search-backward (count) - "Start a backward search." - :jump t - :repeat evil-repeat-ex-search - (evil-ex-start-search 'backward count)) - -(evil-define-motion evil-ex-search-word-forward (count &optional symbol) - "Search for the next occurrence of word under the cursor." - :jump t - :type exclusive - (interactive (list (prefix-numeric-value current-prefix-arg) - evil-symbol-word-search)) - (evil-ex-start-word-search nil 'forward count symbol)) - -(evil-define-motion evil-ex-search-word-backward (count &optional symbol) - "Search for the next occurrence of word under the cursor." - :jump t - :type exclusive - (interactive (list (prefix-numeric-value current-prefix-arg) - evil-symbol-word-search)) - (evil-ex-start-word-search nil 'backward count symbol)) - -(evil-define-motion evil-ex-search-unbounded-word-forward (count &optional symbol) - "Search for the next occurrence of word under the cursor." - :jump t - :type exclusive - (interactive (list (prefix-numeric-value current-prefix-arg) - evil-symbol-word-search)) - (evil-ex-start-word-search t 'forward count symbol)) - -(evil-define-motion evil-ex-search-unbounded-word-backward (count &optional symbol) - "Search for the next occurrence of word under the cursor." - :jump t - :type exclusive - (interactive (list (prefix-numeric-value current-prefix-arg) - evil-symbol-word-search)) - (evil-ex-start-word-search t 'backward count symbol)) - -(defun evil-revert-reveal (open-spots) - "Unconditionally close overlays in OPEN-SPOTS in current window. -Modified version of `reveal-close-old-overlays' from -reveal.el. OPEN-SPOTS is a local version of `reveal-open-spots'." - (dolist (spot open-spots) - (let ((window (car spot)) - (ol (cdr spot))) - (unless (eq window (selected-window)) - (error "evil-revert-reveal: slot with wrong window")) - (let* ((inv (overlay-get ol 'reveal-invisible)) - (open (or (overlay-get ol 'reveal-toggle-invisible) - (get inv 'reveal-toggle-invisible) - (overlay-get ol 'isearch-open-invisible-temporary)))) - (if (and (overlay-start ol) ; Check if still live - open) - (condition-case err - (funcall open ol t) - (error (message "!!Reveal-hide (funcall %s %s t): %s !!" - open ol err))) - (overlay-put ol 'invisible inv)) - ;; Remove the overlay from the list of open spots. - (overlay-put ol 'reveal-invisible nil))))) - -(defun evil--ex-substitute-final-message (nreplaced flags) - "Display message according to replacements and flags. -If FLAGS contains \"p\" or \"#\" and NREPLACED is more than 0, print -the last line to the echo area. Otherwise, print the number of -replacements made or found." - (let ((replaced-any (< 0 nreplaced))) - (cond - ((and replaced-any (memq ?p flags)) - (evil-echo "%s" (buffer-substring (line-beginning-position) - (line-end-position)))) - ((and replaced-any (memq ?# flags)) - (evil-echo "%s %s" (propertize (number-to-string (line-number-at-pos)) - 'face 'line-number-current-line) - (buffer-substring (line-beginning-position) - (line-end-position)))) - (t (evil-echo "%s %d occurrence%s" - (if (memq ?n flags) "Found" "Replaced") - nreplaced - (if (/= nreplaced 1) "s" "")))))) - -(evil-define-operator evil-ex-substitute - (beg end pattern replacement flags) - "The Ex substitute command. -\[BEG,END]substitute/PATTERN/REPLACEMENT/FLAGS" - :repeat nil - :jump t - :move-point nil - :motion evil-line - (interactive "") - (evil-ex-nohighlight) - (unless pattern (user-error "No pattern given")) - (setq replacement (or replacement "") - flags (append flags) - evil-ex-last-was-search nil - evil-ex-substitute-pattern pattern - evil-ex-substitute-replacement replacement - evil-ex-substitute-flags flags) - (let* ((inhibit-field-text-motion t) - (count-only (memq ?n flags)) - (confirm (and (memq ?c flags) (not count-only))) - (case-fold-search (evil-ex-pattern-ignore-case pattern)) - (case-replace case-fold-search) - (regex (evil-ex-pattern-regex pattern)) - (nreplaced 0) - (orig-point (point-marker)) - (last-point (point)) - (whole-line (evil-ex-pattern-whole-line pattern)) - (evil-ex-substitute-overlay (make-overlay (point) (point))) - (end-marker (move-marker (make-marker) end)) - (use-reveal confirm) - match-data - reveal-open-spots - transient-mark-mode) - (unwind-protect - (catch 'exit-search - (isearch-update-ring (setq isearch-string regex) t) - (evil-ex-hl-change 'evil-ex-substitute pattern) - (overlay-put evil-ex-substitute-overlay 'face 'isearch) - (overlay-put evil-ex-substitute-overlay 'priority 1001) - (goto-char beg) - (while (re-search-forward regex end-marker t) - (unless (and query-replace-skip-read-only - (text-property-any (match-beginning 0) (match-end 0) 'read-only t)) - (let* ((match-beg (match-beginning 0)) - (match-end (match-end 0)) - (zero-length-match (= match-beg match-end)) - match-contains-newline) - (goto-char match-beg) - (when (and (= match-beg end-marker) (> end-marker beg) (bolp)) - ;; This line is not included due to range being exclusive - (throw 'exit-search nil)) - (setq match-data (match-data t match-data) - match-contains-newline (search-forward "\n" match-end t)) - (goto-char match-end) - (if confirm - (let* ((next-replacement - (if (stringp replacement) replacement - (funcall (car replacement) (cdr replacement) nreplaced))) - (prompt - (format "Replace %s with %s (y/n/a/q/l/^E/^Y)? " - (match-string 0) - (match-substitute-replacement - next-replacement (not case-replace)))) - (search-invisible t) - response) - (move-overlay evil-ex-substitute-overlay match-beg match-end) - ;; Simulate `reveal-mode'. `reveal-mode' uses - ;; `post-command-hook' but that won't work here. - (when use-reveal - (reveal-post-command)) - (catch 'exit-read-char - (while (setq response (read-char prompt)) - (when (member response '(?y ?a ?l)) - (unless count-only - (set-match-data match-data) - (replace-match next-replacement (not case-replace))) - (cl-incf nreplaced) - (evil-ex-hl-set-region - 'evil-ex-substitute - (line-beginning-position 2) - (evil-ex-hl-get-max 'evil-ex-substitute))) - (cl-case response - ((?y ?n) (throw 'exit-read-char nil)) - (?a (setq confirm nil) - (throw 'exit-read-char nil)) - ((?q ?l ?\C-\[) (throw 'exit-search nil)) - (?\C-e (evil-scroll-line-down 1)) - (?\C-y (evil-scroll-line-up 1)))))) - (unless count-only - (let ((next-replacement - (if (stringp replacement) replacement - (funcall (car replacement) (cdr replacement) nreplaced)))) - (set-match-data match-data) - (replace-match next-replacement (not case-replace)))) - (cl-incf nreplaced)) - (setq last-point (point)) - (cond ((>= (point) end-marker) - ;; Don't want to perform multiple replacements at the end - ;; of the search region. - (throw 'exit-search nil)) - ((and (not whole-line) - (not match-contains-newline)) - (forward-line) - ;; forward-line just moves to the end of the line on the - ;; last line of the buffer. - (when (>= (point) end-marker) (throw 'exit-search nil))) - ;; For zero-length matches check to see if point won't - ;; move next time. This is a problem when matching the - ;; regexp "$" because we can enter an infinite loop, - ;; repeatedly matching the same character - ((and zero-length-match - (let ((pnt (point))) - (save-excursion - (and (re-search-forward regex end-marker t) - (= pnt (point)))))) - (when (eobp) (throw 'exit-search nil)) - (forward-char))))))) - (evil-ex-delete-hl 'evil-ex-substitute) - (delete-overlay evil-ex-substitute-overlay) - (goto-char (if count-only orig-point last-point)) - (move-marker orig-point nil) - (move-marker end-marker nil) - - (when use-reveal - (evil-revert-reveal reveal-open-spots))) - - (evil--ex-substitute-final-message nreplaced flags) - - (if (and (= nreplaced 0) evil-ex-point) - (goto-char evil-ex-point) - (evil-first-non-blank)))) - -(evil-define-operator evil-ex-repeat-substitute (beg end flags) - "Repeat last substitute command. -This is the same as \":s//~/\"." - :repeat nil - :jump t - :move-point nil - :motion evil-line - (interactive "") - (apply #'evil-ex-substitute beg end - (evil-ex-get-substitute-info (concat "//~/" flags)))) - -(evil-define-operator evil-ex-repeat-substitute-with-flags (beg end flags) - "Repeat last substitute command with last flags. -This is the same as \":s//~/&\"." - :repeat nil - :jump t - :move-point nil - :motion evil-line - (interactive "") - (apply #'evil-ex-substitute beg end - (evil-ex-get-substitute-info (concat "//~/&" flags)))) - -(evil-define-operator evil-ex-repeat-substitute-with-search (beg end flags) - "Repeat last substitute command with last search pattern. -This is the same as \":s//~/r\"." - :repeat nil - :jump t - :move-point nil - :motion evil-line - (interactive "") - (apply #'evil-ex-substitute beg end - (evil-ex-get-substitute-info (concat "//~/r" flags)))) - -(evil-define-operator evil-ex-repeat-substitute-with-search-and-flags - (beg end flags) - "Repeat last substitute command with last search pattern and last flags. -This is the same as \":s//~/&r\"." - :repeat nil - :jump t - :move-point nil - :motion evil-line - (interactive "") - (apply #'evil-ex-substitute beg end - (evil-ex-get-substitute-info (concat "//~/&r" flags)))) - -(evil-define-operator evil-ex-repeat-global-substitute () - "Repeat last substitute command on the whole buffer. -This is the same as \":%s//~/&\"." - :repeat nil - :jump t - :move-point nil - :motion evil-line - (interactive) - (apply #'evil-ex-substitute (point-min) (point-max) - (evil-ex-get-substitute-info (concat "//~/&")))) - -(declare-function hi-lock-read-face-name "hi-lock") -(evil-define-command evil-ex-match (args &optional bang) - "Define a pattern to highlight in the current buffer. -With no args, clear a highlight from the buffer -With only an ! argument, clear all highlights from the buffer. -With one arg, interpret as the pattern, and prompt for a face. -With two args, interpret as :match {face} /{pattern}/. -Unlike Vim, multiple highlights can be set at once, so there is no need for -\":2match\" and \":3match\" Ex commands." - (interactive "") - (unless args (setq args "")) - (string-match "\\` *\\([^ ]+\\)? *\\(.+\\)?\\'" args) - (let* ((face (match-string 1 args)) - (search-string (match-string 2 args)) - (raw-patterns (evil-delimited-arguments (or search-string face ""))) - (raw-pattern (or (car raw-patterns) "")) - (case-fold-search ; ignore case if non-nil - (eq (evil-ex-regex-case raw-pattern evil-ex-search-case) 'insensitive)) - search-upper-case ; bypass isearch-no-upper-case-p - (pattern-no-case (evil-ex-regex-without-case raw-pattern)) - (pattern (if evil-ex-search-vim-style-regexp - (evil-transform-vim-style-regexp pattern-no-case) - pattern-no-case))) - (cond - ((or (not face) (string= "none" face)) - (if bang - (hi-lock-unface-buffer t) - (call-interactively #'hi-lock-unface-buffer))) - ((/= 1 (length raw-patterns)) - (user-error "Invalid pattern argument")) - ((not search-string) - (require 'hi-lock) - (hi-lock-face-buffer pattern (hi-lock-read-face-name))) - (t (hi-lock-face-buffer pattern face))))) - -(defun evil-keep-lines (pattern beg end) - "Stripped down version of `keep-lines'. -Delete lines between BEG & END which don't match PATTERN." - (goto-char (min beg end)) - (setq end - (progn - (save-excursion - (goto-char (max beg end)) - (unless (or (bolp) (eobp)) - (forward-line 0)) - (point-marker)))) - (save-excursion - (or (bolp) (forward-line 1)) - (let ((start (point))) - (while (< (point) end) - ;; Start is first char not preserved by previous match. - (if (not (re-search-forward pattern end 'move)) - (delete-region start end) - (let ((end (save-excursion (goto-char (match-beginning 0)) - (forward-line 0) - (point)))) - ;; Now end is first char preserved by the new match. - (if (< start end) - (delete-region start end)))) - - (setq start (save-excursion (forward-line 1) (point))) - ;; If the match was empty, avoid matching again at same place. - (and (< (point) end) - (= (match-beginning 0) (match-end 0)) - (forward-char 1))))) - (set-marker end nil) - nil) - -(defun evil-flush-lines (pattern beg end) - "Stripped down version of `flush-lines'. -Delete lines between BEG & END which match PATTERN." - (goto-char (min beg end)) - (setq end (copy-marker (max beg end))) - (save-excursion - (while (and (< (point) end) - (re-search-forward pattern end t)) - (delete-region (save-excursion (goto-char (match-beginning 0)) - (forward-line 0) - (point)) - (progn (forward-line 1) (point))))) - (set-marker end nil)) - -(defun evil--ex-performant-global-delete (beg end pattern invert) - "Use fast functions for fast line deletion. -Delete lines between BEG & END which match PATTERN. -Use `evil-flush-lines' if INVERT is nil, or `evil-keep-lines' if not." - (goto-char end) - (re-search-backward pattern beg t) - (let ((end-marker (point-marker))) - (if invert - (evil-keep-lines pattern beg end) - (evil-flush-lines pattern beg end)) - (goto-char end-marker) - (set-marker end-marker nil))) - -(evil-define-operator evil-ex-global - (beg end pattern command &optional invert) - "The Ex global command. -\[BEG,END]global[!]/PATTERN/COMMAND" - :motion mark-whole-buffer - :move-point nil - (interactive "") - (unless pattern - (user-error "No pattern given")) - (unless command - (user-error "No command given")) - ;; TODO: `evil-ex-make-substitute-pattern' should be executed so - ;; :substitute can re-use :global's pattern depending on its `r' - ;; flag. This isn't supported currently but should be simple to add - (let* ((case-fold-search - (eq (evil-ex-regex-case pattern evil-ex-search-case) 'insensitive)) - (pattern (evil-ex-regex-without-case pattern)) - (command-form (evil-ex-parse command)) - (ex-delete (eq 'evil-ex-delete (evil-ex-completed-binding (nth 2 command-form)))) - (transient-mark-mode transient-mark-mode) - (deactivate-mark deactivate-mark) - markers) - (when (and pattern command) - (when evil-ex-search-vim-style-regexp - (setq pattern (evil-transform-vim-style-regexp pattern))) - (if (and ex-delete (not (nth 3 command-form)) (not (nth 1 command-form))) - (evil--ex-performant-global-delete beg end pattern invert) - (setq isearch-string pattern) - (isearch-update-ring pattern t) - (goto-char beg) - (evil-move-beginning-of-line) - (while (< (point) end) - (let ((match (re-search-forward pattern (line-end-position) t))) - (when (if invert (not match) match) - (push (move-marker (make-marker) - (or (and match (match-beginning 0)) - (line-beginning-position))) - markers))) - (forward-line)) - (setq markers (nreverse markers)) - (unwind-protect - (evil-with-single-undo - (let ((evil--ex-global-active-p t)) - (dolist (marker markers) - (goto-char marker) - (eval command-form t)))) - ;; ensure that all markers are deleted afterwards, - ;; even in the event of failure - (dolist (marker markers) - (set-marker marker nil)) - (run-hooks 'evil-after-global-hook)))))) - -(evil-define-operator evil-ex-global-inverted - (beg end pattern command &optional invert) - "The Ex vglobal command. -\[BEG,END]vglobal/PATTERN/COMMAND" - :motion mark-whole-buffer - :move-point nil - (interactive "") - (evil-ex-global beg end pattern command (not invert))) - -(evil-define-operator evil-ex-normal (beg end commands) - "The Ex normal command. -Execute the argument as normal command on each line in the -range. The given argument is passed straight to -`execute-kbd-macro'. The default is the current line." - :motion evil-line - (interactive "") - ;; replace ^[ by escape - (setq commands - (vconcat (mapcar (lambda (ch) (if (eq ch ?) 'escape ch)) - commands))) - (let (markers evil-called-from-ex-p prefix-arg current-prefix-arg) - (goto-char beg) - (beginning-of-line) - (while (when (< (point) end) - (push (point-marker) markers) - (and (= (forward-line) 0) (bolp)))) - (setq markers (nreverse markers)) - (deactivate-mark) - (evil-force-normal-state) - (evil-with-single-undo - (dolist (marker markers) - (goto-char marker) - (ignore-errors (execute-kbd-macro commands)) - (evil-force-normal-state) - (set-marker marker nil))))) - -(evil-define-motion evil-goto-char (position) - "Go to POSITION in the buffer. -Default position is the beginning of the buffer." - :jump t - (interactive "") - (goto-char (or position (point-min)))) - -(evil-define-operator evil-ex-line-number (beg end) - "Print the last line number." - :motion mark-whole-buffer - :move-point nil - (interactive "") - (evil-echo "%d" (count-lines (point-min) end))) - -(evil-define-command evil-show-file-info () - "Show basic file information." - (let* ((nlines (count-lines (point-min) (point-max))) - (curr (line-number-at-pos (point))) - (perc (if (> nlines 0) - (format "%d%%" (* (/ (float curr) (float nlines)) 100.0)) - "No lines in buffer")) - (file (buffer-file-name (buffer-base-buffer))) - (writable (and file (file-writable-p file))) - (readonly (if (and file (not writable)) "[readonly] " ""))) - (if file - (evil-echo "\"%s\" %d %slines --%s--" file nlines readonly perc) - (evil-echo "%d lines --%s--" nlines perc)))) - -(defvar sort-fold-case) -(evil-define-operator evil-ex-sort (beg end &optional args reverse) - "The Ex sort command. -\[BEG,END]sort[!] [/PATTERN/] [b][i][u][r][n][x][o] -The following additional options are supported: - - * i ignore case - * u remove duplicate lines - * r sort the contents of pattern - * n sort by the first decimal number - * x sort by the first hexadecimal number (with optional \"0x\" prefix) - * o sort by the first octal number - * b sort by the first binary number - -If a pattern is supplied without supplying the \"r\" option, sort -the contents of the lines after skipping the pattern. -If the pattern is empty, the last search pattern is used instead. - -The \"!\" argument means to sort in reverse order." - :motion mark-whole-buffer - :move-point nil - (interactive "") - (unless args (setq args "")) - (let ((inhibit-field-text-motion t) - options sort-fold-case unique base sort-pat pat) - ;; Handle arguments like - ;; /[^,]*,/ n - ;; and - ;; nu - (if (or (zerop (length args)) (memq (aref args 0) '(?i ?n ?x ?o ?b ?u ?r))) - (setq options args) - (setq args (evil-delimited-arguments args 2) - ;; Use last search pattern when an empty pattern is provided - pat (if (string= (car args) "") - (evil-ex-pattern-regex evil-ex-search-pattern) - (car args)) - options (cadr args))) - (cl-loop - for opt across options do - (cond - ((eq opt ?i) (setq sort-fold-case t)) - ((eq opt ?b) (setq base 2)) - ((eq opt ?o) (setq base 8)) - ((eq opt ?n) (setq base 10)) - ((eq opt ?x) (setq base 16)) - ((eq opt ?r) (setq sort-pat t)) - ((eq opt ?u) (setq unique t)) - ((eq opt ? )) - (t (user-error "Invalid sort option `%c'" opt)))) - (evil-with-restriction beg end - (goto-char beg) - (let ((num-re - (cond - ((null base) nil) - ((= base 2) "[01]+") - ((= base 8) "[0-7]+") - ((= base 10) "-?[0-9]+") - ((= base 16) "\\(-\\)?\\(?:0x\\)?\\([0-9a-f]+\\)"))) - key-end) - (sort-subr - reverse - #'forward-line - #'end-of-line - (lambda () - ;; Find the boundary of the key to match on the line - (setq key-end (line-end-position)) - (and (> (length pat) 0) - ;; When matching a pattern and one doesn't exist on the line, - ;; skip the line - (re-search-forward pat key-end 'move) - sort-pat ; Otherwise go to the start of the key - (progn (setq key-end (point)) - (goto-char (match-beginning 0)))) - ;; Return the key for the line when sorting numbers, otherwise let - ;; `sort-subr' extract the key - (when base - (let ((case-fold-search t)) - (if (not (re-search-forward num-re key-end t)) - ;; When sorting numbers and a number doesn't exist on the - ;; line, place it above all the numeric lines - most-negative-fixnum - (let ((num (string-to-number - (buffer-substring - (match-beginning (if (= base 16) 2 0)) - (match-end 0)) - base))) - (if (and (= base 16) (match-beginning 1)) - (- num) - num)))))) - ;; Only called when sorting lexicographically - (lambda () (goto-char key-end)))) - (when unique - (goto-char (point-min)) - (let ((case-fold-search sort-fold-case) - prev-line-beg) - (while (not (eobp)) - (if (and prev-line-beg - (eq 0 (compare-buffer-substrings - nil prev-line-beg (1- (point)) - nil (point) (line-end-position)))) - (delete-region (point) (line-beginning-position 2)) - (setq prev-line-beg (point)) - (forward-line))))))) - (goto-char beg)) - -;;; Window navigation - -(defvar evil--window-digit nil) - -(defun evil--window-keep-pred () - (eq 'evil-window-digit-argument this-command)) - -(defun evil--window-reset-digit () - (setq evil--window-digit nil) - (remove-hook 'post-command-hook #'evil--window-reset-digit)) - -(defun evil--window-on-exit () - (add-hook 'post-command-hook #'evil--window-reset-digit)) - -(defun evil-window-digit-argument () - "Like `digit-argument' but maintains the window map." - (interactive) - (unless (eq 'evil-window-digit-argument last-command) - (set-transient-map evil-window-map #'evil--window-keep-pred #'evil--window-on-exit)) - (let* ((char (if (integerp last-command-event) - last-command-event - (get last-command-event 'ascii-character))) - (digit (- (logand char ?\177) ?0))) - (setq evil--window-digit (+ (* 10 (or evil--window-digit 0)) digit)))) - -(defmacro evil-save-side-windows (&rest body) - "Toggle side windows, evaluate BODY, restore side windows." - (declare (indent defun) (debug (&rest form))) - (let ((sides (make-symbol "sidesvar"))) - `(let ((,sides (and (fboundp 'window-toggle-side-windows) - (window-with-parameter 'window-side)))) - ;; The compiler doesn't understand that all uses are protected - ;; by `fboundp' :-( - (declare-function window-toggle-side-windows "window") - (when ,sides - (window-toggle-side-windows)) - (unwind-protect - (progn ,@body) - (when ,sides - (window-toggle-side-windows)))))) - -(defun evil-resize-window (new-size &optional horizontal) - "Set the current window's width or height to NEW-SIZE. -If HORIZONTAL is non-nil the width of the window is changed, -otherwise its height is changed." - (let ((count (- new-size (if horizontal (window-width) (window-height))))) - (enlarge-window count horizontal))) - -(defun evil-move-window (side) - "Move the `selected-window' to SIDE. -The state of the `selected-window' is saved along with the state -of the window tree consisting of all the other windows. Then, all -windows are deleted, the remaining window is split according to -SIDE, the state of the window at SIDE is replaced with the saved -state of the `selected-window', and, finally, the state of the -saved window tree is reconstructed on the opposite side. - -SIDE has the same meaning as in `split-window'. - -Note, this function only operates on the window tree rooted in -the frame's main window and effectively preserves any side -windows (i.e. windows with a valid window-side window -parameter)." - (evil-save-side-windows - (unless (one-window-p) - (save-excursion - (let ((w (window-state-get (selected-window)))) - (delete-window) - (let ((wtree (window-state-get))) - (delete-other-windows) - (let ((subwin (selected-window)) - ;; NOTE: SIDE is new in Emacs 24 - (newwin (split-window nil nil side))) - (window-state-put wtree subwin) - (window-state-put w newwin) - (select-window newwin))))) - (balance-windows)))) - -(defun evil-alternate-buffer (&optional window) - "Return the last buffer WINDOW has displayed other than the current one. -This is equivalent to Vim's alternate buffer." - ;; If the last buffer visited has been killed, then `window-prev-buffers' - ;; returns a list with `window-buffer' at the head. - (let* ((prev-buffers (window-prev-buffers)) - (head (car prev-buffers))) - (if (eq (car head) (window-buffer window)) - (cadr prev-buffers) - head))) - -(evil-define-command evil-switch-to-windows-last-buffer () - "Switch to the last open buffer of the current window." - :repeat nil - (let ((previous-place (evil-alternate-buffer))) - (when previous-place - (switch-to-buffer (car previous-place))))) - -(evil-define-command evil-window-delete () - "Delete the current window or tab. -If `evil-auto-balance-windows' is non-nil then all children of -the deleted window's parent window are rebalanced." - (let ((p (window-parent))) - ;; If tabs are enabled and this is the only visible window, then attempt to - ;; close this tab. - (if (and (bound-and-true-p tab-bar-mode) - (null p)) - (tab-close) - (delete-window) - (when evil-auto-balance-windows - ;; balance-windows raises an error if the parent does not have - ;; any further children (then rebalancing is not necessary anyway) - (ignore-errors (balance-windows p)))))) - -(evil-define-command evil-window-split (&optional count file read-only) - "Split the current window horizontally, COUNT lines height, -editing a certain FILE. The new window will be created below -when `evil-split-window-below' is non-nil. If COUNT and -`evil-auto-balance-windows' are both non-nil then all children -of the parent of the splitted window are rebalanced." - :repeat nil - (interactive "") - (select-window - (split-window (selected-window) (when count (- count)) - (if evil-split-window-below 'below 'above))) - (when (and (not count) evil-auto-balance-windows) - (balance-windows (window-parent))) - (when file - (funcall (if read-only #'evil-view #'evil-edit) file))) - -(evil-define-command evil-window-split-view (&optional count file) - "As with `evil-window-split' but the file is opened read-only." - :repeat nil - (interactive "") - (evil-window-split count file t)) - -(evil-define-command evil-window-vsplit (&optional count file) - "Split the current window vertically, COUNT columns width, -editing a certain FILE. The new window will be created to the -right when `evil-vsplit-window-right' is non-nil. If COUNT and -`evil-auto-balance-windows'are both non-nil then all children -of the parent of the splitted window are rebalanced." - :repeat nil - (interactive "") - (select-window - (split-window (selected-window) (when count (- count)) - (if evil-vsplit-window-right 'right 'left))) - (when (and (not count) evil-auto-balance-windows) - (balance-windows (window-parent))) - (when file - (evil-edit file))) - -(evil-define-command evil-split-buffer (buffer) - "Split window and switch to another buffer." - :repeat nil - (interactive "") - (evil-window-split) - (evil-buffer buffer)) - -(evil-define-command evil-split-next-buffer (&optional count) - "Split the window and go to the COUNT-th next buffer in the buffer list." - :repeat nil - (interactive "p") - (evil-window-split) - (next-buffer count)) - -(evil-define-command evil-split-prev-buffer (&optional count) - "Split window and go to the COUNT-th prev buffer in the buffer list." - :repeat nil - (interactive "p") - (evil-window-split) - (previous-buffer count)) - -(evil-define-command evil-window-left (count) - "Move the cursor to new COUNT-th window left of the current one." - :repeat nil - (interactive "") - (dotimes (_ count) - (windmove-left))) - -(evil-define-command evil-window-right (count) - "Move the cursor to new COUNT-th window right of the current one." - :repeat nil - (interactive "") - (dotimes (_ count) - (windmove-right))) - -(evil-define-command evil-window-up (count) - "Move the cursor to new COUNT-th window above the current one." - :repeat nil - (interactive "") - (dotimes (_ (or count 1)) - (windmove-up))) - -(evil-define-command evil-window-down (count) - "Move the cursor to new COUNT-th window below the current one." - :repeat nil - (interactive "") - (dotimes (_ (or count 1)) - (windmove-down))) - -(evil-define-command evil-window-bottom-right () - "Move the cursor to bottom-right window." - :repeat nil - (let ((last-sibling (frame-root-window))) - (while (and last-sibling (not (window-live-p last-sibling))) - (setq last-sibling (window-last-child last-sibling))) - (when last-sibling - (select-window last-sibling)))) - -(evil-define-command evil-window-top-left () - "Move the cursor to top-left window." - :repeat nil - (let ((first-child (window-child (frame-root-window)))) - (while (and first-child (not (window-live-p first-child))) - (setq first-child (window-child first-child))) - (when first-child - (select-window - first-child)))) - -(evil-define-command evil-window-mru () - "Move the cursor to the previous (last accessed) buffer in another window. -More precisely, it selects the most recently used buffer that is -shown in some other window, preferably of the current frame, and -is different from the current one." - :repeat nil - (catch 'done - (dolist (buf (buffer-list (selected-frame))) - (let ((win (get-buffer-window buf))) - (when (and (not (eq buf (current-buffer))) - win - (not (eq win (selected-window)))) - (select-window win) - (throw 'done nil)))))) - -(evil-define-command evil-window-next (count) - "Move the cursor to the next window in the cyclic order. -With COUNT go to the count-th window in the order starting from -top-left." - :repeat nil - (interactive "") - (if (not count) - (other-window +1) - (evil-window-top-left) - (other-window (1- (min count (length (window-list))))))) - -(evil-define-command evil-window-prev (count) - "Move the cursor to the previous window in the cyclic order. -With COUNT go to the count-th window in the order starting from -top-left." - :repeat nil - (interactive "") - (if (not count) - (other-window -1) - (evil-window-top-left) - (other-window (1- (min count (length (window-list))))))) - -(evil-define-command evil-window-new (count file) - "Split the current window horizontally -and open a new buffer or edit a certain FILE." - :repeat nil - (interactive "") - (let ((new-window (split-window (selected-window) (when count (- count)) - (if evil-split-window-below 'below 'above)))) - (when (and (not count) evil-auto-balance-windows) - (balance-windows (window-parent))) - (select-window new-window) - (evil-buffer-new file))) - -(evil-define-command evil-window-vnew (count file) - "Split the current window vertically -and open a new buffer name or edit a certain FILE." - :repeat nil - (interactive "") - (let ((new-window (split-window (selected-window) (when count (- count)) - (if evil-vsplit-window-right 'right 'left)))) - (when (and (not count) evil-auto-balance-windows) - (balance-windows (window-parent))) - (select-window new-window) - (evil-buffer-new file))) - -(evil-define-command evil-buffer-new (&optional file) - "Edit a new unnamed buffer or FILE." - :repeat nil - (interactive "") - (if file - (evil-edit file) - (let ((buffer (generate-new-buffer "*new*"))) - (set-buffer-major-mode buffer) - (set-window-buffer nil buffer)))) - -(evil-define-command evil-window-increase-height (count) - "Increase current window height by COUNT." - :repeat nil - (interactive "") - (enlarge-window count)) - -(evil-define-command evil-window-decrease-height (count) - "Decrease current window height by COUNT." - :repeat nil - (interactive "") - (enlarge-window (- count))) - -(evil-define-command evil-window-increase-width (count) - "Increase current window width by COUNT." - :repeat nil - (interactive "") - (enlarge-window count t)) - -(evil-define-command evil-window-decrease-width (count) - "Decrease current window width by COUNT." - :repeat nil - (interactive "") - (enlarge-window (- count) t)) - -(evil-define-command evil-window-set-height (count) - "Set the height of the current window to COUNT." - :repeat nil - (interactive "") - (evil-resize-window (or count (frame-height)) nil)) - -(evil-define-command evil-window-set-width (count) - "Set the width of the current window to COUNT." - :repeat nil - (interactive "") - (evil-resize-window (or count (frame-width)) t)) - -(evil-define-command evil-ex-resize (arg) - "The ex :resize command. - -If ARG is a signed positive integer, increase the current window -height by ARG. - -If ARG is a signed negative integer, decrease the current window -height by ARG. - -If ARG is a positive integer without explicit sign, set the current -window height to ARG. - -If ARG is empty, maximize the current window height." - (interactive "") - (if (or (not arg) (= 0 (length arg))) - (evil-window-set-height nil) - (let ((n (string-to-number arg))) - (if (> n 0) - (if (= ?+ (aref arg 0)) - (evil-window-increase-height n) - (evil-window-set-height n)) - (evil-window-decrease-height (- n)))))) - -(evil-define-command evil-window-rotate-upwards () - "Rotate the windows according to the current cyclic ordering." - :repeat nil - (evil-save-side-windows - (let ((wlist (window-list)) - (slist (mapcar #'window-state-get (window-list)))) - (setq slist (append (cdr slist) (list (car slist)))) - (while (and wlist slist) - (window-state-put (car slist) (car wlist)) - (setq wlist (cdr wlist) - slist (cdr slist))) - (select-window (car (window-list)))))) - -(evil-define-command evil-window-rotate-downwards () - "Rotate the windows according to the current cyclic ordering." - :repeat nil - (evil-save-side-windows - (let ((wlist (window-list)) - (slist (mapcar #'window-state-get (window-list)))) - (setq slist (append (last slist) slist)) - (while (and wlist slist) - (window-state-put (car slist) (car wlist)) - (setq wlist (cdr wlist) - slist (cdr slist))) - (select-window (car (window-list)))))) - -(evil-define-command evil-window-exchange (&optional count) - "Exchange the current window with the next, or the COUNT-th, one." - :repeat nil - (interactive "") - (let ((original-window (selected-window))) - (evil-window-next count) - (if (fboundp 'window-swap-states) - (window-swap-states nil original-window t) - (let* ((other-window (selected-window)) - (original-state (window-state-get original-window)) - (other-state (window-state-get other-window))) - (window-state-put other-state original-window t) - (window-state-put original-state other-window t))))) - -(evil-define-command evil-window-move-very-top () - "Close the current window, split the upper-left one horizontally -and redisplay the current buffer there." - :repeat nil - (evil-move-window 'above)) - -(evil-define-command evil-window-move-far-left () - "Close the current window, split the upper-left one vertically -and redisplay the current buffer there." - :repeat nil - (evil-move-window 'left)) - -(evil-define-command evil-window-move-far-right () - "Close the current window, split the lower-right one vertically -and redisplay the current buffer there." - :repeat nil - (evil-move-window 'right)) - -(evil-define-command evil-window-move-very-bottom () - "Close the current window, split the lower-right one horizontally -and redisplay the current buffer there." - :repeat nil - (evil-move-window 'below)) - -;;; Tab commands - -(evil-define-command evil-tab-next (arg) - "Switch to the next tab. -If ARG is non-nil, parse ARG as an index and go to the tab at that -index." - :repeat nil - (interactive "") - (if arg - (tab-bar-select-tab arg) - (tab-bar-switch-to-next-tab))) - -;;; Mouse handling - -;; Large parts of this code are taken from mouse.el which is -;; distributed with GNU Emacs -(defun evil-mouse-drag-region (start-event) - "Set the region to the text that the mouse is dragged over. -Highlight the drag area as you move the mouse. -This must be bound to a button-down mouse event. - -If the click is in the echo area, display the `*Messages*' buffer. - -START-EVENT should be the event that started the drag." - (interactive "e") - ;; Give temporary modes such as isearch a chance to turn off. - (run-hooks 'mouse-leave-buffer-hook) - (evil-mouse-drag-track start-event t)) -(evil-set-command-property 'evil-mouse-drag-region :keep-visual t) - -;; Make sure `touch-screen-handle-touch' processes touch screen gestures by -;; ignoring `evil-mouse-drag-region' (bound to `down-mouse-1') during mouse -;; click emulation. -(put 'evil-mouse-drag-region 'ignored-mouse-command t) - -(defun evil-mouse-drag-track (start-event &optional - do-mouse-drag-region-post-process) - "Track mouse drags by highlighting area between point and cursor. -The region will be defined with mark and point. -DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by -`mouse-drag-region'." - (mouse-minibuffer-check start-event) - (setq mouse-selection-click-count-buffer (current-buffer)) - (deactivate-mark) - (let* ((scroll-margin 0) ; Avoid margin scrolling (Bug#9541). - (original-window (selected-window)) - ;; We've recorded what we needed from the current buffer and - ;; window, now let's jump to the place of the event, where things - ;; are happening. - (_ (mouse-set-point start-event)) - (echo-keystrokes 0) - (start-posn (event-start start-event)) - (start-point (posn-point start-posn)) - (start-window (posn-window start-posn)) - (start-window-start (window-start start-window)) - (start-hscroll (window-hscroll start-window)) - (bounds (window-edges start-window)) - (make-cursor-line-fully-visible nil) - (top (nth 1 bounds)) - (bottom (if (or (window-minibuffer-p start-window) - (not mode-line-format)) - (nth 3 bounds) - ;; Don't count the mode line. - (1- (nth 3 bounds)))) - (on-link (and mouse-1-click-follows-link - (or mouse-1-click-in-non-selected-windows - (eq start-window original-window)) - ;; Use start-point before the intangibility - ;; treatment, in case we click on a link inside an - ;; intangible text. - (mouse-on-link-p start-posn))) - (click-count (1- (event-click-count start-event))) - (remap-double-click (and on-link - (eq mouse-1-click-follows-link 'double) - (= click-count 1))) - ;; Suppress automatic hscrolling, because that is a nuisance - ;; when setting point near the right fringe (but see below). - (auto-hscroll-mode-saved auto-hscroll-mode) - (auto-hscroll-mode nil) - event end end-point) - - (setq mouse-selection-click-count click-count) - ;; In case the down click is in the middle of some intangible text, - ;; use the end of that text, and put it in START-POINT. - (if (< (point) start-point) - (goto-char start-point)) - (setq start-point (point)) - (if remap-double-click - (setq click-count 0)) - - (setq click-count (mod click-count 4)) - - ;; activate correct visual state - (let ((range (evil-mouse-start-end start-point start-point click-count))) - (set-mark (nth 0 range)) - (goto-char (nth 1 range))) - - (cond - ((= click-count 0) - (when (evil-visual-state-p) (evil-exit-visual-state))) - ((= click-count 1) - (evil-visual-char) - (evil-visual-post-command)) - ((= click-count 2) - (evil-visual-line) - (evil-visual-post-command)) - ((= click-count 3) - (evil-visual-block) - (evil-visual-post-command))) - - ;; Track the mouse until we get a non-movement event. - (track-mouse - (while (progn - (setq event (read-key)) - (or (mouse-movement-p event) - (memq (car-safe event) '(switch-frame select-window)))) - (unless (evil-visual-state-p) - (cond - ((= click-count 0) (evil-visual-char)) - ((= click-count 1) (evil-visual-char)) - ((= click-count 2) (evil-visual-line)) - ((= click-count 3) (evil-visual-block)))) - - (evil-visual-pre-command) - (unless (memq (car-safe event) '(switch-frame select-window)) - ;; Automatic hscrolling did not occur during the call to - ;; `read-event'; but if the user subsequently drags the - ;; mouse, go ahead and hscroll. - (let ((auto-hscroll-mode auto-hscroll-mode-saved)) - (redisplay)) - (setq end (event-end event) - end-point (posn-point end)) - (if (and (eq (posn-window end) start-window) - (integer-or-marker-p end-point)) - (evil-mouse--drag-set-mark-and-point start-point - end-point click-count) - (let ((mouse-row (cdr (cdr (mouse-position))))) - (cond - ((null mouse-row)) - ((< mouse-row top) - (mouse-scroll-subr start-window (- mouse-row top) - nil start-point)) - ((>= mouse-row bottom) - (mouse-scroll-subr start-window (1+ (- mouse-row bottom)) - nil start-point)))))) - (evil-visual-post-command))) - - ;; Store the fact that the current region was set by the mouse - (setq evil--region-from-mouse t) - - ;; Handle the terminating event if possible. - (when (consp event) - ;; Ensure that point is on the end of the last event. - (when (and (setq end-point (posn-point (event-end event))) - (eq (posn-window end) start-window) - (integer-or-marker-p end-point) - (/= start-point end-point)) - (evil-mouse--drag-set-mark-and-point start-point - end-point click-count)) - - ;; Find its binding. - (let* ((fun (key-binding (vector (car event)))) - (do-multi-click (and (> (event-click-count event) 0) - (functionp fun) - (not (memq fun '(mouse-set-point - mouse-set-region)))))) - (if (and (or (/= (mark) (point)) - (= click-count 1) ; word selection - (and (memq (evil-visual-type) '(line block)))) - (not do-multi-click)) - - ;; If point has moved, finish the drag. - (let (last-command this-command) - (and mouse-drag-copy-region - do-mouse-drag-region-post-process - (let (deactivate-mark) - (evil-visual-expand-region) - (copy-region-as-kill (mark) (point)) - (evil-visual-contract-region)))) - - ;; If point hasn't moved, run the binding of the - ;; terminating up-event. - (if do-multi-click - (goto-char start-point) - (deactivate-mark)) - (when (and (functionp fun) - (= start-hscroll (window-hscroll start-window)) - ;; Don't run the up-event handler if the window - ;; start changed in a redisplay after the - ;; mouse-set-point for the down-mouse event at - ;; the beginning of this function. When the - ;; window start has changed, the up-mouse event - ;; contains a different position due to the new - ;; window contents, and point is set again. - (or end-point - (= (window-start start-window) - start-window-start))) - (when (and on-link - (= start-point (point)) - (evil-mouse--remap-link-click-p start-event event)) - ;; If we rebind to mouse-2, reselect previous selected - ;; window, so that the mouse-2 event runs in the same - ;; situation as if user had clicked it directly. Fixes - ;; the bug reported by juri@jurta.org on 2005-12-27. - (if (or (vectorp on-link) (stringp on-link)) - (setq event (aref on-link 0)) - (select-window original-window) - (setcar event 'mouse-2) - ;; If this mouse click has never been done by the - ;; user, it doesn't have the necessary property to be - ;; interpreted correctly. - (put 'mouse-2 'event-kind 'mouse-click))) - (push event unread-command-events))))))) - -;; This function is a plain copy of `mouse--drag-set-mark-and-point', -;; which is only available in Emacs 24 -(defun evil-mouse--drag-set-mark-and-point (start click click-count) - (let* ((range (evil-mouse-start-end start click click-count)) - (beg (nth 0 range)) - (end (nth 1 range))) - (cond ((eq (mark) beg) - (goto-char end)) - ((eq (mark) end) - (goto-char beg)) - ((< click (mark)) - (set-mark end) - (goto-char beg)) - (t - (set-mark beg) - (goto-char end))))) - -;; This function is a plain copy of `mouse--remap-link-click-p', -;; which is only available in Emacs 23 -(defun evil-mouse--remap-link-click-p (start-event end-event) - (or (and (eq mouse-1-click-follows-link 'double) - (= (event-click-count start-event) 2)) - (and - (not (eq mouse-1-click-follows-link 'double)) - (= (event-click-count start-event) 1) - (= (event-click-count end-event) 1) - (or (not (integerp mouse-1-click-follows-link)) - (let ((t0 (posn-timestamp (event-start start-event))) - (t1 (posn-timestamp (event-end end-event)))) - (and (integerp t0) (integerp t1) - (if (> mouse-1-click-follows-link 0) - (<= (- t1 t0) mouse-1-click-follows-link) - (< (- t0 t1) mouse-1-click-follows-link)))))))) - -(defun evil-mouse-start-end (start end mode) - "Return a list of region bounds based on START and END according to MODE. -If MODE is not 1 then set point to (min START END), mark to (max -START END). If MODE is 1 then set point to start of word at (min -START END), mark to end of word at (max START END)." - (evil-sort start end) - (setq mode (mod mode 4)) - (if (/= mode 1) (list start end) - (list - (save-excursion - (goto-char (min (point-max) (1+ start))) - (if (zerop (forward-thing evil-mouse-word -1)) - (let ((bpnt (point))) - (forward-thing evil-mouse-word +1) - (if (> (point) start) bpnt (point))) - (point-min))) - (save-excursion - (goto-char end) - (1- - (if (zerop (forward-thing evil-mouse-word +1)) - (let ((epnt (point))) - (forward-thing evil-mouse-word -1) - (if (<= (point) end) epnt (point))) - (point-max))))))) - -;;; State switching - -(evil-define-command evil-exit-emacs-state (&optional buffer message) - "Exit Emacs state. -Changes the state to the previous state, or to Normal state -if the previous state was Emacs state." - :keep-visual t - :suppress-operator t - (interactive '(nil t)) - (with-current-buffer (or buffer (current-buffer)) - (when (evil-emacs-state-p) - (evil-change-to-previous-state buffer message) - (when (evil-emacs-state-p) - (evil-normal-state (and message 1)))))) - -(defun evil--restore-repeat-hooks () - "No insert-state repeat info is recorded after executing in normal state. -Restore the disabled repeat hooks on insert-state exit." - (evil-repeat-stop) - (add-hook 'pre-command-hook #'evil-repeat-pre-hook) - (add-hook 'post-command-hook #'evil-repeat-post-hook) - (remove-hook 'evil-insert-state-exit-hook #'evil--restore-repeat-hooks)) - -(defvar evil--execute-normal-return-state nil - "The state to return to after executing in normal state.") - -(evil-define-local-var evil--execute-normal-eol-pos nil - "Point position if it was at EOL before `evil-execute-in-normal-state'.") - -(defun evil-execute-in-normal-state () - "Execute the next command in Normal state." - (interactive) - (let ((buf (current-buffer)) - (state evil-state)) - (evil-with-delay (not (memq this-command - '(nil - evil-execute-in-normal-state - evil-replace-state - evil-use-register - evil-window-digit-argument - digit-argument - negative-argument - universal-argument - universal-argument-minus - universal-argument-more - universal-argument-other-key))) - post-command-hook - (with-current-buffer buf - ;; If cursor was after EOL before CTRL-O and is now at EOL, - ;; put it after EOL. - (and (or (when evil--execute-normal-eol-pos - (= (1+ (point)) (save-excursion - (goto-char evil--execute-normal-eol-pos) - (set-marker evil--execute-normal-eol-pos nil) - (line-end-position)))) - (and (eq (or goal-column temporary-goal-column) most-positive-fixnum) - (memq this-command '(next-line previous-line)))) - (not (eolp)) - (not (memq this-command - '(evil-insert evil-beginning-of-line evil-first-non-blank))) - (forward-char)) - (unless (memq evil-state '(replace insert)) - (evil-change-state state)) - (when (eq 'insert evil-state) - (remove-hook 'pre-command-hook #'evil-repeat-pre-hook) - (remove-hook 'post-command-hook #'evil-repeat-post-hook) - (add-hook 'evil-insert-state-exit-hook #'evil--restore-repeat-hooks)) - (setq evil-execute-normal-keys nil)))) - (setq evil-insert-count nil - evil--execute-normal-return-state evil-state - evil--execute-normal-eol-pos (when (eolp) (point-marker)) - evil-execute-normal-keys (this-command-keys)) - (let (evil-move-cursor-back) (evil-normal-state)) - (evil-echo "Switched to Normal state for the next command...")) - -(defun evil-stop-execute-in-emacs-state () - (when (and (not (eq this-command #'evil-execute-in-emacs-state)) - (not (minibufferp))) - (remove-hook 'post-command-hook #'evil-stop-execute-in-emacs-state) - (when (buffer-live-p evil-execute-in-emacs-state-buffer) - (with-current-buffer evil-execute-in-emacs-state-buffer - (if (and (eq evil-previous-state 'visual) - (not (use-region-p))) - (progn - (evil-change-to-previous-state) - (evil-exit-visual-state)) - (evil-change-to-previous-state)))) - (setq evil-execute-in-emacs-state-buffer nil))) - -(evil-define-command evil-execute-in-emacs-state () - "Execute the next command in Emacs state." - (add-hook 'post-command-hook #'evil-stop-execute-in-emacs-state t) - (setq evil-execute-in-emacs-state-buffer (current-buffer)) - (cond - ((evil-visual-state-p) - (let ((mrk (mark)) - (pnt (point))) - (evil-emacs-state) - (set-mark mrk) - (goto-char pnt))) - (t - (evil-emacs-state))) - (evil-echo "Switched to Emacs state for the next command ...")) - -(defun evil-exit-visual-and-repeat (event) - "Exit insert state and repeat event. -This special command should be used if some command called from -visual state should actually be called in normal-state. The main -reason for doing this is that the repeat system should *not* -record the visual state information for some command. This -command should be bound to exactly the same event in visual state -as the original command is bound in normal state. EVENT is the -event that triggered the execution of this command." - (interactive "e") - (when (evil-visual-state-p) - (evil-exit-visual-state) - (push event unread-command-events))) -(evil-declare-ignore-repeat 'evil-exit-visual-and-repeat) - -(evil-define-command evil-retab (tabstop) - "Convert all tabs to spaces or the other way around. -Replace all sequences of white-space containing a with new -strings of white-space using the new TABSTOP value given. -If you do not specify a new TABSTOP size or it is zero, Evil uses the -current value of `tab-width'." - (interactive "") - (unless (or (not tabstop) (string-match-p "^[0-9]*$" tabstop)) - (user-error "Invalid argument: %s" tabstop)) - (let ((beg (if (use-region-p) (region-beginning) (point-min))) - (end (if (use-region-p) (region-end) (point-max))) - (retab (if indent-tabs-mode #'tabify #'untabify)) - (tab-width (cond ((not tabstop) tab-width) - ((equal tabstop "0") tab-width) - (t (string-to-number tabstop))))) - (funcall retab beg end))) - -(provide 'evil-commands) - -;;; evil-commands.el ends here diff --git a/.config/emacs/lisp/evil/evil-common.el b/.config/emacs/lisp/evil/evil-common.el deleted file mode 100644 index 4aa1416..0000000 --- a/.config/emacs/lisp/evil/evil-common.el +++ /dev/null @@ -1,3843 +0,0 @@ -;;; evil-common.el --- Common functions and utilities -*- lexical-binding: t -*- -;; Author: Vegard Øye -;; Maintainer: Vegard Øye - -;; Version: 1.15.0 - -;; -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -;;; Code: - -(require 'evil-vars) -(require 'rect) -(require 'thingatpt) -(require 'cl-lib) - -(declare-function evil-visual-state-p "evil-states") -(declare-function evil-visual-restore "evil-states") -(declare-function evil-motion-state "evil-states") -(declare-function evil-replace-state-p "evil-states") -(declare-function evil-set-jump "evil-jumps") - -;;; Compatibility with different Emacs versions - -;; x-set-selection and x-get-selection have been deprecated since 25.1 -;; by gui-set-selection and gui-get-selection -(defalias 'evil-get-selection - (if (fboundp 'gui-get-selection) 'gui-get-selection 'x-get-selection)) -(defalias 'evil-set-selection - (if (fboundp 'gui-set-selection) 'gui-set-selection 'x-set-selection)) - -(defmacro evil-with-delay (condition hook &rest body) - "Execute BODY when CONDITION becomes true, checking with HOOK. -HOOK can be a simple symbol or of the form (HOOK APPEND LOCAL NAME) -where: -NAME specifies the name of the entry added to HOOK. -If APPEND is non-nil, the entry is appended to the hook. -If LOCAL is non-nil, the buffer-local value of HOOK is modified." - (declare (debug (form sexp body)) (indent 2)) - (cl-destructuring-bind (hook-sym &optional append local name) - (mapcar #'macroexp-quote (if (consp hook) hook (list hook))) - (macroexp-let2* nil - ((fun-name `(make-symbol - ,(or name (format "evil-delay-in-%s" hook-sym)))) - ;; `apply-partially' is used in case this macro is expanded - ;; (via `evil-define-key') in a file which still does not - ;; activate `lexical-binding'. - (fun `(apply-partially - (lambda (name &rest _) - (when ,(or condition t) - (remove-hook ,hook-sym name ,local) - ,@body - t)) - ,fun-name))) - `(unless ,(and condition `(funcall ,fun)) - (progn (fset ,fun-name ,fun) - ,@(when local `((put ,fun-name 'permanent-local-hook t))) - (add-hook ,hook-sym ,fun-name ,append ,local)))))) - -(defun evil-delay (condition form hook &optional append local name) - "Execute FORM when CONDITION becomes true, checking with HOOK. -NAME specifies the name of the entry added to HOOK. If APPEND is -non-nil, the entry is appended to the hook. If LOCAL is non-nil, -the buffer-local value of HOOK is modified." - (declare (obsolete evil-with-delay "1.15.0") (indent 2)) - (eval `(evil-with-delay ,condition (,hook ,append ,local ,name) ,form) t)) - -;;; List functions - -(defmacro evil--add-to-alist (alist &rest elements) - "Add the association of KEY and VAL to the value of ALIST. -If the list already contains an entry for KEY, update that entry; -otherwise prepend it to the list. - -\(fn ALIST [KEY VAL]...)" - `(progn - ,@(cl-loop - for (key val) on elements by #'cddr collect - (if (< emacs-major-version 26) - (macroexp-let2* nil ((k key) (p `(assoc ,k ,alist))) - `(if ,p (setcdr ,p ,val) - (push (cons ,k ,val) ,alist))) - `(setf (alist-get ,key ,alist nil nil #'equal) ,val))) - ,alist)) - -;; custom version of `delete-if' -(defun evil-filter-list (predicate list &optional pointer) - "Delete by side-effect all items satisfying PREDICATE in LIST. -Stop when reaching POINTER. If the first item satisfies PREDICATE, -there is no way to remove it by side-effect; therefore, write -\(setq foo (evil-filter-list #\\='predicate foo)) to be sure of -changing the value of `foo'." - (let ((tail list) elt head) - (while (and tail (not (eq tail pointer))) - (setq elt (car tail)) - (cond - ((funcall predicate elt) - (setq tail (cdr tail)) - (if head - (setcdr head tail) - (setq list tail))) - (t - (setq head tail - tail (cdr tail))))) - list)) - -(defun evil-member-if (predicate list &optional pointer) - "Find the first item satisfying PREDICATE in LIST. -Stop when reaching POINTER, which should point at a link -in the list." - (let (elt) - (catch 'done - (while (and (consp list) (not (eq list pointer))) - (setq elt (car list)) - (if (funcall predicate elt) - (throw 'done elt) - (setq list (cdr list))))))) - -(defun evil-member-recursive-if (predicate tree) - "Find the first item satisfying PREDICATE in TREE." - (declare (obsolete nil "1.15.0")) - (cond - ((funcall predicate tree) - tree) - ((listp tree) - (catch 'done - (dolist (elt tree) - (when (setq elt (evil-member-recursive-if predicate elt)) - (throw 'done elt))))))) - -(defun evil-concat-lists (&rest sequences) - "Concatenate lists, removing duplicates. -Elements are compared with `eq'." - (let (result) - (dolist (sequence sequences) - (dolist (elt sequence) - (push elt result))) - (nreverse (cl-remove-duplicates result :test #'eq)))) - -(defun evil-concat-alists (&rest sequences) - "Concatenate association lists, removing duplicates. -An alist is a list of cons cells (KEY . VALUE) where each key -may occur only once. Later values overwrite earlier values." - (let (result) - (dolist (sequence sequences) - (dolist (elt sequence) - (setq result (assq-delete-all (car-safe elt) result)) - (push elt result))) - (nreverse result))) - -(defun evil-concat-plists (&rest sequences) - "Concatenate property lists, removing duplicates. -A property list is a list (:KEYWORD1 VALUE1 :KEYWORD2 VALUE2...) -where each keyword may occur only once. Later values overwrite -earlier values." - (let (result) - (dolist (sequence sequences result) - (while sequence - (setq result - (plist-put result (pop sequence) (pop sequence))))))) - -(defun evil-concat-keymap-alists (&rest sequences) - "Concatenate keymap association lists, removing duplicates. -A keymap alist is a list of cons cells (VAR . MAP) where each keymap -may occur only once, but where the variables may be repeated -\(e.g., (VAR . MAP1) (VAR . MAP2) is allowed). The order matters, -with the highest priority keymaps being listed first." - (let (result) - (dolist (sequence sequences) - (dolist (elt sequence) - (unless (rassq (cdr-safe elt) result) - (push elt result)))) - (nreverse result))) - -(defun evil-plist-delete (prop plist) - "Delete by side effect the property PROP from PLIST. -If PROP is the first property in PLIST, there is no way -to remove it by side-effect; therefore, write -\(setq foo (evil-plist-delete :prop foo)) to be sure of -changing the value of `foo'." - (let ((tail plist) elt head) - (while tail - (setq elt (car tail)) - (cond - ((eq elt prop) - (setq tail (cdr (cdr tail))) - (if head - (setcdr (cdr head) tail) - (setq plist tail))) - (t - (setq head tail - tail (cdr (cdr tail)))))) - plist)) - -(defun evil-get-property (alist key &optional prop) - "Return property PROP for KEY in ALIST. -ALIST is an association list with entries of the form -\(KEY . PLIST), where PLIST is a property list. -If PROP is nil, return all properties for KEY. -If KEY is t, return an association list of keys -and their PROP values." - (declare (obsolete nil "1.15.0")) - (cond - ((null prop) - (cdr (assq key alist))) - ((eq key t) - (let (result val) - (dolist (entry alist result) - (setq key (car entry) - val (cdr entry)) - (when (plist-member val prop) - (setq val (plist-get val prop)) - (push (cons key val) result))))) - (t - (plist-get (cdr (assq key alist)) prop)))) - -(defun evil-put-property (alist-var key prop val &rest properties) - "Set PROP to VAL for KEY in ALIST-VAR. -ALIST-VAR points to an association list with entries of the form -\(KEY . PLIST), where PLIST is a property list storing PROP and VAL." - (declare (obsolete nil "1.15.0")) - (set alist-var - (let* ((alist (symbol-value alist-var)) - (plist (cdr (assq key alist)))) - (setq plist (plist-put plist prop val)) - (when properties - (setq plist (evil-concat-plists plist properties) - val (car (last properties)))) - (setq alist (assq-delete-all key alist)) - (push (cons key plist) alist))) - val) - -(defun evil-state-property (state prop &optional value) - "Return the value of property PROP for STATE. -PROP is a keyword as used by `evil-define-state'. STATE is the state's -symbolic name. If VALUE is non-nil and the value is a variable, return -the value of that variable. - -If STATE is t, return an association list of states and their PROP -values instead." - (if (eq state t) - (cl-loop for (key . plist) in evil-state-properties with result do - (let ((p (plist-member plist prop))) - (when p (push (cons key (cadr p)) result))) - finally return result) - (let ((val (plist-get (cdr (assq state evil-state-properties)) prop))) - (if (and value (symbolp val) (boundp val)) - (symbol-value val) - val)))) - -(eval-and-compile (defalias 'evil-swap #'cl-rotatef)) - -(defmacro evil-sort (&rest vars) - "Sort the symbol values of VARS. -Place the smallest value in the first argument and the largest in the -last, sorting in between." - (if (= (length vars) 2) - `(when (> ,@vars) (evil-swap ,@vars)) - (let ((sorted (make-symbol "sortvar"))) - `(let ((,sorted (sort (list ,@vars) #'<))) - (setq ,@(apply #'nconc - (mapcar (lambda (var) (list var `(pop ,sorted))) - vars))))))) - -(defun evil-vector-to-string (vector) - "Turn VECTOR into a string, changing to \"\\e\"." - (mapconcat (lambda (c) (if (eq c 'escape) "\e" (list c))) - vector - "")) - -;;; Command properties - -(defmacro evil-define-command (command &rest body) - "Define a command COMMAND. - -\(fn COMMAND (ARGS...) DOC [[KEY VALUE]...] BODY...)" - (declare (indent defun) - (doc-string 3) - (debug (&define name - [&optional lambda-list] - [&optional stringp] - [&rest keywordp sexp] - [&optional ("interactive" [&rest form])] - def-body))) - (let ((interactive '(interactive)) - args doc doc-form keys) - ;; collect arguments - (when (listp (car body)) - (setq args (pop body))) - ;; collect docstring - (cond ((stringp (car body)) (setq doc (pop body))) - ((eq (car-safe (car body)) #'format) (setq doc-form (pop body)))) - ;; collect keywords - (while (keywordp (car body)) - (let* ((key (pop body)) - (arg (pop body))) - (setq keys (plist-put keys key arg)))) ; TODO: add keyword check - ;; collect `interactive' form - (when (eq (caar body) 'interactive) - (cl-destructuring-bind (form . attrs) - (apply #'evil-interactive-form (cdr (pop body))) - (setq interactive `(interactive ,form) - keys (evil-concat-plists keys attrs)))) - `(progn - ;; the compiler does not recognize `defun' inside `let' - ,(when (and command body) - `(defun ,command ,args - ,@(when doc `(,doc)) - ,interactive - ,@body)) - ,(when (and command doc-form) - `(put ',command 'function-documentation ,doc-form)) - ;; set command properties for symbol or lambda function - (let ((func ,(if (and (null command) body) - `(lambda ,args - ,interactive - ,@body) - `#',command))) - (apply #'evil-set-command-properties func ',keys) - func)))) - -(define-obsolete-variable-alias - 'evil-command-properties 'evil--command-properties "1.15.0") -(defvar evil--command-properties nil - "Specifications made by `evil-define-command'.") - -(defun evil-command-properties (command) - "Return the Evil command property list for COMMAND. -See also `evil-get-command-property'." - (if (symbolp command) (get command 'evil--command-plist) - (cdr (assq command evil--command-properties)))) -(define-obsolete-function-alias - 'evil-get-command-properties #'evil-command-properties "1.15.0") - -(gv-define-setter evil-command-properties (val command) - `(if (symbolp ,command) (put ,command 'evil--command-plist ,val) - ,(macroexp-let2 nil p `(assq ,command evil--command-properties) - `(if ,p (setcdr ,p ,val) - (push (cons ,command ,val) evil--command-properties))))) - -(defalias 'evil-has-command-properties-p #'evil-command-properties - "Whether Evil properties are defined for COMMAND. -See also `evil-has-command-property-p'.") - -(defun evil-has-command-property-p (command property) - "Whether COMMAND has Evil PROPERTY. -See also `evil-has-command-properties-p'." - (plist-member (evil-command-properties command) property)) - -(defun evil-get-command-property (command property &optional default) - "Return the value of Evil PROPERTY of COMMAND. -If the command does not have the property, return DEFAULT. -See also `evil-get-command-properties'." - (let ((p (plist-member (evil-command-properties command) property))) - (if p (cadr p) default))) - -(defun evil-add-command-properties (command &rest properties) - "Set each Evil command property KEY to its VAL for COMMAND. -To replace existing properties, use `evil-set-command-properties'. - -\(fn COMMAND [KEY VAL]...)" - (let ((props (evil-command-properties command))) - (while properties - (setq props (plist-put props (pop properties) (pop properties)))) - (setf (evil-command-properties command) props))) - -(defalias 'evil-set-command-property #'evil-add-command-properties - "Set PROPERTY to VALUE for COMMAND. -To set multiple properties at once, see -`evil-set-command-properties' and `evil-add-command-properties'. - -\(fn COMMAND PROPERTY VALUE)") -(defalias 'evil-put-command-property #'evil-set-command-property) - -(defun evil-set-command-properties (command &rest properties) - "Replace all of COMMAND's properties with PROPERTIES. -PROPERTIES should be a property list. -This erases all previous properties; to only add properties, -use `evil-set-command-property'." - (setf (evil-command-properties command) properties)) - -(defun evil-remove-command-properties (command &rest properties) - "Remove PROPERTIES from COMMAND. -PROPERTIES should be a list of properties (:PROP1 :PROP2 ...). -If PROPERTIES is the empty list, all properties are removed." - (let (plist) - (when properties - (setq plist (evil-command-properties command)) - (dolist (property properties) - (setq plist (evil-plist-delete property plist)))) - (apply #'evil-set-command-properties command plist))) - -(defun evil-yank-handler (&optional motion) - "Return the yank handler for MOTION. -MOTION defaults to the current motion." - (evil-get-command-property (or motion evil-this-motion) :yank-handler)) - -(defun evil-declare-motion (command) - "Declare COMMAND to be a movement function. -This ensures that it behaves correctly in visual state." - (evil-add-command-properties command :keep-visual t :repeat 'motion)) - -(defun evil-declare-repeat (command) - "Declare COMMAND to be repeatable." - (evil-add-command-properties command :repeat t)) - -(defun evil-declare-not-repeat (command) - "Declare COMMAND to be nonrepeatable." - (evil-add-command-properties command :repeat nil)) -(defalias 'evil-declare-ignore-repeat #'evil-declare-not-repeat) - -(defun evil-declare-change-repeat (command) - "Declare COMMAND to be repeatable by buffer changes rather than -keystrokes." - (evil-add-command-properties command :repeat 'change)) - -(defun evil-declare-insert-at-point-repeat (command) - "Declare COMMAND to be repeatable by buffer changes." - (evil-add-command-properties command :repeat 'insert-at-point)) - -(defun evil-declare-abort-repeat (command) - "Declare COMMAND to be nonrepeatable." - (evil-add-command-properties command :repeat 'abort)) - -(defun evil-delimited-arguments (string &optional count) - "Parse STRING as a sequence of delimited arguments. -Return a list of COUNT strings, or as many arguments as the string -contains. The first non-blank character is taken to be the delimiter. -If some arguments are missing from STRING, the resulting list is -padded with nil values. Two delimiters following directly after each -other gives an empty string." - (unless count (setq count -1)) - (let ((idx 0) delim regexp result) - (when (string-match "^[[:space:]]*\\([^[:space:]]\\)" string) - (setq delim (match-string 1 string) - regexp (format "%s\\(\\(?:\\\\.\\|[^%s]\\)*\\)" - (regexp-quote delim) delim)) - (while (and (/= count 0) (string-match regexp string idx) - (/= (match-beginning 1) (length string))) - (setq idx (match-end 0) - count (1- count)) - (push - (if (when (= count 0) - (not (string-match-p - (concat (regexp-quote delim) "[[:space:]]*$") - string idx))) - (substring string (match-beginning 1)) - (match-string 1 string)) - result))) - (dotimes (_ count) (push nil result)) - (nreverse result))) - -(defun evil-concat-charsets (&rest sets) - "Concatenate character sets. -A character set is the part between [ and ] in a regular expression. -If any character set is complemented, the result is also complemented." - (let ((bracket "") (complement "") (hyphen "") result) - (dolist (set sets) - (when (string-match-p "^\\^" set) - (setq set (substring set 1) - complement "^")) - (when (string-match-p "^]" set) - (setq set (substring set 1) - bracket "]")) - (when (string-match-p "^-" set) - (setq set (substring set 1) - hyphen "-")) - (setq result (concat result set))) - (format "%s%s%s%s" complement bracket hyphen result))) - -;;; Key sequences - -(defun evil-keypress-parser (&optional input) - "Read from keyboard or INPUT and build a command description. -Return (CMD COUNT), where COUNT is the numeric prefix argument. -Both COUNT and CMD may be nil." - (when input (setq unread-command-events (append input unread-command-events))) - (let (count negative) - (catch 'done - (while t - (let ((seq (read-key-sequence ""))) - (when seq - (let ((cmd (key-binding seq))) - (cond - ((null cmd) (throw 'done (list nil nil))) - ((arrayp cmd) ; keyboard macro, recursive call - (let ((cmd (evil-keypress-parser cmd))) - (throw 'done - (list (car cmd) - (if (or count (cadr cmd)) - (list (car cmd) (* (or count 1) - (or (cadr cmd) 1)))))))) - ((or (eq cmd #'digit-argument) - (and (equal seq "0") count)) - (let* ((event (aref seq (1- (length seq)))) - (char (or (when (characterp event) event) - (when (symbolp event) - (get event 'ascii-character)))) - (digit (when (integerp char) (- (logand char ?\177) ?0)))) - (setq count (+ (* 10 (or count 0)) digit)))) - ((eq cmd #'negative-argument) - (setq negative (not negative))) - (t - (throw 'done (list cmd - (and count - (* count - (if negative -1 1)))))))))))))) - -(defun evil-read-key (&optional prompt) - "Read a key from the keyboard. -Translates it according to the input method." - (let ((old-global-map (current-global-map)) - (new-global-map (make-sparse-keymap)) - (overriding-terminal-local-map nil) - (overriding-local-map evil-read-key-map) - seq char cmd) - (unwind-protect - (condition-case nil - (progn - (define-key new-global-map [menu-bar] - (lookup-key global-map [menu-bar])) - (define-key new-global-map [tab-bar] - (lookup-key global-map [tab-bar])) - (define-key new-global-map [tool-bar] - (lookup-key global-map [tool-bar])) - (setq new-global-map - (append new-global-map - (list (make-char-table 'display-table - 'self-insert-command)))) - (use-global-map new-global-map) - (setq seq (read-key-sequence prompt nil t) - char (aref seq 0) - cmd (key-binding seq)) - (while (arrayp cmd) - (setq char (aref cmd 0) - cmd (key-binding cmd))) - (cond - ((eq cmd 'self-insert-command) char) - (cmd (call-interactively cmd)) - (t (user-error "No replacement character typed")))) - (quit - (when (fboundp 'evil-repeat-abort) - (evil-repeat-abort)) - (signal 'quit nil))) - (use-global-map old-global-map)))) - -(defun evil-read-quoted-char () - "Command that calls `read-quoted-char'. -This command can be used wherever `read-quoted-char' is required -as a command. Its main use is in the `evil-read-key-map'." - (interactive) - (read-quoted-char)) - -(defvar evil-digraph-read-key-keymap - (let ((map (make-sparse-keymap)) - (n ?0)) - (while (<= n ?9) - (define-key map (vector (intern (concat "kp-" (string n)))) nil) - (cl-incf n)) - map) - "By default, used to exclude otherwise disabled fallbacks.") - -(declare-function evil-digraph "evil-digraphs") -(defun evil-read-digraph-char-with-overlay (overlay) - "Read two chars, displaying the first in OVERLAY, replacing \"?\". -Return the digraph from `evil-digraph', else return second char." - (interactive) - (unwind-protect - (let ((read-key-empty-map - (let ((map (copy-keymap evil-digraph-read-key-keymap))) - (set-keymap-parent map read-key-empty-map) - ;; Disable read-key-sequence unbound fallbacks, e.g. downcasing - (define-key map [t] 'dummy) - map)) - char1 char2) - ;; create overlay prompt - (overlay-put overlay 'invisible t) - (overlay-put overlay 'after-string - #("?" 0 1 (face minibuffer-prompt cursor 1))) - (setq char1 (read-key)) - (overlay-put overlay 'after-string - (propertize (char-to-string char1) - 'face 'minibuffer-prompt - 'cursor 1)) - (setq char2 (read-key)) - - (or (evil-digraph (list char1 char2)) - ;; use the last character if undefined - char2)) - (delete-overlay overlay))) - -(defun evil-read-digraph-char (&optional hide-chars) - "Read two keys from keyboard forming a digraph. -This function creates an overlay at (point), hiding the next -HIDE-CHARS characters. HIDE-CHARS defaults to 1." - (interactive) - (let ((overlay (make-overlay - (point) (min (+ (point) (or hide-chars 1)) - (point-max))))) - (evil-read-digraph-char-with-overlay overlay))) - -(defun evil-read-motion (&optional motion count type modifier) - "Read a MOTION, motion COUNT and motion TYPE from the keyboard. -The type may be overridden with MODIFIER, which may be a type -or a Visual selection as defined by `evil-define-visual-selection'. -Return a list (MOTION COUNT [TYPE])." - (let (command prefix) - (setq evil-this-type-modified nil) - (unless motion - (while (progn - (setq command (evil-keypress-parser) - motion (pop command) - prefix (pop command)) - (when prefix - (setq count - (if count - (string-to-number - (concat (number-to-string count) - (number-to-string prefix))) - prefix))) - ;; if the command is a type modifier, read more - (when (rassq motion evil-visual-alist) - (setq modifier - (or modifier - (car (rassq motion evil-visual-alist)))))))) - (when modifier - (setq type (or type (evil-type motion 'exclusive))) - (cond - ((eq modifier 'char) - ;; TODO: this behavior could be less hard-coded - (setq type (if (eq type 'exclusive) 'inclusive 'exclusive))) - (t (setq type modifier))) - (setq evil-this-type-modified type)) - (list motion count type))) - -(defun evil-mouse-events-p (keys) - "Return non-nil iff KEYS contains a mouse event." - (cl-loop for key across keys thereis - (or (mouse-event-p key) - (mouse-movement-p key)))) - -(defun evil-extract-count (keys) - "Split the key-sequence KEYS into prefix-argument and the rest. -Return the list (PREFIX CMD SEQ REST), where PREFIX is the -prefix count, CMD the command to be executed, SEQ the subsequence -calling CMD, and REST is all remaining events in the -key-sequence. PREFIX and REST may be nil if they do not exist. -If a command is bound to some keyboard macro, it is expanded -recursively." - (catch 'done - (let ((len (length keys)) - (beg 0) - (end 1) - found-prefix) - (while (<= end len) - (let* ((seq (substring keys beg end)) - (cmd (key-binding seq))) - (cond - ((memq cmd '(undefined nil)) - (user-error "No command bound to `%s'" seq)) - ((arrayp cmd) ; keyboard macro, replace command with macro - (setq keys (vconcat (substring keys 0 beg) - cmd - (substring keys end)) - end (1+ beg) - len (length keys))) - ((functionp cmd) - (if (or (memq cmd '(digit-argument negative-argument)) - (and found-prefix - (equal (vconcat seq) (vector ?0)))) - ;; skip those commands - (setq found-prefix t ; found at least one prefix argument - beg end - end (1+ end)) - ;; a real command, finish - (throw 'done - (list (unless (zerop beg) - (string-to-number - (concat (substring keys 0 beg)))) - cmd - seq - (when (< end len) - (substring keys end)))))) - (t ; append a further event - (setq end (1+ end)))))) - (user-error "Key sequence contains no complete binding")))) - -(defun evil-extract-append (file-or-append) - "Return an (APPEND . FILENAME) pair based on FILE-OR-APPEND. -FILE-OR-APPEND should either be a filename or a \">> FILE\" -directive. APPEND will be t if FILE-OR-APPEND is an append -directive and nil otherwise. FILENAME will be the extracted -filename." - (if (and (stringp file-or-append) - (string-match "\\(>> *\\)" file-or-append)) - (cons t (substring file-or-append (match-end 1))) - (cons nil file-or-append))) - -(defun evil-set-keymap-prompt (map prompt) - "Set the prompt-string of MAP to PROMPT." - (delq (keymap-prompt map) map) - (when prompt - (setcdr map (cons prompt (cdr map))))) - -(defun evil-lookup-key (map key) - "Return non-nil value if KEY is bound in MAP." - (let ((definition (lookup-key map key))) - (unless (numberp definition) ; in-band error - definition))) - -;;; Display - -(defun evil-set-cursor (specs) - "Change the cursor's apperance according to SPECS. -SPECS may be a cursor type as per `cursor-type', a color -string as passed to `set-cursor-color', a zero-argument -function for changing the cursor, or a list of the above. - -If SPECS is nil, this function does not have an effect; -pass (list nil) instead to indicate a nil `cursor-type' -\(i.e., to disable the cursor)." - (unless (and (not (functionp specs)) - (listp specs) - (null (cdr-safe (last specs)))) - (setq specs (list specs))) - (dolist (spec specs) - (cond - ((functionp spec) - (ignore-errors (funcall spec))) - ((stringp spec) - (evil-set-cursor-color spec)) - (t - (setq cursor-type spec))))) - -(defun evil-set-cursor-color (color) - "Set the cursor color to COLOR." - (unless (equal (frame-parameter nil 'cursor-color) color) - ;; `set-cursor-color' forces a redisplay, so only - ;; call it when the color actually changes - (set-cursor-color color))) - -(defun evil-refresh-cursor (&optional state buffer) - "Refresh the cursor for STATE in BUFFER. -BUFFER defaults to the current buffer. If STATE is nil the -cursor type is either `evil-force-cursor' or the current state." - (defvar evil-local-mode) - (when evil-local-mode - (let* ((state (or state evil-force-cursor evil-state 'normal)) - (default (or evil-default-cursor t)) - (cursor (evil-state-property state :cursor t)) - (color (or (and (stringp cursor) cursor) - (and (listp cursor) (evil-member-if #'stringp cursor)) - (frame-parameter nil 'cursor-color)))) - (with-current-buffer (or buffer (current-buffer)) - ;; if both STATE and `evil-default-cursor' - ;; specify a color, don't set it twice - (evil-set-cursor (if (and color (listp default)) - (cl-remove-if #'stringp default) - default)) - (evil-set-cursor cursor))))) - -(defmacro evil-save-cursor (&rest body) - "Save the current cursor; execute BODY; restore the cursor." - (declare (indent defun) (debug t) (obsolete nil "1.15.0")) - `(let ((cursor cursor-type) - (color (frame-parameter (selected-frame) 'cursor-color)) - (inhibit-quit t)) - (unwind-protect - (progn ,@body) - (setq cursor-type cursor) - (evil-set-cursor-color color)))) - -(defun evil-echo (string &rest args) - "Display an unlogged message in the echo area. -That is, the message is not logged in the *Messages* buffer. -\(To log the message, just use `message'.)" - (unless evil-no-display - (let (message-log-max) - (apply #'message string args)))) - -(defun evil-echo-area-save () - "Save the current echo area in `evil-echo-area-message'." - (setq evil-echo-area-message (current-message))) - -(defun evil-echo-area-restore () - "Restore the echo area from `evil-echo-area-message'. -Does not restore if `evil-write-echo-area' is non-nil." - (unless evil-write-echo-area - (if evil-echo-area-message - (message "%s" evil-echo-area-message) - (message nil))) - (setq evil-echo-area-message nil - evil-write-echo-area nil)) - -;; toggleable version of `with-temp-message' -(defmacro evil-save-echo-area (&rest body) - "Save the echo area; execute BODY; restore the echo area. -Intermittent messages are not logged in the *Messages* buffer." - (declare (indent defun) (debug t)) - `(let ((inhibit-quit t) - evil-echo-area-message evil-write-echo-area) - (evil-echo-area-save) - (unwind-protect - (progn ,@body) - (evil-echo-area-restore)))) - -(defmacro evil-without-display (&rest body) - "Execute BODY without Evil displays. -Inhibits echo area messages, mode line updates and cursor changes." - (declare (indent defun) - (debug t)) - `(let ((evil-no-display t)) - ,@body)) - -(defun evil-count-lines (beg end) - "Return absolute line-number-difference betweeen BEG and END. -This should give the same results no matter where on the line BEG -and END are." - (if (= beg end) - 0 - (let ((end-at-bol (save-excursion (goto-char (max beg end)) - (bolp)))) - (if end-at-bol - (count-lines beg end) - (1- (count-lines beg end)))))) - -;;; Movement - -(defun evil-normalize-position (pos) - "Return POS if it does not exceed the buffer boundaries. -If POS is less than `point-min', return `point-min'. -Is POS is more than `point-max', return `point-max'. -If POS is a marker, return its position." - (cond - ((not (number-or-marker-p pos)) - pos) - ((< pos (point-min)) - (point-min)) - ((> pos (point-max)) - (point-max)) - ((markerp pos) - (marker-position pos)) - (t - pos))) - -(defmacro evil-save-goal-column (&rest body) - "Restore the goal column after execution of BODY. -See also `evil-save-column'." - (declare (indent defun) - (debug t)) - `(let ((goal-column goal-column) - (temporary-goal-column temporary-goal-column)) - ,@body)) - -(defmacro evil-save-column (&rest body) - "Restore the column after execution of BODY. -See also `evil-save-goal-column'." - (declare (indent defun) - (debug t)) - `(let ((col (current-column))) - (evil-save-goal-column - ,@body - (move-to-column col)))) - -(defun evil--stick-to-eol-p () - "Called by vertical movement commands to help determine cursor position." - (and evil-track-eol - (eq (or goal-column temporary-goal-column) most-positive-fixnum) - (memq last-command '(next-line previous-line)))) - -(defun evil-eolp () - "Like `eolp' but accounts for `evil-move-beyond-eol' being nil." - (ignore-errors - (save-excursion - (unless (or evil-move-beyond-eol (memq evil-state '(insert replace))) - (forward-char)) - (eolp)))) - -(defmacro evil-ensure-column (&rest body) - "Execute BODY so that column after execution is correct. -If `evil-start-of-line' is nil, treat BODY as if it were a `next-line' command. -This mostly copies the approach of Emacs' `line-move-1', but is modified -so it is more compatible with Evil's notion of EOL tracking." - (declare (indent defun) (debug t)) - `(progn - (unless evil-start-of-line - (setq this-command 'next-line - temporary-goal-column - (cond ((memq last-command '(next-line previous-line)) - temporary-goal-column) - ((and track-eol (eolp) (not (bolp))) most-positive-fixnum) - (t (current-column))))) - ,@body - (if evil-start-of-line - (evil-first-non-blank) - (line-move-to-column - (or goal-column - (if (consp temporary-goal-column) - ;; Guard against a negative value as `temporary-goal-column' - ;; may have a negative component when both `whitespace-mode' - ;; and `display-line-numbers-mode' are enabled (#1297). - (max 0 (+ (truncate (car temporary-goal-column)) - (cdr temporary-goal-column))) - temporary-goal-column)))))) - -(defun evil-narrow (beg end) - "Restrict the buffer to BEG and END. -BEG or END may be nil, specifying a one-sided restriction including -`point-min' or `point-max'. See also `evil-with-restriction.'" - (declare (obsolete nil "1.15.0")) - (narrow-to-region - (if beg (max beg (point-min)) (point-min)) - (if end (min end (point-max)) (point-max)))) - -(defmacro evil-with-restriction (beg end &rest body) - "Execute BODY with the buffer narrowed to BEG and END. -BEG or END may be nil to specify a one-sided restriction." - (declare (indent 2) (debug t)) - `(save-restriction - (let ((evil-restriction-stack - (cons (cons (point-min) (point-max)) evil-restriction-stack))) - (narrow-to-region (or ,beg (point-min)) (or ,end (point-max))) - ,@body))) - -(defmacro evil-without-restriction (&rest body) - "Execute BODY with the top-most narrowing removed. -This works only if the previous narrowing has been generated by -`evil-with-restriction'." - (declare (indent defun) (debug t)) - `(save-restriction - (widen) - (narrow-to-region (car (car evil-restriction-stack)) - (cdr (car evil-restriction-stack))) - (let ((evil-restriction-stack (cdr evil-restriction-stack))) - ,@body))) - -(defmacro evil-narrow-to-field (&rest body) - "Narrow to the current field." - (declare (indent defun) - (debug t)) - `(evil-with-restriction (field-beginning) (field-end) - ,@body)) - -(defun evil-move-beginning-of-line (&optional arg) - "Move to the beginning of the line as displayed. -Like `move-beginning-of-line', but retains the goal column." - (evil-save-goal-column - (move-beginning-of-line arg) - (beginning-of-line))) - -(defun evil-move-end-of-line (&optional arg) - "Move to the end of the line as displayed. -Like `move-end-of-line', but retains the goal column." - (evil-save-goal-column - (move-end-of-line arg) - (end-of-line))) - -(defun evil-adjust-cursor (&optional _) - "Move point one character back if at the end of a non-empty line. -This behavior is controlled by `evil-move-beyond-eol'." - (and (not evil-move-beyond-eol) - (eolp) - (evil-move-cursor-back t))) - -(defun evil-move-cursor-back (&optional force) - "Move point one character back within the current line. -Contingent on the variable `evil-move-cursor-back' or the FORCE -argument. Movement is constrained to the current field." - (or (not (or evil-move-cursor-back force)) - (bolp) - (when (bound-and-true-p visual-line-mode) - (= (point) (save-excursion (vertical-motion 0) (point)))) - (goto-char (constrain-to-field (1- (point)) (point))))) - -(defun evil-line-position (line &optional column) - "Return the position of LINE. -If COLUMN is specified, return its position on the line. -A negative number means the end of the line." - (save-excursion - (goto-char (point-min)) - (forward-line (1- line)) - (when (numberp column) - (if (< column 0) - (forward-line) - (move-to-column column))) - (point))) - -(defun evil-column (&optional pos) - "Return the horizontal position of POS. -POS defaults to point." - (save-excursion - (when pos - (goto-char pos)) - (current-column))) - -(defun evil-move-to-column (column &optional dir force) - "Move point to column COLUMN in the current line. -Places point at left of the tab character (at the right if DIR -is non-nil) and returns point." - (interactive "p") - (move-to-column column force) - (unless force - (when (or (not dir) (and (numberp dir) (< dir 1))) - (when (> (current-column) column) - (evil-move-cursor-back)))) - (point)) - -(defmacro evil-loop (spec &rest body) - "Loop with countdown variable. -Evaluate BODY with VAR counting down from COUNT to 0. -COUNT can be negative, in which case VAR counts up instead. -The return value is the value of VAR when the loop -terminates, which is 0 if the loop completes successfully. -RESULT specifies a variable for storing this value. - -\(fn (VAR COUNT [RESULT]) BODY...)" - (declare (indent defun) (debug dolist) (obsolete nil "1.15.0")) - (let* ((i (make-symbol "loopvar")) - (var (pop spec)) - (count (pop spec)) - (result (pop spec))) - (setq var (or (unless (eq var result) var) i) - result (or result var)) - `(let ((,var ,count)) - (setq ,result ,var) - (while (/= ,var 0) - ,@body - (if (> ,var 0) - (setq ,var (1- ,var)) - (setq ,var (1+ ,var))) - (setq ,result ,var)) - ,var))) - -;;; Motions - -(defmacro evil-motion-loop (spec &rest body) - "Loop a certain number of times. -Evaluate BODY repeatedly COUNT times with VAR bound to 1 or -1, -depending on the sign of COUNT. Set RESULT, if specified, to the -number of unsuccessful iterations, which is 0 if the loop completes -successfully. This is also the return value. - -Each iteration must move point; if point does not change, the loop -immediately quits. - -\(fn (VAR COUNT [RESULT]) BODY...)" - (declare (indent defun) - (debug ((symbolp form &optional symbolp) body))) - (let* ((var (or (pop spec) (make-symbol "unitvar"))) - (count (or (pop spec) 0)) - (result (or (pop spec) var)) - (i (make-symbol "loopvar"))) - `(let* ((,i ,count) - (,var (if (< ,i 0) -1 1))) - (while (and (/= ,i 0) - (/= (point) (progn ,@body (point)))) - (setq ,i (if (< ,i 0) (1+ ,i) (1- ,i)))) - (setq ,result ,i)))) - -(defun evil-signal-at-bob-or-eob (&optional count) - "Signal error if `point' is at boundaries. -If `point' is at bob and COUNT is negative this function signals -`beginning-of-buffer'. If `point' is at eob and COUNT is positive -this function signals `end-of-buffer'. This function should be used -in motions. COUNT defaults to 1." - (setq count (or count 1)) - (cond - ((< count 0) (evil-signal-at-bob)) - ((> count 0) (evil-signal-at-eob)))) - -(defun evil-signal-at-bob () - "Signal `beginning-of-buffer' if `point' is at bob. -This function should be used in backward motions. If `point' is at -bob so that no further backward motion is possible the error -`beginning-of-buffer' is raised." - (when (bobp) (signal 'beginning-of-buffer nil))) - -(defun evil-signal-at-eob () - "Signal `end-of-buffer' if `point' is at eob. -This function should be used in forward motions. If `point' is close -to eob so that no further forward motion is possible the error -`end-of-buffer' is raised. This is the case if `point' is at -`point-max' or if is one position before `point-max', -`evil-move-beyond-eol' is nil and `point' is not at the end -of a line. The latter is necessary because `point' cannot be -moved to `point-max' if `evil-move-beyond-eol' is nil and -the last line in the buffer is not empty." - (when (or (eobp) - (and (not (eolp)) - (not evil-move-beyond-eol) - (save-excursion (forward-char) (eobp)))) - (signal 'end-of-buffer nil))) - -(defmacro evil-with-hproject-point-on-window (&rest body) - "Project point after BODY to current window. -If point is on a position left or right of the current window -then it is moved to the left and right boundary of the window, -respectively. If `auto-hscroll-mode' is non-nil then the left and -right positions are increased or decreased, respectively, by -`horizontal-margin' so that no automatic scrolling occurs." - (declare (indent defun) - (debug t)) - (let ((diff (make-symbol "diff")) - (left (make-symbol "left")) - (right (make-symbol "right"))) - `(let ((,diff (if auto-hscroll-mode (1+ hscroll-margin) 0)) - auto-hscroll-mode) - ,@body - (let* ((,left (+ (window-hscroll) ,diff)) - (,right (+ (window-hscroll) (window-width) (- ,diff) -1))) - (move-to-column (min (max (current-column) ,left) ,right)))))) - -(defun evil-forward-not-thing (thing &optional count) - "Move point to the end or beginning of the complement of THING." - (evil-motion-loop (dir (or count 1)) - (let (bnd) - (cond - ((> dir 0) - (while (and (setq bnd (bounds-of-thing-at-point thing)) - (< (point) (cdr bnd))) - (goto-char (cdr bnd))) - ;; no thing at (point) - (if (zerop (forward-thing thing)) - ;; now at the end of the next thing - (let ((bnd (bounds-of-thing-at-point thing))) - (if (or (< (car bnd) (point)) ; end of a thing - (= (car bnd) (cdr bnd))) ; zero width thing - (goto-char (car bnd)) - ;; beginning of yet another thing, go back - (forward-thing thing -1))) - (goto-char (point-max)))) - (t - (while (and (not (bobp)) - (setq bnd (progn (backward-char) (bounds-of-thing-at-point thing))) - (< (point) (cdr bnd))) - (goto-char (car bnd))) - ;; either bob or no thing at point - (goto-char - (if (and (not (bobp)) - (zerop (forward-thing thing -1)) - (setq bnd (bounds-of-thing-at-point thing))) - (cdr bnd) - (point-min)))))))) - -(defun evil-bounds-of-not-thing-at-point (thing &optional which) - "Return the bounds of a complement of THING at point. -If there is a THING at point nil is returned. Otherwise if WHICH -is nil or 0 a cons cell (BEG . END) is returned. If WHICH is -negative the beginning is returned. If WHICH is positive the END -is returned." - (let ((pnt (point))) - (let ((beg (save-excursion - (and (zerop (forward-thing thing -1)) - (forward-thing thing)) - (if (> (point) pnt) (point-min) (point)))) - (end (save-excursion - (and (zerop (forward-thing thing)) - (forward-thing thing -1)) - (if (< (point) pnt) (point-max) (point))))) - (when (and (<= beg (point) end) (< beg end)) - (cond - ((or (not which) (zerop which)) (cons beg end)) - ((< which 0) beg) - ((> which 0) end)))))) - -(defun evil-forward-nearest (count &rest forwards) - "Move point forward to the first of several motions. -FORWARDS is a list of forward motion functions (i.e. each moves -point forward to the next end of a text object (if passed a +1) -or backward to the preceeding beginning of a text object (if -passed a -1)). This function calls each of these functions once -and moves point to the nearest of the resulting positions. If -COUNT is positive point is moved forward COUNT times, if negative -point is moved backward -COUNT times." - (evil-motion-loop (dir (or count 1)) - (let ((pnt (point)) - (nxt (if (< dir 0) (point-min) (point-max)))) - (dolist (fwd forwards) - (goto-char pnt) - (ignore-errors - (evil-with-restriction - (when (< dir 0) - (save-excursion - (goto-char nxt) - (line-beginning-position 0))) - (when (> dir 0) - (save-excursion - (goto-char nxt) - (line-end-position 2))) - (and (zerop (funcall fwd dir)) - (/= (point) pnt) - (if (< dir 0) (> (point) nxt) (< (point) nxt)) - (setq nxt (point)))))) - (goto-char nxt)))) - -(defun bounds-of-evil-string-at-point (&optional state) - "Return the bounds of a string at point. -If STATE is given it used a parsing state at point." - (save-excursion - (let ((state (or state (syntax-ppss)))) - (when (nth 3 state) - (cons (nth 8 state) - (when (parse-partial-sexp - (point) (point-max) nil nil state 'syntax-table) - (point))))))) -(put 'evil-string 'bounds-of-thing-at-point #'bounds-of-evil-string-at-point) - -(defun bounds-of-evil-comment-at-point () - "Return the bounds of a string at point." - (save-excursion - (let ((state (syntax-ppss))) - (when (nth 4 state) - (cons (nth 8 state) - (when (parse-partial-sexp - (point) (point-max) nil nil state 'syntax-table) - (point))))))) -(put 'evil-comment 'bounds-of-thing-at-point #'bounds-of-evil-comment-at-point) - -;; The purpose of this function is to provide line motions which -;; preserve the column. This is how `previous-line' and `next-line' -;; work, but unfortunately the behaviour is hard-coded: if and only if -;; the last command was `previous-line' or `next-line', the column is -;; preserved. Furthermore, in contrast to Vim, when we cannot go -;; further, those motions move point to the beginning resp. the end of -;; the line (we never want point to leave its column). The code here -;; comes from simple.el, and I hope it will work in future. -(declare-function evil-end-of-visual-line "evil-commands") -(defun evil-line-move (count &optional noerror) - "Like `line-move' but conserves the column. -Signal an error at buffer boundaries unless NOERROR is non-nil." - (setq this-command (if (< count 0) 'previous-line 'next-line)) - (let ((last-command - ;; Reset tmp goal column between visual/logical movement - (when (or (eq line-move-visual (consp temporary-goal-column)) - (eq temporary-goal-column most-positive-fixnum)) - last-command)) - (opoint (point))) - (if (and line-move-visual - (eq temporary-goal-column most-positive-fixnum) - (memq last-command '(next-line previous-line))) - (let (temporary-goal-column) (evil-end-of-visual-line (1+ count))) - (condition-case err - (line-move count) - ((beginning-of-buffer end-of-buffer) - (let* ((raw-col (or goal-column - (car-safe temporary-goal-column) - temporary-goal-column)) - (col (if (numberp raw-col) (max 0 raw-col) 0))) - (line-move-finish col opoint (< count 0))) - (or noerror (/= (point) opoint) (signal (car err) (cdr err)))))))) - -(defun evil-forward-syntax (syntax &optional count) - "Move point to the end or beginning of a sequence of characters in SYNTAX. -Stop on reaching a character not in SYNTAX." - (let ((notsyntax (if (= (aref syntax 0) ?^) - (substring syntax 1) - (concat "^" syntax)))) - (evil-motion-loop (dir (or count 1)) - (cond - ((< dir 0) - (skip-syntax-backward notsyntax) - (skip-syntax-backward syntax)) - (t - (skip-syntax-forward notsyntax) - (skip-syntax-forward syntax)))))) - -(defun evil-forward-chars (chars &optional count) - "Move point to the end or beginning of a sequence of CHARS. -CHARS is a character set as inside [...] in a regular expression." - (let ((notchars (if (= (aref chars 0) ?^) - (substring chars 1) - (concat "^" chars)))) - (evil-motion-loop (dir (or count 1)) - (cond - ((< dir 0) - (skip-chars-backward notchars) - (skip-chars-backward chars)) - (t - (skip-chars-forward notchars) - (skip-chars-forward chars)))))) - -(defun evil-up-block (beg end &optional count) - "Move point to the end or beginning of text enclosed by BEG and END. -BEG and END should be regular expressions matching the opening -and closing delimiters, respectively. If COUNT is greater than -zero point is moved forward otherwise it is moved -backwards. Whenever an opening delimiter is found the COUNT is -increased by one, if a closing delimiter is found the COUNT is -decreased by one. The motion stops when COUNT reaches zero. The -match-data reflects the last successful match (that caused COUNT -to reach zero). The behaviour of this functions is similar to -`up-list'." - (let* ((count (or count 1)) - (forwardp (> count 0)) - (dir (if forwardp +1 -1))) - (catch 'done - (while (not (zerop count)) - (let* ((pnt (point)) - (cl (save-excursion - (and (re-search-forward (if forwardp end beg) nil t dir) - (or (/= pnt (point)) - (progn - ;; zero size match, repeat search from - ;; the next position - (forward-char dir) - (re-search-forward (if forwardp end beg) nil t dir))) - (point)))) - (match (match-data t)) - (op (save-excursion - (and (not (equal beg end)) - (re-search-forward (if forwardp beg end) cl t dir) - (or (/= pnt (point)) - (progn - ;; zero size match, repeat search from - ;; the next position - (forward-char dir) - (re-search-forward (if forwardp beg end) cl t dir))) - (point))))) - (cond - ((not cl) - (goto-char (if forwardp (point-max) (point-min))) - (set-match-data nil) - (throw 'done count)) - (t - (if op - (progn - (setq count (if forwardp (1+ count) (1- count))) - (goto-char op)) - (setq count (if forwardp (1- count) (1+ count))) - (if (zerop count) (set-match-data match)) - (goto-char cl)))))) - 0))) - -(defun evil-up-paren (open close &optional count) - "Move point to the end or beginning of balanced parentheses. -OPEN and CLOSE should be characters identifying the opening and -closing parenthesis, respectively. If COUNT is greater than zero -point is moved forward otherwise it is moved backwards. Whenever -an opening delimiter is found the COUNT is increased by one, if a -closing delimiter is found the COUNT is decreased by one. The -motion stops when COUNT reaches zero. The match-data reflects the -last successful match (that caused COUNT to reach zero)." - ;; Always use the default `forward-sexp-function'. This is important - ;; for modes that use a custom one like `python-mode'. - ;; (addresses #364) - (let (forward-sexp-function up-list-function) - (with-syntax-table (copy-syntax-table (syntax-table)) - (modify-syntax-entry open (format "(%c" close)) - (modify-syntax-entry close (format ")%c" open)) - (let ((rest (evil-motion-loop (dir count) - (let ((pnt (point))) - (condition-case nil - (cond - ((> dir 0) - (while (progn - (up-list dir t) - (/= (char-before) close)))) - (t - (while (progn - (up-list dir t) - (/= (char-after) open))))) - (error (goto-char pnt))))))) - (cond - ((= rest count) (set-match-data nil)) - ((> count 0) (set-match-data (list (1- (point)) (point)))) - (t (set-match-data (list (point) (1+ (point)))))) - rest)))) - -(defun evil-up-xml-tag (&optional count) - "Move point to the end or beginning of balanced xml tags. -If COUNT is greater than zero point is moved forward otherwise it is moved -backwards. Whenever an opening delimiter is found the COUNT is increased by -one, if a closing delimiter is found the COUNT is decreased by one. The motion -stops when COUNT reaches zero. The match data reflects the last successful -match (that caused COUNT to reach zero)." - (let* ((dir (if (> (or count 1) 0) +1 -1)) - (count (abs (or count 1))) - (op (if (> dir 0) 1 2)) - (cl (if (> dir 0) 2 1)) - (orig (point)) - pnt tags match) - (catch 'done - (while (> count 0) - ;; find the previous opening tag - (while - (and (setq match - (re-search-forward - "<\\([^/ >\n]+\\)\\(?:=>?\\|[^\"/>]\\|\"[^\"]*\"\\)*?>\\|]+?\\)>" - nil t dir)) - (cond - ((match-beginning op) - (push (match-string op) tags)) - ((null tags) nil) ; free closing tag - ((and (< dir 0) - (string= (car tags) (match-string cl))) - ;; in backward direction we only accept matching - ;; tags. If the current tag is a free opener - ;; without matching closing tag, the subsequent - ;; test will make us ignore this tag - (pop tags)) - ((and (> dir 0)) - ;; non matching openers are considered free openers - (while (and tags - (not (string= (car tags) - (match-string cl)))) - (pop tags)) - (pop tags))))) - (unless (setq match (and match (match-data t))) - (setq match nil) - (throw 'done count)) - ;; found closing tag, look for corresponding opening tag - (cond - ((> dir 0) - (setq pnt (match-end 0)) - (goto-char (match-beginning 0))) - (t - (setq pnt (match-beginning 0)) - (goto-char (match-end 0)))) - (let* ((tag (match-string cl)) - (refwd (concat "<\\(/\\)?" - (regexp-quote tag) - "\\(?:>\\|[ \n]\\(?:[^\"/>]\\|\"[^\"]*\"\\)*?>\\)")) - (cnt 1)) - (while (and (> cnt 0) (re-search-backward refwd nil t dir)) - (setq cnt (+ cnt (if (match-beginning 1) dir (- dir))))) - (if (zerop cnt) (setq count (1- count) tags nil)) - (goto-char pnt))) - (if (> count 0) - (set-match-data nil) - (set-match-data match) - (goto-char (if (> dir 0) (match-end 0) (match-beginning 0))))) - ;; if not found, set to point-max/point-min - (unless (zerop count) - (set-match-data nil) - (goto-char (if (> dir 0) (point-max) (point-min))) - (if (/= (point) orig) (setq count (1- count)))) - (* dir count))) - -(defun evil-forward-quote (quote &optional count) - "Move point to the end or beginning of a string. -QUOTE is the character delimiting the string. If COUNT is greater -than zero point is moved forward otherwise it is moved -backwards." - (let (reset-parser) - (with-syntax-table (copy-syntax-table (syntax-table)) - (unless (= (char-syntax quote) ?\") - (modify-syntax-entry quote "\"") - (setq reset-parser t)) - ;; global parser state is out of state, use local one - (let* ((pnt (point)) - (state (save-excursion - (beginning-of-defun) - (parse-partial-sexp (point) pnt nil nil (syntax-ppss)))) - (bnd (bounds-of-evil-string-at-point state))) - (when (and bnd (< (point) (cdr bnd))) - ;; currently within a string - (if (> count 0) - (progn - (goto-char (cdr bnd)) - (setq count (1- count))) - (goto-char (car bnd)) - (setq count (1+ count)))) - ;; forward motions work with local parser state - (cond - ((> count 0) - ;; no need to reset global parser state because we only use - ;; the local one - (setq reset-parser nil) - (catch 'done - (while (and (> count 0) (not (eobp))) - (setq state (parse-partial-sexp - (point) (point-max) nil nil state 'syntax-table)) - (cond - ((nth 3 state) - (setq bnd (bounds-of-thing-at-point 'evil-string)) - (goto-char (cdr bnd)) - (setq count (1- count))) - ((eobp) (goto-char pnt) (throw 'done nil)))))) - ((< count 0) - ;; need to update global cache because of backward motion - (setq reset-parser (and reset-parser (point))) - (save-excursion - (beginning-of-defun) - (syntax-ppss-flush-cache (point))) - (catch 'done - (while (and (< count 0) (not (bobp))) - (setq pnt (point)) - (while (and (not (bobp)) - (or (eobp) (/= (char-after) quote))) - (backward-char)) - (cond - ((setq bnd (bounds-of-thing-at-point 'evil-string)) - (goto-char (car bnd)) - (setq count (1+ count))) - ((bobp) (goto-char pnt) (throw 'done nil)) - (t (backward-char)))))) - (t (setq reset-parser nil))))) - (when reset-parser - ;; reset global cache - (save-excursion - (goto-char reset-parser) - (beginning-of-defun) - (syntax-ppss-flush-cache (point)))) - count)) - -;;; Thing-at-point motion functions for Evil text objects and motions -(defun forward-evil-empty-line (&optional count) - "Move forward COUNT empty lines." - (setq count (or count 1)) - (cond - ((> count 0) - (while (and (> count 0) (not (eobp))) - (when (and (bolp) (eolp)) - (setq count (1- count))) - (forward-line 1))) - (t - (while (and (< count 0) (not (bobp)) - (zerop (forward-line -1))) - (when (and (bolp) (eolp)) - (setq count (1+ count)))))) - count) - -(defun forward-evil-space (&optional count) - "Move forward COUNT whitespace sequences [[:space:]]+." - (evil-forward-chars "[:space:]" count)) - -(defun forward-evil-word (&optional count) - "Move forward COUNT words. -Moves point COUNT words forward or (- COUNT) words backward if -COUNT is negative. Point is placed after the end of the word (if -forward) or at the first character of the word (if backward). A -word is a sequence of word characters matching -\[[:word:]] (recognized by `forward-word'), a sequence of -non-whitespace non-word characters '[^[:word:]\\n\\r\\t\\f ]', or -an empty line matching ^$." - (evil-forward-nearest - count - #'(lambda (&optional cnt) - (let ((word-separating-categories evil-cjk-word-separating-categories) - (word-combining-categories evil-cjk-word-combining-categories) - (pnt (point))) - (forward-word cnt) - (if (= pnt (point)) cnt 0))) - #'(lambda (&optional cnt) - (evil-forward-chars "^[:word:]\n\r\t\f " cnt)) - #'forward-evil-empty-line)) - -(defun forward-evil-WORD (&optional count) - "Move forward COUNT \"WORDS\". -Moves point COUNT WORDS forward or (- COUNT) WORDS backward if -COUNT is negative. Point is placed after the end of the WORD (if -forward) or at the first character of the WORD (if backward). A -WORD is a sequence of non-whitespace characters -'[^\\n\\r\\t\\f ]', or an empty line matching ^$." - (evil-forward-nearest count - #'(lambda (&optional cnt) - (evil-forward-chars "^\n\r\t\f " cnt)) - #'forward-evil-empty-line)) - -(defun forward-evil-symbol (&optional count) - "Move forward COUNT symbols. -Moves point COUNT symbols forward or (- COUNT) symbols backward -if COUNT is negative. Point is placed after the end of the -symbol (if forward) or at the first character of the symbol (if -backward). A symbol is either determined by `forward-symbol', or -is a sequence of characters not in the word, symbol or whitespace -syntax classes." - (evil-forward-nearest - count - #'(lambda (&optional cnt) - (evil-forward-syntax "^w_->" cnt)) - #'(lambda (&optional cnt) - (let ((pnt (point))) - (forward-symbol cnt) - (if (= pnt (point)) cnt 0))) - #'forward-evil-empty-line)) - -(defun forward-evil-defun (&optional count) - "Move forward COUNT defuns. -Moves point COUNT defuns forward or (- COUNT) defuns backward -if COUNT is negative. A defun is defined by -`beginning-of-defun' and `end-of-defun' functions." - (evil-motion-loop (dir (or count 1)) - (if (> dir 0) (end-of-defun) (beginning-of-defun)))) - -(defun forward-evil-sentence (&optional count) - "Move forward COUNT sentences. -Moves point COUNT sentences forward or (- COUNT) sentences -backward if COUNT is negative. This function is the same as -`forward-sentence' but returns the number of sentences that could -NOT be moved over." - (evil-motion-loop (dir (or count 1)) - (ignore-errors (forward-sentence dir)))) - -(defun forward-evil-paragraph (&optional count) - "Move forward COUNT paragraphs. -Moves point COUNT paragraphs forward or (- COUNT) paragraphs backward -if COUNT is negative. A paragraph is defined by -`start-of-paragraph-text' and `forward-paragraph' functions." - (evil-motion-loop (dir (or count 1)) - (cond - ((> dir 0) (forward-paragraph)) - ((not (bobp)) (start-of-paragraph-text) (beginning-of-line))))) - -(defvar evil-forward-quote-char ?\" - "The character to be used by `forward-evil-quote'.") - -(defun forward-evil-quote (&optional count) - "Move forward COUNT strings. -The quotation character is specified by the global variable -`evil-forward-quote-char'. This character is passed to -`evil-forward-quote'." - (evil-forward-quote evil-forward-quote-char count)) - -(defun forward-evil-quote-simple (&optional count) - "Move forward COUNT strings. -The quotation character is specified by the global variable -`evil-forward-quote-char'. This functions uses Vim's rules -parsing from the beginning of the current line for quotation -characters. It should only be used when looking for strings -within comments and buffer *must* be narrowed to the comment." - (let ((dir (if (> (or count 1) 0) 1 -1)) - (ch evil-forward-quote-char) - (pnt (point)) - (cnt 0)) - (beginning-of-line) - ;; count number of quotes before pnt - (while (< (point) pnt) - (when (= (char-after) ch) - (setq cnt (1+ cnt))) - (forward-char)) - (setq cnt (- (* 2 (abs count)) (mod cnt 2))) - (cond - ((> dir 0) - (while (and (not (eolp)) (not (zerop cnt))) - (when (= (char-after) ch) (setq cnt (1- cnt))) - (forward-char)) - (when (not (zerop cnt)) (goto-char (point-max)))) - (t - (while (and (not (bolp)) (not (zerop cnt))) - (when (= (char-before) ch) (setq cnt (1- cnt))) - (forward-char -1)) - (when (not (zerop cnt)) (goto-char (point-min))))) - (/ cnt 2))) - -;;; Motion functions -(defun evil-forward-beginning (thing &optional count) - "Move forward to beginning of THING. -The motion is repeated COUNT times." - (setq count (or count 1)) - (if (< count 0) - (forward-thing thing count) - (let ((bnd (bounds-of-thing-at-point thing)) - rest) - (when (and bnd (< (point) (cdr bnd))) - (goto-char (cdr bnd))) - (ignore-errors - (when (zerop (setq rest (forward-thing thing count))) - (when (and (bounds-of-thing-at-point thing) - (not (bobp)) - ;; handle final empty line - (not (and (bolp) (eobp)))) - (backward-char)) - (beginning-of-thing thing))) - rest))) - -(defun evil-backward-beginning (thing &optional count) - "Move backward to beginning of THING. -The motion is repeated COUNT times. This is the same as calling -`evil-backward-beginning' with -COUNT." - (evil-forward-beginning thing (- (or count 1)))) - -(defun evil-forward-end (thing &optional count) - "Move forward to end of THING. -The motion is repeated COUNT times." - (setq count (or count 1)) - (if (> count 0) - (progn (unless (eobp) (forward-char)) - (prog1 (forward-thing thing count) - (unless (bobp) (backward-char)))) - (let ((bnd (bounds-of-thing-at-point thing)) - rest) - (when (and bnd (< (point) (cdr bnd) )) - (goto-char (car bnd))) - (ignore-errors - (when (zerop (setq rest (forward-thing thing count))) - (end-of-thing thing) - (backward-char))) - rest))) - -(defun evil-backward-end (thing &optional count) - "Move backward to end of THING. -The motion is repeated COUNT times. This is the same as calling -`evil-backward-end' with -COUNT." - (evil-forward-end thing (- (or count 1)))) - -(defun evil-forward-word (&optional count) - "Move by words. -Moves point COUNT words forward or (- COUNT) words backward if -COUNT is negative. This function is the same as `forward-word' -but returns the number of words by which point could *not* be -moved." - (setq count (or count 1)) - (let* ((dir (if (>= count 0) +1 -1)) - (count (abs count))) - (while (and (> count 0) - (forward-word dir)) - (setq count (1- count))) - count)) - -(defun evil-in-comment-p (&optional pos) - "Check if POS is within a comment according to current syntax. -If POS is nil, (point) is used. The return value is the beginning -position of the comment." - (setq pos (or pos (point))) - (let ((chkpos - (cond - ((eobp) pos) - ((= (char-syntax (char-after)) ?<) (1+ pos)) - ((and (not (zerop (logand (car (syntax-after (point))) - (ash 1 16)))) - (not (zerop (logand (or (car (syntax-after (1+ (point)))) 0) - (ash 1 17))))) - (+ pos 2)) - ((and (not (zerop (logand (car (syntax-after (point))) - (ash 1 17)))) - (not (zerop (logand (or (car (syntax-after (1- (point)))) 0) - (ash 1 16))))) - (1+ pos)) - (t pos)))) - (let ((syn (save-excursion (syntax-ppss chkpos)))) - (and (nth 4 syn) (nth 8 syn))))) - -(defun evil-looking-at-start-comment (&optional move) - "Return t if point is at the start of a comment. -Point must be on one of the opening characters of a block comment -according to the current syntax table. Futhermore, these -characters must been parsed as opening characters, i.e. they -won't be considered as comment starters inside a string or -possibly another comment. Point is moved to the first character -of the comment opener if MOVE is non-nil." - (cond - ((= (point) (point-max)) nil) - ;; one character opener - ((= (char-syntax (char-after)) ?<) - (equal (point) (evil-in-comment-p (1+ (point))))) - ;; two character opener on first char - ((and (not (zerop (logand (car (syntax-after (point))) - (ash 1 16)))) - (not (zerop (logand (or (car (syntax-after (1+ (point)))) 0) - (ash 1 17))))) - (equal (point) (evil-in-comment-p (+ 2 (point))))) - ;; two character opener on second char - ((and (not (zerop (logand (car (syntax-after (point))) - (ash 1 17)))) - (not (zerop (logand (or (car (syntax-after (1- (point)))) 0) - (ash 1 16))))) - (and (equal (1- (point)) (evil-in-comment-p (1+ (point)))) - (prog1 t (when move (backward-char))))))) - -(defun evil-looking-at-end-comment (&optional move) - "Return t if point is at the end of a comment. -Point must be on one of the opening characters of a block comment -according to the current syntax table. Futhermore, these -characters must been parsed as opening characters, i.e. they -won't be considered as comment starters inside a string or -possibly another comment. Point is moved right after the comment -closer if MOVE is non-nil." - (cond - ;; one char closer - ((= (char-syntax (char-after)) ?>) - (and (evil-in-comment-p) ; in comment - (not (evil-in-comment-p (1+ (point)))) - (prog1 t (when move (forward-char))))) - ;; two char closer on first char - ((and (not (zerop (logand (car (syntax-after (point))) - (ash 1 18)))) - (not (zerop (logand (or (car (syntax-after (1+ (point)))) 0) - (ash 1 19))))) - (and (evil-in-comment-p) - (not (evil-in-comment-p (+ (point) 2))) - (prog1 t (when move (forward-char 2))))) - ;; two char closer on second char - ((and (not (zerop (logand (car (syntax-after (point))) - (ash 1 19)))) - (not (zerop (logand (or (car (syntax-after (1- (point)))) 0) - (ash 1 18))))) - (and (evil-in-comment-p) - (not (evil-in-comment-p (1+ (point)))) - (prog1 t (when move (forward-char))))))) - -(defun evil-insert-newline-above () - "Insert a new line above point and place point in that line -with regard to indentation." - (evil-narrow-to-field - (evil-move-beginning-of-line) - (insert (if use-hard-newlines hard-newline "\n")) - (forward-line -1) - (back-to-indentation))) - -(defun evil-insert-newline-below () - "Insert a new line below point and place point in that line -with regard to indentation." - (evil-narrow-to-field - (evil-move-end-of-line) - (insert (if use-hard-newlines hard-newline "\n")) - (back-to-indentation))) - -;;; Markers - -(defun evil-global-marker-p (char) - "Whether CHAR denotes a global marker." - (or (and (>= char ?A) (<= char ?Z)) - (assq char (default-value 'evil-markers-alist)))) - -(defun evil-set-marker (char &optional pos advance) - "Set the marker denoted by CHAR to position POS. -POS defaults to the current position of point. -If ADVANCE is t, the marker advances when inserting text at it; -otherwise, it stays behind." - (interactive (list (read-char))) - (catch 'done - (let ((marker (evil-get-marker char t)) alist) - (unless (markerp marker) - (cond - ((eq marker 'evil-visual-beginning) - (setq marker evil-visual-mark)) - ((eq marker 'evil-visual-goto-end) - (setq marker evil-visual-point)) - ((and marker (symbolp marker) (boundp marker)) - (set marker (or (symbol-value marker) (make-marker))) - (setq marker (symbol-value marker))) - ((eq marker 'evil-jump-backward-swap) - (evil-set-jump) - (throw 'done nil)) - ((functionp marker) - (user-error "Cannot set special marker `%c'" char)) - ((evil-global-marker-p char) - (setq alist (default-value 'evil-markers-alist) - marker (make-marker)) - (evil--add-to-alist alist char marker) - (setq-default evil-markers-alist alist)) - (t - (setq marker (make-marker)) - (evil--add-to-alist evil-markers-alist char marker)))) - (add-hook 'kill-buffer-hook #'evil-swap-out-markers nil t) - (set-marker-insertion-type marker advance) - (set-marker marker (or pos (point)))))) -(evil-set-command-properties #'evil-set-marker :suppress-operator t) - -(defun evil-get-marker (char &optional raw) - "Return the marker denoted by CHAR. -This is either a marker object as returned by `make-marker', -a number, a cons cell (FILE . POS) with FILE being a string -and POS a number, or nil. If RAW is non-nil, then the -return value may also be a variable, a movement function, -or a marker object pointing nowhere." - (let ((marker (cdr (assq char (if (evil-global-marker-p char) - (default-value 'evil-markers-alist) - evil-markers-alist))))) - (if raw - marker - (when (and (symbolp marker) (boundp marker)) - (setq marker (symbol-value marker))) - (when (functionp marker) - (save-excursion - (save-window-excursion - (funcall marker) - (setq marker (move-marker (make-marker) (point)))))) - (if (markerp marker) - (if (eq (marker-buffer marker) (current-buffer)) - (marker-position marker) - (when (marker-buffer marker) marker)) - marker)))) - -(defun evil-swap-out-markers () - "Turn markers into file references when the buffer is killed." - (when buffer-file-name - (dolist (entry evil-markers-alist) - (and (markerp (cdr entry)) - (eq (marker-buffer (cdr entry)) (current-buffer)) - (setcdr entry (cons buffer-file-name - (marker-position (cdr entry)))))))) -(put 'evil-swap-out-markers 'permanent-local-hook t) - -(defvar calc-multiplication-has-precedence) -(defun evil--eval-expr (input) - "Eval INPUT and return stringified result, if of a suitable type. -If INPUT starts with a number, +, -, or . use `calc-eval' instead." - (let* ((calcable-p (string-match-p "\\`[[:space:]]*[0-9+.-]" input)) - (result (if calcable-p - (let ((calc-multiplication-has-precedence nil)) - (calc-eval input)) - (eval (car (read-from-string input)) t)))) - (cond - ((stringp result) result) - ((or (numberp result) (symbolp result)) - (format "%s" result)) - ((sequencep result) - (mapconcat (lambda (x) (format "%s" x)) result "\n")) - (t (user-error "Using `%s' as a string" (type-of result)))))) - -(defvar evil-paste-clear-minibuffer-first nil - "`evil-paste-before' cannot have `delete-minibuffer-contents' called before -it fetches certain registers becuase this would trigger various ex-updates, -sometimes moving point, so `C-a' `C-w' etc. would miss their intended target.") - -(defun evil-ex-remove-default () - "Remove the default text shown in the ex minibuffer. -When Ex starts, the previous command is shown enclosed in -parenthesis. This function removes this text when the first key -is pressed." - (when (and (not (eq this-command 'exit-minibuffer)) - (/= (minibuffer-prompt-end) (point-max))) - (when (eq this-command 'evil-ex-delete-backward-char) - (setq this-command 'ignore)) - (if (eq this-original-command 'evil-paste-from-register) - (setq evil-paste-clear-minibuffer-first t) - (delete-minibuffer-contents))) - (remove-hook 'pre-command-hook #'evil-ex-remove-default t)) - -(defun evil-get-register (register &optional noerror) - "Return contents of REGISTER. -Signal an error if empty, unless NOERROR is non-nil. - -The following special registers are supported. - \" the unnamed register - * the clipboard contents - + the clipboard contents - the word at point (ex mode only) - the WORD at point (ex mode only) - the symbol at point (ex mode only) - the current file at point (ex mode only) - % the current file name (read only) - # the alternate file name (read only) - / the last search pattern (read only) - : the last command line (read only) - . the last inserted text (read only) - - the last small (less than a line) delete - _ the black hole register - = the expression register (read only)" - (unless (characterp register) (error "Invalid register `%S'" register)) - (condition-case err - (or (cond - ((eq register ?\") - (current-kill 0)) - ((<= ?1 register ?9) - (let ((reg (- register ?1))) - (and (< reg (length kill-ring)) - (current-kill reg t)))) - ((memq register '(?* ?+)) - (let ((what (if (eq register ?*) 'PRIMARY 'CLIPBOARD))) - (if (eval-when-compile (>= emacs-major-version 29)) - (gui--selection-value-internal what) - ;; The following code is based on `x-selection-value-internal' - ;; (now `gui--selection-value-internal') circa Emacs 24. We're - ;; unsure why exactly it's duplicated here, and it's possible - ;; it needn't be for newer versions of Emacs. - (let ((request-type (or (bound-and-true-p x-select-request-type) - '(UTF8_STRING COMPOUND_TEXT STRING))) - text) - (unless (consp request-type) - (setq request-type (list request-type))) - (while (and request-type (not text)) - (setq text (ignore-errors - (evil-get-selection what (pop request-type))))) - (when text - (remove-text-properties 0 (length text) '(foreign-selection nil) text)) - text)))) - ((eq register ?\C-W) - (with-current-buffer - (or evil-ex-original-buffer - (let ((w (minibuffer-selected-window))) (and w (window-buffer w))) - (user-error "Register is only available in Ex state")) - (thing-at-point 'evil-word))) - ((eq register ?\C-A) - (with-current-buffer - (or evil-ex-original-buffer - (let ((w (minibuffer-selected-window))) (and w (window-buffer w))) - (user-error "Register is only available in Ex state")) - (thing-at-point 'evil-WORD))) - ((eq register ?\C-O) - (with-current-buffer - (or evil-ex-original-buffer - (let ((w (minibuffer-selected-window))) (and w (window-buffer w))) - (user-error "Register is only available in Ex state")) - (thing-at-point 'evil-symbol))) - ((eq register ?\C-F) - (with-current-buffer - (or evil-ex-original-buffer - (let ((w (minibuffer-selected-window))) (and w (window-buffer w))) - (user-error "Register is only available in Ex state")) - (thing-at-point 'filename))) - ((eq register ?\C-L) - (with-current-buffer - (or evil-ex-original-buffer - (let ((w (minibuffer-selected-window))) (and w (window-buffer w))) - (user-error "Register is only available in Ex state")) - (replace-regexp-in-string "\n\\'" "" (thing-at-point 'line)))) - ((eq register ?%) - (or (buffer-file-name - (or evil-ex-original-buffer - (let ((w (minibuffer-selected-window))) (and w (window-buffer w))))) - (user-error "No file name"))) - ((= register ?#) - (or (with-current-buffer (other-buffer) (buffer-file-name)) - (user-error "No file name"))) - ((eq register ?/) - (defvar evil-search-module) - (or (car (cond - ((eq evil-search-module 'evil-search) evil-ex-search-history) - (isearch-regexp regexp-search-ring) - (t search-ring))) - (user-error "No previous regular expression"))) - ((eq register ?:) - (or (car evil-ex-history) (user-error "No previous command line"))) - ((eq register ?.) evil-last-insertion) - ((eq register ?-) evil-last-small-deletion) - ((eq register ?=) - (let ((enable-recursive-minibuffers t)) - (setq evil-last-=-register-input - (minibuffer-with-setup-hook - (lambda () - (when evil-last-=-register-input - (add-hook 'pre-command-hook #'evil-ex-remove-default nil t))) - (read-from-minibuffer - "=" - (and evil-last-=-register-input - (propertize evil-last-=-register-input 'face 'shadow)) - evil-eval-map - nil - 'evil-eval-history - evil-last-=-register-input - t))) - (evil--eval-expr evil-last-=-register-input))) - ((eq register ?_) "") ; the black hole register - (t (setq register (downcase register)) - (get-register register))) - (user-error "Register `%c' is empty" register)) - (error (unless noerror (signal (car err) (cdr err)))))) - -(defun evil-append-register (register text) - "Append TEXT to the contents of REGISTER." - (let ((content (get-register register))) - (set-register - register - (cond - ((not content) text) - ;; if the register does not contain a string treat it as a vector - ((not (stringp content)) (vconcat content text)) - ;; some non-trivial yank-handler -> always switch to line handler - ((or (text-property-not-all - 0 (length content) 'yank-handler nil content) - (text-property-not-all - 0 (length text) 'yank-handler nil text)) - ;; ensure complete lines - (setq text - (concat - content - (and (> (length content) 0) - (/= (aref content (1- (length content))) ?\n) - "\n") - text - (and (> (length text) 0) - (/= (aref text (1- (length text))) ?\n) - "\n"))) - (put-text-property 0 (length text) 'yank-handler '(evil-yank-line-handler) - text) - text) - (t (concat content text)))))) - -(defun evil-set-register (register text) - "Set the contents of REGISTER to TEXT. -If REGISTER is an upper case character then TEXT is appended to that -register instead of replacing its content." - (cond - ((not (characterp register)) (user-error "Invalid register")) - ;; don't allow modification of read-only registers - ((member register '(?: ?. ?%)) - (user-error "Can't modify read-only register")) - ((eq register ?\") (kill-new text)) - ((<= ?1 register ?9) - (if (null kill-ring) - (kill-new text) - (let ((kill-ring-yank-pointer kill-ring-yank-pointer) - interprogram-paste-function - interprogram-cut-function) - (current-kill (- register ?1)) - (setcar kill-ring-yank-pointer text)))) - ((eq register ?*) (evil-set-selection 'PRIMARY text)) - ((eq register ?+) (evil-set-selection 'CLIPBOARD text)) - ((eq register ?-) (setq evil-last-small-deletion text)) - ((eq register ?_) nil) ; the black hole register - ((and (<= ?A register) (<= register ?Z)) - (evil-append-register (downcase register) text)) - (t (set-register register text)))) - -(defun evil-register-list () - "Return an alist of all registers, but only those named -with number or character. Registers with symbol or string in names are ignored -to keep Vim compatibility with register jumps." - (sort (append (mapcar (lambda (reg) (cons reg (evil-get-register reg t))) - '(?\" ?* ?+ ?% ?# ?/ ?: ?. ?- - ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9)) - (list (cons ?= evil-last-=-register-input)) - (cl-remove-if-not (lambda (reg) (number-or-marker-p (car reg))) register-alist) - nil) - #'car-less-than-car)) - -(defsubst evil-kbd-macro-suppress-motion-error () - "Return non-nil if a motion error should be suppressed. -Whether the motion error should be suppressed depends on the -variable `evil-kbd-macro-suppress-motion-error'." - (or (and defining-kbd-macro - (memq evil-kbd-macro-suppress-motion-error '(t record))) - (and executing-kbd-macro - (memq evil-kbd-macro-suppress-motion-error '(t replay))))) - -;;; Region - -;; `set-mark' does too much at once -(defun evil-move-mark (pos) - "Set buffer's mark to POS. -If POS is nil, delete the mark." - (set-marker (mark-marker) pos)) - -(defun evil-save-transient-mark-mode () - "Save Transient Mark mode and make it buffer-local. -Any changes to Transient Mark mode are now local to the current -buffer, until `evil-restore-transient-mark-mode' is called. - -Variables pertaining to Transient Mark mode are listed in -`evil-transient-vars', and their values are stored in -`evil-transient-vals'." - (dolist (var evil-transient-vars) - (when (and (boundp var) - (not (assq var evil-transient-vals))) - (push (list var (symbol-value var) - (local-variable-p var)) - evil-transient-vals) - (make-variable-buffer-local var) - (put var 'permanent-local t)))) - -(defun evil-restore-transient-mark-mode () - "Restore Transient Mark mode. -This presupposes that `evil-save-transient-mark-mode' has been -called earlier. If Transient Mark mode was disabled before but -enabled in the meantime, this function disables it; if it was -enabled before but disabled in the meantime, this function -enables it. - -The earlier settings of Transient Mark mode are stored in -`evil-transient-vals'." - (let (entry local var val) - (while (setq entry (pop evil-transient-vals)) - (setq var (pop entry) - val (pop entry) - local (pop entry)) - (unless local - (kill-local-variable var)) - (unless (equal (symbol-value var) val) - (if (fboundp var) - (funcall var (if val 1 -1)) - (setq var val)))))) - -;; In theory, an active region implies Transient Mark mode, and -;; disabling Transient Mark mode implies deactivating the region. -;; In practice, Emacs never clears `mark-active' except in Transient -;; Mark mode, so we define our own toggle functions to make things -;; more predictable. -(defun evil-transient-mark (&optional arg) - "Toggle Transient Mark mode. -Ensure that the region is properly deactivated. -Enable with positive ARG, disable with negative ARG." - (unless (numberp arg) - (setq arg (if transient-mark-mode -1 1))) - (cond - ((< arg 1) - (evil-active-region -1) - ;; Transient Mark mode cannot be disabled - ;; while CUA mode is enabled - (when (fboundp 'cua-mode) - (cua-mode -1)) - (when transient-mark-mode - (transient-mark-mode -1))) - (t - (unless transient-mark-mode - (evil-active-region -1) - (transient-mark-mode 1))))) - -(defun evil-active-region (&optional arg) - "Toggle active region. -Ensure that Transient Mark mode is properly enabled. -Enable with positive ARG, disable with negative ARG." - (unless (numberp arg) - (setq arg (if (region-active-p) -1 1))) - (cond - ((and (< arg 1)) - (when (or transient-mark-mode mark-active) - (setq mark-active nil - deactivate-mark nil) - (when (boundp 'cua--explicit-region-start) - (setq cua--explicit-region-start nil)) - (run-hooks 'deactivate-mark-hook))) - (t - (evil-transient-mark 1) - (when deactivate-mark - (setq deactivate-mark nil)) - (unless (mark t) - (evil-move-mark (point))) - (unless (region-active-p) - (set-mark (mark t))) - (when (boundp 'cua--explicit-region-start) - (setq cua--explicit-region-start t))))) - -(defmacro evil-with-transient-mark-mode (&rest body) - "Execute BODY with Transient Mark mode. -Then restore Transient Mark mode to its previous setting." - (declare (indent defun) - (debug t)) - `(let ((inhibit-quit t) - evil-transient-vals) - (unwind-protect - (progn - (evil-save-transient-mark-mode) - (evil-transient-mark 1) - ,@body) - (evil-restore-transient-mark-mode)))) - -(defmacro evil-with-active-region (beg end &rest body) - "Execute BODY with an active region from BEG to END." - (declare (indent 2) - (debug t)) - `(let ((beg ,beg) (end ,end) - evil-transient-vals) - (evil-with-transient-mark-mode - (save-excursion - (evil-active-region 1) - (evil-move-mark beg) - (goto-char end) - ,@body)))) - -(defun evil-exchange-point-and-mark () - "Exchange point and mark without activating the region." - (let* ((point (point)) - (mark (or (mark t) point))) - (set-marker (mark-marker) point) - (goto-char mark))) - -(defun evil-apply-on-block (func beg end pass-columns &rest args) - "Call FUNC for each line of a block selection. -The selection is specified by the region BEG and END. FUNC must -take at least two arguments, the beginning and end of each -line. If PASS-COLUMNS is non-nil, these values are the columns, -otherwise they are buffer positions. Extra arguments to FUNC may -be passed via ARGS." - (let (startcol startpt endcol endpt) - (save-excursion - (goto-char beg) - (setq startcol (current-column) - startpt (line-beginning-position)) - (goto-char end) - (setq endcol (current-column)) - (forward-line 1) - (setq endpt (point-marker)) - ;; ensure the start column is the left one. - (evil-sort startcol endcol) - ;; maybe extend up to EOL - (when (and (memq last-command '(next-line previous-line evil-use-register)) - (eq temporary-goal-column most-positive-fixnum)) - (goto-char startpt) - (while (< (point) endpt) - (setq endcol (max endcol (evil-column (line-end-position)))) - (forward-line 1))) - ;; start looping over lines - (goto-char startpt) - (while (< (point) endpt) - (if pass-columns - (apply func startcol endcol args) - (apply func - (save-excursion (evil-move-to-column startcol)) - (save-excursion (evil-move-to-column endcol t)) - args)) - (forward-line 1))))) - -(defun evil-apply-on-rectangle (function start end &rest args) - "Like `apply-on-rectangle' but maybe extends to eol. -If `temporary-goal-column' is set to a big number, then the -region of each line is extended to the end of each line. The end -column is set to the maximal column in all covered lines." - (apply #'evil-apply-on-block function start end t args)) - -;;; Insertion - -(defun evil-track-last-insertion (beg end old-len) - "Track the last insertion range and its text. -BEG, END and OLD-LEN are as for `after-change-functions'. -The insertion range is stored as a pair of buffer positions in -`evil-current-insertion'." - ;; For deletions left of, or insertions right of the end of the last - ;; insertion (with any changes in between), extend or contract the - ;; insertion range as appropriate. Otherwise, start a new range. - (if (when evil-current-insertion - (let ((ins-beg (car evil-current-insertion)) - (ins-end (cdr evil-current-insertion))) - (and (<= ins-beg beg) - (or (= (+ beg old-len) ins-end) - (when (evil-replace-state-p) (= beg ins-end)))))) - ;; Ignore insertion of previous char from Backspace in Replace state - (unless (and (eq this-command 'evil-replace-backspace) (= old-len 0)) - (setcdr evil-current-insertion end)) - (setq evil-current-insertion (cons beg end)))) -(put 'evil-track-last-insertion 'permanent-local-hook t) - -(defun evil-start-track-last-insertion () - "Start tracking the last insertion." - (setq evil-current-insertion nil) - (add-hook 'after-change-functions #'evil-track-last-insertion nil t)) - -(defun evil-stop-track-last-insertion () - "Stop tracking the last insertion. -The tracked insertion is set to `evil-last-insertion'." - (setq evil-last-insertion - (and evil-current-insertion - ;; Check whether the insertion range is a valid buffer - ;; range. If a buffer modification is done from within - ;; another change hook or modification-hook (yasnippet - ;; does this using overlay modification-hooks), then the - ;; insertion information may be invalid. There is no way - ;; to detect this situation, but at least we should - ;; ensure that no error occurs (see bug #272). - (>= (car evil-current-insertion) (point-min)) - (<= (cdr evil-current-insertion) (point-max)) - (buffer-substring-no-properties (car evil-current-insertion) - (cdr evil-current-insertion)))) - (remove-hook 'after-change-functions #'evil-track-last-insertion t)) - -;;; Paste - -(defun evil-yank-characters (beg end &optional register yank-handler) - "Save the characters defined by the region BEG and END in the kill-ring." - (let ((text (filter-buffer-substring beg end))) - (when yank-handler - (put-text-property 0 (length text) 'yank-handler (list yank-handler) text)) - (when register - (evil-set-register register text)) - (when evil-was-yanked-without-register - (evil-set-register ?0 text)) ; "0 register contains last yanked text - (unless (eq register ?_) - (kill-new text)))) - -(defun evil-yank-lines (beg end &optional register yank-handler) - "Save the lines in the region BEG and END into the kill-ring." - (let ((text (filter-buffer-substring beg end)) - (yank-handler (list (or yank-handler #'evil-yank-line-handler) - nil - t))) - ;; Ensure the text ends with a newline. This is required - ;; if the deleted lines were the last lines in the buffer. - (when (or (zerop (length text)) - (/= (aref text (1- (length text))) ?\n)) - (setq text (concat text "\n"))) - (put-text-property 0 (length text) 'yank-handler yank-handler text) - (when register - (evil-set-register register text)) - (when evil-was-yanked-without-register - (evil-set-register ?0 text)) ; "0 register contains last yanked text - (unless (eq register ?_) - (kill-new text)))) - -(defun evil-yank-rectangle (beg end &optional register yank-handler) - "Save the rectangle defined by region BEG and END into the kill-ring." - (let ((lines (list nil))) - (evil-apply-on-rectangle #'extract-rectangle-line beg end lines) - ;; We remove spaces from the beginning and the end of the next. - ;; Spaces are inserted explicitly in the yank-handler in order to - ;; NOT insert lines full of spaces. - (setq lines (nreverse (cdr lines))) - ;; `text' is used as default insert text when pasting this rectangle - ;; in another program, e.g., using the X clipboard. - (let ((yank-handler (list (or yank-handler #'evil-yank-block-handler) - lines - t - #'evil-delete-yanked-rectangle)) - (text (mapconcat #'identity lines "\n"))) - (put-text-property 0 (length text) 'yank-handler yank-handler text) - (when register - (evil-set-register register text)) - (when evil-was-yanked-without-register - (evil-set-register ?0 text)) ; "0 register contains last yanked text - (unless (eq register ?_) - (kill-new text)) - text))) - -(defun evil-remove-yank-excluded-properties (text) - "Remove `yank-excluded-properties' from TEXT." - (if (eq yank-excluded-properties t) - (set-text-properties 0 (length text) nil text) - (remove-list-of-text-properties 0 (length text) - yank-excluded-properties text))) - -(defun evil-yank-line-handler (text) - "Insert the current text linewise." - (let ((text (apply #'concat (make-list (or evil-paste-count 1) text))) - (opoint (point))) - (evil-remove-yank-excluded-properties text) - (cond - ((eq this-command 'evil-paste-before) - (evil-move-beginning-of-line) - (let ((beg (point))) - (insert text) - (setq evil-last-paste - (list 'evil-paste-before evil-paste-count opoint beg (point))) - (evil-set-marker ?\[ beg) - (evil-set-marker ?\] (1- (point))) - (goto-char beg)) - (back-to-indentation)) - ((eq this-command 'evil-paste-after) - (evil-move-end-of-line) - (let ((beg (point))) - (insert "\n") - (insert text) - (delete-char -1) ; delete the last newline - (setq evil-last-paste - (list 'evil-paste-after evil-paste-count opoint beg (point))) - (evil-set-marker ?\[ (1+ beg)) - (evil-set-marker ?\] (point)) - (unless evil--cursor-after - (goto-char (1+ beg)))) - (back-to-indentation)) - (t (insert text))))) - -(defun evil-yank-block-handler (lines) - "Insert the current text as block." - (let* ((count (or evil-paste-count 1)) - shifted-forward - (col (if (and (eq this-command 'evil-paste-after) - (not (and (bolp) (eolp))) - (setq shifted-forward t)) - (1+ (current-column)) - (current-column))) - (opoint (point)) - (first t)) - (dolist (line lines) - ;; maybe we have to insert a new line at eob - (if first - (setq first nil) - (when (or (> (forward-line 1) 0) - (and (eobp) (not (bolp)))) - (insert "\n"))) - ;; concat multiple copies according to count - (setq line (apply #'concat (make-list count line))) - ;; trim whitespace at beginning and end - (string-match "\\` *\\(.*?\\) *\\'" line) - (let ((text (match-string 1 line)) - (begextra (match-beginning 1)) - (endextra (- (match-end 0) (match-end 1)))) - ;; insert text unless we insert an empty line behind eol - (unless (and (< (evil-column (line-end-position)) col) - (string= text "")) - ;; if we paste behind eol, it may be sufficient to insert tabs - (if (< (evil-column (line-end-position)) col) - (move-to-column (+ col begextra) t) - (move-to-column col t) - (insert (make-string begextra ?\s))) - (evil-remove-yank-excluded-properties text) - (insert text) - (unless (eolp) - ;; text follows, so we have to insert spaces - (insert (make-string endextra ?\s)))))) - (setq evil-last-paste - (list this-command - evil-paste-count - opoint - (length lines) ; number of rows - (* count (length (car lines))))) ; number of columns - (evil-set-marker ?\[ opoint) - (evil-set-marker ?\] (1- (point))) - (if evil--cursor-after - (backward-char) - (goto-char opoint) - (when shifted-forward (forward-char))))) - -(defun evil-delete-yanked-rectangle (nrows ncols) - "Special function to delete the block yanked by a previous paste command. -Supplied as the `undo' element of a yank handler." - (let ((opoint (point)) - (col (if (eq last-command 'evil-paste-after) - (1+ (current-column)) - (current-column)))) - (dotimes (_ nrows) - (delete-region (save-excursion - (move-to-column col) - (point)) - (save-excursion - (move-to-column (+ col ncols)) - (point))) - (unless (eobp) (forward-line))) - (goto-char opoint))) - -;; TODO: if undoing is disabled in the current buffer, paste-pop won't -;; work. Although this is probably not a big problem, because usually -;; buffers where `evil-paste-pop' may be useful have undoing enabled. -;; A solution would be to temporarily enable undo when pasting and -;; store the undo information in a special variable that does not -;; interfere with `buffer-undo-list'. -(defun evil-paste-pop (count) - "Replace the just-yanked stretch of killed text with a different stretch. -This command is allowed only immediatly after a `yank', -`evil-paste-before', `evil-paste-after' or `evil-paste-pop'. -This command uses the same paste command as before, i.e., when -used after `evil-paste-after' the new text is also yanked using -`evil-paste-after', used with the same paste-count argument. - -The COUNT argument inserts the COUNTth previous kill. If COUNT -is negative this is a more recent kill." - (interactive "p") - (unless (memq last-command - '(evil-paste-after - evil-paste-before - evil-visual-paste)) - (user-error "Previous command was not an evil-paste: %s" last-command)) - (unless evil-last-paste - (user-error "Previous paste command used a register")) - (evil-undo-pop) - (goto-char (nth 2 evil-last-paste)) - (setq this-command (nth 0 evil-last-paste)) - ;; use temporary kill-ring, so the paste cannot modify it - (let ((kill-ring (list (current-kill - (if (and (> count 0) (nth 5 evil-last-paste)) - ;; if was visual paste then skip the - ;; text that has been replaced - (1+ count) - count)))) - (kill-ring-yank-pointer kill-ring)) - (when (eq last-command 'evil-visual-paste) - (let ((evil-no-display t)) - (evil-visual-restore))) - (funcall (nth 0 evil-last-paste) (nth 1 evil-last-paste)) - ;; if this was a visual paste, then mark the last paste as NOT - ;; being the first visual paste - (when (eq last-command 'evil-visual-paste) - (setcdr (nthcdr 4 evil-last-paste) nil)))) - -(defun evil-paste-pop-next (count) - "Same as `evil-paste-pop' but with negative argument." - (interactive "p") - (evil-paste-pop (- count))) - -;;; Interactive forms - -(defun evil-match-interactive-code (interactive &optional pos) - "Match an interactive code at position POS in string INTERACTIVE. -Return the first matching entry in `evil-interactive-alist', or nil." - (unless pos (setq pos 0)) - (cl-loop - with len = (length interactive) for entry in evil-interactive-alist thereis - (let* ((string (car entry)) - (end (+ pos (length string)))) - (and (<= end len) - (eq (compare-strings string nil nil interactive pos end) t) - entry)))) - -(defun evil-concatenate-interactive-forms (&rest forms) - "Concatenate interactive list expressions FORMS. -Return a single expression where successive expressions -are joined, if possible." - (let (result) - (when forms - (while (cdr forms) - (cond - ((null (car forms)) - (pop forms)) - ((and (eq (car (car forms)) 'list) - (eq (car (cadr forms)) 'list)) - (setq forms (cons (append (car forms) - (cdr (cadr forms))) - (cdr (cdr forms))))) - (t (push (pop forms) result)))) - (when (car forms) - (push (pop forms) result)) - (setq result (nreverse result)) - (cond - ((null result)) - ((null (cdr result)) (car result)) - (t `(append ,@result)))))) - -(defun evil-interactive-string (string) - "Evaluate the interactive string STRING. -The string may contain extended interactive syntax. -The return value is a cons cell (FORM . PROPERTIES), -where FORM is a single list-expression to be passed to -a standard `interactive' statement, and PROPERTIES is a -list of command properties as passed to `evil-define-command'." - (let ((len (length string)) - (pos 0) - forms properties) - (while (< pos len) - (if (eq (aref string pos) ?\n) - (setq pos (1+ pos)) - (cl-destructuring-bind (code expr . plist) - (or (evil-match-interactive-code string pos) - (user-error "Unknown interactive code: `%s'" - (substring string pos))) - (setq pos (+ pos (length code))) - (when (functionp expr) - (let ((prompt (substring - string pos - (or (string-match-p "\n" string pos) len)))) - (setq pos (+ pos (length prompt)) - expr `(funcall ,expr ,prompt)))) - (setq forms (append forms (list expr)) - properties (append properties plist))))) - (cons `(append ,@forms) properties))) - -(defun evil-interactive-form (&rest args) - "Evaluate interactive forms ARGS. -The return value is a cons cell (FORM . PROPERTIES), -where FORM is a single list-expression to be passed to -a standard `interactive' statement, and PROPERTIES is a -list of command properties as passed to `evil-define-command'." - (let (forms properties) - (dolist (arg args) - (if (not (stringp arg)) - (setq forms (append forms (list arg))) - (setq arg (evil-interactive-string arg) - forms (append forms (cdr (car arg))) - properties (append properties (cdr arg))))) - (cons (apply #'evil-concatenate-interactive-forms forms) - properties))) - -;;; Types - -(defun evil-type (object &optional default) - "Return the type of OBJECT, or DEFAULT if none." - (let (type) - (cond - ((overlayp object) - (setq type (overlay-get object :type))) - ((evil-range-p object) - (setq type (nth 2 object))) - ((listp object) - (setq type (plist-get object :type))) - ((commandp object) - (setq type (evil-get-command-property object :type))) - ((symbolp object) - (setq type (get object 'type)))) - (setq type (or type default)) - (and (evil-type-p type) type))) - -(defun evil-set-type (object type) - "Set the type of OBJECT to TYPE. -For example, (evil-set-type \\='next-line \\='line) -will make `line' the type of the `next-line' command." - (cond - ((overlayp object) - (overlay-put object :type type)) - ((evil-range-p object) - (evil-set-range-type object type)) - ((listp object) - (plist-put object :type type)) - ((commandp object) - (evil-set-command-property object :type type)) - ((symbolp object) - (put object 'type type))) - object) - -(defun evil-type-property (type prop) - "Return property PROP for TYPE." - (plist-get (cdr (assq type evil-type-properties)) prop)) - -(defun evil-type-p (sym) - "Whether SYM is the name of a type." - (assq sym evil-type-properties)) - -(defun evil-expand (beg end type &rest properties) - "Expand BEG and END as TYPE with PROPERTIES. -Return a list (BEG END TYPE PROPERTIES ...), where the tail -may contain a property list." - (apply #'evil-transform - ;; don't expand if already expanded - (unless (plist-get properties :expanded) :expand) - beg end type properties)) - -(defun evil-contract (beg end type &rest properties) - "Contract BEG and END as TYPE with PROPERTIES. -Return a list (BEG END TYPE PROPERTIES ...), where the tail -may contain a property list." - (apply #'evil-transform :contract beg end type properties)) - -(defun evil-normalize (beg end type &rest properties) - "Normalize BEG and END as TYPE with PROPERTIES. -Return a list (BEG END TYPE PROPERTIES ...), where the tail -may contain a property list." - (apply #'evil-transform :normalize beg end type properties)) - -(defun evil-transform (transform beg end type &rest properties) - "Apply TRANSFORM on BEG and END with PROPERTIES. -Return a list (BEG END TYPE PROPERTIES ...), where the tail -may contain a property list. If TRANSFORM is undefined, -return positions unchanged." - (let* ((type (or type (evil-type properties))) - (transform (when (and type transform) - (evil-type-property type transform)))) - (if transform - (apply transform beg end properties) - (apply #'evil-range beg end type properties)))) - -(defun evil-describe (beg end type &rest properties) - "Return description of BEG and END with PROPERTIES. -If no description is available, return the empty string." - (let* ((type (or type (evil-type properties))) - (properties (plist-put properties :type type)) - (describe (evil-type-property type :string))) - (or (when describe - (apply describe beg end properties)) - ""))) - -;;; Ranges - -(defun evil-range (beg end &optional type &rest properties) - "Return a list (BEG END [TYPE] PROPERTIES...). -BEG and END are buffer positions (numbers or markers), -TYPE is a type as per `evil-type-p', and PROPERTIES is -a property list." - (let ((beg (evil-normalize-position beg)) - (end (evil-normalize-position end))) - (when (and (numberp beg) (numberp end)) - (evil-sort beg end) - (nconc (list beg end) - (when (evil-type-p type) (list type)) - properties)))) - -(defun evil-range-p (object) - "Whether OBJECT is a range." - (and (listp object) - (numberp (nth 0 object)) - (numberp (nth 1 object)))) - -(defun evil-range-beginning (range) - "Return beginning of RANGE." - (when (evil-range-p range) - (let ((beg (evil-normalize-position (nth 0 range))) - (end (evil-normalize-position (nth 1 range)))) - (min beg end)))) - -(defun evil-range-end (range) - "Return end of RANGE." - (when (evil-range-p range) - (let ((beg (evil-normalize-position (nth 0 range))) - (end (evil-normalize-position (nth 1 range)))) - (max beg end)))) - -(defun evil-range-properties (range) - "Return properties of RANGE." - (when (evil-range-p range) - (nthcdr (if (evil-type range) 3 2) range))) - -(defalias 'evil-copy-range #'copy-sequence - "Return a copy of RANGE.") - -(defun evil-set-range (range &optional beg end type &rest properties) - "Set RANGE to have beginning BEG and end END. -The TYPE and additional PROPERTIES may also be specified. -If an argument is nil, it's not used; the previous value is retained. -See also `evil-set-range-beginning', `evil-set-range-end', -`evil-set-range-type' and `evil-set-range-properties'." - (when (evil-range-p range) - (let ((beg (or (evil-normalize-position beg) - (evil-range-beginning range))) - (end (or (evil-normalize-position end) - (evil-range-end range))) - (type (or type (evil-type range))) - (plist (evil-range-properties range))) - (evil-sort beg end) - (setq plist (evil-concat-plists plist properties)) - (evil-set-range-beginning range beg) - (evil-set-range-end range end) - (evil-set-range-type range type) - (evil-set-range-properties range plist) - range))) - -(defun evil-set-range-beginning (range beg &optional copy) - "Set RANGE's beginning to BEG. -If COPY is non-nil, return a copy of RANGE." - (when copy - (setq range (evil-copy-range range))) - (setcar range beg) - range) - -(defun evil-set-range-end (range end &optional copy) - "Set RANGE's end to END. -If COPY is non-nil, return a copy of RANGE." - (when copy - (setq range (evil-copy-range range))) - (setcar (cdr range) end) - range) - -(defun evil-set-range-type (range type &optional copy) - "Set RANGE's type to TYPE. -If COPY is non-nil, return a copy of RANGE." - (when copy - (setq range (evil-copy-range range))) - (if type - (setcdr (cdr range) - (cons type (evil-range-properties range))) - (setcdr (cdr range) (evil-range-properties range))) - range) - -(defun evil-set-range-properties (range properties &optional copy) - "Set RANGE's properties to PROPERTIES. -If COPY is non-nil, return a copy of RANGE." - (when copy - (setq range (evil-copy-range range))) - (setcdr (if (evil-type range) (cddr range) (cdr range)) properties) - range) - -(defun evil-range-union (range1 range2 &optional type) - "Return the union of the ranges RANGE1 and RANGE2. -If the ranges have conflicting types, use RANGE1's type. -This can be overridden with TYPE." - (when (and (evil-range-p range1) - (evil-range-p range2)) - (evil-range (min (evil-range-beginning range1) - (evil-range-beginning range2)) - (max (evil-range-end range1) - (evil-range-end range2)) - (or type - (evil-type range1) - (evil-type range2))))) - -(defun evil-subrange-p (range1 range2) - "Whether RANGE1 is contained within RANGE2." - (and (evil-range-p range1) - (evil-range-p range2) - (<= (evil-range-beginning range2) - (evil-range-beginning range1)) - (>= (evil-range-end range2) - (evil-range-end range1)))) - -(defun evil-select-inner-object (thing beg end type &optional count line) - "Return an inner text object range of COUNT objects. -If COUNT is positive, return objects following point; if COUNT is -negative, return objects preceding point. If one is unspecified, -the other is used with a negative argument. THING is a symbol -understood by `thing-at-point'. BEG, END and TYPE specify the -current selection. If LINE is non-nil, the text object should be -linewise, otherwise it is character wise." - (let* ((count (or count 1)) - (bnd (or (let ((b (bounds-of-thing-at-point thing))) - (and b (< (point) (cdr b)) b)) - (evil-bounds-of-not-thing-at-point thing) - (cons (point-min) (point-max))))) - ;; check if current object is selected - (when (or (not beg) (not end) - (> beg (car bnd)) - (< end (cdr bnd)) - (and (eq type 'inclusive) - (= (1+ beg) end))) ; empty region does not count - (when (or (not beg) (< (car bnd) beg)) (setq beg (car bnd))) - (when (or (not end) (> (cdr bnd) end)) (setq end (cdr bnd))) - (setq count (if (> count 0) (1- count) (1+ count)))) - (goto-char (if (< count 0) beg end)) - (evil-forward-nearest count - #'(lambda (cnt) (forward-thing thing cnt)) - #'(lambda (cnt) (evil-forward-not-thing thing cnt))) - (evil-range (if (>= count 0) beg (point)) - (if (< count 0) end (point)) - (if line 'line type) - :expanded t))) - -(defun evil-select-inner-restricted-object (thing beg end type &optional count line) - "Return an inner text object range of COUNT objects. -Selection is restricted to the current line, unless it is empty. -If COUNT is positive, return objects following point; if COUNT is -negative, return objects preceding point. If one is unspecified, -the other is used with a negative argument. THING is a symbol -understood by `thing-at-point'. BEG, END and TYPE specify the -current selection. If LINE is non-nil, the text object should be -linewise, otherwise it is character wise." - (save-restriction - (let ((start (line-beginning-position)) - (end (line-end-position))) - (unless (= start end) - (narrow-to-region start end))) - (evil-select-inner-object thing beg end type count line))) - -(defun evil-select-an-object (thing beg end type count &optional line) - "Return an outer text object range of COUNT objects. -If COUNT is positive, return objects following point; if COUNT is -negative, return objects preceding point. If one is unspecified, -the other is used with a negative argument. THING is a symbol -understood by thing-at-point. BEG, END and TYPE specify the -current selection. If LINE is non-nil, the text object should be -linewise, otherwise it is character wise." - (let* ((dir (if (> (or count 1) 0) +1 -1)) - (count (abs (or count 1))) - (objbnd (let ((b (bounds-of-thing-at-point thing))) - (and b (< (point) (cdr b)) b))) - (bnd (or objbnd - (evil-bounds-of-not-thing-at-point thing) - (cons (point-min) (point-max)))) - addcurrent other) - ;; check if current object is not selected - (when (or (not beg) (not end) - (> beg (car bnd)) - (< end (cdr bnd)) - (and (eq type 'inclusive) - (= (1+ beg) end))) ; empty region does not count - ;; if not, enlarge selection - (when (or (not beg) (< (car bnd) beg)) (setq beg (car bnd))) - (when (or (not end) (> (cdr bnd) end)) (setq end (cdr bnd))) - (if objbnd (setq addcurrent t))) - ;; make other and (point) reflect the selection - (cond - ((> dir 0) (goto-char end) (setq other beg)) - (t (goto-char beg) (setq other end))) - (cond - ;; do nothing more than only current is selected - ((not (and (= beg (car bnd)) (= end (cdr bnd))))) - ;; current match is thing, add whitespace - (objbnd - (let ((wsend (evil-with-restriction - ;; restrict to current line if we do non-line selection - (unless line (line-beginning-position)) - (unless line (line-end-position)) - (evil-bounds-of-not-thing-at-point thing dir)))) - (cond - (wsend - ;; add whitespace at end - (goto-char wsend) - (setq addcurrent t)) - (t - ;; no whitespace at end, try beginning - (save-excursion - (goto-char other) - (setq wsend - (evil-with-restriction - ;; restrict to current line if we do non-line selection - (unless line - (if (member thing '(evil-word evil-WORD)) - (save-excursion (back-to-indentation) (point)) - (line-beginning-position))) - (unless line (line-end-position)) - (evil-bounds-of-not-thing-at-point thing (- dir)))) - (when wsend (setq other wsend addcurrent t))))))) - ;; current match is whitespace, add thing - (t - (forward-thing thing dir) - (setq addcurrent t))) - ;; possibly count current object as selection - (if addcurrent (setq count (1- count))) - ;; move - (dotimes (_ count) - (let ((wsend (evil-bounds-of-not-thing-at-point thing dir))) - (if (and wsend (/= wsend (point))) - ;; start with whitespace - (forward-thing thing dir) - ;; start with thing - (forward-thing thing dir) - (setq wsend (evil-bounds-of-not-thing-at-point thing dir)) - (when wsend (goto-char wsend))))) - ;; return range - (evil-range (if (> dir 0) other (point)) - (if (< dir 0) other (point)) - (if line 'line type) - :expanded t))) - -(defun evil-select-a-restricted-object (thing beg end type &optional count line) - "Return an outer text object range of COUNT objects. -Selection is restricted to the current line, unless it is empty. -If COUNT is positive, return objects following point; if COUNT is -negative, return objects preceding point. If one is unspecified, -the other is used with a negative argument. THING is a symbol -understood by thing-at-point. BEG, END and TYPE specify the -current selection. If LINE is non-nil, the text object should be -linewise, otherwise it is character wise." - (save-restriction - (let ((start (line-beginning-position)) - (end (line-end-position))) - (when (/= start end) - (narrow-to-region start end))) - (evil-select-an-object thing beg end type count line))) - -(defun evil--get-block-range (op cl selection-type) - "Return the exclusive range of a visual selection. -OP and CL are pairs of buffer positions for the opening and -closing delimiter of a range. SELECTION-TYPE is the desired type -of selection. It is a symbol that determines which parts of the -block are selected. If it is `inclusive' or t the returned range -is \(cons (car OP) (cdr CL)). If it is `exclusive' or nil the -returned range is (cons (cdr OP) (car CL)). If it is -`exclusive-line' the returned range will skip whitespace at the -end of the line of OP and at the beginning of the line of CL." - (cond - ((memq selection-type '(inclusive t)) (cons (car op) (cdr cl))) - ((memq selection-type '(exclusive nil)) (cons (cdr op) (car cl))) - ((eq selection-type 'exclusive-line) - (let ((beg (cdr op)) - (end (car cl))) - (save-excursion - (goto-char beg) - (when (and (eolp) (not (eobp))) - (setq beg (line-beginning-position 2))) - (goto-char end) - (skip-chars-backward " \t") - (when (bolp) - (setq end (point)) - (goto-char beg) - (when (and (not (bolp)) (< beg end)) - (setq end (1- end))))) - (cons beg end))) - (t (user-error "Unknown selection-type `%s'" selection-type)))) - -(defun evil-select-block (thing beg end type count - &optional - selection-type - countcurrent - fixedscan) - "Return a range (BEG END) of COUNT delimited text objects. -BEG END TYPE are the currently selected (visual) range. The -delimited object must be given by THING-up function (see -`evil-up-block'). - -SELECTION-TYPE is symbol that determines which parts of the block -are selected. If it is `inclusive' or t OPEN and CLOSE are -included in the range. If it is `exclusive' or nil the delimiters -are not contained. If it is `exclusive-line' the delimiters are -not included as well as adjacent whitespace until the beginning -of the next line or the end of the previous line. If the -resulting selection consists of complete lines only and visual -state is not active, the returned selection is linewise. - -If COUNTCURRENT is non-nil an objected is counted if the current -selection matches that object exactly. - -Usually scanning for the surrounding block starts at (1+ beg) -and (1- end). If this might fail due to the behavior of THING -then FIXEDSCAN can be set to t. In this case the scan starts at -BEG and END. One example where this might fail is if BEG and END -are the delimiters of a string or comment." - (save-excursion - (save-match-data - (let* ((orig-beg beg) - (orig-end end) - (beg (or beg (point))) - (end (or end (point))) - (count (abs (or count 1))) - op cl op-end cl-end) - ;; We always assume at least one selected character. - (if (= beg end) (setq end (1+ end))) - ;; We scan twice: starting at (1+ beg) forward and at (1- end) - ;; backward. The resulting selection is the smaller one. - (goto-char (if fixedscan beg (1+ beg))) - (when (and (zerop (funcall thing +1)) (match-beginning 0)) - (setq cl (cons (match-beginning 0) (match-end 0))) - (goto-char (car cl)) - (when (and (zerop (funcall thing -1)) (match-beginning 0)) - (setq op (cons (match-beginning 0) (match-end 0))))) - ;; start scanning from end - (goto-char (if fixedscan end (1- end))) - (when (and (zerop (funcall thing -1)) (match-beginning 0)) - (setq op-end (cons (match-beginning 0) (match-end 0))) - (goto-char (cdr op-end)) - (when (and (zerop (funcall thing +1)) (match-beginning 0)) - (setq cl-end (cons (match-beginning 0) (match-end 0))))) - ;; Bug #607: use the tightest selection that contains the - ;; original selection. If non selection contains the original, - ;; use the larger one. - (cond - ((and (not op) (not cl-end)) - (error "No surrounding delimiters found")) - ((or (not op) ; first not found - (and cl-end ; second found - (>= (car op-end) (car op)) ; second smaller - (<= (cdr cl-end) (cdr cl)) - (<= (car op-end) beg) ; second contains orig - (>= (cdr cl-end) end))) - (setq op op-end cl cl-end))) - (setq op-end op cl-end cl) ; store copy - ;; if the current selection contains the surrounding - ;; delimiters, they do not count as new selection - (let ((cnt (if (and orig-beg orig-end (not countcurrent)) - (let ((sel (evil--get-block-range op cl selection-type))) - (if (and (<= orig-beg (car sel)) - (>= orig-end (cdr sel))) - count - (1- count))) - (1- count)))) - ;; starting from the innermost surrounding delimiters - ;; increase selection - (when (> cnt 0) - (setq op (progn - (goto-char (car op-end)) - (funcall thing (- cnt)) - (if (match-beginning 0) - (cons (match-beginning 0) (match-end 0)) - op)) - cl (progn - (goto-char (cdr cl-end)) - (funcall thing cnt) - (if (match-beginning 0) - (cons (match-beginning 0) (match-end 0)) - cl))))) - (let ((sel (evil--get-block-range op cl selection-type))) - (setq op (car sel) - cl (cdr sel))) - (cond - ((and (equal op orig-beg) (equal cl orig-end) - (or (not countcurrent) (/= count 1))) - (error "No surrounding delimiters found")) - ((save-excursion - (and (not (evil-visual-state-p)) - (eq type 'inclusive) - (progn (goto-char op) (bolp)) - (progn (goto-char cl) (bolp)))) - (evil-range op cl 'line :expanded t)) - (t (evil-range op cl type :expanded t))))))) - -(defun evil-select-paren (open close beg end type count &optional inclusive) - "Return a range (BEG END) of COUNT delimited text objects. -OPEN and CLOSE specify the opening and closing delimiter, -respectively. BEG END TYPE are the currently selected (visual) -range. If INCLUSIVE is non-nil, OPEN and CLOSE are included in -the range; otherwise they are excluded. - -If you aren't inside a pair of the opening and closing delimiters, -it jumps you inside the next one. If there isn't one, it errors. - -The types of OPEN and CLOSE specify which kind of THING is used -for parsing with `evil-select-block'. If OPEN and CLOSE are -characters `evil-up-paren' is used. Otherwise OPEN and CLOSE -must be regular expressions and `evil-up-block' is used. - -If the selection is exclusive, whitespace at the end or at the -beginning of the selection until the end-of-line or beginning-of-line -is ignored." - (condition-case nil - (progn - ;; we need special linewise exclusive selection - (unless inclusive (setq inclusive 'exclusive-line)) - (cond - ((and (characterp open) (characterp close)) - (let ((thing #'(lambda (&optional cnt) - (evil-up-paren open close cnt))) - (bnd (or (bounds-of-thing-at-point 'evil-string) - (bounds-of-thing-at-point 'evil-comment) - ;; If point is at the opening quote of a string, - ;; this must be handled as if point is within the - ;; string, i.e. the selection must be extended - ;; around the string. Otherwise - ;; `evil-select-block' might do the wrong thing - ;; because it accidentally moves point inside the - ;; string (for inclusive selection) when looking - ;; for the current surrounding block. (re #364) - (and (= (point) (or beg (point))) - (save-excursion - (goto-char (1+ (or beg (point)))) - (or (bounds-of-thing-at-point 'evil-string) - (bounds-of-thing-at-point 'evil-comment))))))) - (if (not bnd) - (evil-select-block thing beg end type count inclusive) - (or (evil-with-restriction (car bnd) (cdr bnd) - (ignore-errors - (evil-select-block thing beg end type count inclusive))) - (save-excursion - (setq beg (or beg (point)) - end (or end (point))) - (goto-char (car bnd)) - (let ((extbeg (min beg (car bnd))) - (extend (max end (cdr bnd)))) - (evil-select-block thing - extbeg extend - type - count - inclusive - (or (< extbeg beg) (> extend end)) - t))))))) - (t - (evil-select-block #'(lambda (&optional cnt) - (evil-up-block open close cnt)) - beg end type count inclusive)))) - (error ; we aren't in the parens, so find next instance - (save-match-data - (goto-char (or (if (and count (> 0 count)) end beg) - (point))) - (let ((re (if (characterp open) (regexp-quote (string open)) open))) - (if (and (not (looking-at-p re)) - (re-search-forward re nil t count)) - (progn - (goto-char (match-beginning 0)) - (let* ((mbeg (match-beginning 0)) - (res (evil-select-paren open close mbeg mbeg - type nil inclusive))) - (if (< (car res) mbeg) - ;; this will error if the beginning of the found parens is before the target paren - ;; this prevents things such as on the line `prova ( verder "((testo)")`, - ;; the inputs `g2ci(` from putting your cursor inside the deleted `()` after `prova` - ;; without this, it would go to the second paren (the unbalanced first paren inside the quotes) - ;; and then do a change there, changing inside the whole paren after `prova` - (error "No surrounding delimiters found") - res))) - (error "No surrounding delimiters found"))))))) - -(defun evil-select-quote-thing (thing beg end _type count &optional inclusive) - "Selection THING as if it described a quoted object. -THING is typically either `evil-quote' or `evil-chars'. This -function is called from `evil-select-quote'." - (save-excursion - (let* ((count (or count 1)) - (dir (if (> count 0) 1 -1)) - (bnd (let ((b (bounds-of-thing-at-point thing))) - (and b (< (point) (cdr b)) b))) - addcurrent - wsboth) - (if inclusive (setq inclusive t) - (when (= (abs count) 2) - (setq count dir) - (setq inclusive 'quote-only)) - ;; never extend with exclusive selection - (setq beg nil end nil)) - ;; check if the previously selected range does not contain a - ;; string - (unless (and beg end - (save-excursion - (goto-char (if (> dir 0) beg end)) - (forward-thing thing dir) - (and (<= beg (point)) (< (point) end)))) - ;; if so forget the range - (setq beg nil end nil)) - ;; check if there is a current object, if not fetch one - (when (not bnd) - (unless (and (zerop (forward-thing thing dir)) - (setq bnd (bounds-of-thing-at-point thing))) - (error "No quoted string found")) - (if (> dir 0) - (setq end (point)) - (setq beg (point))) - (setq addcurrent t)) - ;; check if current object is not selected - (when (or (not beg) (not end) (> beg (car bnd)) (< end (cdr bnd))) - ;; if not, enlarge selection - (when (or (not beg) (< (car bnd) beg)) (setq beg (car bnd))) - (when (or (not end) (> (cdr bnd) end)) (setq end (cdr bnd))) - (setq addcurrent t wsboth t)) - ;; maybe count current element - (when addcurrent - (setq count (if (> dir 0) (1- count) (1+ count)))) - ;; enlarge selection - (goto-char (if (> dir 0) end beg)) - (when (and (not addcurrent) - (= count (forward-thing thing count))) - (error "No quoted string found")) - (if (> dir 0) (setq end (point)) (setq beg (point))) - ;; add whitespace - (cond - ((not inclusive) (setq beg (1+ beg) end (1- end))) - ((not (eq inclusive 'quote-only)) - ;; try to add whitespace in forward direction - (goto-char (if (> dir 0) end beg)) - (if (setq bnd (bounds-of-thing-at-point 'evil-space)) - (if (> dir 0) (setq end (cdr bnd)) (setq beg (car bnd))) - ;; if not found try backward direction - (goto-char (if (> dir 0) beg end)) - (if (and wsboth (setq bnd (bounds-of-thing-at-point 'evil-space))) - (if (> dir 0) (setq beg (car bnd)) (setq end (cdr bnd))))))) - (evil-range beg end - ;; HACK: fixes #583 - ;; When not in visual state, an empty range is - ;; possible. However, this cannot be achieved with - ;; inclusive ranges, hence we use exclusive ranges - ;; in this case. In visual state the range must be - ;; inclusive because otherwise the selection would - ;; be wrong. - (if (evil-visual-state-p) 'inclusive 'exclusive) - :expanded t)))) - -(defun evil-select-quote (quote beg end type count &optional inclusive) - "Return a range (BEG END) of COUNT quoted text objects. -QUOTE specifies the quotation delimiter. BEG END TYPE are the -currently selected (visual) range. - -If INCLUSIVE is nil the previous selection is ignore. If there is -quoted string at point this object will be selected, otherwise -the following (if (> COUNT 0)) or preceeding object (if (< COUNT -0)) is selected. If (/= (abs COUNT) 2) the delimiting quotes are not -contained in the range, otherwise they are contained in the range. - -If INCLUSIVE is non-nil the selection depends on the previous -selection. If the currently selection contains at least one -character that is contained in a quoted string then the selection -is extended, otherwise it is thrown away. If there is a -non-selected object at point then this object is added to the -selection. Otherwise the selection is extended to the -following (if (> COUNT 0)) or preceeding object (if (< COUNT -0)). Any whitespace following (or preceeding if (< COUNT 0)) the -new selection is added to the selection. If no such whitespace -exists and the selection contains only one quoted string then the -preceeding (or following) whitespace is added to the range. " - (let ((evil-forward-quote-char quote)) - (or (let ((bnd (or (bounds-of-thing-at-point 'evil-comment) - (bounds-of-thing-at-point 'evil-string)))) - (when (and bnd (< (point) (cdr bnd)) - (/= (char-after (car bnd)) quote) - (/= (char-before (cdr bnd)) quote)) - (evil-with-restriction (car bnd) (cdr bnd) - (ignore-errors (evil-select-quote-thing - 'evil-quote-simple - beg end type - count - inclusive))))) - (let ((evil-forward-quote-char quote)) - (evil-select-quote-thing 'evil-quote - beg end type - count - inclusive))))) - -(defun evil-select-xml-tag (beg end type &optional count inclusive) - "Return a range (BEG END) of COUNT matching XML tags. -If INCLUSIVE is non-nil, the tags themselves are included -from the range." - (cond - ((and (not inclusive) (= (abs (or count 1)) 1)) - (let ((rng (evil-select-block #'evil-up-xml-tag beg end type count nil t))) - (if (or (and beg (= beg (evil-range-beginning rng)) - end (= end (evil-range-end rng)))) - (evil-select-block #'evil-up-xml-tag beg end type count t) - rng))) - (t - (evil-select-block #'evil-up-xml-tag beg end type count inclusive)))) - -(defun evil-expand-range (range &optional copy) - "Expand RANGE according to its type. -Return a new range if COPY is non-nil." - (when copy - (setq range (evil-copy-range range))) - (unless (plist-get (evil-range-properties range) :expanded) - (setq range (evil-transform-range :expand range))) - range) - -(defun evil-contract-range (range &optional copy) - "Contract RANGE according to its type. -Return a new range if COPY is non-nil." - (evil-transform-range :contract range copy)) - -(defun evil-normalize-range (range &optional copy) - "Normalize RANGE according to its type. -Return a new range if COPY is non-nil." - (evil-transform-range :normalize range copy)) - -(defun evil-transform-range (transform range &optional copy) - "Apply TRANSFORM to RANGE according to its type. -Return a new range if COPY is non-nil." - (when copy - (setq range (evil-copy-range range))) - (when (evil-type range) - (apply #'evil-set-range range - (apply #'evil-transform transform range))) - range) - -(defun evil-describe-range (range) - "Return description of RANGE. -If no description is available, return the empty string." - (apply #'evil-describe range)) - -;;; Undo - -(defvar buffer-undo-tree) -(declare-function undo-tree-current "ext:undo-tree") -(declare-function undo-tree-node-next "ext:undo-tree") -(declare-function undo-tree-node-branch "ext:undo-tree") -(declare-function undo-tree-node-branch "ext:undo-tree") -(declare-function undo-tree-undo "ext:undo-tree") -(declare-function undo-tree-snip-node "ext:undo-tree") - -(defun evil-start-undo-step (&optional continue) - "Start a undo step. -All following buffer modifications are grouped together as a -single action. If CONTINUE is non-nil, preceding modifications -are included. The step is terminated with `evil-end-undo-step'." - (when (and (listp buffer-undo-list) - (not evil-in-single-undo)) - (if evil-undo-list-pointer - (evil-refresh-undo-step) - (unless (or continue (null (car-safe buffer-undo-list))) - (undo-boundary)) - (setq evil-undo-list-pointer (or buffer-undo-list t))))) - -(defun evil-end-undo-step (&optional continue) - "End a undo step started with `evil-start-undo-step'. -Adds an undo boundary unless CONTINUE is specified." - (when (and (listp buffer-undo-list) - evil-undo-list-pointer - (not evil-in-single-undo)) - (evil-refresh-undo-step) - (unless (or continue (null (car-safe buffer-undo-list))) - (undo-boundary)) - (setq evil-undo-list-pointer nil))) - -(defun evil-refresh-undo-step () - "Refresh `buffer-undo-list' entries for current undo step. -Undo boundaries until `evil-undo-list-pointer' are removed to -make the entries undoable as a single action. See -`evil-start-undo-step'." - (when evil-undo-list-pointer - (setq buffer-undo-list - (evil-filter-list #'null buffer-undo-list evil-undo-list-pointer)) - (setq evil-undo-list-pointer (or buffer-undo-list t)))) - -(defmacro evil-with-undo (&rest body) - "Execute BODY with enabled undo. -If undo is disabled in the current buffer, the undo information -is stored in `evil-temporary-undo' instead of `buffer-undo-list'." - (declare (indent defun) (debug t)) - (let ((undo-list (make-symbol "undo-list"))) - `(let ((,undo-list buffer-undo-list) - (evil-undo-system evil-undo-system)) - (when (eq ,undo-list t) (setq buffer-undo-list nil - evil-undo-system nil)) - (unwind-protect - (progn ,@body) - ;; ensure any new undo changes we've accumulated start with - ;; exactly one undo boundary marker, i.e. nil - (when (car-safe buffer-undo-list) (push nil buffer-undo-list)) - (if (eq ,undo-list t) - ;; undo is disabled, so store undo information in - ;; evil-temporary-undo - (setq evil-temporary-undo buffer-undo-list - buffer-undo-list t) - (setq evil-temporary-undo nil)))))) - -(defmacro evil-with-single-undo (&rest body) - "Execute BODY as a single undo step." - (declare (indent defun) (debug t)) - `(let (evil-undo-list-pointer) - (evil-with-undo - (evil-start-undo-step) - (unwind-protect - (let ((evil-in-single-undo t)) ,@body) - (evil-end-undo-step))))) - -(defun evil-undo-pop () - "Undo and forget the last buffer change. -If undo is disabled in the current buffer, use the information -in `evil-temporary-undo' instead." - (if (and (eq evil-undo-system 'undo-tree) - (not (eq buffer-undo-list t))) - (let (current) - (undo-tree-undo) - (setq current (undo-tree-current buffer-undo-tree) - current (nth (undo-tree-node-branch current) - (undo-tree-node-next current))) - ;; Remove only if leaf to not have to adjust child buffer positions - (unless (undo-tree-node-next current) (undo-tree-snip-node current))) - (let ((paste-undo (list nil)) - (undo-list (if (eq buffer-undo-list t) - evil-temporary-undo - buffer-undo-list))) - (when (or (not undo-list) (car undo-list)) - (user-error "Can't undo previous change")) - (while (and undo-list (null (car undo-list))) - (pop undo-list)) ; remove nil - (while (and undo-list (car undo-list)) - (push (pop undo-list) paste-undo)) - (let ((buffer-undo-list (nreverse paste-undo))) - (evil-save-echo-area - (undo))) - (if (eq buffer-undo-list t) - (setq evil-temporary-undo nil) - (setq buffer-undo-list undo-list))))) - -;;; Search -(defun evil-transform-regexp (regexp replacements-alist) - (replace-regexp-in-string - "\\\\+[^\\\\]" - #'(lambda (txt) - (let* ((b (match-beginning 0)) - (e (match-end 0)) - (ch (aref txt (1- e))) - (repl (assoc ch replacements-alist))) - (if (and repl (zerop (mod (length txt) 2))) - (concat (substring txt b (- e 2)) - (cdr repl)) - txt))) - regexp nil t)) - -(defun evil-transform-magic (str magic quote transform &optional _start) - "Transform STR with magic characters. -MAGIC is a regexp that matches all potential magic -characters. Each occurence of CHAR as magic character within str -is replaced by the result of calling the associated TRANSFORM -function. TRANSFORM is a function taking two arguments, the -character to be transformed and the rest of string after the -character. The function should return a triple (REPLACEMENT REST -. STOP) where REPLACEMENT is the replacement and REST is the rest -of the string that has not been transformed. If STOP is non-nil -then the substitution stops immediately. The replacement starts -at position START, everything before that position is returned -literally. The result is a pair (RESULT . REST). RESULT is a -list containing the transformed parts in order. If two -subsequents parts are both strings, they are concatenated. REST -is the untransformed rest string (usually \"\" but may be more if -TRANSFORM stopped the substitution). Which characters are -considered as magic characters (i.e. the transformation happens -if the character is NOT preceeded by a backslash) is determined -by `evil-magic'. The special tokens \\v, \\V, \\m and \\M have -always a special meaning (like in Vim) and should not be -contained in TRANSFORMS, otherwise their meaning is overwritten. - -The parameter QUOTE is a quoting function applied to literal -transformations, usually `regexp-quote' or `replace-quote'." - (save-match-data - (let ((regexp (concat "\\(?:\\`\\|[^\\]\\)\\(\\\\\\(?:\\(" magic "\\)\\|\\(.\\)\\)\\|\\(" magic "\\)\\)")) - (magic-chars (evil-get-magic evil-magic)) - (evil-magic evil-magic) - (quote (or quote #'identity)) - result stop) - (while (and (not stop) str (string-match regexp str)) - (unless (zerop (match-beginning 1)) - (push (substring str 0 (match-beginning 1)) result)) - (let ((char (or (match-string 2 str) - (match-string 3 str) - (match-string 4 str))) - (rest (substring str (match-end 0)))) - (cond - ((match-beginning 4) - ;; magic character without backslash - (if (string-match magic-chars char) - ;; magic, do transform - (let ((trans (funcall transform (aref char 0) rest))) - (push (car trans) result) - (setq str (cadr trans) stop (nthcdr 2 trans))) - ;; non-magic, literal transformation - (push (funcall quote char) result) - (setq str rest))) - ((match-beginning 2) - ;; magic character with backslash - (if (not (string-match magic-chars char)) - ;; non-magic, do transform - (let ((trans (funcall transform (aref char 0) rest))) - (push (car trans) result) - (setq str (cadr trans) stop (nthcdr 2 trans))) - ;; magic, literal transformation - (push (funcall quote char) result) - (setq str rest))) - ((memq (aref char 0) '(?m ?M ?v ?V)) - (setq evil-magic (cdr (assq (aref char 0) - '((?m . t) - (?M . nil) - (?v . very-magic) - (?V . very-nomagic))))) - (setq magic-chars (evil-get-magic evil-magic)) - (setq str rest)) - (t - ;; non-magic char with backslash, literal transformation - (push (funcall quote char) result) - (setq str rest))))) - (cond - ((and str (not stop)) - (push str result) - (setq str "")) - ((not str) - (setq str ""))) - ;; concatenate subsequent strings - ;; note that result is in reverse order - (let (repl) - (while result - (cond - ((and (stringp (car result)) - (zerop (length (car result)))) - (pop result)) - ((and (stringp (car result)) - (stringp (cadr result))) - (setq result (cons (concat (cadr result) - (car result)) - (nthcdr 2 result)))) - (t - (push (pop result) repl)))) - (cons repl str))))) - -(defconst evil-vim-regexp-replacements - '((?n . "\n") (?r . "\r") - (?t . "\t") (?b . "\b") - (?s . "[[:space:]]") (?S . "[^[:space:]]") - (?d . "[[:digit:]]") (?D . "[^[:digit:]]") - (?x . "[[:xdigit:]]") (?X . "[^[:xdigit:]]") - (?o . "[0-7]") (?O . "[^0-7]") - (?a . "[[:alpha:]]") (?A . "[^[:alpha:]]") - (?l . "[a-z]") (?L . "[^a-z]") - (?u . "[A-Z]") (?U . "[^A-Z]") - (?y . "\\s") (?Y . "\\S") - (?\( . "\\(") (?\) . "\\)") - (?{ . "\\{") (?} . "\\}") - (?\[ . "[") (?\] . "]") - (?< . "\\<") (?> . "\\>") - (?_ . "\\_") - (?* . "*") (?+ . "+") - (?? . "?") (?= . "?") - (?. . ".") - (?` . "`") (?^ . "^") - (?$ . "$") (?| . "\\|"))) - -(defconst evil-regexp-magic "[][(){}<>_dDsSxXoOaAlLuUwWyY.*+?=^$`|nrtb0-9]") - -(defun evil-transform-vim-style-regexp (regexp) - "Transform vim-style backslash codes to Emacs regexp. -This includes the backslash codes \\d, \\D, \\s, \\S, \\x, \\X, -\\o, \\O, \\a, \\A, \\l, \\L, \\u, \\U and \\w, \\W. The new -codes \\y and \\Y can be used instead of the Emacs code \\s and -\\S which have a different meaning in Vim-style." - (car - (car - (evil-transform-magic - regexp evil-regexp-magic #'regexp-quote - #'(lambda (char rest) - (let ((repl (assoc char evil-vim-regexp-replacements))) - (if repl - (list (cdr repl) rest) - (list (concat "\\" (char-to-string char)) rest)))))))) - -;;; Substitute - -(defun evil-downcase-first (str) - "Return STR with the first letter downcased." - (if (zerop (length str)) - str - (concat (downcase (substring str 0 1)) - (substring str 1)))) - -(defun evil-upcase-first (str) - "Return STR with the first letter upcased." - (if (zerop (length str)) - str - (concat (upcase (substring str 0 1)) - (substring str 1)))) - -(defun evil-get-magic (magic) - "Return a regexp matching the magic characters according to MAGIC. -Depending on the value of MAGIC the following characters are -considered magic. - t [][{}*+?.&~$^ - nil [][{}*+?$^ - `very-magic' not 0-9A-Za-z_ - `very-nomagic' empty." - (cond - ((eq magic t) "[][}{*+?.&~$^]") - ((eq magic 'very-magic) "[^0-9A-Za-z_]") - ((eq magic 'very-nomagic) "\\\\") - (t "[][}{*+?$^]"))) - -;; TODO: support magic characters in patterns -(defconst evil-replacement-magic "[eElLuU0-9&#,rnbt=]" - "All magic characters in a replacement string") - -(defun evil-compile-subreplacement (to &optional start) - "Convert a regexp replacement TO to Lisp from START until \\e or \\E. -Return a pair (RESULT . REST). RESULT is a list suitable for -`perform-replace' if necessary, the original string if not. -REST is the unparsed remainder of TO." - (let ((result - (evil-transform-magic - to evil-replacement-magic #'replace-quote - #'(lambda (char rest) - (cond - ((eq char ?#) - (list '(number-to-string replace-count) rest)) - ((eq char ?r) (list "\r" rest)) - ((eq char ?n) (list "\n" rest)) - ((eq char ?b) (list "\b" rest)) - ((eq char ?t) (list "\t" rest)) - ((memq char '(?e ?E)) - `("" ,rest . t)) - ((memq char '(?l ?L ?u ?U)) - (let ((result (evil-compile-subreplacement rest)) - (func (cdr (assoc char - '((?l . evil-downcase-first) - (?L . downcase) - (?u . evil-upcase-first) - (?U . upcase)))))) - (list `(,func - (replace-quote - (evil-match-substitute-replacement - ,(car result) - (not case-replace)))) - (cdr result)))) - ((eq char ?=) - (when (or (zerop (length rest)) - (not (eq (aref rest 0) ?@))) - (user-error "Expected @ after \\=")) - (when (< (length rest) 2) - (user-error "Expected register after \\=@")) - (list (evil-get-register (aref rest 1)) - (substring rest 2))) - ((eq char ?,) - (let* ((obj (read-from-string rest)) - (result `(replace-quote ,(car obj))) - (end - ;; swallow a space after a symbol - (if (and (or (symbolp (car obj)) - ;; swallow a space after 'foo, - ;; but not after (quote foo) - (and (eq (car-safe (car obj)) 'quote) - (not (= ?\( (aref rest 0))))) - (eq (string-match " " rest (cdr obj)) - (cdr obj))) - (1+ (cdr obj)) - (cdr obj)))) - (list result (substring rest end)))) - ((eq char ?0) - (list "\\&" rest)) - (t - (list (concat "\\" (char-to-string char)) rest)))) - start))) - (let ((rest (cdr result)) - (result (car result))) - (replace-match-string-symbols result) - (cons (if (cdr result) - (cons 'concat result) - (or (car result) "")) - rest)))) - -(defun evil-compile-replacement (to) - "Maybe convert a regexp replacement TO to Lisp. -Return a list suitable for `perform-replace' if necessary, the -original string if not. Currently the following magic characters -in replacements are supported: 0-9&#lLuUrnbt, -The magic character , (comma) start an Emacs-lisp expression." - (when (stringp to) - (save-match-data - (cons 'replace-eval-replacement - (car (evil-compile-subreplacement to)))))) - -(defun evil-match-substitute-replacement (replacement &optional fixedcase string) - "Return REPLACEMENT as it will be inserted by `evil-replace-match'. -If REPLACEMENT is an expression it will be evaluated to compute the -replacement text first." - (match-substitute-replacement - (if (stringp replacement) - replacement - (funcall (car replacement) - (cdr replacement) - 0)) - fixedcase nil string)) - -;;; Alignment - -(defun evil-justify-lines (beg end justify position) - "Justify all lines in a range. -BEG and END specify the range of those lines to be -justified. JUSTIFY is either `left', `right' or `center' according -to the justification type. POSITION is the maximal text width for -right and center justification or the column at which the lines -should be left-aligned for left justification." - (let ((fill-column position) - adaptive-fill-mode fill-prefix) - (evil-with-restriction - (save-excursion (goto-char beg) (line-beginning-position)) - (save-excursion (goto-char end) (line-end-position (if (bolp) 0 1))) - (goto-char (point-min)) - (while (progn - (if (eq justify 'left) - (indent-line-to position) - (when (re-search-forward "^[[:space:]]*" nil t) - (delete-region (match-beginning 0) - (match-end 0))) - (justify-current-line justify nil t)) - (and (zerop (forward-line)) (bolp)))) - (goto-char (point-min)) - (back-to-indentation)))) - -;;; View helper - -(defvar-local evil-list-view-select-action nil) - -(define-derived-mode evil-list-view-mode tabulated-list-mode - "Evil List View" - (tabulated-list-init-header) - (tabulated-list-print)) - -(defun evil-list-view-goto-entry () - (interactive) - (when (and evil-list-view-select-action - (not (eobp))) - (let* ((line (line-number-at-pos (point))) - (entry (elt tabulated-list-entries (1- line)))) - (funcall evil-list-view-select-action (nth 1 entry))))) - -(defun evil-list-view-quit () - (interactive) - (quit-window 'kill)) - -(define-key evil-list-view-mode-map (kbd "q") #'evil-list-view-quit) -(define-key evil-list-view-mode-map [follow-link] nil) ;; allows mouse-1 to be activated -(define-key evil-list-view-mode-map [mouse-1] #'evil-list-view-goto-entry) -(define-key evil-list-view-mode-map [return] #'evil-list-view-goto-entry) - -(defmacro evil-with-view-list (&rest properties) - "Open a new list view buffer. -PROPERTIES is a property-list which supports the following properties: - -:name (required) The name of the buffer. -:mode-name (required) The name for the mode line. -:format (required) The value for `tabulated-list-format'. -:entries (required) The value for `tabulated-list-entries'. -:select-action (optional) A function for row selection. - It takes a single parameter, which is the - selected row's vector value that is - passed into `:entries'." - (declare (indent defun) (debug t)) - `(let ((bufname (concat "*" ,(plist-get properties :name) "*")) - (inhibit-read-only t)) - (and (get-buffer bufname) - (kill-buffer bufname)) - (let ((buf (get-buffer-create bufname))) - (with-current-buffer buf - (setq tabulated-list-format ,(plist-get properties :format)) - (setq tabulated-list-entries ,(plist-get properties :entries)) - (setq evil-list-view-select-action ,(plist-get properties :select-action)) - (evil-list-view-mode) - (setq mode-name ,(plist-get properties :mode-name)) - (evil-motion-state)) - (switch-to-buffer-other-window buf)))) - -(provide 'evil-common) - -;;; evil-common.el ends here diff --git a/.config/emacs/lisp/evil/evil-core.el b/.config/emacs/lisp/evil/evil-core.el deleted file mode 100644 index ae3f949..0000000 --- a/.config/emacs/lisp/evil/evil-core.el +++ /dev/null @@ -1,1322 +0,0 @@ -;;; evil-core.el --- Core functionality -*- lexical-binding: t -*- -;; Author: Vegard Øye -;; Maintainer: Vegard Øye - -;; Version: 1.15.0 - -;; -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -;;; Commentary: - -;; Evil is defined as a globalized minor mode, enabled with the toggle -;; function `evil-mode'. This in turn enables `evil-local-mode' in -;; every buffer, which sets up the buffer's state. -;; -;; Each state has its own keymaps, and these keymaps have status as -;; "emulation keymaps" with priority over regular keymaps. Emacs -;; maintains the following keymap hierarchy (highest priority first): -;; -;; * Overriding keymaps/overlay keymaps... -;; * Emulation mode keymaps... -;; - Evil keymaps... -;; * Minor mode keymaps... -;; * Local keymap (`local-set-key') -;; * Global keymap (`global-set-key') -;; -;; Within this hierarchy, Evil arranges the keymaps for the current -;; state as shown below: -;; -;; * Intercept keymaps... -;; * Local state keymap -;; * Minor-mode keymaps... -;; * Auxiliary keymaps... -;; * Overriding keymaps... -;; * Global state keymap -;; * Keymaps for other states... -;; -;; These keymaps are listed in `evil-mode-map-alist', which is listed -;; in `emulation-mode-map-alist'. -;; -;; Most of the key bindings for a state are stored in its global -;; keymap, which has a name such as `evil-normal-state-map'. (See the -;; file evil-maps.el, which contains all the default key bindings.) A -;; state also has a local keymap (`evil-normal-state-local-map'), -;; which may contain user customizations for the current buffer. -;; Furthermore, any Emacs mode may be assigned state bindings of its -;; own by passing the mode's keymap to the function `evil-define-key' -;; or `evil-define-minor-mode-key'. The former uses a specific map to -;; define the key in while the latter associates the key with a -;; particular mode. These mode-specific bindings are ultimately stored -;; in so-called auxiliary and minor-mode keymaps respectively, which -;; are sandwiched between the local keymap and the global keymap. -;; Finally, the state may also activate the keymaps of other states -;; (e.g., Normal state inherits bindings from Motion state). -;; -;; For integration purposes, a regular Emacs keymap may be "elevated" -;; to emulation status by passing it to `evil-make-intercept-map' or -;; `evil-make-overriding-map'. An "intercept" keymap has priority over -;; all other Evil keymaps. (Evil uses this facility when debugging and -;; for handling the "ESC" key in the terminal.) More common is the -;; "overriding" keymap, which only has priority over the global state -;; keymap. (This is useful for adapting key-heavy modes such as Dired, -;; where all but a few keys should be left as-is and should not be -;; shadowed by Evil's default bindings.) -;; -;; States are defined with the macro `evil-define-state', which -;; creates a command for switching to the state. This command, -;; for example `evil-normal-state' for Normal state, performs -;; the following tasks: -;; -;; * Setting `evil-state' to the new state. -;; * Refreshing the keymaps in `evil-mode-map-alist'. -;; * Updating the mode line. -;; - Normal state depends on `evil-normal-state-tag'. -;; * Adjusting the cursor's appearance. -;; - Normal state depends on `evil-normal-state-cursor'. -;; * Displaying a message in the echo area. -;; - Normal state depends on `evil-normal-state-message'. -;; * Running hooks. -;; - Normal state runs `evil-normal-state-entry-hook' when -;; entering, and `evil-normal-state-exit-hook' when exiting. -;; -;; The various properties of a state can be accessed through their -;; respective variables, or by passing a keyword and the state's name -;; to the `evil-state-property' function. Evil defines the states -;; Normal state ("normal"), Insert state ("insert"), Visual state -;; ("visual"), Replace state ("replace"), Operator-Pending state -;; ("operator"), Motion state ("motion") and Emacs state ("emacs"). - -;;; Code: - -(require 'evil-common) - -(declare-function evil-emacs-state-p "evil-states") -(declare-function evil-ex-p "evil-ex") - -(define-minor-mode evil-local-mode - "Minor mode for setting up Evil in a single buffer." - :init-value nil - (if evil-local-mode - (progn - (cl-pushnew 'evil-mode-map-alist emulation-mode-map-alists) - (evil-initialize-local-keymaps) - (when (minibufferp) - (setq-local evil-default-state 'insert) - (setq-local evil-echo-state nil)) - (setq evil-input-method current-input-method) - (evil-initialize-state) - (add-hook 'input-method-activate-hook #'evil-activate-input-method t t) - (add-hook 'input-method-deactivate-hook #'evil-deactivate-input-method t t) - (add-hook 'activate-mark-hook 'evil-visual-activate-hook nil t) - ;; FIXME: Add these hooks buffer-locally and remove when disabling - (add-hook 'pre-command-hook 'evil-repeat-pre-hook) - (add-hook 'post-command-hook 'evil-repeat-post-hook)) - (evil-refresh-mode-line) - (remove-hook 'activate-mark-hook 'evil-visual-activate-hook t) - (remove-hook 'input-method-activate-hook #'evil-activate-input-method t) - (remove-hook 'input-method-deactivate-hook #'evil-deactivate-input-method t) - (activate-input-method evil-input-method) - (evil-change-state nil))) - -;; Make the variable permanent local. This is particular useful in -;; conjunction with nXhtml/mumamo because mumamo does not touch these -;; variables. -(put 'evil-local-mode 'permanent-local t) - -(defun turn-on-evil-mode () - "Turn on Evil in the current buffer." - (interactive) - (evil-local-mode)) - -(defun turn-off-evil-mode () - "Turn off Evil in the current buffer." - (interactive) - (evil-local-mode -1)) - -;; The function `evil-initialize' should only be used to initialize -;; `evil-local-mode' from the globalized minor-mode `evil-mode'. It is -;; called whenever evil is enabled in a buffer for the first time or -;; when evil is active and the major-mode of the buffer changes. -(defun evil-initialize () - "Enable Evil in the current buffer, if appropriate. -To enable Evil globally, do (evil-mode)." - (if evil-local-mode - ;; Set Evil state according to new major-mode - (evil-initialize-state) - (or (and (minibufferp) (not evil-want-minibuffer)) - (evil-disabled-buffer-p) - (evil-local-mode)))) - -(defalias 'evil--fundamental-mode #'fundamental-mode) - -(defvar evil--advices ()) - -;;;###autoload (autoload 'evil-mode "evil" nil t) -(define-globalized-minor-mode evil-mode evil-local-mode evil-initialize - :group 'evil) - -;; `define-globalized-minor-mode' supports a BODY argument but only since -;; GNU Emacs 27.1, so resort to this ugly advice in the mean time. -(define-advice evil-mode (:after (&optional _arg) body) - ;; Hooks used to not run in Fundamental buffers (bug#23827), so - ;; other measures are necessary to initialize Evil there. When Evil - ;; is enabled globally, the default value of `major-mode' is set to - ;; the `evil--fundamental-mode' alias, sidestepping the restriction. - (if evil-mode - (progn - (and (eval-when-compile (version< emacs-version "26.1")) - (eq (default-value 'major-mode) 'fundamental-mode) - (setq-default major-mode #'evil--fundamental-mode)) - (dolist (advice evil--advices) (apply #'advice-add advice)) - (with-no-warnings (evil-esc-mode 1))) - (when (eq (default-value 'major-mode) #'evil--fundamental-mode) - (setq-default major-mode 'fundamental-mode)) - (pcase-dolist (`(,funname ,_where ,adfun) evil--advices) - (advice-remove funname adfun)) - (with-no-warnings (evil-esc-mode -1)))) - -(defun evil--advice-add (&rest args) - "Like `advice-add' for advices active only in `evil-mode'." - (when evil-mode (apply #'advice-add args)) - (cl-pushnew args evil--advices :test #'equal)) - -(defun evil-change-state (state &optional message) - "Change the state to STATE. -If STATE is nil, disable all states." - (let ((func (evil-state-property (or state evil-state) :toggle))) - (when (and (functionp func) - (or message (not (eq state evil-state)))) - (funcall func (if state (and message 1) -1))))) - -(defmacro evil-save-state (&rest body) - "Save the current state; execute BODY; restore the state." - (declare (indent defun) - (debug t)) - `(let ((evil-state evil-state) - (evil-previous-state evil-previous-state) - (evil-previous-state-alist (copy-tree evil-previous-state-alist)) - (evil-next-state evil-next-state) - (old-state evil-state) - (inhibit-quit t) - (buf (current-buffer))) - (unwind-protect - (progn ,@body) - (when (buffer-live-p buf) - (with-current-buffer buf - (evil-change-state old-state)))))) - -(defmacro evil-with-state (state &rest body) - "Change to STATE and execute BODY without refreshing the display. -Restore the previous state afterwards." - (declare (indent defun) - (debug t)) - `(evil-without-display - (evil-save-state - (evil-change-state ',state) - ,@body))) - -(defun evil-initialize-state () - "Set up the initial state for the current buffer. -See also `evil-set-initial-state'." - (evil-change-state (evil-initial-state-for-buffer))) - -(defun evil-initial-state-for-buffer-name (&optional name default) - "Return the initial Evil state to use for a buffer with name NAME. -Matches the name against the regular expressions in -`evil-buffer-regexps'. If none matches, returns DEFAULT." - (let ((name (if (stringp name) name (buffer-name name)))) - (when name - (catch 'done - (dolist (entry evil-buffer-regexps default) - (let ((regexp (car entry)) - (state (cdr entry))) - (when (string-match-p regexp name) - (throw 'done state)))))))) - -(defun evil-disabled-buffer-p (&optional buffer) - "Whether Evil should be disabled in BUFFER." - (null (evil-initial-state-for-buffer-name buffer 'undefined))) - -(defun evil-initial-state-for-buffer (&optional buffer) - "Return the initial Evil state to use for BUFFER. -BUFFER defaults to the current buffer. See also `evil-initial-state'." - (with-current-buffer (or buffer (current-buffer)) - (or (evil-initial-state-for-buffer-name) - (cl-loop for (mode) in minor-mode-map-alist - when (and (boundp mode) (symbol-value mode)) - thereis (evil-initial-state mode)) - (evil-initial-state major-mode nil t) - evil-default-state))) - -(defun evil-initial-state (mode &optional default follow-parent checked-modes) - "Return the Evil state to use for MODE or its alias. -Return DEFAULT if no initial state is associated with MODE. -The initial state for a mode can be set with -`evil-set-initial-state'. - -If FOLLOW-PARENT is non-nil, also check parent modes of MODE and -its alias. CHECKED-MODES is used internally and should not be set -initially." - (when (memq mode checked-modes) - (error "Circular reference detected in ancestors of `%s'\n%s" - major-mode checked-modes)) - (let ((mode-alias (let ((func (symbol-function mode))) - (when (symbolp func) func)))) - (or (cl-dolist (entry (evil-state-property t :modes) default) - (let ((state (car entry)) - (modes (symbol-value (cdr entry)))) - (when (or (memq mode modes) - (and mode-alias (memq mode-alias modes))) - (cl-return state)))) - (and follow-parent (get mode 'derived-mode-parent) - (evil-initial-state (get mode 'derived-mode-parent) - nil t (cons mode checked-modes))) - (and follow-parent mode-alias - (get mode-alias 'derived-mode-parent) - (evil-initial-state (get mode-alias 'derived-mode-parent) - nil t (cons mode-alias checked-modes)))))) - -(defun evil-set-initial-state (mode state) - "Set the initial state for major mode MODE to STATE. -This is the state the buffer comes up in." - (dolist (modes (evil-state-property t :modes)) - (setq modes (cdr-safe modes)) - (set modes (delq mode (symbol-value modes)))) - (when state - (add-to-list (evil-state-property state :modes) mode))) - -(evil-define-command evil-change-to-initial-state - (&optional buffer message) - "Change the state of BUFFER to its initial state. -This is the state the buffer came up in. If Evil is not activated -then this function does nothing." - :keep-visual t - :suppress-operator t - (when evil-local-mode - (with-current-buffer (or buffer (current-buffer)) - (evil-change-state (evil-initial-state-for-buffer buffer) - message)))) - -(evil-define-command evil-change-to-previous-state - (&optional buffer message) - "Change the state of BUFFER to its previous state." - :keep-visual t - :repeat abort - :suppress-operator t - (with-current-buffer (or buffer (current-buffer)) - (let ((prev-state evil-previous-state) - (prev-prev-state (cdr-safe (assoc evil-previous-state - evil-previous-state-alist)))) - (evil-change-state nil) - (when prev-prev-state - (setq evil-previous-state prev-prev-state)) - (evil-change-state (or prev-state evil-default-state 'normal) - message)))) - -;; When a buffer is created in a low-level way, it is invisible to -;; Evil (as well as other globalized minor modes) because no hooks are -;; run. This is appropriate since many buffers are used for throwaway -;; purposes. Passing the buffer to `set-window-buffer' indicates -;; otherwise, though, so advise this function to initialize Evil. -(evil--advice-add 'set-window-buffer :before #'evil--swb-initialize) -(defun evil--swb-initialize (_window buffer &rest _) - "Initialize Evil in the displayed buffer." - (when (and evil-mode (get-buffer buffer)) - (with-current-buffer buffer - (unless evil-local-mode - (save-match-data (evil-initialize)))))) - -;; Refresh cursor color. -;; Cursor color can only be set for each frame but not for each buffer. -;; FIXME: Shouldn't this belong in `evil-(local-)mode'? -(add-hook 'window-configuration-change-hook #'evil-refresh-cursor) -(advice-add 'select-window :after #'evil--sw-refresh-cursor) -(defun evil--sw-refresh-cursor (&rest _) - (evil-refresh-cursor)) - -(defun evil-generate-mode-line-tag (&optional state) - "Generate the evil mode-line tag for STATE." - (let ((tag (evil-state-property state :tag t))) - (when (functionp tag) - (setq tag (funcall tag))) - ;; prepare mode-line: add tooltip - (if (stringp tag) - (propertize tag - 'help-echo (evil-state-property state :name) - 'mouse-face 'mode-line-highlight) - tag))) - -(defun evil-refresh-mode-line (&optional state) - "Refresh mode line tag." - (when (listp mode-line-format) - (setq evil-mode-line-tag (evil-generate-mode-line-tag state)) - ;; refresh mode line data structure - ;; first remove evil from mode-line - (setq mode-line-format (delq 'evil-mode-line-tag mode-line-format)) - (let ((mlpos mode-line-format) - pred which where) - ;; determine before/after which symbol the tag should be placed - (cond - ((eq evil-mode-line-format 'before) - (setq where 'after which 'mode-line-position)) - ((eq evil-mode-line-format 'after) - (setq where 'after which 'mode-line-modes)) - ((consp evil-mode-line-format) - (setq where (car evil-mode-line-format) - which (cdr evil-mode-line-format)))) - ;; find the cons-cell of the symbol before/after which the tag - ;; should be placed - (while (and mlpos - (let ((sym (or (car-safe (car mlpos)) (car mlpos)))) - (not (eq which sym)))) - (setq pred mlpos - mlpos (cdr mlpos))) - ;; put evil tag at the right position in the mode line - (cond - ((not mlpos)) ;; position not found, so do not add the tag - ((eq where 'before) - (if pred - (setcdr pred (cons 'evil-mode-line-tag mlpos)) - (setq mode-line-format - (cons 'evil-mode-line-tag mode-line-format)))) - ((eq where 'after) - (setcdr mlpos (cons 'evil-mode-line-tag (cdr mlpos))))) - (force-mode-line-update)))) - -;; input methods should be disabled in non-insertion states -(defun evil-activate-input-method () - "Enable input method in states with :input-method non-nil." - (let (input-method-activate-hook - input-method-deactivate-hook) - (when (and evil-local-mode evil-state) - (setq evil-input-method current-input-method) - (unless (evil-state-property evil-state :input-method) - (deactivate-input-method))))) -(put 'evil-activate-input-method 'permanent-local-hook t) - -(defun evil-deactivate-input-method () - "Disable input method in all states." - (let (input-method-activate-hook - input-method-deactivate-hook) - (when (and evil-local-mode evil-state) - (setq evil-input-method nil)))) -(put 'evil-deactivate-input-method 'permanent-local-hook t) - -(defmacro evil-without-input-method-hooks (&rest body) - "Execute body with evil's activate/deactivate-input-method hooks deactivated. -This allows input methods to be used in normal-state." - (declare (indent defun)) - `(unwind-protect - (progn - (remove-hook 'input-method-activate-hook #'evil-activate-input-method t) - (remove-hook 'input-method-deactivate-hook #'evil-deactivate-input-method t) - ,@body) - (add-hook 'input-method-activate-hook #'evil-activate-input-method nil t) - (add-hook 'input-method-deactivate-hook #'evil-deactivate-input-method nil t))) - -(evil--advice-add 'toggle-input-method :around #'evil--refresh-input-method) -(defun evil--refresh-input-method (orig-fun &rest args) - "Refresh `evil-input-method'." - (cond - ((not evil-local-mode) - (apply orig-fun args)) - ((evil-state-property evil-state :input-method) - (apply orig-fun args)) - (t - (let ((current-input-method evil-input-method)) - (apply orig-fun args))))) - -;; Local keymaps are implemented using buffer-local variables. -;; However, unless a buffer-local value already exists, -;; `define-key' acts on the variable's default (global) value. -;; So we need to initialize the variable whenever we enter a -;; new buffer or when the buffer-local values are reset. -(defun evil-initialize-local-keymaps () - "Initialize a buffer-local value for local keymaps as necessary. -The initial value is that of `make-sparse-keymap'." - (dolist (entry evil-local-keymaps-alist) - (let ((map (cdr entry))) - (unless (and (keymapp (symbol-value map)) - (local-variable-p map)) - (set map (make-sparse-keymap)))))) - -(defun evil-make-overriding-map (keymap &optional state copy) - "Give KEYMAP precedence over the global keymap of STATE. -The keymap will have lower precedence than custom STATE bindings. -If STATE is nil, give it precedence over all states. -If COPY is t, create a copy of KEYMAP and give that -higher precedence. See also `evil-make-intercept-map'." - (let ((key [override-state])) - (if (not copy) - (define-key keymap key (or state 'all)) - (unless (keymapp copy) - (setq copy (assq-delete-all 'menu-bar (copy-keymap keymap)))) - (define-key copy key (or state 'all)) - (define-key keymap key copy)))) - -(defun evil-make-intercept-map (keymap &optional state aux) - "Give KEYMAP precedence over all Evil keymaps in STATE. -If STATE is nil, give it precedence over all states. If AUX is non-nil, make the -auxiliary keymap corresponding to KEYMAP in STATE an intercept keymap instead of -KEYMAP itself. See also `evil-make-overriding-map'." - (let ((key [intercept-state]) - (keymap (if aux - (evil-get-auxiliary-keymap keymap state t t) - keymap))) - (define-key keymap key (or state 'all)))) - -(defmacro evil-define-keymap (keymap doc &rest body) - "Define a keymap KEYMAP listed in `evil-mode-map-alist'. -That means it will have precedence over regular keymaps. - -DOC is the documentation for the variable. BODY, if specified, -is executed after toggling the mode. Optional keyword arguments -may be specified before the body code: - -:mode VAR Mode variable. If unspecified, the variable - is based on the keymap name. -:local BOOLEAN Whether the keymap should be buffer-local, that is, - reinitialized for each buffer. -:func BOOLEAN Create a toggle function even if BODY is empty. - -\(fn KEYMAP DOC [[KEY VAL]...] BODY...)" - (declare (indent defun) - (doc-string 2) - (debug (&define name - [&optional stringp] - [&rest [keywordp sexp]] - def-body))) - (let ((func t) - arg intercept key local mode overriding) - (while (keywordp (car-safe body)) - (setq key (pop body) - arg (pop body)) - (cond - ((eq key :mode) (setq mode arg)) - ((eq key :local) (setq local arg)) - ((eq key :func) (setq func arg)) - ((eq key :intercept) (setq intercept arg)) - ((eq key :overriding) (setq overriding arg)))) - (setq mode (or mode - (intern (replace-regexp-in-string - "\\(?:-\\(?:mode-\\)?\\(?:key\\)?map\\)?$" - "-mode" - (symbol-name keymap))))) - `(progn - (defvar ,keymap ,(unless local '(make-sparse-keymap))) - (unless (get ',keymap 'variable-documentation) - (put ',keymap 'variable-documentation ,doc)) - (defvar ,mode nil) - (unless (get ',mode 'variable-documentation) - (put ',mode 'variable-documentation ,doc)) - (make-variable-buffer-local ',mode) - (put ',mode 'permanent-local t) - (when ,intercept - (evil-make-intercept-map ,keymap)) - (when ,overriding - (evil-make-overriding-map ,keymap)) - ,@(if local - `((make-variable-buffer-local ',keymap) - (put ',keymap 'permanent-local t) - (evil--add-to-alist evil-local-keymaps-alist ',mode ',keymap)) - `((evil--add-to-alist evil-global-keymaps-alist ',mode ',keymap) - (evil--add-to-alist evil-mode-map-alist ',mode ,keymap))) - ,(when (or body func) - `(defun ,mode (&optional arg) - ,@(when doc `(,doc)) - (interactive) - (cond - ((numberp arg) (setq ,mode (> arg 0))) - (t (setq ,mode (not ,mode)))) - ,@body)) - ',keymap))) - -;; The ESC -> escape translation code has been provided by Stefan -;; Monnier in the discussion of GNU Emacs bug #13793. -(defun evil-esc-mode (&optional arg) - "Toggle interception of \\e (escape). -Enable with positive ARG and disable with negative ARG. - -When enabled, `evil-esc-mode' modifies the entry of \\e in -`input-decode-map'. If such an event arrives, it is translated to -a plain `escape' event if no further event occurs within -`evil-esc-delay' seconds. Otherwise no translation happens and -the ESC prefix map (i.e. the map originally bound to \\e in -`input-decode-map`) is returned." - (cond - ((or (null arg) (eq arg 0)) - (evil-esc-mode (if evil-esc-mode -1 +1))) - ((> arg 0) - (unless evil-esc-mode - (setq evil-esc-mode t) - (add-hook 'after-make-frame-functions #'evil-init-esc) - (mapc #'evil-init-esc (frame-list)))) - ((< arg 0) - (when evil-esc-mode - (remove-hook 'after-make-frame-functions #'evil-init-esc) - (mapc #'evil-deinit-esc (frame-list)) - (setq evil-esc-mode nil))))) - -(defun evil-init-esc (frame) - "Update `input-decode-map' in terminal." - (with-selected-frame frame - (let ((term (frame-terminal frame))) - (when (and - (or (eq evil-intercept-esc 'always) - (and evil-intercept-esc - (eq (terminal-live-p term) t))) ; only patch tty - (not (terminal-parameter term 'evil-esc-map))) - (let ((evil-esc-map (lookup-key input-decode-map [?\e]))) - (set-terminal-parameter term 'evil-esc-map evil-esc-map) - (define-key input-decode-map [?\e] - `(menu-item "" ,evil-esc-map :filter ,#'evil-esc))))))) - -(defun evil-deinit-esc (frame) - "Restore `input-decode-map' in terminal." - (with-selected-frame frame - (let ((term (frame-terminal frame))) - (when (terminal-live-p term) - (let ((evil-esc-map (terminal-parameter term 'evil-esc-map))) - (when evil-esc-map - (define-key input-decode-map [?\e] evil-esc-map) - (set-terminal-parameter term 'evil-esc-map nil))))))) - -(defun evil-esc (map) - "Translate \\e to `escape' if no further event arrives. -This function is used to translate a \\e event either to `escape' -or to the standard ESC prefix translation map. If \\e arrives, -this function waits for `evil-esc-delay' seconds for another -event. If no other event arrives, the event is translated to -`escape', otherwise it is translated to the standard ESC prefix -map stored in `input-decode-map'. If `evil-inhibit-esc' is -non-nil or if evil is in emacs state, the event is always -translated to the ESC prefix. - -The translation to `escape' happens only if the current command -has indeed been triggered by \\e. In other words, this will only -happen when the keymap is accessed from `read-key-sequence'. In -particular, if it is access from `define-key' the returned -mapping will always be the ESC prefix map." - (if (and (not evil-inhibit-esc) - (or evil-local-mode (evil-ex-p) - (active-minibuffer-window)) - (not (evil-emacs-state-p)) - (let ((keys (this-single-command-keys))) - (and (> (length keys) 0) - (= (aref keys (1- (length keys))) ?\e))) - (sit-for evil-esc-delay)) - (prog1 [escape] - (when defining-kbd-macro - (end-kbd-macro) - (setq last-kbd-macro (vconcat last-kbd-macro [escape])) - (start-kbd-macro t t))) - map)) - -(defun evil-state-p (sym) - "Whether SYM is the name of a state." - (assq sym evil-state-properties)) - -(defun evil-state-keymaps (state &rest excluded) - "Return a keymap alist of keymaps activated by STATE. -If STATE references other states in its :enable property, -these states are recursively processed and added to the list. -\(The EXCLUDED argument is an internal safeguard against -infinite recursion, keeping track of processed states.)" - (let* ((state (or state evil-state)) - (enable (evil-state-property state :enable)) - (map (cons - (evil-state-property state :mode) - (evil-state-property state :keymap t))) - (local-map (cons - (evil-state-property state :local) - (evil-state-property state :local-keymap t))) - (minor-mode-maps (evil-state-minor-mode-keymaps state)) - (aux-maps (evil-state-auxiliary-keymaps state)) - (overriding-maps - (evil-state-overriding-keymaps state)) - (intercept-maps - (evil-state-intercept-keymaps state)) - (result `(,intercept-maps)) - (remove-duplicates (null excluded))) - (unless (memq state enable) - (setq enable (cons state enable))) - ;; process STATE's :enable property - (dolist (entry enable) - (cond - ((memq entry excluded)) - ;; the keymaps for STATE - ((eq entry state) - (setq result `(,@result - (,local-map) - ,minor-mode-maps - ,aux-maps - ,overriding-maps - (,map))) - (push state excluded)) - ;; the keymaps for another state: call `evil-state-keymaps' - ;; recursively, but keep track of processed states - ((evil-state-p entry) - (setq result `(,@result - ,(apply #'evil-state-keymaps entry excluded)))) - ;; a single keymap - ((or (keymapp entry) - (and (keymapp (symbol-value entry)) - (setq entry (symbol-value entry))) - (setq entry (evil-keymap-for-mode entry))) - (setq result `(,@result - ((,(evil-mode-for-keymap entry t) . - ,entry))))))) - ;; postpone the expensive filtering of duplicates to the top level - (if remove-duplicates - (apply #'evil-concat-keymap-alists result) - (apply #'append result)))) - -(defun evil-normalize-keymaps (&optional state) - "Create a buffer-local value for `evil-mode-map-alist'. -This is a keymap alist, determined by the current state -\(or by STATE if specified)." - (let ((state (or state evil-state)) - (excluded '(nil t)) - map mode temp) - ;; initialize buffer-local keymaps as necessary - (evil-initialize-local-keymaps) - ;; deactivate keymaps of previous state - (dolist (entry evil-mode-map-alist) - (setq mode (car entry) - map (cdr entry)) - ;; don't deactivate overriding keymaps; - ;; they are toggled by their associated mode - (if (or (memq mode excluded) - (evil-intercept-keymap-p map) - (evil-overriding-keymap-p map) - (evil-auxiliary-keymap-p map) - (evil-minor-mode-keymap-p map)) - (push mode excluded) - (and (fboundp mode) (symbol-value mode) (funcall mode -1)) - (set mode nil))) - (setq evil-mode-map-alist nil) - ;; activate keymaps of current state - (when state - (setq temp (evil-state-keymaps state)) - (dolist (entry temp) - (setq mode (car entry) - map (cdr entry)) - (unless (or (and (boundp mode) (symbol-value mode)) - ;; the minor-mode keymaps include modes that are not - ;; necessarily active - (evil-minor-mode-keymap-p map)) - (when (fboundp mode) - (funcall mode 1)) - (set mode t)) - ;; refresh the keymap in case it has changed - ;; (e.g., `evil-operator-shortcut-map' is - ;; reset on toggling) - (if (or (memq mode excluded) - (evil-intercept-keymap-p map) - (evil-overriding-keymap-p map) - (evil-auxiliary-keymap-p map) - (evil-minor-mode-keymap-p map)) - (push mode excluded) - (setcdr entry (or (evil-keymap-for-mode mode) map)))) - ;; update `evil-mode-map-alist' - (setq evil-mode-map-alist temp)))) - -(defun evil-mode-for-keymap (keymap &optional default) - "Return the minor mode associated with KEYMAP. -Return DEFAULT if no mode is found. -See also `evil-keymap-for-mode'." - (let ((map (if (keymapp keymap) keymap (symbol-value keymap))) - (var (when (symbolp keymap) keymap))) - ;; Check Evil variables first for speed purposes. - ;; If all else fails, check `minor-mode-map-alist'. - (or (when var - (or (car (rassq var evil-global-keymaps-alist)) - (car (rassq var evil-local-keymaps-alist)))) - (car (rassq map (mapcar #'(lambda (e) - ;; from (MODE-VAR . MAP-VAR) - ;; to (MODE-VAR . MAP) - (cons (car-safe e) - (symbol-value (cdr-safe e)))) - (append evil-global-keymaps-alist - evil-local-keymaps-alist)))) - (car (rassq map minor-mode-map-alist)) - default))) - -(defun evil-keymap-for-mode (mode &optional variable) - "Return the keymap associated with MODE. -Return the keymap variable if VARIABLE is non-nil. -See also `evil-mode-for-keymap'." - (let* ((var (or (cdr (assq mode evil-global-keymaps-alist)) - (cdr (assq mode evil-local-keymaps-alist)))) - (map (or (symbol-value var) - (cdr (assq mode minor-mode-map-alist))))) - (if variable var map))) - -(defun evil-state-auxiliary-keymaps (state) - "Return a keymap alist of auxiliary keymaps for STATE." - (let ((state (or state evil-state)) - aux result) - (dolist (map (current-active-maps) (nreverse result)) - (when (setq aux (evil-get-auxiliary-keymap map state)) - (push (cons (evil-mode-for-keymap map t) aux) result))))) - -(defun evil-state-minor-mode-keymaps (state) - "Return a keymap alist of minor-mode keymaps for STATE." - (cdr (assq (or state evil-state) evil-minor-mode-keymaps-alist))) - -(defun evil-state-overriding-keymaps (&optional state) - "Return a keymap alist of overriding keymaps for STATE." - (let* ((state (or state evil-state)) - result) - (dolist (map (current-active-maps)) - (when (setq map (evil-overriding-keymap-p map state)) - (push (cons (evil-mode-for-keymap map t) map) result))) - (nreverse result))) - -(defun evil-state-intercept-keymaps (&optional state) - "Return a keymap alist of intercept keymaps for STATE." - (let* ((state (or state evil-state)) - result) - (dolist (map (current-active-maps)) - (when (setq map (or (evil-intercept-keymap-p map state) - (evil-intercept-keymap-p - (evil-get-auxiliary-keymap map state) state))) - (push (cons (evil-mode-for-keymap map t) map) result))) - (setq result (nreverse result)) - result)) - -(defun evil-set-auxiliary-keymap (map state &optional aux) - "Set the auxiliary keymap for MAP in STATE to AUX. -If AUX is nil, create a new auxiliary keymap." - (unless aux (setq aux (make-sparse-keymap))) - (unless (evil-auxiliary-keymap-p aux) - (evil-set-keymap-prompt - aux (format "Auxiliary keymap for %s" - (or (evil-state-property state :name) - (format "%s state" state))))) - (define-key map (vector (intern (format "%s-state" state))) aux) - aux) - -(defun evil-get-auxiliary-keymap (map state &optional create ignore-parent) - "Get the auxiliary keymap for MAP in STATE. -If CREATE is non-nil, create an auxiliary keymap -if MAP does not have one. If CREATE and -IGNORE-PARENT are non-nil then a new auxiliary -keymap is created even if the parent of MAP has -one already." - (when state - (let* ((key (vector (intern (format "%s-state" state)))) - (parent-aux (when (and ignore-parent - (keymap-parent map)) - (lookup-key (keymap-parent map) key))) - (aux (lookup-key map key))) - (cond - ((and ignore-parent - (equal parent-aux aux) - create) - (evil-set-auxiliary-keymap map state)) - ((evil-auxiliary-keymap-p aux) - aux) - (create - (evil-set-auxiliary-keymap map state)))))) - -(defun evil-get-minor-mode-keymap (state mode) - "Get the auxiliary keymap for MODE in STATE, creating one if it -does not already exist." - (let ((state-entry (assq state evil-minor-mode-keymaps-alist))) - (if (and state-entry - (assq mode state-entry)) - (cdr (assq mode state-entry)) - (let ((map (make-sparse-keymap))) - (evil-set-keymap-prompt - map (format "Minor-mode keymap for %s in %s" - mode - (or (evil-state-property state :name) - (format "%s state" state)))) - (if state-entry - (setcdr state-entry - (append (list (cons mode map)) (cdr state-entry))) - (push (cons state (list (cons mode map))) - evil-minor-mode-keymaps-alist)) - map)))) - -(defun evil-auxiliary-keymap-p (map) - "Whether MAP is an auxiliary keymap." - (let ((prompt (keymap-prompt map))) - (when prompt (string-prefix-p "Auxiliary keymap" prompt)))) - -(defun evil-minor-mode-keymap-p (map) - "Whether MAP is a minor-mode keymap." - (let ((prompt (keymap-prompt map))) - (when prompt (string-prefix-p "Minor-mode keymap" prompt)))) - -(defun evil-intercept-keymap-p (map &optional state) - "Whether MAP is an intercept keymap for STATE. -If STATE is nil, it means any state." - (let ((entry (and (keymapp map) - (lookup-key map [intercept-state])))) - (cond - ((null entry) nil) - ((null state) map) - ((eq entry state) map) - ((eq entry 'all) map)))) - -(defun evil-overriding-keymap-p (map &optional state) - "Whether MAP is an overriding keymap for STATE. -If STATE is nil, it means any state." - (let ((entry (and (keymapp map) - (lookup-key map [override-state])))) - (cond - ((null entry) nil) - ((keymapp entry) (evil-overriding-keymap-p entry state)) - ((null state) map) - ((eq entry state) map) - ((eq entry 'all) map)))) - -(defun evil-intercept-keymap-state (map) - "Return the state for the intercept keymap MAP. -A return value of t means all states." - (let ((state (lookup-key map [intercept-state] map))) - (cond - ((keymapp state) - (evil-intercept-keymap-state state)) - ((eq state 'all) - t) - (t - state)))) - -(defun evil-overriding-keymap-state (map) - "Return the state for the overriding keymap MAP. -A return value of t means all states." - (let ((state (lookup-key map [override-state] map))) - (cond - ((keymapp state) - (evil-overriding-keymap-state state)) - ((eq state 'all) - t) - (t - state)))) - -(defun evil-set-leader (state key &optional localleader) - "Set KEY to trigger leader bindings in STATE. -KEY should be in the form produced by `kbd'. STATE is one of -`normal', `insert', `visual', `replace', `operator', `motion', -`emacs', a list of one or more of these, or `nil', which means -all of the above. If LOCALLEADER is non-nil, set the local leader -instead." - (let* ((all-states '(normal insert visual replace operator motion emacs)) - (states (cond ((null state) all-states) - ((consp state) state) - (t (list state)))) - (leaderkey (if localleader [localleader] [leader])) - (binding - `(menu-item "" nil :filter ,(lambda (_cmd) (key-binding leaderkey))))) - (dolist (state states) - (evil-global-set-key state key binding)))) - -(defmacro evil-define-key (state keymap key def &rest bindings) - "Create a STATE binding from KEY to DEF for KEYMAP. -STATE is one of `normal', `insert', `visual', `replace', -`operator', `motion', `emacs', or a list of one or more of -these. Omitting a state by using `nil' corresponds to a standard -Emacs binding using `define-key'. The remaining arguments are -like those of `define-key'. For example: - - (evil-define-key \\='normal foo-map \"a\" \\='bar) - -This creates a binding from `a' to `bar' in normal state, which -is active whenever `foo-map' is active. Using nil for the state, -the following lead to identical bindings: - - (evil-define-key nil foo-map \"a\" \\='bar) - (define-key foo-map \"a\" \\='bar) - -It is possible to specify multiple states and/or bindings at -once: - - (evil-define-key \\='(normal visual) foo-map - \"a\" \\='bar - \"b\" \\='foo) - -If `foo-map' has not been initialized yet, this macro adds an -entry to `after-load-functions', delaying execution as necessary. - -KEYMAP may also be a quoted symbol. If the symbol is `global', the -global evil keymap corresponding to the state(s) is used, meaning -the following lead to identical bindings: - - (evil-define-key \\='normal \\='global \"a\" \\='bar) - (evil-global-set-key \\='normal \"a\" \\='bar) - -The symbol `local' may also be used, which corresponds to using -`evil-local-set-key'. If a quoted symbol is used that is not -`global' or `local', it is assumed to be the name of a minor -mode, in which case `evil-define-minor-mode-key' is used. - -KEY is an internal Emacs representation of a key, as for -`define-key'. To bind key sequences that use modifier keys such -as \"C-a\" or \"M-a\", convert the key sequences using `kbd'. -For example: - - (evil-define-key \\='normal foo-map (kbd \"C-a\") \\='bar)" - (declare (indent defun)) - (cond - ((member keymap '('global 'local)) - `(evil-define-key* ,state ,keymap ,key ,def ,@bindings)) - ((eq (car-safe keymap) 'quote) - `(evil-define-minor-mode-key ,state ,keymap ,key ,def ,@bindings)) - (t `(evil-with-delay ,(if (symbolp keymap) - ;; BEWARE: Can't work for lexically scoped vars - `(and (boundp ',keymap) (keymapp ,keymap)) - `(keymapp ,keymap)) - (after-load-functions - t nil ,(format "evil-define-key-in-%s" - (if (symbolp keymap) keymap 'keymap))) - (with-demoted-errors "Error in evil-define-key: %S" - (evil-define-key* ,state ,keymap ,key ,def ,@bindings)))))) -(defalias 'evil-declare-key #'evil-define-key) - -(defun evil-define-key* (state keymap key def &rest bindings) - "Create a STATE binding from KEY to DEF for KEYMAP. -STATE is one of normal, insert, visual, replace, operator, -motion, emacs, or a list of one or more of these. Omitting a -state by using nil corresponds to a standard Emacs binding using -`define-key' The remaining arguments are like those of -`define-key'. For example: - - (evil-define-key* \\='normal foo-map \"a\" \\='bar) - -This creates a binding from \"a\" to bar in Normal state, which -is active whenever foo-map is active. Using nil for the state, -the following are equivalent: - - (evil-define-key* nil foo-map \"a\" \\='bar) - - (define-key foo-map \"a\" \\='bar) - - It is possible to specify multiple states and/or bindings at - once: - - (evil-define-key* \\='(normal visual) foo-map - \"a\" \\='bar - \"b\" \\='foo) - -KEYMAP may also be a quoted symbol. If the symbol is global, the -global evil keymap corresponding to the state(s) is used, meaning -the following are equivalent: - - (evil-define-key* \\='normal \\='global \"a\" \\='bar) - - (evil-global-set-key \\='normal \"a\" \\='bar) - -The symbol local may also be used, which corresponds to using -`evil-local-set-key'. - -The use is nearly identical to `evil-define-key' with the -exception that this is a function and not a macro (and so will -not be expanded when compiled which can have unintended -consequences). `evil-define-key*' also does not defer any -bindings like `evil-define-key' does using `evil-with-delay'. This -allows errors in the bindings to be caught immediately, and makes -its behavior more predictable." - (declare (indent defun)) - (let ((maps - (if state - (mapcar - (lambda (st) - (cond ((eq keymap 'global) - (evil-state-property st :keymap t)) - ((eq keymap 'local) - (evil-state-property st :local-keymap t)) - (t - (evil-get-auxiliary-keymap keymap st t t)))) - (if (listp state) state (list state))) - (list - (cond ((eq keymap 'global) - global-map) - ((eq keymap 'local) - ;; see `local-set-key' - (or (current-local-map) - (let ((map (make-sparse-keymap))) - (use-local-map map) - map))) - (t - keymap)))))) - (while key - (dolist (map maps) - (define-key map key def)) - (setq key (pop bindings) - def (pop bindings))) - ;; ensure the prompt string comes first - (dolist (map maps) - (evil-set-keymap-prompt map (keymap-prompt map))))) - -(defun evil-define-minor-mode-key (state mode key def &rest bindings) - "Similar to `evil-define-key' but the bindings are associated -with the minor-mode symbol MODE instead of a particular map. -Associating bindings with a mode symbol instead of a map allows -evil to use Emacs' built-in mechanisms to enable the bindings -automatically when MODE is active without relying on calling -`evil-normalize-keymaps'. Another less significant difference is -that the bindings can be created immediately, because this -function only uses the symbol MODE and does not rely on its -value. - -See `evil-define-key' for the usage of STATE, KEY, DEF and -BINDINGS." - (declare (indent defun)) - (let ((maps (mapcar - (lambda (st) - (evil-get-minor-mode-keymap st mode)) - (if (listp state) state (list state))))) - (while key - (dolist (map maps) - (define-key map key def)) - (setq key (pop bindings) - def (pop bindings))))) - -(defmacro evil-add-hjkl-bindings (keymap &optional state &rest bindings) - "Add \"h\", \"j\", \"k\", \"l\" bindings to KEYMAP in STATE. -Add additional BINDINGS if specified." - (declare (indent defun)) - `(evil-define-key ,state ,keymap - "h" (lookup-key evil-motion-state-map "h") - "j" (lookup-key evil-motion-state-map "j") - "k" (lookup-key evil-motion-state-map "k") - "l" (lookup-key evil-motion-state-map "l") - ":" (lookup-key evil-motion-state-map ":") - ,@bindings)) - -;; may be useful for programmatic purposes -(defun evil-global-set-key (state key def) - "Bind KEY to DEF in STATE." - (define-key (evil-state-property state :keymap t) key def)) - -(defun evil-local-set-key (state key def) - "Bind KEY to DEF in STATE in the current buffer." - (define-key (evil-state-property state :local-keymap t) key def)) - -;; Advise these functions as they may activate an overriding keymap or -;; a keymap with state bindings; if so, refresh `evil-mode-map-alist'. -(advice-add 'use-global-map :after #'evil--do-normalize-keymaps) -(advice-add 'use-local-map :after #'evil--do-normalize-keymaps) -(defun evil--do-normalize-keymaps (&rest _) - "Refresh Evil keymaps." - (evil-normalize-keymaps)) - - -(defmacro evil-define-state (state doc &rest body) - "Define an Evil state STATE. -DOC is a general description and shows up in all docstrings; -the first line of the string should be the full name of the state. - -BODY is executed each time the state is enabled or disabled. - -Optional keyword arguments: -- `:tag' - the mode line indicator, e.g. \"\". -- `:message' - string shown in the echo area when the state is - activated. -- `:cursor' - default cursor specification. -- `:enable' - list of other state keymaps to enable when in this - state. -- `:entry-hook' - list of functions to run when entering this state. -- `:exit-hook' - list of functions to run when exiting this state. -- `:suppress-keymap' - if non-nil, effectively disables bindings to - `self-insert-command' by making `evil-suppress-map' the parent of - the global state keymap. - -The global keymap of this state will be `evil-test-state-map', -the local keymap will be `evil-test-state-local-map', and so on. - -\(fn STATE DOC [[KEY VAL]...] BODY...)" - (declare (indent defun) - (doc-string 2) - (debug (&define name - [&optional stringp] - [&rest [keywordp sexp]] - def-body))) - (let* ((name (and (string-match "^\\(.+\\)\\(\\(?:.\\|\n\\)*\\)" doc) - (match-string 1 doc))) - (doc (match-string 2 doc)) - (name (and (string-match "^\\(.+?\\)\\.?$" name) - (match-string 1 name))) - (doc (if (or (null doc) (string= doc "")) "" - (format "\n%s" doc))) - (toggle (intern (format "evil-%s-state" state))) - (mode (intern (format "%s-minor-mode" toggle))) - (keymap (intern (format "%s-map" toggle))) - (local (intern (format "%s-local-minor-mode" toggle))) - (local-keymap (intern (format "%s-local-map" toggle))) - (tag (intern (format "%s-tag" toggle))) - (message (intern (format "%s-message" toggle))) - (cursor (intern (format "%s-cursor" toggle))) - (entry-hook (intern (format "%s-entry-hook" toggle))) - (exit-hook (intern (format "%s-exit-hook" toggle))) - (modes (intern (format "%s-modes" toggle))) - (predicate (intern (format "%s-p" toggle))) - arg cursor-value enable entry-hook-value exit-hook-value - input-method key message-value suppress-keymap tag-value) - ;; collect keywords - (while (keywordp (car-safe body)) - (setq key (pop body) - arg (pop body)) - (cond - ((eq key :tag) - (setq tag-value arg)) - ((eq key :message) - (setq message-value arg)) - ((eq key :cursor) - (setq cursor-value arg)) - ((eq key :entry-hook) - (setq entry-hook-value arg) - (unless (listp entry-hook-value) - (setq entry-hook-value (list entry-hook-value)))) - ((eq key :exit-hook) - (setq exit-hook-value arg) - (unless (listp exit-hook-value) - (setq exit-hook-value (list exit-hook-value)))) - ((eq key :enable) - (setq enable arg)) - ((eq key :input-method) - (setq input-method arg)) - ((eq key :suppress-keymap) - (setq suppress-keymap arg)))) - - ;; macro expansion - `(progn - ;; Save the state's properties in `evil-state-properties' for - ;; runtime lookup. Among other things, this information is used - ;; to determine what keymaps should be activated by the state - ;; (and, when processing :enable, what keymaps are activated by - ;; other states). We cannot know this at compile time because - ;; it depends on the current buffer and its active keymaps - ;; (to which we may have assigned state bindings), as well as - ;; states whose definitions may not have been processed yet. - (let ((plist (list - :name ',name - :toggle ',toggle - :mode (defvar ,mode nil - ,(format "Non-nil if %s is enabled. -Use the command `%s' to change this variable." name toggle)) - :keymap (defvar ,keymap (make-sparse-keymap) - ,(format "Keymap for %s." name)) - :local (defvar ,local nil - ,(format "Non-nil if %s is enabled. -Use the command `%s' to change this variable." name toggle)) - :local-keymap (defvar ,local-keymap nil - ,(format "Buffer-local keymap for %s." name)) - :tag (defvar ,tag ,tag-value - ,(format "Mode line tag for %s." name)) - :message (defvar ,message ,message-value - ,(format "Echo area message for %s." name)) - :cursor (defvar ,cursor ',cursor-value - ,(format "Cursor for %s. -May be a cursor type as per `cursor-type', a color string as passed -to `set-cursor-color', a zero-argument function for changing the -cursor, or a list of the above. - -If set to nil, the value of `evil-default-cursor' is used; if you -want the nil `cursor-type' (i.e., you want to disable the cursor), -set this variable to (list nil)." name)) - :entry-hook (defvar ,entry-hook nil - ,(format "Hooks to run when entering %s." name)) - :exit-hook (defvar ,exit-hook nil - ,(format "Hooks to run when exiting %s." name)) - :modes (defvar ,modes nil - ,(format "Modes that should come up in %s." name)) - :input-method ',input-method - :predicate ',predicate - :enable ',enable))) - (evil--add-to-alist evil-state-properties ',state plist)) - - ,@(when suppress-keymap - `((set-keymap-parent ,keymap evil-suppress-map))) - - (dolist (func ',entry-hook-value) (add-hook ',entry-hook func)) - (dolist (func ',exit-hook-value) (add-hook ',exit-hook func)) - - (defun ,predicate (&optional state) - ,(format "Whether the current state is %s. -\(That is, whether `evil-state' is `%s'.)" name state) - (and evil-local-mode - (eq (or state evil-state) ',state))) - - ;; define state function - (defun ,toggle (&optional arg) - ,(format "Enable %s. Disable with negative ARG. -If ARG is nil, don't display a message in the echo area.%s" name doc) - (interactive) - (cond - ((and (numberp arg) (< arg 1)) - (setq evil-previous-state evil-state - evil-state nil) - (let ((evil-state ',state)) - (run-hooks ',exit-hook) - (setq evil-state nil) - (evil-normalize-keymaps) - ,@body)) - (t - (unless evil-local-mode (evil-local-mode)) - (let ((evil-next-state ',state) - input-method-activate-hook input-method-deactivate-hook) - (evil-change-state nil) - (setq evil-state ',state) - (evil--add-to-alist evil-previous-state-alist - ',state evil-previous-state) - (let ((evil-state ',state)) - (evil-normalize-keymaps) - (if ',input-method - (activate-input-method evil-input-method) - ;; BUG #475: Deactivate the current input method only - ;; if there is a function to deactivate it, otherwise - ;; an error would be raised. This strange situation - ;; should not arise in general and there should - ;; probably be a better way to handle this situation. - (when deactivate-current-input-method-function - (deactivate-input-method))) - (unless evil-no-display - (when (eq (window-buffer) (current-buffer)) - (evil-refresh-cursor ',state)) - (evil-refresh-mode-line ',state)) - ,@body - (run-hooks ',entry-hook) - (when (and evil-echo-state - arg (not evil-no-display) ,message) - (if (functionp ,message) - (funcall ,message) - (evil-echo "%s" ,message)))))))) - - (evil-add-command-properties ',toggle :keep-visual t :suppress-operator t) - - (evil-define-keymap ,keymap nil - :mode ,mode - :func nil) - - (evil-define-keymap ,local-keymap nil - :mode ,local - :local t - :func nil) - - ',state))) - -(provide 'evil-core) - -;;; evil-core.el ends here diff --git a/.config/emacs/lisp/evil/evil-development.el b/.config/emacs/lisp/evil/evil-development.el deleted file mode 100644 index 60da92d..0000000 --- a/.config/emacs/lisp/evil/evil-development.el +++ /dev/null @@ -1,50 +0,0 @@ -;;; evil-development.el --- Useful features for Evil developers -*- lexical-binding: t -*- - -;; Author: Justin Burkett - -;; Version: 1.15.0 - -;; -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -;;; Code: - -;;; Teach imenu about evil macros - -(with-eval-after-load 'lisp-mode - (when (boundp 'lisp-imenu-generic-expression) - (dolist (macro '("interactive-code" - "type" - "text-object" - "motion" - "command" - "operator")) - (let ((macro-name (format "evil-%s" macro))) - (unless (assoc macro-name lisp-imenu-generic-expression) - (push (list - macro-name - (format "^\\s-*(evil-define-%s\\s-+\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)+\\)" - macro) - 1) - lisp-imenu-generic-expression)))))) - -(provide 'evil-development) - -;;; evil-development.el ends here diff --git a/.config/emacs/lisp/evil/evil-digraphs.el b/.config/emacs/lisp/evil/evil-digraphs.el deleted file mode 100644 index 2bd3687..0000000 --- a/.config/emacs/lisp/evil/evil-digraphs.el +++ /dev/null @@ -1,1735 +0,0 @@ -;;; evil-digraphs.el --- Digraphs -*- lexical-binding: t -*- - -;; Author: Vegard Øye -;; Maintainer: Vegard Øye - -;; Version: 1.15.0 - -;; -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -;;; Code: - -(require 'evil-vars) - -(defgroup evil-digraphs nil - "Digraph support based on RFC 1345." - :group 'evil - :prefix "evil-digraph-") - -(defcustom evil-digraphs-table-user nil - "List of user-defined digraphs. -Entries have the form ((?CHAR1 ?CHAR2) . ?DIGRAPH). That is, -a cons cell of the digraph and its character replacement, -where the digraph is a list of two characters. -See also `evil-digraphs-table'." - :type '(alist :key-type (list character character) - :value-type character)) - -(defconst evil-digraphs-table - '(((?N ?U) . ?\x00) - ((?S ?H) . ?\x01) - ((?S ?X) . ?\x02) - ((?E ?X) . ?\x03) - ((?E ?T) . ?\x04) - ((?E ?Q) . ?\x05) - ((?A ?K) . ?\x06) - ((?B ?L) . ?\x07) - ((?B ?S) . ?\x08) - ((?H ?T) . ?\x09) - ((?L ?F) . ?\x0a) - ((?V ?T) . ?\x0b) - ((?F ?F) . ?\x0c) - ((?C ?R) . ?\x0d) - ((?S ?O) . ?\x0e) - ((?S ?I) . ?\x0f) - ((?D ?L) . ?\x10) - ((?D ?1) . ?\x11) - ((?D ?2) . ?\x12) - ((?D ?3) . ?\x13) - ((?D ?4) . ?\x14) - ((?N ?K) . ?\x15) - ((?S ?Y) . ?\x16) - ((?E ?B) . ?\x17) - ((?C ?N) . ?\x18) - ((?E ?M) . ?\x19) - ((?S ?B) . ?\x1a) - ((?E ?C) . ?\x1b) - ((?F ?S) . ?\x1c) - ((?G ?S) . ?\x1d) - ((?R ?S) . ?\x1e) - ((?U ?S) . ?\x1f) - ((?S ?P) . ?\x20) - ((?N ?b) . ?\x23) - ((?D ?O) . ?\x24) - ((?A ?t) . ?\x40) - ((?< ?\() . ?\x5b) - ((?/ ?/) . ?\x5c) - ((?\) ?>) . ?\x5d) - ((?' ?>) . ?\x5e) - ((?' ?!) . ?\x60) - ((?\( ?!) . ?\x7b) - ((?! ?!) . ?\x7c) - ((?! ?\)) . ?\x7d) - ((?' ??) . ?\x7e) - ((?D ?T) . ?\x7f) - ((?P ?A) . ?\x80) - ((?H ?O) . ?\x81) - ((?B ?H) . ?\x82) - ((?N ?H) . ?\x83) - ((?I ?N) . ?\x84) - ((?N ?L) . ?\x85) - ((?S ?A) . ?\x86) - ((?E ?S) . ?\x87) - ((?H ?S) . ?\x88) - ((?H ?J) . ?\x89) - ((?V ?S) . ?\x8a) - ((?P ?D) . ?\x8b) - ((?P ?U) . ?\x8c) - ((?R ?I) . ?\x8d) - ((?S ?2) . ?\x8e) - ((?S ?3) . ?\x8f) - ((?D ?C) . ?\x90) - ((?P ?1) . ?\x91) - ((?P ?2) . ?\x92) - ((?T ?S) . ?\x93) - ((?C ?C) . ?\x94) - ((?M ?W) . ?\x95) - ((?S ?G) . ?\x96) - ((?E ?G) . ?\x97) - ((?S ?S) . ?\x98) - ((?G ?C) . ?\x99) - ((?S ?C) . ?\x9a) - ((?C ?I) . ?\x9b) - ((?S ?T) . ?\x9c) - ((?O ?C) . ?\x9d) - ((?P ?M) . ?\x9e) - ((?A ?C) . ?\x9f) - ((?N ?S) . ?\xa0) - ((?! ?I) . ?\xa1) - ((?C ?t) . ?\xa2) - ((?P ?d) . ?\xa3) - ((?C ?u) . ?\xa4) - ((?Y ?e) . ?\xa5) - ((?B ?B) . ?\xa6) - ((?S ?E) . ?\xa7) - ((?' ?:) . ?\xa8) - ((?C ?o) . ?\xa9) - ((?- ?a) . ?\xaa) - ((?< ?<) . ?\xab) - ((?N ?O) . ?\xac) - ((?- ?-) . ?\xad) - ((?R ?g) . ?\xae) - ((?' ?m) . ?\xaf) - ((?D ?G) . ?\xb0) - ((?+ ?-) . ?\xb1) - ((?2 ?S) . ?\xb2) - ((?3 ?S) . ?\xb3) - ((?' ?') . ?\xb4) - ((?M ?y) . ?\xb5) - ((?P ?I) . ?\xb6) - ((?. ?M) . ?\xb7) - ((?' ?,) . ?\xb8) - ((?1 ?S) . ?\xb9) - ((?- ?o) . ?\xba) - ((?> ?>) . ?\xbb) - ((?1 ?4) . ?\xbc) - ((?1 ?2) . ?\xbd) - ((?3 ?4) . ?\xbe) - ((?? ?I) . ?\xbf) - ((?A ?!) . ?\xc0) - ((?A ?') . ?\xc1) - ((?A ?>) . ?\xc2) - ((?A ??) . ?\xc3) - ((?A ?:) . ?\xc4) - ((?A ?A) . ?\xc5) - ((?A ?E) . ?\xc6) - ((?C ?,) . ?\xc7) - ((?E ?!) . ?\xc8) - ((?E ?') . ?\xc9) - ((?E ?>) . ?\xca) - ((?E ?:) . ?\xcb) - ((?I ?!) . ?\xcc) - ((?I ?') . ?\xcd) - ((?I ?>) . ?\xce) - ((?I ?:) . ?\xcf) - ((?D ?-) . ?\xd0) - ((?N ??) . ?\xd1) - ((?O ?!) . ?\xd2) - ((?O ?') . ?\xd3) - ((?O ?>) . ?\xd4) - ((?O ??) . ?\xd5) - ((?O ?:) . ?\xd6) - ((?* ?X) . ?\xd7) - ((?O ?/) . ?\xd8) - ((?U ?!) . ?\xd9) - ((?U ?') . ?\xda) - ((?U ?>) . ?\xdb) - ((?U ?:) . ?\xdc) - ((?Y ?') . ?\xdd) - ((?T ?H) . ?\xde) - ((?s ?s) . ?\xdf) - ((?a ?!) . ?\xe0) - ((?a ?') . ?\xe1) - ((?a ?>) . ?\xe2) - ((?a ??) . ?\xe3) - ((?a ?:) . ?\xe4) - ((?a ?a) . ?\xe5) - ((?a ?e) . ?\xe6) - ((?c ?,) . ?\xe7) - ((?e ?!) . ?\xe8) - ((?e ?') . ?\xe9) - ((?e ?>) . ?\xea) - ((?e ?:) . ?\xeb) - ((?i ?!) . ?\xec) - ((?i ?') . ?\xed) - ((?i ?>) . ?\xee) - ((?i ?:) . ?\xef) - ((?d ?-) . ?\xf0) - ((?n ??) . ?\xf1) - ((?o ?!) . ?\xf2) - ((?o ?') . ?\xf3) - ((?o ?>) . ?\xf4) - ((?o ??) . ?\xf5) - ((?o ?:) . ?\xf6) - ((?- ?:) . ?\xf7) - ((?o ?/) . ?\xf8) - ((?u ?!) . ?\xf9) - ((?u ?') . ?\xfa) - ((?u ?>) . ?\xfb) - ((?u ?:) . ?\xfc) - ((?y ?') . ?\xfd) - ((?t ?h) . ?\xfe) - ((?y ?:) . ?\xff) - ((?A ?-) . ?\x0100) - ((?a ?-) . ?\x0101) - ((?A ?\() . ?\x0102) - ((?a ?\() . ?\x0103) - ((?A ?\;) . ?\x0104) - ((?a ?\;) . ?\x0105) - ((?C ?') . ?\x0106) - ((?c ?') . ?\x0107) - ((?C ?>) . ?\x0108) - ((?c ?>) . ?\x0109) - ((?C ?.) . ?\x010a) - ((?c ?.) . ?\x010b) - ((?C ?<) . ?\x010c) - ((?c ?<) . ?\x010d) - ((?D ?<) . ?\x010e) - ((?d ?<) . ?\x010f) - ((?D ?/) . ?\x0110) - ((?d ?/) . ?\x0111) - ((?E ?-) . ?\x0112) - ((?e ?-) . ?\x0113) - ((?E ?\() . ?\x0114) - ((?e ?\() . ?\x0115) - ((?E ?.) . ?\x0116) - ((?e ?.) . ?\x0117) - ((?E ?\;) . ?\x0118) - ((?e ?\;) . ?\x0119) - ((?E ?<) . ?\x011a) - ((?e ?<) . ?\x011b) - ((?G ?>) . ?\x011c) - ((?g ?>) . ?\x011d) - ((?G ?\() . ?\x011e) - ((?g ?\() . ?\x011f) - ((?G ?.) . ?\x0120) - ((?g ?.) . ?\x0121) - ((?G ?,) . ?\x0122) - ((?g ?,) . ?\x0123) - ((?H ?>) . ?\x0124) - ((?h ?>) . ?\x0125) - ((?H ?/) . ?\x0126) - ((?h ?/) . ?\x0127) - ((?I ??) . ?\x0128) - ((?i ??) . ?\x0129) - ((?I ?-) . ?\x012a) - ((?i ?-) . ?\x012b) - ((?I ?\() . ?\x012c) - ((?i ?\() . ?\x012d) - ((?I ?\;) . ?\x012e) - ((?i ?\;) . ?\x012f) - ((?I ?.) . ?\x0130) - ((?i ?.) . ?\x0131) - ((?I ?J) . ?\x0132) - ((?i ?j) . ?\x0133) - ((?J ?>) . ?\x0134) - ((?j ?>) . ?\x0135) - ((?K ?,) . ?\x0136) - ((?k ?,) . ?\x0137) - ((?k ?k) . ?\x0138) - ((?L ?') . ?\x0139) - ((?l ?') . ?\x013a) - ((?L ?,) . ?\x013b) - ((?l ?,) . ?\x013c) - ((?L ?<) . ?\x013d) - ((?l ?<) . ?\x013e) - ((?L ?.) . ?\x013f) - ((?l ?.) . ?\x0140) - ((?L ?/) . ?\x0141) - ((?l ?/) . ?\x0142) - ((?N ?') . ?\x0143) - ((?n ?') . ?\x0144) - ((?N ?,) . ?\x0145) - ((?n ?,) . ?\x0146) - ((?N ?<) . ?\x0147) - ((?n ?<) . ?\x0148) - ((?' ?n) . ?\x0149) - ((?N ?G) . ?\x014a) - ((?n ?g) . ?\x014b) - ((?O ?-) . ?\x014c) - ((?o ?-) . ?\x014d) - ((?O ?\() . ?\x014e) - ((?o ?\() . ?\x014f) - ((?O ?\") . ?\x0150) - ((?o ?\") . ?\x0151) - ((?O ?E) . ?\x0152) - ((?o ?e) . ?\x0153) - ((?R ?') . ?\x0154) - ((?r ?') . ?\x0155) - ((?R ?,) . ?\x0156) - ((?r ?,) . ?\x0157) - ((?R ?<) . ?\x0158) - ((?r ?<) . ?\x0159) - ((?S ?') . ?\x015a) - ((?s ?') . ?\x015b) - ((?S ?>) . ?\x015c) - ((?s ?>) . ?\x015d) - ((?S ?,) . ?\x015e) - ((?s ?,) . ?\x015f) - ((?S ?<) . ?\x0160) - ((?s ?<) . ?\x0161) - ((?T ?,) . ?\x0162) - ((?t ?,) . ?\x0163) - ((?T ?<) . ?\x0164) - ((?t ?<) . ?\x0165) - ((?T ?/) . ?\x0166) - ((?t ?/) . ?\x0167) - ((?U ??) . ?\x0168) - ((?u ??) . ?\x0169) - ((?U ?-) . ?\x016a) - ((?u ?-) . ?\x016b) - ((?U ?\() . ?\x016c) - ((?u ?\() . ?\x016d) - ((?U ?0) . ?\x016e) - ((?u ?0) . ?\x016f) - ((?U ?\") . ?\x0170) - ((?u ?\") . ?\x0171) - ((?U ?\;) . ?\x0172) - ((?u ?\;) . ?\x0173) - ((?W ?>) . ?\x0174) - ((?w ?>) . ?\x0175) - ((?Y ?>) . ?\x0176) - ((?y ?>) . ?\x0177) - ((?Y ?:) . ?\x0178) - ((?Z ?') . ?\x0179) - ((?z ?') . ?\x017a) - ((?Z ?.) . ?\x017b) - ((?z ?.) . ?\x017c) - ((?Z ?<) . ?\x017d) - ((?z ?<) . ?\x017e) - ((?O ?9) . ?\x01a0) - ((?o ?9) . ?\x01a1) - ((?O ?I) . ?\x01a2) - ((?o ?i) . ?\x01a3) - ((?y ?r) . ?\x01a6) - ((?U ?9) . ?\x01af) - ((?u ?9) . ?\x01b0) - ((?Z ?/) . ?\x01b5) - ((?z ?/) . ?\x01b6) - ((?E ?D) . ?\x01b7) - ((?A ?<) . ?\x01cd) - ((?a ?<) . ?\x01ce) - ((?I ?<) . ?\x01cf) - ((?i ?<) . ?\x01d0) - ((?O ?<) . ?\x01d1) - ((?o ?<) . ?\x01d2) - ((?U ?<) . ?\x01d3) - ((?u ?<) . ?\x01d4) - ((?A ?1) . ?\x01de) - ((?a ?1) . ?\x01df) - ((?A ?7) . ?\x01e0) - ((?a ?7) . ?\x01e1) - ((?A ?3) . ?\x01e2) - ((?a ?3) . ?\x01e3) - ((?G ?/) . ?\x01e4) - ((?g ?/) . ?\x01e5) - ((?G ?<) . ?\x01e6) - ((?g ?<) . ?\x01e7) - ((?K ?<) . ?\x01e8) - ((?k ?<) . ?\x01e9) - ((?O ?\;) . ?\x01ea) - ((?o ?\;) . ?\x01eb) - ((?O ?1) . ?\x01ec) - ((?o ?1) . ?\x01ed) - ((?E ?Z) . ?\x01ee) - ((?e ?z) . ?\x01ef) - ((?j ?<) . ?\x01f0) - ((?G ?') . ?\x01f4) - ((?g ?') . ?\x01f5) - ((?\; ?S) . ?\x02bf) - ((?' ?<) . ?\x02c7) - ((?' ?\() . ?\x02d8) - ((?' ?.) . ?\x02d9) - ((?' ?0) . ?\x02da) - ((?' ?\;) . ?\x02db) - ((?' ?\") . ?\x02dd) - ((?A ?%) . ?\x0386) - ((?E ?%) . ?\x0388) - ((?Y ?%) . ?\x0389) - ((?I ?%) . ?\x038a) - ((?O ?%) . ?\x038c) - ((?U ?%) . ?\x038e) - ((?W ?%) . ?\x038f) - ((?i ?3) . ?\x0390) - ((?A ?*) . ?\x0391) - ((?B ?*) . ?\x0392) - ((?G ?*) . ?\x0393) - ((?D ?*) . ?\x0394) - ((?E ?*) . ?\x0395) - ((?Z ?*) . ?\x0396) - ((?Y ?*) . ?\x0397) - ((?H ?*) . ?\x0398) - ((?I ?*) . ?\x0399) - ((?K ?*) . ?\x039a) - ((?L ?*) . ?\x039b) - ((?M ?*) . ?\x039c) - ((?N ?*) . ?\x039d) - ((?C ?*) . ?\x039e) - ((?O ?*) . ?\x039f) - ((?P ?*) . ?\x03a0) - ((?R ?*) . ?\x03a1) - ((?S ?*) . ?\x03a3) - ((?T ?*) . ?\x03a4) - ((?U ?*) . ?\x03a5) - ((?F ?*) . ?\x03a6) - ((?X ?*) . ?\x03a7) - ((?Q ?*) . ?\x03a8) - ((?W ?*) . ?\x03a9) - ((?J ?*) . ?\x03aa) - ((?V ?*) . ?\x03ab) - ((?a ?%) . ?\x03ac) - ((?e ?%) . ?\x03ad) - ((?y ?%) . ?\x03ae) - ((?i ?%) . ?\x03af) - ((?u ?3) . ?\x03b0) - ((?a ?*) . ?\x03b1) - ((?b ?*) . ?\x03b2) - ((?g ?*) . ?\x03b3) - ((?d ?*) . ?\x03b4) - ((?e ?*) . ?\x03b5) - ((?z ?*) . ?\x03b6) - ((?y ?*) . ?\x03b7) - ((?h ?*) . ?\x03b8) - ((?i ?*) . ?\x03b9) - ((?k ?*) . ?\x03ba) - ((?l ?*) . ?\x03bb) - ((?m ?*) . ?\x03bc) - ((?n ?*) . ?\x03bd) - ((?c ?*) . ?\x03be) - ((?o ?*) . ?\x03bf) - ((?p ?*) . ?\x03c0) - ((?r ?*) . ?\x03c1) - ((?* ?s) . ?\x03c2) - ((?s ?*) . ?\x03c3) - ((?t ?*) . ?\x03c4) - ((?u ?*) . ?\x03c5) - ((?f ?*) . ?\x03c6) - ((?x ?*) . ?\x03c7) - ((?q ?*) . ?\x03c8) - ((?w ?*) . ?\x03c9) - ((?j ?*) . ?\x03ca) - ((?v ?*) . ?\x03cb) - ((?o ?%) . ?\x03cc) - ((?u ?%) . ?\x03cd) - ((?w ?%) . ?\x03ce) - ((?' ?G) . ?\x03d8) - ((?, ?G) . ?\x03d9) - ((?T ?3) . ?\x03da) - ((?t ?3) . ?\x03db) - ((?M ?3) . ?\x03dc) - ((?m ?3) . ?\x03dd) - ((?K ?3) . ?\x03de) - ((?k ?3) . ?\x03df) - ((?P ?3) . ?\x03e0) - ((?p ?3) . ?\x03e1) - ((?' ?%) . ?\x03f4) - ((?j ?3) . ?\x03f5) - ((?I ?O) . ?\x0401) - ((?D ?%) . ?\x0402) - ((?G ?%) . ?\x0403) - ((?I ?E) . ?\x0404) - ((?D ?S) . ?\x0405) - ((?I ?I) . ?\x0406) - ((?Y ?I) . ?\x0407) - ((?J ?%) . ?\x0408) - ((?L ?J) . ?\x0409) - ((?N ?J) . ?\x040a) - ((?T ?s) . ?\x040b) - ((?K ?J) . ?\x040c) - ((?V ?%) . ?\x040e) - ((?D ?Z) . ?\x040f) - ((?A ?=) . ?\x0410) - ((?B ?=) . ?\x0411) - ((?V ?=) . ?\x0412) - ((?G ?=) . ?\x0413) - ((?D ?=) . ?\x0414) - ((?E ?=) . ?\x0415) - ((?Z ?%) . ?\x0416) - ((?Z ?=) . ?\x0417) - ((?I ?=) . ?\x0418) - ((?J ?=) . ?\x0419) - ((?K ?=) . ?\x041a) - ((?L ?=) . ?\x041b) - ((?M ?=) . ?\x041c) - ((?N ?=) . ?\x041d) - ((?O ?=) . ?\x041e) - ((?P ?=) . ?\x041f) - ((?R ?=) . ?\x0420) - ((?S ?=) . ?\x0421) - ((?T ?=) . ?\x0422) - ((?U ?=) . ?\x0423) - ((?F ?=) . ?\x0424) - ((?H ?=) . ?\x0425) - ((?C ?=) . ?\x0426) - ((?C ?%) . ?\x0427) - ((?S ?%) . ?\x0428) - ((?S ?c) . ?\x0429) - ((?= ?\") . ?\x042a) - ((?Y ?=) . ?\x042b) - ((?% ?\") . ?\x042c) - ((?J ?E) . ?\x042d) - ((?J ?U) . ?\x042e) - ((?J ?A) . ?\x042f) - ((?a ?=) . ?\x0430) - ((?b ?=) . ?\x0431) - ((?v ?=) . ?\x0432) - ((?g ?=) . ?\x0433) - ((?d ?=) . ?\x0434) - ((?e ?=) . ?\x0435) - ((?z ?%) . ?\x0436) - ((?z ?=) . ?\x0437) - ((?i ?=) . ?\x0438) - ((?j ?=) . ?\x0439) - ((?k ?=) . ?\x043a) - ((?l ?=) . ?\x043b) - ((?m ?=) . ?\x043c) - ((?n ?=) . ?\x043d) - ((?o ?=) . ?\x043e) - ((?p ?=) . ?\x043f) - ((?r ?=) . ?\x0440) - ((?s ?=) . ?\x0441) - ((?t ?=) . ?\x0442) - ((?u ?=) . ?\x0443) - ((?f ?=) . ?\x0444) - ((?h ?=) . ?\x0445) - ((?c ?=) . ?\x0446) - ((?c ?%) . ?\x0447) - ((?s ?%) . ?\x0448) - ((?s ?c) . ?\x0449) - ((?= ?') . ?\x044a) - ((?y ?=) . ?\x044b) - ((?% ?') . ?\x044c) - ((?j ?e) . ?\x044d) - ((?j ?u) . ?\x044e) - ((?j ?a) . ?\x044f) - ((?i ?o) . ?\x0451) - ((?d ?%) . ?\x0452) - ((?g ?%) . ?\x0453) - ((?i ?e) . ?\x0454) - ((?d ?s) . ?\x0455) - ((?i ?i) . ?\x0456) - ((?y ?i) . ?\x0457) - ((?j ?%) . ?\x0458) - ((?l ?j) . ?\x0459) - ((?n ?j) . ?\x045a) - ((?t ?s) . ?\x045b) - ((?k ?j) . ?\x045c) - ((?v ?%) . ?\x045e) - ((?d ?z) . ?\x045f) - ((?Y ?3) . ?\x0462) - ((?y ?3) . ?\x0463) - ((?O ?3) . ?\x046a) - ((?o ?3) . ?\x046b) - ((?F ?3) . ?\x0472) - ((?f ?3) . ?\x0473) - ((?V ?3) . ?\x0474) - ((?v ?3) . ?\x0475) - ((?C ?3) . ?\x0480) - ((?c ?3) . ?\x0481) - ((?G ?3) . ?\x0490) - ((?g ?3) . ?\x0491) - ((?A ?+) . ?\x05d0) - ((?B ?+) . ?\x05d1) - ((?G ?+) . ?\x05d2) - ((?D ?+) . ?\x05d3) - ((?H ?+) . ?\x05d4) - ((?W ?+) . ?\x05d5) - ((?Z ?+) . ?\x05d6) - ((?X ?+) . ?\x05d7) - ((?T ?j) . ?\x05d8) - ((?J ?+) . ?\x05d9) - ((?K ?%) . ?\x05da) - ((?K ?+) . ?\x05db) - ((?L ?+) . ?\x05dc) - ((?M ?%) . ?\x05dd) - ((?M ?+) . ?\x05de) - ((?N ?%) . ?\x05df) - ((?N ?+) . ?\x05e0) - ((?S ?+) . ?\x05e1) - ((?E ?+) . ?\x05e2) - ((?P ?%) . ?\x05e3) - ((?P ?+) . ?\x05e4) - ((?Z ?j) . ?\x05e5) - ((?Z ?J) . ?\x05e6) - ((?Q ?+) . ?\x05e7) - ((?R ?+) . ?\x05e8) - ((?S ?h) . ?\x05e9) - ((?T ?+) . ?\x05ea) - ((?, ?+) . ?\x060c) - ((?\; ?+) . ?\x061b) - ((?? ?+) . ?\x061f) - ((?H ?') . ?\x0621) - ((?a ?M) . ?\x0622) - ((?a ?H) . ?\x0623) - ((?w ?H) . ?\x0624) - ((?a ?h) . ?\x0625) - ((?y ?H) . ?\x0626) - ((?a ?+) . ?\x0627) - ((?b ?+) . ?\x0628) - ((?t ?m) . ?\x0629) - ((?t ?+) . ?\x062a) - ((?t ?k) . ?\x062b) - ((?g ?+) . ?\x062c) - ((?h ?k) . ?\x062d) - ((?x ?+) . ?\x062e) - ((?d ?+) . ?\x062f) - ((?d ?k) . ?\x0630) - ((?r ?+) . ?\x0631) - ((?z ?+) . ?\x0632) - ((?s ?+) . ?\x0633) - ((?s ?n) . ?\x0634) - ((?c ?+) . ?\x0635) - ((?d ?d) . ?\x0636) - ((?t ?j) . ?\x0637) - ((?z ?H) . ?\x0638) - ((?e ?+) . ?\x0639) - ((?i ?+) . ?\x063a) - ((?+ ?+) . ?\x0640) - ((?f ?+) . ?\x0641) - ((?q ?+) . ?\x0642) - ((?k ?+) . ?\x0643) - ((?l ?+) . ?\x0644) - ((?m ?+) . ?\x0645) - ((?n ?+) . ?\x0646) - ((?h ?+) . ?\x0647) - ((?w ?+) . ?\x0648) - ((?j ?+) . ?\x0649) - ((?y ?+) . ?\x064a) - ((?: ?+) . ?\x064b) - ((?\" ?+) . ?\x064c) - ((?= ?+) . ?\x064d) - ((?/ ?+) . ?\x064e) - ((?' ?+) . ?\x064f) - ((?1 ?+) . ?\x0650) - ((?3 ?+) . ?\x0651) - ((?0 ?+) . ?\x0652) - ((?a ?S) . ?\x0670) - ((?p ?+) . ?\x067e) - ((?v ?+) . ?\x06a4) - ((?g ?f) . ?\x06af) - ((?0 ?a) . ?\x06f0) - ((?1 ?a) . ?\x06f1) - ((?2 ?a) . ?\x06f2) - ((?3 ?a) . ?\x06f3) - ((?4 ?a) . ?\x06f4) - ((?5 ?a) . ?\x06f5) - ((?6 ?a) . ?\x06f6) - ((?7 ?a) . ?\x06f7) - ((?8 ?a) . ?\x06f8) - ((?9 ?a) . ?\x06f9) - ((?B ?.) . ?\x1e02) - ((?b ?.) . ?\x1e03) - ((?B ?_) . ?\x1e06) - ((?b ?_) . ?\x1e07) - ((?D ?.) . ?\x1e0a) - ((?d ?.) . ?\x1e0b) - ((?D ?_) . ?\x1e0e) - ((?d ?_) . ?\x1e0f) - ((?D ?,) . ?\x1e10) - ((?d ?,) . ?\x1e11) - ((?F ?.) . ?\x1e1e) - ((?f ?.) . ?\x1e1f) - ((?G ?-) . ?\x1e20) - ((?g ?-) . ?\x1e21) - ((?H ?.) . ?\x1e22) - ((?h ?.) . ?\x1e23) - ((?H ?:) . ?\x1e26) - ((?h ?:) . ?\x1e27) - ((?H ?,) . ?\x1e28) - ((?h ?,) . ?\x1e29) - ((?K ?') . ?\x1e30) - ((?k ?') . ?\x1e31) - ((?K ?_) . ?\x1e34) - ((?k ?_) . ?\x1e35) - ((?L ?_) . ?\x1e3a) - ((?l ?_) . ?\x1e3b) - ((?M ?') . ?\x1e3e) - ((?m ?') . ?\x1e3f) - ((?M ?.) . ?\x1e40) - ((?m ?.) . ?\x1e41) - ((?N ?.) . ?\x1e44) - ((?n ?.) . ?\x1e45) - ((?N ?_) . ?\x1e48) - ((?n ?_) . ?\x1e49) - ((?P ?') . ?\x1e54) - ((?p ?') . ?\x1e55) - ((?P ?.) . ?\x1e56) - ((?p ?.) . ?\x1e57) - ((?R ?.) . ?\x1e58) - ((?r ?.) . ?\x1e59) - ((?R ?_) . ?\x1e5e) - ((?r ?_) . ?\x1e5f) - ((?S ?.) . ?\x1e60) - ((?s ?.) . ?\x1e61) - ((?T ?.) . ?\x1e6a) - ((?t ?.) . ?\x1e6b) - ((?T ?_) . ?\x1e6e) - ((?t ?_) . ?\x1e6f) - ((?V ??) . ?\x1e7c) - ((?v ??) . ?\x1e7d) - ((?W ?!) . ?\x1e80) - ((?W ?`) . ?\x1e80) - ((?w ?!) . ?\x1e81) - ((?w ?`) . ?\x1e81) - ((?W ?') . ?\x1e82) - ((?w ?') . ?\x1e83) - ((?W ?:) . ?\x1e84) - ((?w ?:) . ?\x1e85) - ((?W ?.) . ?\x1e86) - ((?w ?.) . ?\x1e87) - ((?X ?.) . ?\x1e8a) - ((?x ?.) . ?\x1e8b) - ((?X ?:) . ?\x1e8c) - ((?x ?:) . ?\x1e8d) - ((?Y ?.) . ?\x1e8e) - ((?y ?.) . ?\x1e8f) - ((?Z ?>) . ?\x1e90) - ((?z ?>) . ?\x1e91) - ((?Z ?_) . ?\x1e94) - ((?z ?_) . ?\x1e95) - ((?h ?_) . ?\x1e96) - ((?t ?:) . ?\x1e97) - ((?w ?0) . ?\x1e98) - ((?y ?0) . ?\x1e99) - ((?A ?2) . ?\x1ea2) - ((?a ?2) . ?\x1ea3) - ((?E ?2) . ?\x1eba) - ((?e ?2) . ?\x1ebb) - ((?E ??) . ?\x1ebc) - ((?e ??) . ?\x1ebd) - ((?I ?2) . ?\x1ec8) - ((?i ?2) . ?\x1ec9) - ((?O ?2) . ?\x1ece) - ((?o ?2) . ?\x1ecf) - ((?U ?2) . ?\x1ee6) - ((?u ?2) . ?\x1ee7) - ((?Y ?!) . ?\x1ef2) - ((?Y ?`) . ?\x1ef2) - ((?y ?!) . ?\x1ef3) - ((?y ?`) . ?\x1ef3) - ((?Y ?2) . ?\x1ef6) - ((?y ?2) . ?\x1ef7) - ((?Y ??) . ?\x1ef8) - ((?y ??) . ?\x1ef9) - ((?\; ?') . ?\x1f00) - ((?, ?') . ?\x1f01) - ((?\; ?!) . ?\x1f02) - ((?, ?!) . ?\x1f03) - ((?? ?\;) . ?\x1f04) - ((?? ?,) . ?\x1f05) - ((?! ?:) . ?\x1f06) - ((?? ?:) . ?\x1f07) - ((?1 ?N) . ?\x2002) - ((?1 ?M) . ?\x2003) - ((?3 ?M) . ?\x2004) - ((?4 ?M) . ?\x2005) - ((?6 ?M) . ?\x2006) - ((?1 ?T) . ?\x2009) - ((?1 ?H) . ?\x200a) - ((?- ?1) . ?\x2010) - ((?- ?N) . ?\x2013) - ((?- ?M) . ?\x2014) - ((?- ?3) . ?\x2015) - ((?! ?2) . ?\x2016) - ((?= ?2) . ?\x2017) - ((?' ?6) . ?\x2018) - ((?' ?9) . ?\x2019) - ((?. ?9) . ?\x201a) - ((?9 ?') . ?\x201b) - ((?\" ?6) . ?\x201c) - ((?\" ?9) . ?\x201d) - ((?: ?9) . ?\x201e) - ((?9 ?\") . ?\x201f) - ((?/ ?-) . ?\x2020) - ((?/ ?=) . ?\x2021) - ((?o ?o) . ?\x2022) - ((?. ?.) . ?\x2025) - ((?, ?.) . ?\x2026) - ((?% ?0) . ?\x2030) - ((?1 ?') . ?\x2032) - ((?2 ?') . ?\x2033) - ((?3 ?') . ?\x2034) - ((?1 ?\") . ?\x2035) - ((?2 ?\") . ?\x2036) - ((?3 ?\") . ?\x2037) - ((?C ?a) . ?\x2038) - ((?< ?1) . ?\x2039) - ((?> ?1) . ?\x203a) - ((?: ?X) . ?\x203b) - ((?' ?-) . ?\x203e) - ((?/ ?f) . ?\x2044) - ((?0 ?S) . ?\x2070) - ((?4 ?S) . ?\x2074) - ((?5 ?S) . ?\x2075) - ((?6 ?S) . ?\x2076) - ((?7 ?S) . ?\x2077) - ((?8 ?S) . ?\x2078) - ((?9 ?S) . ?\x2079) - ((?+ ?S) . ?\x207a) - ((?- ?S) . ?\x207b) - ((?= ?S) . ?\x207c) - ((?\( ?S) . ?\x207d) - ((?\) ?S) . ?\x207e) - ((?n ?S) . ?\x207f) - ((?0 ?s) . ?\x2080) - ((?1 ?s) . ?\x2081) - ((?2 ?s) . ?\x2082) - ((?3 ?s) . ?\x2083) - ((?4 ?s) . ?\x2084) - ((?5 ?s) . ?\x2085) - ((?6 ?s) . ?\x2086) - ((?7 ?s) . ?\x2087) - ((?8 ?s) . ?\x2088) - ((?9 ?s) . ?\x2089) - ((?+ ?s) . ?\x208a) - ((?- ?s) . ?\x208b) - ((?= ?s) . ?\x208c) - ((?\( ?s) . ?\x208d) - ((?\) ?s) . ?\x208e) - ((?L ?i) . ?\x20a4) - ((?P ?t) . ?\x20a7) - ((?W ?=) . ?\x20a9) - ((?= ?e) . ?\x20ac) - ((?E ?u) . ?\x20ac) - ((?= ?R) . ?\x20bd) - ((?= ?P) . ?\x20bd) - ((?o ?C) . ?\x2103) - ((?c ?o) . ?\x2105) - ((?o ?F) . ?\x2109) - ((?N ?0) . ?\x2116) - ((?P ?O) . ?\x2117) - ((?R ?x) . ?\x211e) - ((?S ?M) . ?\x2120) - ((?T ?M) . ?\x2122) - ((?O ?m) . ?\x2126) - ((?A ?O) . ?\x212b) - ((?1 ?3) . ?\x2153) - ((?2 ?3) . ?\x2154) - ((?1 ?5) . ?\x2155) - ((?2 ?5) . ?\x2156) - ((?3 ?5) . ?\x2157) - ((?4 ?5) . ?\x2158) - ((?1 ?6) . ?\x2159) - ((?5 ?6) . ?\x215a) - ((?1 ?8) . ?\x215b) - ((?3 ?8) . ?\x215c) - ((?5 ?8) . ?\x215d) - ((?7 ?8) . ?\x215e) - ((?1 ?R) . ?\x2160) - ((?2 ?R) . ?\x2161) - ((?3 ?R) . ?\x2162) - ((?4 ?R) . ?\x2163) - ((?5 ?R) . ?\x2164) - ((?6 ?R) . ?\x2165) - ((?7 ?R) . ?\x2166) - ((?8 ?R) . ?\x2167) - ((?9 ?R) . ?\x2168) - ((?a ?R) . ?\x2169) - ((?b ?R) . ?\x216a) - ((?c ?R) . ?\x216b) - ((?1 ?r) . ?\x2170) - ((?2 ?r) . ?\x2171) - ((?3 ?r) . ?\x2172) - ((?4 ?r) . ?\x2173) - ((?5 ?r) . ?\x2174) - ((?6 ?r) . ?\x2175) - ((?7 ?r) . ?\x2176) - ((?8 ?r) . ?\x2177) - ((?9 ?r) . ?\x2178) - ((?a ?r) . ?\x2179) - ((?b ?r) . ?\x217a) - ((?c ?r) . ?\x217b) - ((?< ?-) . ?\x2190) - ((?- ?!) . ?\x2191) - ((?- ?>) . ?\x2192) - ((?- ?v) . ?\x2193) - ((?< ?>) . ?\x2194) - ((?U ?D) . ?\x2195) - ((?< ?=) . ?\x21d0) - ((?= ?>) . ?\x21d2) - ((?= ?=) . ?\x21d4) - ((?F ?A) . ?\x2200) - ((?d ?P) . ?\x2202) - ((?T ?E) . ?\x2203) - ((?/ ?0) . ?\x2205) - ((?D ?E) . ?\x2206) - ((?N ?B) . ?\x2207) - ((?\( ?-) . ?\x2208) - ((?- ?\)) . ?\x220b) - ((?* ?P) . ?\x220f) - ((?+ ?Z) . ?\x2211) - ((?- ?2) . ?\x2212) - ((?- ?+) . ?\x2213) - ((?* ?-) . ?\x2217) - ((?O ?b) . ?\x2218) - ((?S ?b) . ?\x2219) - ((?R ?T) . ?\x221a) - ((?0 ?\() . ?\x221d) - ((?0 ?0) . ?\x221e) - ((?- ?L) . ?\x221f) - ((?- ?V) . ?\x2220) - ((?P ?P) . ?\x2225) - ((?A ?N) . ?\x2227) - ((?O ?R) . ?\x2228) - ((?\( ?U) . ?\x2229) - ((?\) ?U) . ?\x222a) - ((?I ?n) . ?\x222b) - ((?D ?I) . ?\x222c) - ((?I ?o) . ?\x222e) - ((?. ?:) . ?\x2234) - ((?: ?.) . ?\x2235) - ((?: ?R) . ?\x2236) - ((?: ?:) . ?\x2237) - ((?? ?1) . ?\x223c) - ((?C ?G) . ?\x223e) - ((?? ?-) . ?\x2243) - ((?? ?=) . ?\x2245) - ((?? ?2) . ?\x2248) - ((?= ??) . ?\x224c) - ((?H ?I) . ?\x2253) - ((?! ?=) . ?\x2260) - ((?= ?3) . ?\x2261) - ((?= ?<) . ?\x2264) - ((?> ?=) . ?\x2265) - ((?< ?*) . ?\x226a) - ((?* ?>) . ?\x226b) - ((?! ?<) . ?\x226e) - ((?! ?>) . ?\x226f) - ((?\( ?C) . ?\x2282) - ((?\) ?C) . ?\x2283) - ((?\( ?_) . ?\x2286) - ((?\) ?_) . ?\x2287) - ((?0 ?.) . ?\x2299) - ((?0 ?2) . ?\x229a) - ((?- ?T) . ?\x22a5) - ((?. ?P) . ?\x22c5) - ((?: ?3) . ?\x22ee) - ((?. ?3) . ?\x22ef) - ((?E ?h) . ?\x2302) - ((?< ?7) . ?\x2308) - ((?> ?7) . ?\x2309) - ((?7 ?<) . ?\x230a) - ((?7 ?>) . ?\x230b) - ((?N ?I) . ?\x2310) - ((?\( ?A) . ?\x2312) - ((?T ?R) . ?\x2315) - ((?I ?u) . ?\x2320) - ((?I ?l) . ?\x2321) - ((?< ?/) . ?\x2329) - ((?/ ?>) . ?\x232a) - ((?V ?s) . ?\x2423) - ((?1 ?h) . ?\x2440) - ((?3 ?h) . ?\x2441) - ((?2 ?h) . ?\x2442) - ((?4 ?h) . ?\x2443) - ((?1 ?j) . ?\x2446) - ((?2 ?j) . ?\x2447) - ((?3 ?j) . ?\x2448) - ((?4 ?j) . ?\x2449) - ((?1 ?.) . ?\x2488) - ((?2 ?.) . ?\x2489) - ((?3 ?.) . ?\x248a) - ((?4 ?.) . ?\x248b) - ((?5 ?.) . ?\x248c) - ((?6 ?.) . ?\x248d) - ((?7 ?.) . ?\x248e) - ((?8 ?.) . ?\x248f) - ((?9 ?.) . ?\x2490) - ((?h ?h) . ?\x2500) - ((?H ?H) . ?\x2501) - ((?v ?v) . ?\x2502) - ((?V ?V) . ?\x2503) - ((?3 ?-) . ?\x2504) - ((?3 ?_) . ?\x2505) - ((?3 ?!) . ?\x2506) - ((?3 ?/) . ?\x2507) - ((?4 ?-) . ?\x2508) - ((?4 ?_) . ?\x2509) - ((?4 ?!) . ?\x250a) - ((?4 ?/) . ?\x250b) - ((?d ?r) . ?\x250c) - ((?d ?R) . ?\x250d) - ((?D ?r) . ?\x250e) - ((?D ?R) . ?\x250f) - ((?d ?l) . ?\x2510) - ((?d ?L) . ?\x2511) - ((?D ?l) . ?\x2512) - ((?L ?D) . ?\x2513) - ((?u ?r) . ?\x2514) - ((?u ?R) . ?\x2515) - ((?U ?r) . ?\x2516) - ((?U ?R) . ?\x2517) - ((?u ?l) . ?\x2518) - ((?u ?L) . ?\x2519) - ((?U ?l) . ?\x251a) - ((?U ?L) . ?\x251b) - ((?v ?r) . ?\x251c) - ((?v ?R) . ?\x251d) - ((?V ?r) . ?\x2520) - ((?V ?R) . ?\x2523) - ((?v ?l) . ?\x2524) - ((?v ?L) . ?\x2525) - ((?V ?l) . ?\x2528) - ((?V ?L) . ?\x252b) - ((?d ?h) . ?\x252c) - ((?d ?H) . ?\x252f) - ((?D ?h) . ?\x2530) - ((?D ?H) . ?\x2533) - ((?u ?h) . ?\x2534) - ((?u ?H) . ?\x2537) - ((?U ?h) . ?\x2538) - ((?U ?H) . ?\x253b) - ((?v ?h) . ?\x253c) - ((?v ?H) . ?\x253f) - ((?V ?h) . ?\x2542) - ((?V ?H) . ?\x254b) - ((?F ?D) . ?\x2571) - ((?B ?D) . ?\x2572) - ((?T ?B) . ?\x2580) - ((?L ?B) . ?\x2584) - ((?F ?B) . ?\x2588) - ((?l ?B) . ?\x258c) - ((?R ?B) . ?\x2590) - ((?. ?S) . ?\x2591) - ((?: ?S) . ?\x2592) - ((?? ?S) . ?\x2593) - ((?f ?S) . ?\x25a0) - ((?O ?S) . ?\x25a1) - ((?R ?O) . ?\x25a2) - ((?R ?r) . ?\x25a3) - ((?R ?F) . ?\x25a4) - ((?R ?Y) . ?\x25a5) - ((?R ?H) . ?\x25a6) - ((?R ?Z) . ?\x25a7) - ((?R ?K) . ?\x25a8) - ((?R ?X) . ?\x25a9) - ((?s ?B) . ?\x25aa) - ((?S ?R) . ?\x25ac) - ((?O ?r) . ?\x25ad) - ((?U ?T) . ?\x25b2) - ((?u ?T) . ?\x25b3) - ((?P ?R) . ?\x25b6) - ((?T ?r) . ?\x25b7) - ((?D ?t) . ?\x25bc) - ((?d ?T) . ?\x25bd) - ((?P ?L) . ?\x25c0) - ((?T ?l) . ?\x25c1) - ((?D ?b) . ?\x25c6) - ((?D ?w) . ?\x25c7) - ((?L ?Z) . ?\x25ca) - ((?0 ?m) . ?\x25cb) - ((?0 ?o) . ?\x25ce) - ((?0 ?M) . ?\x25cf) - ((?0 ?L) . ?\x25d0) - ((?0 ?R) . ?\x25d1) - ((?S ?n) . ?\x25d8) - ((?I ?c) . ?\x25d9) - ((?F ?d) . ?\x25e2) - ((?B ?d) . ?\x25e3) - ((?* ?2) . ?\x2605) - ((?* ?1) . ?\x2606) - ((?< ?H) . ?\x261c) - ((?> ?H) . ?\x261e) - ((?0 ?u) . ?\x263a) - ((?0 ?U) . ?\x263b) - ((?S ?U) . ?\x263c) - ((?F ?m) . ?\x2640) - ((?M ?l) . ?\x2642) - ((?c ?S) . ?\x2660) - ((?c ?H) . ?\x2661) - ((?c ?D) . ?\x2662) - ((?c ?C) . ?\x2663) - ((?M ?d) . ?\x2669) - ((?M ?8) . ?\x266a) - ((?M ?2) . ?\x266b) - ((?M ?b) . ?\x266d) - ((?M ?x) . ?\x266e) - ((?M ?X) . ?\x266f) - ((?O ?K) . ?\x2713) - ((?X ?X) . ?\x2717) - ((?- ?X) . ?\x2720) - ((?I ?S) . ?\x3000) - ((?, ?_) . ?\x3001) - ((?. ?_) . ?\x3002) - ((?+ ?\") . ?\x3003) - ((?+ ?_) . ?\x3004) - ((?* ?_) . ?\x3005) - ((?\; ?_) . ?\x3006) - ((?0 ?_) . ?\x3007) - ((?< ?+) . ?\x300a) - ((?> ?+) . ?\x300b) - ((?< ?') . ?\x300c) - ((?> ?') . ?\x300d) - ((?< ?\") . ?\x300e) - ((?> ?\") . ?\x300f) - ((?\( ?\") . ?\x3010) - ((?\) ?\") . ?\x3011) - ((?= ?T) . ?\x3012) - ((?= ?_) . ?\x3013) - ((?\( ?') . ?\x3014) - ((?\) ?') . ?\x3015) - ((?\( ?I) . ?\x3016) - ((?\) ?I) . ?\x3017) - ((?- ??) . ?\x301c) - ((?A ?5) . ?\x3041) - ((?a ?5) . ?\x3042) - ((?I ?5) . ?\x3043) - ((?i ?5) . ?\x3044) - ((?U ?5) . ?\x3045) - ((?u ?5) . ?\x3046) - ((?E ?5) . ?\x3047) - ((?e ?5) . ?\x3048) - ((?O ?5) . ?\x3049) - ((?o ?5) . ?\x304a) - ((?k ?a) . ?\x304b) - ((?g ?a) . ?\x304c) - ((?k ?i) . ?\x304d) - ((?g ?i) . ?\x304e) - ((?k ?u) . ?\x304f) - ((?g ?u) . ?\x3050) - ((?k ?e) . ?\x3051) - ((?g ?e) . ?\x3052) - ((?k ?o) . ?\x3053) - ((?g ?o) . ?\x3054) - ((?s ?a) . ?\x3055) - ((?z ?a) . ?\x3056) - ((?s ?i) . ?\x3057) - ((?z ?i) . ?\x3058) - ((?s ?u) . ?\x3059) - ((?z ?u) . ?\x305a) - ((?s ?e) . ?\x305b) - ((?z ?e) . ?\x305c) - ((?s ?o) . ?\x305d) - ((?z ?o) . ?\x305e) - ((?t ?a) . ?\x305f) - ((?d ?a) . ?\x3060) - ((?t ?i) . ?\x3061) - ((?d ?i) . ?\x3062) - ((?t ?U) . ?\x3063) - ((?t ?u) . ?\x3064) - ((?d ?u) . ?\x3065) - ((?t ?e) . ?\x3066) - ((?d ?e) . ?\x3067) - ((?t ?o) . ?\x3068) - ((?d ?o) . ?\x3069) - ((?n ?a) . ?\x306a) - ((?n ?i) . ?\x306b) - ((?n ?u) . ?\x306c) - ((?n ?e) . ?\x306d) - ((?n ?o) . ?\x306e) - ((?h ?a) . ?\x306f) - ((?b ?a) . ?\x3070) - ((?p ?a) . ?\x3071) - ((?h ?i) . ?\x3072) - ((?b ?i) . ?\x3073) - ((?p ?i) . ?\x3074) - ((?h ?u) . ?\x3075) - ((?b ?u) . ?\x3076) - ((?p ?u) . ?\x3077) - ((?h ?e) . ?\x3078) - ((?b ?e) . ?\x3079) - ((?p ?e) . ?\x307a) - ((?h ?o) . ?\x307b) - ((?b ?o) . ?\x307c) - ((?p ?o) . ?\x307d) - ((?m ?a) . ?\x307e) - ((?m ?i) . ?\x307f) - ((?m ?u) . ?\x3080) - ((?m ?e) . ?\x3081) - ((?m ?o) . ?\x3082) - ((?y ?A) . ?\x3083) - ((?y ?a) . ?\x3084) - ((?y ?U) . ?\x3085) - ((?y ?u) . ?\x3086) - ((?y ?O) . ?\x3087) - ((?y ?o) . ?\x3088) - ((?r ?a) . ?\x3089) - ((?r ?i) . ?\x308a) - ((?r ?u) . ?\x308b) - ((?r ?e) . ?\x308c) - ((?r ?o) . ?\x308d) - ((?w ?A) . ?\x308e) - ((?w ?a) . ?\x308f) - ((?w ?i) . ?\x3090) - ((?w ?e) . ?\x3091) - ((?w ?o) . ?\x3092) - ((?n ?5) . ?\x3093) - ((?v ?u) . ?\x3094) - ((?\" ?5) . ?\x309b) - ((?0 ?5) . ?\x309c) - ((?* ?5) . ?\x309d) - ((?+ ?5) . ?\x309e) - ((?a ?6) . ?\x30a1) - ((?A ?6) . ?\x30a2) - ((?i ?6) . ?\x30a3) - ((?I ?6) . ?\x30a4) - ((?u ?6) . ?\x30a5) - ((?U ?6) . ?\x30a6) - ((?e ?6) . ?\x30a7) - ((?E ?6) . ?\x30a8) - ((?o ?6) . ?\x30a9) - ((?O ?6) . ?\x30aa) - ((?K ?a) . ?\x30ab) - ((?G ?a) . ?\x30ac) - ((?K ?i) . ?\x30ad) - ((?G ?i) . ?\x30ae) - ((?K ?u) . ?\x30af) - ((?G ?u) . ?\x30b0) - ((?K ?e) . ?\x30b1) - ((?G ?e) . ?\x30b2) - ((?K ?o) . ?\x30b3) - ((?G ?o) . ?\x30b4) - ((?S ?a) . ?\x30b5) - ((?Z ?a) . ?\x30b6) - ((?S ?i) . ?\x30b7) - ((?Z ?i) . ?\x30b8) - ((?S ?u) . ?\x30b9) - ((?Z ?u) . ?\x30ba) - ((?S ?e) . ?\x30bb) - ((?Z ?e) . ?\x30bc) - ((?S ?o) . ?\x30bd) - ((?Z ?o) . ?\x30be) - ((?T ?a) . ?\x30bf) - ((?D ?a) . ?\x30c0) - ((?T ?i) . ?\x30c1) - ((?D ?i) . ?\x30c2) - ((?T ?U) . ?\x30c3) - ((?T ?u) . ?\x30c4) - ((?D ?u) . ?\x30c5) - ((?T ?e) . ?\x30c6) - ((?D ?e) . ?\x30c7) - ((?T ?o) . ?\x30c8) - ((?D ?o) . ?\x30c9) - ((?N ?a) . ?\x30ca) - ((?N ?i) . ?\x30cb) - ((?N ?u) . ?\x30cc) - ((?N ?e) . ?\x30cd) - ((?N ?o) . ?\x30ce) - ((?H ?a) . ?\x30cf) - ((?B ?a) . ?\x30d0) - ((?P ?a) . ?\x30d1) - ((?H ?i) . ?\x30d2) - ((?B ?i) . ?\x30d3) - ((?P ?i) . ?\x30d4) - ((?H ?u) . ?\x30d5) - ((?B ?u) . ?\x30d6) - ((?P ?u) . ?\x30d7) - ((?H ?e) . ?\x30d8) - ((?B ?e) . ?\x30d9) - ((?P ?e) . ?\x30da) - ((?H ?o) . ?\x30db) - ((?B ?o) . ?\x30dc) - ((?P ?o) . ?\x30dd) - ((?u ?R) . ?\x2515) - ((?U ?r) . ?\x2516) - ((?U ?R) . ?\x2517) - ((?u ?l) . ?\x2518) - ((?u ?L) . ?\x2519) - ((?U ?l) . ?\x251a) - ((?U ?L) . ?\x251b) - ((?v ?r) . ?\x251c) - ((?v ?R) . ?\x251d) - ((?V ?r) . ?\x2520) - ((?V ?R) . ?\x2523) - ((?v ?l) . ?\x2524) - ((?v ?L) . ?\x2525) - ((?V ?l) . ?\x2528) - ((?V ?L) . ?\x252b) - ((?d ?h) . ?\x252c) - ((?d ?H) . ?\x252f) - ((?D ?h) . ?\x2530) - ((?D ?H) . ?\x2533) - ((?u ?h) . ?\x2534) - ((?u ?H) . ?\x2537) - ((?U ?h) . ?\x2538) - ((?U ?H) . ?\x253b) - ((?v ?h) . ?\x253c) - ((?v ?H) . ?\x253f) - ((?V ?h) . ?\x2542) - ((?V ?H) . ?\x254b) - ((?F ?D) . ?\x2571) - ((?B ?D) . ?\x2572) - ((?T ?B) . ?\x2580) - ((?L ?B) . ?\x2584) - ((?F ?B) . ?\x2588) - ((?l ?B) . ?\x258c) - ((?R ?B) . ?\x2590) - ((?. ?S) . ?\x2591) - ((?: ?S) . ?\x2592) - ((?? ?S) . ?\x2593) - ((?f ?S) . ?\x25a0) - ((?O ?S) . ?\x25a1) - ((?R ?O) . ?\x25a2) - ((?R ?r) . ?\x25a3) - ((?R ?F) . ?\x25a4) - ((?R ?Y) . ?\x25a5) - ((?R ?H) . ?\x25a6) - ((?R ?Z) . ?\x25a7) - ((?R ?K) . ?\x25a8) - ((?R ?X) . ?\x25a9) - ((?s ?B) . ?\x25aa) - ((?S ?R) . ?\x25ac) - ((?O ?r) . ?\x25ad) - ((?U ?T) . ?\x25b2) - ((?u ?T) . ?\x25b3) - ((?P ?R) . ?\x25b6) - ((?T ?r) . ?\x25b7) - ((?D ?t) . ?\x25bc) - ((?d ?T) . ?\x25bd) - ((?P ?L) . ?\x25c0) - ((?T ?l) . ?\x25c1) - ((?D ?b) . ?\x25c6) - ((?D ?w) . ?\x25c7) - ((?L ?Z) . ?\x25ca) - ((?0 ?m) . ?\x25cb) - ((?0 ?o) . ?\x25ce) - ((?0 ?M) . ?\x25cf) - ((?0 ?L) . ?\x25d0) - ((?0 ?R) . ?\x25d1) - ((?S ?n) . ?\x25d8) - ((?I ?c) . ?\x25d9) - ((?F ?d) . ?\x25e2) - ((?B ?d) . ?\x25e3) - ((?* ?2) . ?\x2605) - ((?* ?1) . ?\x2606) - ((?< ?H) . ?\x261c) - ((?> ?H) . ?\x261e) - ((?0 ?u) . ?\x263a) - ((?0 ?U) . ?\x263b) - ((?S ?U) . ?\x263c) - ((?F ?m) . ?\x2640) - ((?M ?l) . ?\x2642) - ((?c ?S) . ?\x2660) - ((?c ?H) . ?\x2661) - ((?c ?D) . ?\x2662) - ((?c ?C) . ?\x2663) - ((?M ?d) . ?\x2669) - ((?M ?8) . ?\x266a) - ((?M ?2) . ?\x266b) - ((?M ?b) . ?\x266d) - ((?M ?x) . ?\x266e) - ((?M ?X) . ?\x266f) - ((?O ?K) . ?\x2713) - ((?X ?X) . ?\x2717) - ((?- ?X) . ?\x2720) - ((?I ?S) . ?\x3000) - ((?, ?_) . ?\x3001) - ((?. ?_) . ?\x3002) - ((?+ ?\") . ?\x3003) - ((?+ ?_) . ?\x3004) - ((?* ?_) . ?\x3005) - ((?\; ?_) . ?\x3006) - ((?0 ?_) . ?\x3007) - ((?< ?+) . ?\x300a) - ((?> ?+) . ?\x300b) - ((?< ?') . ?\x300c) - ((?> ?') . ?\x300d) - ((?< ?\") . ?\x300e) - ((?> ?\") . ?\x300f) - ((?\( ?\") . ?\x3010) - ((?\) ?\") . ?\x3011) - ((?= ?T) . ?\x3012) - ((?= ?_) . ?\x3013) - ((?\( ?') . ?\x3014) - ((?\) ?') . ?\x3015) - ((?\( ?I) . ?\x3016) - ((?\) ?I) . ?\x3017) - ((?- ??) . ?\x301c) - ((?A ?5) . ?\x3041) - ((?a ?5) . ?\x3042) - ((?I ?5) . ?\x3043) - ((?i ?5) . ?\x3044) - ((?U ?5) . ?\x3045) - ((?u ?5) . ?\x3046) - ((?E ?5) . ?\x3047) - ((?e ?5) . ?\x3048) - ((?O ?5) . ?\x3049) - ((?o ?5) . ?\x304a) - ((?k ?a) . ?\x304b) - ((?g ?a) . ?\x304c) - ((?k ?i) . ?\x304d) - ((?g ?i) . ?\x304e) - ((?k ?u) . ?\x304f) - ((?g ?u) . ?\x3050) - ((?k ?e) . ?\x3051) - ((?g ?e) . ?\x3052) - ((?k ?o) . ?\x3053) - ((?g ?o) . ?\x3054) - ((?s ?a) . ?\x3055) - ((?z ?a) . ?\x3056) - ((?s ?i) . ?\x3057) - ((?z ?i) . ?\x3058) - ((?s ?u) . ?\x3059) - ((?z ?u) . ?\x305a) - ((?s ?e) . ?\x305b) - ((?z ?e) . ?\x305c) - ((?s ?o) . ?\x305d) - ((?z ?o) . ?\x305e) - ((?t ?a) . ?\x305f) - ((?d ?a) . ?\x3060) - ((?t ?i) . ?\x3061) - ((?d ?i) . ?\x3062) - ((?t ?U) . ?\x3063) - ((?t ?u) . ?\x3064) - ((?d ?u) . ?\x3065) - ((?t ?e) . ?\x3066) - ((?d ?e) . ?\x3067) - ((?t ?o) . ?\x3068) - ((?d ?o) . ?\x3069) - ((?n ?a) . ?\x306a) - ((?n ?i) . ?\x306b) - ((?n ?u) . ?\x306c) - ((?n ?e) . ?\x306d) - ((?n ?o) . ?\x306e) - ((?h ?a) . ?\x306f) - ((?b ?a) . ?\x3070) - ((?p ?a) . ?\x3071) - ((?h ?i) . ?\x3072) - ((?b ?i) . ?\x3073) - ((?p ?i) . ?\x3074) - ((?h ?u) . ?\x3075) - ((?b ?u) . ?\x3076) - ((?p ?u) . ?\x3077) - ((?h ?e) . ?\x3078) - ((?b ?e) . ?\x3079) - ((?p ?e) . ?\x307a) - ((?h ?o) . ?\x307b) - ((?b ?o) . ?\x307c) - ((?p ?o) . ?\x307d) - ((?m ?a) . ?\x307e) - ((?m ?i) . ?\x307f) - ((?m ?u) . ?\x3080) - ((?m ?e) . ?\x3081) - ((?m ?o) . ?\x3082) - ((?y ?A) . ?\x3083) - ((?y ?a) . ?\x3084) - ((?y ?U) . ?\x3085) - ((?y ?u) . ?\x3086) - ((?y ?O) . ?\x3087) - ((?y ?o) . ?\x3088) - ((?r ?a) . ?\x3089) - ((?r ?i) . ?\x308a) - ((?r ?u) . ?\x308b) - ((?r ?e) . ?\x308c) - ((?r ?o) . ?\x308d) - ((?w ?A) . ?\x308e) - ((?w ?a) . ?\x308f) - ((?w ?i) . ?\x3090) - ((?w ?e) . ?\x3091) - ((?w ?o) . ?\x3092) - ((?n ?5) . ?\x3093) - ((?v ?u) . ?\x3094) - ((?\" ?5) . ?\x309b) - ((?0 ?5) . ?\x309c) - ((?* ?5) . ?\x309d) - ((?+ ?5) . ?\x309e) - ((?a ?6) . ?\x30a1) - ((?A ?6) . ?\x30a2) - ((?i ?6) . ?\x30a3) - ((?I ?6) . ?\x30a4) - ((?u ?6) . ?\x30a5) - ((?U ?6) . ?\x30a6) - ((?e ?6) . ?\x30a7) - ((?E ?6) . ?\x30a8) - ((?o ?6) . ?\x30a9) - ((?O ?6) . ?\x30aa) - ((?K ?a) . ?\x30ab) - ((?G ?a) . ?\x30ac) - ((?K ?i) . ?\x30ad) - ((?G ?i) . ?\x30ae) - ((?K ?u) . ?\x30af) - ((?G ?u) . ?\x30b0) - ((?K ?e) . ?\x30b1) - ((?G ?e) . ?\x30b2) - ((?K ?o) . ?\x30b3) - ((?G ?o) . ?\x30b4) - ((?S ?a) . ?\x30b5) - ((?Z ?a) . ?\x30b6) - ((?S ?i) . ?\x30b7) - ((?Z ?i) . ?\x30b8) - ((?S ?u) . ?\x30b9) - ((?Z ?u) . ?\x30ba) - ((?S ?e) . ?\x30bb) - ((?Z ?e) . ?\x30bc) - ((?S ?o) . ?\x30bd) - ((?Z ?o) . ?\x30be) - ((?T ?a) . ?\x30bf) - ((?D ?a) . ?\x30c0) - ((?T ?i) . ?\x30c1) - ((?D ?i) . ?\x30c2) - ((?T ?U) . ?\x30c3) - ((?T ?u) . ?\x30c4) - ((?D ?u) . ?\x30c5) - ((?T ?e) . ?\x30c6) - ((?D ?e) . ?\x30c7) - ((?T ?o) . ?\x30c8) - ((?D ?o) . ?\x30c9) - ((?N ?a) . ?\x30ca) - ((?N ?i) . ?\x30cb) - ((?N ?u) . ?\x30cc) - ((?N ?e) . ?\x30cd) - ((?N ?o) . ?\x30ce) - ((?H ?a) . ?\x30cf) - ((?B ?a) . ?\x30d0) - ((?P ?a) . ?\x30d1) - ((?H ?i) . ?\x30d2) - ((?B ?i) . ?\x30d3) - ((?P ?i) . ?\x30d4) - ((?H ?u) . ?\x30d5) - ((?B ?u) . ?\x30d6) - ((?P ?u) . ?\x30d7) - ((?H ?e) . ?\x30d8) - ((?B ?e) . ?\x30d9) - ((?P ?e) . ?\x30da) - ((?H ?o) . ?\x30db) - ((?B ?o) . ?\x30dc) - ((?P ?o) . ?\x30dd) - ((?M ?a) . ?\x30de) - ((?M ?i) . ?\x30df) - ((?M ?u) . ?\x30e0) - ((?M ?e) . ?\x30e1) - ((?M ?o) . ?\x30e2) - ((?Y ?A) . ?\x30e3) - ((?Y ?a) . ?\x30e4) - ((?Y ?U) . ?\x30e5) - ((?Y ?u) . ?\x30e6) - ((?Y ?O) . ?\x30e7) - ((?Y ?o) . ?\x30e8) - ((?R ?a) . ?\x30e9) - ((?R ?i) . ?\x30ea) - ((?R ?u) . ?\x30eb) - ((?R ?e) . ?\x30ec) - ((?R ?o) . ?\x30ed) - ((?W ?A) . ?\x30ee) - ((?W ?a) . ?\x30ef) - ((?W ?i) . ?\x30f0) - ((?W ?e) . ?\x30f1) - ((?W ?o) . ?\x30f2) - ((?N ?6) . ?\x30f3) - ((?V ?u) . ?\x30f4) - ((?K ?A) . ?\x30f5) - ((?K ?E) . ?\x30f6) - ((?V ?a) . ?\x30f7) - ((?V ?i) . ?\x30f8) - ((?V ?e) . ?\x30f9) - ((?V ?o) . ?\x30fa) - ((?. ?6) . ?\x30fb) - ((?- ?6) . ?\x30fc) - ((?* ?6) . ?\x30fd) - ((?+ ?6) . ?\x30fe) - ((?b ?4) . ?\x3105) - ((?p ?4) . ?\x3106) - ((?m ?4) . ?\x3107) - ((?f ?4) . ?\x3108) - ((?d ?4) . ?\x3109) - ((?t ?4) . ?\x310a) - ((?n ?4) . ?\x310b) - ((?l ?4) . ?\x310c) - ((?g ?4) . ?\x310d) - ((?k ?4) . ?\x310e) - ((?h ?4) . ?\x310f) - ((?j ?4) . ?\x3110) - ((?q ?4) . ?\x3111) - ((?x ?4) . ?\x3112) - ((?z ?h) . ?\x3113) - ((?c ?h) . ?\x3114) - ((?s ?h) . ?\x3115) - ((?r ?4) . ?\x3116) - ((?z ?4) . ?\x3117) - ((?c ?4) . ?\x3118) - ((?s ?4) . ?\x3119) - ((?a ?4) . ?\x311a) - ((?o ?4) . ?\x311b) - ((?e ?4) . ?\x311c) - ((?a ?i) . ?\x311e) - ((?e ?i) . ?\x311f) - ((?a ?u) . ?\x3120) - ((?o ?u) . ?\x3121) - ((?a ?n) . ?\x3122) - ((?e ?n) . ?\x3123) - ((?a ?N) . ?\x3124) - ((?e ?N) . ?\x3125) - ((?e ?r) . ?\x3126) - ((?i ?4) . ?\x3127) - ((?u ?4) . ?\x3128) - ((?i ?u) . ?\x3129) - ((?v ?4) . ?\x312a) - ((?n ?G) . ?\x312b) - ((?g ?n) . ?\x312c) - ((?1 ?c) . ?\x3220) - ((?2 ?c) . ?\x3221) - ((?3 ?c) . ?\x3222) - ((?4 ?c) . ?\x3223) - ((?5 ?c) . ?\x3224) - ((?6 ?c) . ?\x3225) - ((?7 ?c) . ?\x3226) - ((?8 ?c) . ?\x3227) - ((?9 ?c) . ?\x3228) - ((?\s ?\s) . ?\xe000) - ((?/ ?c) . ?\xe001) - ((?U ?A) . ?\xe002) - ((?U ?B) . ?\xe003) - ((?\" ?3) . ?\xe004) - ((?\" ?1) . ?\xe005) - ((?\" ?!) . ?\xe006) - ((?\" ?') . ?\xe007) - ((?\" ?>) . ?\xe008) - ((?\" ??) . ?\xe009) - ((?\" ?-) . ?\xe00a) - ((?\" ?\() . ?\xe00b) - ((?\" ?.) . ?\xe00c) - ((?\" ?:) . ?\xe00d) - ((?\" ?0) . ?\xe00e) - ((?\" ?\") . ?\xe00f) - ((?\" ?<) . ?\xe010) - ((?\" ?,) . ?\xe011) - ((?\" ?\;) . ?\xe012) - ((?\" ?_) . ?\xe013) - ((?\" ?=) . ?\xe014) - ((?\" ?/) . ?\xe015) - ((?\" ?i) . ?\xe016) - ((?\" ?d) . ?\xe017) - ((?\" ?p) . ?\xe018) - ((?\; ?\;) . ?\xe019) - ((?, ?,) . ?\xe01a) - ((?b ?3) . ?\xe01b) - ((?C ?i) . ?\xe01c) - ((?f ?\() . ?\xe01d) - ((?e ?d) . ?\xe01e) - ((?a ?m) . ?\xe01f) - ((?p ?m) . ?\xe020) - ((?F ?l) . ?\xe023) - ((?G ?F) . ?\xe024) - ((?> ?V) . ?\xe025) - ((?! ?*) . ?\xe026) - ((?? ?*) . ?\xe027) - ((?J ?<) . ?\xe028) - ((?f ?f) . ?\xfb00) - ((?f ?i) . ?\xfb01) - ((?f ?l) . ?\xfb02) - ((?f ?t) . ?\xfb05) - ((?s ?t) . ?\xfb06) - ((?~ ?!) . ?\x00a1) - ((?c ?|) . ?\x00a2) - ((?$ ?$) . ?\x00a3) - ((?o ?x) . ?\x00a4) - ((?Y ?-) . ?\x00a5) - ((?| ?|) . ?\x00a6) - ((?c ?O) . ?\x00a9) - ((?- ?,) . ?\x00ac) - ((?- ?=) . ?\x00af) - ((?~ ?o) . ?\x00b0) - ((?2 ?2) . ?\x00b2) - ((?3 ?3) . ?\x00b3) - ((?p ?p) . ?\x00b6) - ((?~ ?.) . ?\x00b7) - ((?1 ?1) . ?\x00b9) - ((?~ ??) . ?\x00bf) - ((?A ?`) . ?\x00c0) - ((?A ?^) . ?\x00c2) - ((?A ?~) . ?\x00c3) - ((?A ?\") . ?\x00c4) - ((?A ?@) . ?\x00c5) - ((?E ?`) . ?\x00c8) - ((?E ?^) . ?\x00ca) - ((?E ?\") . ?\x00cb) - ((?I ?`) . ?\x00cc) - ((?I ?^) . ?\x00ce) - ((?I ?\") . ?\x00cf) - ((?N ?~) . ?\x00d1) - ((?O ?`) . ?\x00d2) - ((?O ?^) . ?\x00d4) - ((?O ?~) . ?\x00d5) - ((?/ ?\\) . ?\x00d7) - ((?U ?`) . ?\x00d9) - ((?U ?^) . ?\x00db) - ((?I ?p) . ?\x00de) - ((?a ?`) . ?\x00e0) - ((?a ?^) . ?\x00e2) - ((?a ?~) . ?\x00e3) - ((?a ?\") . ?\x00e4) - ((?a ?@) . ?\x00e5) - ((?e ?`) . ?\x00e8) - ((?e ?^) . ?\x00ea) - ((?e ?\") . ?\x00eb) - ((?i ?`) . ?\x00ec) - ((?i ?^) . ?\x00ee) - ((?n ?~) . ?\x00f1) - ((?o ?`) . ?\x00f2) - ((?o ?^) . ?\x00f4) - ((?o ?~) . ?\x00f5) - ((?u ?`) . ?\x00f9) - ((?u ?^) . ?\x00fb) - ((?y ?\") . ?\x00ff)) - "Table of default digraphs. -This includes all digraphs defined in RFC 1345, -as well as miscellaneous digraphs for multi-byte characters. -See also `evil-digraphs-table-user'.") - -;;;###autoload -(defun evil-digraph (digraph) - "Convert DIGRAPH to character or list representation. -If DIGRAPH is a list (CHAR1 CHAR2), return the corresponding character; -if DIGRAPH is a character, return the corresponding list. -Searches in `evil-digraphs-table-user' and `evil-digraphs-table'." - (if (listp digraph) - (or (cdr (assoc digraph evil-digraphs-table-user)) - (cdr (assoc digraph evil-digraphs-table)) - (cl-destructuring-bind (char1 char2) digraph - (unless (eq char1 char2) - (or (cdr (assoc (list char2 char1) evil-digraphs-table-user)) - (cdr (assoc (list char2 char1) evil-digraphs-table)))))) - (or (car (rassoc digraph evil-digraphs-table-user)) - (car (rassoc digraph evil-digraphs-table))))) - -(provide 'evil-digraphs) - -;;; evil-digraphs.el ends here diff --git a/.config/emacs/lisp/evil/evil-ex.el b/.config/emacs/lisp/evil/evil-ex.el deleted file mode 100644 index 94edd6e..0000000 --- a/.config/emacs/lisp/evil/evil-ex.el +++ /dev/null @@ -1,940 +0,0 @@ -;;; evil-ex.el --- Ex mode -*- lexical-binding: t; -*- - -;; Author: Frank Fischer -;; Maintainer: Vegard Øye - -;; Version: 1.15.0 - -;; -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -;;; Commentary: - -;; Ex is implemented as an extensible minilanguage, whose grammar -;; is stored in `evil-ex-grammar'. Ex commands are defined with -;; `evil-ex-define-cmd', which creates a binding from a string -;; to an interactive function. It is also possible to define key -;; sequences which execute a command immediately when entered: -;; such shortcuts go in `evil-ex-shortcut-map'. - -;; To provide buffer and filename completion, as well as interactive -;; feedback, Ex defines the concept of an argument handler, specified -;; with `evil-ex-define-argument-type'. In the case of the -;; substitution command (":s/foo/bar"), the handler incrementally -;; highlights matches in the buffer as the substitution is typed. - -;;; Code: - -(require 'evil-common) -(require 'evil-states) - -(declare-function evil-goto-line "evil-commands") - -(eval-when-compile - (defconst evil-ex-grammar - '((expression - (count command argument #'evil-ex-call-command) - ((\? range) command argument #'evil-ex-call-command) - (line #'evil-goto-line) - (sexp #'eval-expression)) - (count - number) - (command #'evil-ex-parse-command) - (binding - "[~&*@<>=:#]+\\|[[:alpha:]_]+\\|!") - (emacs-binding - "[[:alpha:]-][[:alnum:][:punct:]]*") - (argument - ((\? "\\(?:.\\|\n\\)+") #'$1)) - (range - ("%" #'(evil-ex-full-range)) - ("*" #'(evil-ex-last-visual-range)) - ((\? line) "[,;]" (\? line) - #'(let ((l1 $1)) - (save-excursion - (and l1 (string= $2 ";") (goto-line l1)) - (evil-ex-range l1 $3)))) - (line #'evil-ex-range) - ("`" marker-name ",`" marker-name - #'(evil-ex-char-marker-range $2 $4))) - (line - ((\? base) (\? offset) search (\? offset) - #'(save-excursion - (goto-line (evil-ex-line $1 $2)) - (evil-ex-line $3 $4))) - (base (\? offset) #'evil-ex-line) - (nil offset #'evil-ex-line)) - (base - number - ("'" marker-name #'(evil-ex-marker $2)) - search - ("\\^" #'(evil-ex-first-line)) - ("\\$" #'(evil-ex-last-line)) - ("\\." #'(evil-ex-current-line))) - (offset - (+ signed-number #'+)) - ;; TODO - handle offset & ;next-pattern search elements - (search - forward - backward - next - prev - subst) - (forward - ("/" "\\(?:\\\\.\\|[^/]\\)+" "/\\|$" #'(evil-ex-re-fwd $2))) - (backward - ("?" "\\(?:\\\\.\\|[^?]\\)+" "?\\|$" #'(evil-ex-re-bwd $2))) - (marker-name - "[]\\[-a-zA-Z_<>'}{)(]") - (next - "\\\\/" #'(evil-ex-prev-search)) - (prev - "\\\\\\?" #'(evil-ex-prev-search)) - (subst - "\\\\&" #'(evil-ex-prev-search)) - (signed-number - (sign (\? number) #'evil-ex-signed-number)) - (sign - "[+-]" #'intern) - (number - "[0-9]+" #'string-to-number) - (sexp - "(.*)?" #'(car (read-from-string $0)))) - "Grammar for Ex. -An association list of syntactic symbols and their definitions. -The first entry is the start symbol. A symbol's definition may -reference other symbols, but the grammar cannot contain -left recursion. See `evil-parser' for a detailed explanation -of the syntax.") - - (defun evil-parser--dexp (obj) - "Parse a numerical dollar-sign symbol. -Given e.g. $4, return 4." - (when (symbolp obj) - (let ((str (symbol-name obj))) - (when (string-match "\\`\\$\\([0-9]+\\)\\'" str) - (string-to-number (match-string 1 str)))))) - - (defmacro evil-parser (grammar &rest entrypoints) - "Construct a parser for GRAMMAR with ENTRYPOINTS. -The result is a function taking the arguments SYMBOL and SYNTAX, that -parses the text after point. SYMBOL should be one of ENTRYPOINTS. - -If parsing succeeds, point is moved to the end of the parsed text and -a 1-tuple (RESULT) is returned. Otherwise, the return value is nil. - -GRAMMAR is an association list of symbols and their definitions. -A definition is a list of production rules, which are tried in -succession. A production rule can be one of the following: - - nil matches the empty string. - A regular expression matches a substring. - A symbol matches a production for that symbol. - (X Y) matches X followed by Y. - (\\? X) matches zero or one of X. - (* X) matches zero or more of X. - (+ X) matches one or more of X. - (& X) matches X, but does not consume. - (! X) matches anything but X, but does not consume. - -Thus, a simple grammar may look like: - - ((plus \"\\\\+\") ; plus <- \"+\" - (minus \"-\") ; minus <- \"-\" - (operator plus minus)) ; operator <- plus / minus - -All input-consuming rules have a value. A regular expression evaluates -to the text matched, while a list evaluates to a list of values. -The value of a list may be overridden with a semantic action, which is -specified with a #\\='-quoted expression at the end: - - (X Y #\\='foo) - -The value of this rule is the result of calling foo with the values -of X and Y as arguments. Alternatively, the function call may be -specified explicitly: - - (X Y #\\='(foo $1 $2)) - -Here, $1 refers to X and $2 refers to Y. $0 refers to the whole list. -Dollar expressions can also be used directly: - - (X Y #\\='$1) - -This matches X followed by Y, but ignores the value of Y; -the value of the list is the same as the value of X. - -If the SYNTAX argument is non-nil, then all semantic actions -are ignored, and a syntax tree is constructed instead. The -syntax tree obeys the property that all the leaf nodes are -parts of the input string. Thus, by traversing the syntax tree, -one can determine how each character was parsed. - -The following symbols have reserved meanings within a grammar: -`\\?', `*', `+', `&', `!', `function', `alt', `seq' and nil." - (cl-labels - ;; Return code for parsing PRODUCTION. - ((compile - (production) - (pcase production - ('nil '(list (when syntax (point)))) ; Epsilon - ((and (pred stringp) regexp) ; Token - `(when (progn - (skip-chars-forward " \t\n\r") ; Ignore leading whitespace - (looking-at ,regexp)) - (goto-char (match-end 0)) - (list (if syntax (point) (match-string 0))))) - ((and (pred symbolp) symbol) ; Symbol - `(let ((result (,symbol syntax))) - (and syntax result (push ',symbol (car result))) - result)) - (`(function ,fun) ; Function - `(let ((result (funcall #',fun))) - (and syntax result (setcar result (point))) - result)) - ;; Positive lookahead - (`(& . ,rule) `(when ,(compile rule) ,(compile nil))) - ;; Negative lookahead - (`(! . ,rule) `(unless ,(compile rule) ,(compile nil))) - ;; Zero or one - (`(\? . ,(or `(,rule) rule)) (compile `(alt ,rule nil))) - ;; Zero or more - (`(* . ,rules) (compile `(alt (+ ,@rules) nil))) - ;; Lists - ((or `(,(and (or '+ 'alt 'seq) symbol) . ,rules) - (and (pred listp) rules (let symbol 'seq))) - (let ((func (unless (eq symbol 'alt) #'list))) - (pcase (when (> (length rules) 1) (car (last rules))) - (`(function ,x) (setq func x - rules (butlast rules)))) - `(let ((cell - ,(pcase symbol - ('+ ; One or more - (when (cdr rules) (error "Too many `+' rules")) - `(cl-loop for x = ,(compile (car rules)) - while x collect (car x) into result until (eobp) - finally return (when result (list result)))) - ('alt `(or ,@(mapcar #'compile rules))) - ('seq - (cl-loop - for rule in rules collect - (macroexp-let2 nil x (compile rule) - (if (memq (car-safe rule) '(& !)) x - `(when ,x (push (car ,x) result)))) - into items finally return - `(let ((pos (point)) result) - (if (and ,@items) (list (nreverse result)) - (goto-char pos) - nil))))))) - ;; Semantic action - (when (and ',func cell (not syntax)) - (setcar - cell - (let ((result (car cell))) - (ignore result) ; Suppress unused var warning - ,(pcase func - ;; Dollar expression - ((or (pred evil-parser--dexp) (pred listp)) - (dval func)) - ((pred symbolp) - `(,(if (eq symbol 'alt) #'list #'cons) #',func result)) - (_ (error "Invalid semantic action `%S'" func)))))) - cell))))) - ;; Substitute all dollar-sign symbols in X. - ;; Each dollar-sign symbol is replaced with the corresponding - ;; element in RESULT, so that $1 becomes the first element, etc. - ;; The special value $0 is substituted with the whole list RESULT. - (dval - (x) - (if (listp x) (cons #'list (mapcar #'dval x)) - (let ((num (evil-parser--dexp x))) - (cond ((null num) `',x) - ((eq num 0) 'result) - (t `(nth (1- ,num) result))))))) - `(lambda (symbol &optional syntax) - (cl-labels - (,@(cl-loop for (symbol . def) in (eval grammar t) collect - `(,symbol (syntax) ,(compile `(alt . ,def)))) - (evil-ex-parse-command - () - (let* ((result (binding nil)) - (command (car result))) - (cond - ((not result) nil) - ;; Check whether the parsed command is followed by a slash, - ;; dash or number and either the part before is NOT known to be - ;; a binding, or the complete string IS known to be a binding. - ((and (let ((ch (char-after))) - (and ch (or (memq ch '(?- ?/)) (<= ?0 ch ?9)))) - (or (evil-ex-binding - (concat command (buffer-substring (point) (point-max))) t) - (not (evil-ex-binding command t)))) - (backward-char (length command)) - (emacs-binding nil)) - ;; Parse a following "!" as bang only if the command - ;; has the property :ex-bang t. - ((when (eq (char-after) ?!) - (let ((binding (evil-ex-completed-binding command t))) - (and binding (evil-get-command-property binding :ex-bang)))) - (forward-char) - (setcar result (concat command "!")) - result) - (t result))))) - (pcase symbol - ,@(cl-loop for sym in entrypoints collect `(',sym ,(compile sym))) - (_ (error "Unknown entrypoint `%s'" symbol)))))))) - -(defvar evil-ex-argument-types nil - "Association list of argument handlers.") - -(defvar evil-ex-commands nil - "Association list of command bindings and functions.") - -(defvar evil-ex-reverse-range nil - "Whether the current Ex range was entered reversed.") - -(defvar evil--ex-cmd nil - "The current Ex command string.") - -(defvar evil--ex-argument-handler nil - "The argument handler for the current Ex command.") - -(defvar evil--ex-shortcut-command nil - "Interactive command to use instead of an Ex command.") - -(define-error 'evil-ex-error "Ex syntax error") - -(defun evil-ex-p () - "Return non-nil if currently in Ex state." - (when evil-ex-original-buffer t)) - -(evil-define-command evil-ex (&optional initial-input) - "Enter an Ex command. -The Ex command line is initialized with the value of INITIAL-INPUT. If -the command is called interactively the initial input depends on the -current state. In Normal state if a prefix count is given then the -initial input is \".,.+count\", otherwise it is empty. In Visual state -the initial input is the visual region '<,'> or `<,`>. The variable -`evil-ex-initial-input', if non-nil, is appended to the line." - :keep-visual t - :repeat abort - (interactive - (let ((s (concat - (cond - ((and (evil-visual-state-p) - evil-ex-visual-char-range - (memq (evil-visual-type) '(inclusive exclusive))) - "`<,`>") - ((evil-visual-state-p) "'<,'>") - (current-prefix-arg - (let ((arg (prefix-numeric-value current-prefix-arg))) - (cond ((< arg 0) (setq arg (1+ arg))) - ((> arg 0) (setq arg (1- arg)))) - (if (= arg 0) "." (format ".,.%+d" arg))))) - evil-ex-initial-input))) - (list (unless (string= s "") s)))) - (let ((buffer (current-buffer)) - (previous-command (when evil-want-empty-ex-last-command - (car evil-ex-history))) - s evil--ex-cmd evil--ex-argument-handler evil--ex-shortcut-command) - (minibuffer-with-setup-hook - (lambda () - (setq-local evil-ex-original-buffer buffer) - (evil-ex-setup) - (if initial-input (evil--ex-update) - (when previous-command - (add-hook 'pre-command-hook #'evil-ex-remove-default nil t)))) - (setq s (read-from-minibuffer - ":" - (or initial-input - (and previous-command (propertize previous-command 'face 'shadow))) - evil-ex-completion-map nil 'evil-ex-history))) - (if evil--ex-shortcut-command - (call-interactively evil--ex-shortcut-command) - (when (string= s "") (setq s previous-command)) - (unless (string= s "") (evil-ex-execute s))))) - -(defun evil-ex-execute (string) - "Execute STRING as an Ex command." - (eval (or (evil-ex-parse string) (signal 'evil-ex-error string)) t)) - -(defun evil-ex-parse (&optional string syntax entrypoint) - "Parse STRING as an Ex expression and return its evaluation tree. -If STRING is nil, parse the text after point instead. If SYNTAX is -non-nil, return a syntax tree instead. ENTRYPOINT is the start -symbol, which defaults to `expression'." - (if string - (with-temp-buffer - (insert string) - (goto-char (point-min)) - (evil-ex-parse nil syntax entrypoint)) - (let ((result (funcall (evil-parser evil-ex-grammar expression range) - (or entrypoint 'expression) syntax))) - (and result - ;; Disallow incomplete matches (ignore trailing WS) - (not (search-forward "[^ \t\n\r]" nil t)) - (car result))))) - -(defun evil-ex-delete-backward-char () - "Close the minibuffer if it is empty, otherwise call `delete-backward-char'." - (interactive) - (call-interactively - (if (< (minibuffer-prompt-end) (point-max)) - #'delete-backward-char - #'abort-recursive-edit))) - -(cl-defstruct (evil-ex-argument-handler (:type list) (:constructor nil) - (:copier nil) (:predicate nil)) - (runner nil :read-only t) (completer nil :read-only t)) - -(defun evil-ex-setup () - "Initialize Ex minibuffer. -This function registers hooks that are used for the interactive -actions during Ex state." - (add-hook 'after-change-functions #'evil--ex-update nil t) - (add-hook 'minibuffer-exit-hook #'evil-ex-teardown nil t) - (add-hook 'completion-at-point-functions #'evil-ex-completion-at-point nil t)) - -(defsubst evil--ex-bang-p (command) - "Return non-nil if the string COMMAND has a \"!\" suffix." - (and (> (length command) 1) (eq (aref command (1- (length command))) ?!))) - -(defun evil--ex-update (&optional beg _end _old-len) - "Update Ex variables when the minibuffer changes. -This function is usually called from `after-change-functions' -hook. If BEG is non-nil (which is the case when called from -`after-change-functions'), then an error description is shown -in case of incomplete or unknown commands." - (when (and beg (eq this-command #'self-insert-command)) - (let ((cmd (lookup-key evil-ex-shortcut-map (minibuffer-contents-no-properties)))) - (when (commandp cmd) - (setq evil--ex-shortcut-command cmd) - (exit-minibuffer)))) - - (setq evil--ex-cmd nil) - (let ((expr (save-excursion (goto-char (minibuffer-prompt-end)) - (evil-ex-parse))) - func handler current-prefix-arg evil-ex-range evil-ex-bang evil-ex-argument) - (when (eq (car expr) #'evil-ex-call-command) - (with-current-buffer evil-ex-original-buffer - (let* ((range (eval (nth 1 expr) t)) - (count (when (integerp range) range))) - (setq current-prefix-arg count - evil-ex-range (if count (evil-ex-range count count) range) - evil--ex-cmd (eval (nth 2 expr) t) - evil-ex-bang (evil--ex-bang-p evil--ex-cmd) - evil-ex-argument (eval (nth 3 expr) t)))) - (cond - ((not beg)) - ;; Test the current command when called from `after-change-functions' - ((setq func (evil-ex-completed-binding evil--ex-cmd t)) - ;; Update argument handler - (let ((type (evil-get-command-property func :ex-arg))) - (when type (setq handler (cdr (assq type evil-ex-argument-types))))) - (if (eq handler evil--ex-argument-handler) - (let ((runner (evil-ex-argument-handler-runner handler))) - (when runner (funcall runner 'update evil-ex-argument))) - (let ((runner (evil-ex-argument-handler-runner evil--ex-argument-handler))) - (when runner (funcall runner 'stop))) - (setq evil--ex-argument-handler handler) - (let ((runner (evil-ex-argument-handler-runner handler))) - (when runner (funcall runner 'start evil-ex-argument))))) - (t (let* ((evil-ex-complete-emacs-commands 'in-turn) - (prefix (try-completion evil--ex-cmd (evil-ex-completion-table)))) - (cond ((stringp prefix) (evil-ex-echo "Incomplete command")) - ((null prefix) (evil-ex-echo "Unknown command"))))))))) - -(defun evil-ex-teardown () - "Deinitialize Ex minibuffer. -Clean up everything set up by `evil-ex-setup'." - (let ((runner (evil-ex-argument-handler-runner evil--ex-argument-handler))) - (when runner (funcall runner 'stop)))) - -(defvar-local evil--ex-echo-overlay nil - "Overlay for displaying info messages during Ex.") - -(defun evil-ex-echo (string &rest args) - "Display a message after the current Ex command." - ;; Differs from minibuffer-message, which see, in that it does not - ;; use sit-for, since it may be called in the middle of a command. - (unless (or evil-no-display (zerop (length string))) - (let ((string (concat " [" (apply #'format string args) "]"))) - (put-text-property 0 1 'cursor t string) ; Place cursor before message - (put-text-property 1 (length string) 'face 'evil-ex-info string) - (with-selected-window (minibuffer-window) - (if evil--ex-echo-overlay - (move-overlay evil--ex-echo-overlay (point-max) (point-max)) - (setq evil--ex-echo-overlay (make-overlay (point-max) (point-max) nil t t))) - (add-hook 'pre-command-hook #'evil--ex-remove-echo-overlay nil t) - (overlay-put evil--ex-echo-overlay 'after-string string))))) - -(defun evil--ex-remove-echo-overlay () - "Remove echo overlay from Ex minibuffer." - (delete-overlay evil--ex-echo-overlay) - (setq evil--ex-echo-overlay nil) - (remove-hook 'pre-command-hook #'evil--ex-remove-echo-overlay t)) - -(cl-defun evil-ex-completion-at-point () - "Function used for `completion-at-point-functions' in Ex state." - (cl-flet ((fix-beg (b) (min (save-excursion - (+ (goto-char b) (skip-chars-forward " \t\n\r"))) - (point)))) - (pcase (nreverse (evil--ex-syntactic-context)) - ((or (and 'nil (let beg (minibuffer-prompt-end))) - `((expression) (command . ,beg) . ,_) - (and `((expression) (line) . ,_) - (guard (looking-at-p "[ \t\n\r]*\\'")) - (let beg (point)))) - (list (fix-beg beg) (point) (evil-ex-completion-table))) - (`((expression) (argument . ,beg)) - (setq beg (fix-beg beg)) - ;; If it's an autoload, load the function; this allows external - ;; packages to register autoloaded Ex commands which will be - ;; loaded when ex argument completion is triggered. - (let ((binding (evil-ex-binding evil--ex-cmd t))) (autoload-do-load binding)) - - (let* ((binding (evil-ex-completed-binding evil--ex-cmd)) - (arg-type (evil-get-command-property binding :ex-arg)) - (arg-handler (cdr (assq arg-type evil-ex-argument-types)))) - (pcase (evil-ex-argument-handler-completer arg-handler) - (`(collection . ,table) (list beg (point-max) table)) - (`(completion-at-point . ,completer) - (save-restriction (narrow-to-region beg (point-max)) - (funcall completer)))))) - (`((expression) (sexp . ,_)) - (when (fboundp 'elisp-completion-at-point) (elisp-completion-at-point)))))) - -(defun evil-ex-completion-table () - (let ((ex-cmds - (cl-loop - for (cmd . fun) in evil-ex-commands unless (stringp fun) - collect cmd - ;; Append ! to all commands that may take a bang argument - when (evil-get-command-property fun :ex-bang) - collect (concat cmd "!"))) - (emacs-cmds (lambda (str pred action) - (completion-table-with-predicate - obarray #'commandp t str pred action)))) - (cond - ((null evil-ex-complete-emacs-commands) ex-cmds) - ((eq evil-ex-complete-emacs-commands 'in-turn) - (completion-table-in-turn ex-cmds emacs-cmds)) - (t (cl-loop for s in-ref ex-cmds do - (setf s (propertize s 'face 'evil-ex-commands))) - (evil-completion-table-concat ex-cmds emacs-cmds))))) - -(defun evil-completion-table-concat (table1 table2) - (lambda (string pred action) - (cond - ((null action) - (let (matches) - (dolist (table (list table1 table2) (try-completion string matches)) - (let ((x (try-completion string table pred))) - (when x (push (if (eq x 't) string x) matches)))))) - ((eq action t) - (delete-dups - (append (all-completions string table1 pred) - (all-completions string table2 pred)))) - ((eq action 'lambda) - (when (or (test-completion string table1 pred) - (test-completion string table2 pred)) - t)) - ((eq (car-safe action) 'boundaries) - (or (completion-boundaries string table1 pred (cdr action)) - (completion-boundaries string table2 pred (cdr action)))) - ((eq action 'metadata) - '(metadata (display-sort-function . evil-ex-sort-completions)))))) - -(defun evil-ex-sort-completions (completions) - (sort completions - (lambda (str1 str2) - (let ((p1 (eq (get-text-property 0 'face str1) 'evil-ex-commands)) - (p2 (eq (get-text-property 0 'face str2) 'evil-ex-commands))) - (if (eq p1 p2) (string< str1 str2) p1))))) - -(define-obsolete-function-alias 'evil-ex-completion #'completion-at-point "1.15.0") - -(define-obsolete-function-alias - 'evil-ex-command-completion-at-point #'evil-ex-completion-at-point "1.15.0") - -(defalias 'evil-ex-argument-completion-at-point #'ignore) -(make-obsolete - 'evil-ex-argument-completion-at-point #'evil-ex-completion-at-point "1.15.0") - -(define-obsolete-function-alias - 'evil-ex-elisp-completion-at-point #'elisp-completion-at-point "1.15.0") - -(defun evil-ex-define-cmd (cmd function) - "Bind the function FUNCTION to the command CMD." - (if (not (string-match-p "\\[" cmd)) - (evil--add-to-alist evil-ex-commands cmd function) - (string-match "\\(.*\\)\\[\\(.*\\)\\]" cmd) - (let ((mandatory (match-string 1 cmd)) - (optional (match-string 2 cmd))) - (dotimes (n (1+ (length optional))) - (evil--add-to-alist evil-ex-commands - (concat mandatory (substring optional 0 n)) - function))))) - -(defmacro evil-ex-define-argument-type (arg-type doc &rest body) - "Define a new handler for argument-type ARG-TYPE. -DOC is the documentation string. It is followed by a list of keywords -and function: - -:collection COLLECTION - - A collection for completion as required by `all-completions'. - -:completion-at-point FUNC - - Function to be called to initialize a potential completion. FUNC - must match the requirements as described for the variable - `completion-at-point-functions'. When FUNC is called the minibuffer - content is narrowed to exactly match the argument. - -:runner FUNC - - Function to be called when the type of the current argument changes - or when the content of this argument changes. This function should - take one obligatory argument FLAG followed by an optional argument - ARG. FLAG is one of three symbol `start', `stop' or `update'. When - the argument type is recognized for the first time and this handler - is started the FLAG is `start'. If the argument type changes to - something else or ex state finished the handler FLAG is `stop'. If - the content of the argument has changed FLAG is `update'. If FLAG is - either `start' or `update' then ARG is the current value of this - argument. If FLAG is `stop' then arg is nil." - (declare (indent defun) - (doc-string 2) - (debug (&define name - [&optional stringp] - [&rest [keywordp function-form]]))) - (unless (stringp doc) (push doc body)) - (let (runner completer) - (while (keywordp (car body)) - (let ((key (pop body)) - (func (pop body))) - (cond - ((eq key :runner) - (setq runner `#',func)) - ((eq key :collection) - (setq completer `(cons 'collection #',func))) - ((eq key :completion-at-point) - (setq completer `(cons 'completion-at-point #',func)))))) - `(evil--add-to-alist evil-ex-argument-types - ',arg-type (list ,runner ,completer)))) - -(evil-ex-define-argument-type file - "Handle a file argument." - :collection read-file-name-internal) - -(evil-ex-define-argument-type buffer - "Called to complete a buffer name argument." - :collection internal-complete-buffer) - -(declare-function comint-completion-at-point "comint") -(declare-function shell-completion-vars "shell" ()) - -(defvar-local evil--ex-shell-argument-initialized nil - "This variable is set to t if shell command completion has been initialized. -See `evil-ex-init-shell-argument-completion'.") - -(defun evil-ex-init-shell-argument-completion (flag &optional _arg) - "Prepare the current minibuffer for completion of shell commands. -This function must be called from the :runner function of some -argument handler that requires shell completion." - (when (and (eq flag 'start) - (not evil--ex-shell-argument-initialized)) - (setq evil--ex-shell-argument-initialized t) - (require 'shell) - ;; Set up Comint for Shell mode, except - ;; `comint-completion-at-point' will be called manually. - (shell-completion-vars) - (remove-hook 'completion-at-point-functions #'comint-completion-at-point t))) - -(evil-ex-define-argument-type shell - "Shell argument type, supports completion." - :completion-at-point comint-completion-at-point - :runner evil-ex-init-shell-argument-completion) - -(defun evil-ex-file-or-shell-command-completion-at-point () - (if (eq (char-after (point-min)) ?!) - (save-restriction - (narrow-to-region (1+ (point-min)) (point-max)) - (comint-completion-at-point)) - (list (point-min) (point-max) #'read-file-name-internal))) - -(evil-ex-define-argument-type file-or-shell - "File or shell argument type. -If the current argument starts with a ! the rest of the argument -is considered a shell command, otherwise a file-name. Completion -works accordingly." - :completion-at-point evil-ex-file-or-shell-command-completion-at-point - :runner evil-ex-init-shell-argument-completion) - -(defun evil-ex-binding (command &optional noerror) - "Return the final binding of COMMAND." - (let ((binding (if (evil--ex-bang-p command) (substring command 0 -1) - command))) - (while (stringp - (setq binding (cdr (assoc binding evil-ex-commands))))) - (unless binding (setq binding (intern-soft command))) - (if (commandp binding) - (or (command-remapping binding) binding) - (unless noerror (user-error "Unknown command: `%s'" command))))) - -(defun evil-ex-completed-binding (command &optional noerror) - "Return the final binding of the completion of COMMAND." - (let ((completion (try-completion command evil-ex-commands))) - (evil-ex-binding (if (eq completion t) command - (or completion command)) - noerror))) - -;; TODO: extensions like :p :~ ... -(defun evil-ex-replace-special-filenames (file-name) - "Replace special symbols in FILE-NAME. -Replaces % by the current file-name, -Replaces # by the alternate file-name in FILE-NAME." - (let ((remote (file-remote-p file-name)) - (current-fname (buffer-file-name)) - (alternate-fname (and (other-buffer) - (buffer-file-name (other-buffer))))) - (setq file-name (or (file-remote-p file-name 'localname) file-name)) - (when current-fname - (setq current-fname (or (file-remote-p current-fname 'localname) - current-fname)) - (setq file-name - (replace-regexp-in-string "\\(^\\|[^\\\\]\\)\\(%\\)" - current-fname file-name - t t 2))) - (when alternate-fname - (setq alternate-fname (or (file-remote-p alternate-fname 'localname) - alternate-fname)) - (setq file-name - (replace-regexp-in-string "\\(^\\|[^\\\\]\\)\\(#\\)" - alternate-fname file-name - t t 2))) - (setq file-name - (replace-regexp-in-string "\\\\\\([#%]\\)" - "\\1" file-name t)) - (setq file-name (concat remote file-name))) - file-name) - -(defun evil-ex-file-arg () - "Return the current Ex argument as a file name. -This function interprets special file names like # and %." - (unless (zerop (length evil-ex-argument)) - (evil-ex-replace-special-filenames evil-ex-argument))) - -(define-error 'evil-ex-no-previous-cmd "No previous command line") - -(defun evil-ex-repeat (&optional count) - "Repeat the last Ex command." - (interactive "P") - (when count - (goto-char (point-min)) - (forward-line (1- count))) - (cl-loop - with evil-ex-original-buffer = (current-buffer) - for last-cmd in evil-ex-history do - (condition-case nil - (cl-return (let (evil-ex-history) (evil-ex-execute last-cmd))) - (evil-ex-no-previous-cmd)) - finally (signal 'evil-ex-no-previous-cmd nil))) - -(defun evil-ex-call-command (range command argument) - "Execute the given command COMMAND." - (when evil-ex-reverse-range - (setq evil-ex-reverse-range nil) - (unless (y-or-n-p "Backward range given, OK to swap? ") - (user-error ""))) - (let* ((count (when (integerp range) range)) - (current-prefix-arg count) - (evil-ex-range (if count (evil-ex-range count count) range)) - (cmd (evil-ex-completed-binding command)) - (evil-ex-bang (evil--ex-bang-p command)) - (evil-ex-argument argument) - (evil-this-type (evil-type evil-ex-range)) - (evil-ex-point (point)) - (restore-point - (and evil-ex-range - (evil-get-command-property cmd :restore-point) - (if (evil-visual-state-p) evil-visual-beginning evil-ex-point))) - (evil-called-from-ex-p t)) - (evil-exit-visual-state) - (deactivate-mark) - (when evil-ex-range - ;; Set region if an explicit range has been specified - (cl-destructuring-bind (beg end &rest) (evil-expand-range evil-ex-range t) - (goto-char beg) - (set-marker (mark-marker) end))) - (setq this-command cmd) - (let ((mark-active evil-ex-range)) - (run-hooks 'pre-command-hook) - (call-interactively cmd)) - (run-hooks 'post-command-hook) - (when restore-point (goto-char restore-point)))) - -(defun evil-ex-line (base &optional offset) - "Return the line number of BASE plus OFFSET." - (+ (or base (line-number-at-pos)) - (or offset 0))) - -(defun evil-ex-first-line () - "Return the line number of the first line." - (line-number-at-pos (point-min))) - -(defun evil-ex-current-line () - "Return the line number of the current line." - (line-number-at-pos)) - -(defun evil-ex-last-line () - "Return the line number of the last line." - (save-excursion - (goto-char (point-max)) - (when (bolp) - (forward-line -1)) - (line-number-at-pos))) - -(defun evil-ex-range (beg-line &optional end-line) - "Return the first and last position of the current range." - (let* ((beg (if beg-line (evil-line-position beg-line) - (line-beginning-position))) - (end (if end-line (evil-line-position (1+ end-line)) - (save-excursion (goto-char beg) (line-beginning-position 2))))) - (when (< end beg) - (setq evil-ex-reverse-range t) - (evil-swap beg end)) - (evil-range beg end 'line :expanded t))) - -(defun evil-ex-full-range () - "Return a range encompassing the whole buffer." - (evil-range (point-min) (point-max) 'line :expanded t)) - -(defun evil-ex-last-visual-range () - "Return a linewise range of the last visual selection." - (evil-range evil-visual-mark evil-visual-point 'line)) - -(defun evil-ex-marker (marker) - "Return MARKER's line number in the current buffer. -Signal an error if MARKER is in a different buffer." - (setq marker (evil-get-marker - (if (stringp marker) (aref marker 0) marker))) - (if (numberp marker) - (line-number-at-pos marker) - (user-error "Ex does not support markers in other files"))) - -(defun evil-ex-char-marker-range (beg end) - (setq beg (evil-get-marker (if (stringp beg) (aref beg 0) beg)) - end (evil-get-marker (if (stringp end) (aref end 0) end))) - (unless (and (numberp beg) (numberp end)) - (user-error "Ex does not support markers in other files")) - (evil-expand-range - (evil-range beg end - (if (evil-visual-state-p) - (evil-visual-type) - 'inclusive)))) - -(declare-function evil-ex-make-search-pattern "evil-search") - -(defun evil-ex-re-fwd (pattern) - "Search forward for PATTERN. -Return the line number of the match." - (when evil-ex-search-vim-style-regexp - (setq pattern (evil-transform-vim-style-regexp pattern))) - (set-text-properties 0 (length pattern) nil pattern) - (setq evil-ex-search-pattern (evil-ex-make-search-pattern pattern) - evil-ex-search-direction 'forward) - (condition-case err - (save-excursion - (evil-move-beginning-of-line 2) - (when (or (re-search-forward pattern nil t) - (progn - (goto-char (point-min)) - (re-search-forward pattern nil t))) - (line-number-at-pos (match-beginning 0)))) - (invalid-regexp - (evil-ex-echo (cadr err)) - nil))) - -(defun evil-ex-re-bwd (pattern) - "Search backward for PATTERN. -Return the line number of the match." - (when evil-ex-search-vim-style-regexp - (setq pattern (evil-transform-vim-style-regexp pattern))) - (set-text-properties 0 (length pattern) nil pattern) - (setq evil-ex-search-pattern (evil-ex-make-search-pattern pattern) - evil-ex-search-direction 'backward) - (condition-case err - (save-excursion - (evil-move-beginning-of-line) - (when (or (re-search-backward pattern nil t) - (progn - (goto-char (point-max)) - (re-search-backward pattern nil t))) - (line-number-at-pos (match-beginning 0)))) - (invalid-regexp - (evil-ex-echo (cadr err)) - nil))) - -(defun evil-ex-prev-search () - (error "Previous search not yet implemented")) - -(defun evil-ex-signed-number (sign &optional number) - "Return a signed number like -3 and +1. -NUMBER defaults to 1." - (funcall sign (or number 1))) - -(defun evil-ex-command-force-p (command) - "Whether COMMAND accepts the bang argument." - (declare (obsolete evil-get-command-property "1.15.0")) - (let ((binding (evil-ex-completed-binding command t))) - (when binding - (evil-get-command-property binding :ex-bang)))) - -(cl-defun evil--ex-syntactic-context - (&optional (pos (point)) - (tree (save-excursion (goto-char (minibuffer-prompt-end)) - (evil-ex-parse nil t))) - &aux i result) - "Return the syntactical context in TREE of the character at POS. -POS defaults to the current position of point." - ;; Iterate over syntax tree leaves (i.e. the strings), and return - ;; the path to the leaf containing the cursor. Or, if not found, - ;; e.g. because of trailing whitespace, the leaf at most one char - ;; past the rightmost non-empty string. - (cl-labels - ((traverse - (node path) - (while (and (consp node) (symbolp (car node))) - (push (cons (pop node) i) path)) - (if (listp node) - (dolist (child node) (traverse child path)) - ;; NODE is the end position of a parsed string - (when (>= node pos) (cl-return-from evil--ex-syntactic-context path)) - (when (or (null result) (> node i)) - (setq i node - result path))))) - (traverse tree ())) - result) - -(provide 'evil-ex) - -;;; evil-ex.el ends here diff --git a/.config/emacs/lisp/evil/evil-integration.el b/.config/emacs/lisp/evil/evil-integration.el deleted file mode 100644 index 710d69d..0000000 --- a/.config/emacs/lisp/evil/evil-integration.el +++ /dev/null @@ -1,468 +0,0 @@ -;;; evil-integration.el --- Integrate Evil with other modules -*- lexical-binding: t -*- - -;; Author: Vegard Øye -;; Maintainer: Vegard Øye - -;; Version: 1.15.0 - -;; -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -;;; Commentary: - -;; This provides evil integration for various emacs modes. -;; Additional keybindings (or default state) should go into evil-keybindings.el. - -;;; Code: - -(require 'evil-maps) -(require 'evil-core) -(require 'evil-macros) -(require 'evil-types) -(require 'evil-repeat) - -;;; Evilize some commands - -;; unbound keys should be ignored -(evil-declare-ignore-repeat 'undefined) - -(mapc #'(lambda (cmd) - (evil-set-command-property cmd :keep-visual t) - (evil-declare-not-repeat cmd)) - '(digit-argument - negative-argument - universal-argument - universal-argument-minus - universal-argument-more - universal-argument-other-key)) -(mapc #'evil-declare-not-repeat - '(what-cursor-position)) -(mapc #'evil-declare-change-repeat - '(dabbrev-expand - hippie-expand - quoted-insert)) -(mapc #'evil-declare-abort-repeat - '(balance-windows - eval-expression - execute-extended-command - exit-minibuffer - compile - delete-window - delete-other-windows - find-file-at-point - ffap-other-window - recompile - redo - save-buffer - split-window - split-window-horizontally - split-window-vertically - undo - undo-tree-redo - undo-tree-undo)) - -(evil-set-type #'previous-line 'line) -(evil-set-type #'next-line 'line) - -(dolist (cmd '(keyboard-quit keyboard-escape-quit)) - (evil-set-command-property cmd :suppress-operator t)) - -;;; Mouse -(evil-declare-insert-at-point-repeat 'mouse-yank-primary) -(evil-declare-insert-at-point-repeat 'mouse-yank-secondary) - -;;; key-binding - -;; Calling `keyboard-quit' should cancel repeat -(advice-add 'keyboard-quit :before #'evil-repeat-abort) - -(add-hook 'wdired-mode-hook #'evil-change-to-initial-state) -(advice-add 'wdired-change-to-dired-mode :after - #'evil--change-to-initial-state-with-msg) -(defun evil--change-to-initial-state-with-msg (&rest _) - (evil-change-to-initial-state nil t)) - -;;; Parentheses - -(evil--advice-add 'show-paren-function :around #'evil--match-paren-in-normal-state) -(defun evil--match-paren-in-normal-state (orig-fun &rest args) - "Match parentheses in Normal state." - (if (eq (not (memq 'not evil-highlight-closing-paren-at-point-states)) - (not (memq evil-state evil-highlight-closing-paren-at-point-states))) - (apply orig-fun args) - (let* ((orig-spdf show-paren-data-function) - (show-paren-data-function - (lambda () - (let ((pos (point)) narrow) - (setq - pos (cl-dotimes (i (1+ (* 2 evil-show-paren-range))) - (setq pos (+ pos (if (cl-evenp i) i (- i)))) - (pcase (syntax-class (syntax-after pos)) - (4 (setq narrow pos) (cl-return pos)) - (5 (cl-return (1+ pos)))))) - (when pos - (save-excursion - (goto-char pos) - (save-restriction - (when narrow (narrow-to-region narrow (point-max))) - (funcall orig-spdf)))))))) - (apply orig-fun args)))) - -;;; Undo tree -(eval-after-load 'undo-tree - '(with-no-warnings - (evil-ex-define-cmd "undol[ist]" 'undo-tree-visualize) - (evil-ex-define-cmd "ul" 'undo-tree-visualize) - - (define-key undo-tree-visualizer-mode-map - [remap evil-backward-char] 'undo-tree-visualize-switch-branch-left) - (define-key undo-tree-visualizer-mode-map - [remap evil-forward-char] 'undo-tree-visualize-switch-branch-right) - (define-key undo-tree-visualizer-mode-map - [remap evil-next-line] 'undo-tree-visualize-redo) - (define-key undo-tree-visualizer-mode-map - [remap evil-previous-line] 'undo-tree-visualize-undo) - (define-key undo-tree-visualizer-mode-map - [remap evil-ret] 'undo-tree-visualizer-set) - - (define-key undo-tree-visualizer-selection-mode-map - [remap evil-backward-char] 'undo-tree-visualizer-select-left) - (define-key undo-tree-visualizer-selection-mode-map - [remap evil-forward-char] 'undo-tree-visualizer-select-right) - (define-key undo-tree-visualizer-selection-mode-map - [remap evil-next-line] 'undo-tree-visualizer-select-next) - (define-key undo-tree-visualizer-selection-mode-map - [remap evil-previous-line] 'undo-tree-visualizer-select-previous) - (define-key undo-tree-visualizer-selection-mode-map - [remap evil-ret] 'undo-tree-visualizer-set))) - -;;; Auto-complete -(eval-after-load 'auto-complete - '(progn - (evil-add-command-properties 'auto-complete :repeat 'evil-ac-repeat) - (evil-add-command-properties 'ac-complete :repeat 'evil-ac-repeat) - (evil-add-command-properties 'ac-expand :repeat 'evil-ac-repeat) - (evil-add-command-properties 'ac-next :repeat 'ignore) - (evil-add-command-properties 'ac-previous :repeat 'ignore) - - (defvar evil-ac-prefix-len nil - "The length of the prefix of the current item to be completed.") - - (defvar ac-prefix) - (defun evil-ac-repeat (flag) - "Record the changes for auto-completion." - (cond - ((eq flag 'pre) - (setq evil-ac-prefix-len (length ac-prefix)) - (evil-repeat-start-record-changes)) - ((eq flag 'post) - ;; Add change to remove the prefix - (evil-repeat-record-change (- evil-ac-prefix-len) - "" - evil-ac-prefix-len) - ;; Add change to insert the full completed text - (evil-repeat-record-change - (- evil-ac-prefix-len) - (buffer-substring-no-properties (- evil-repeat-pos - evil-ac-prefix-len) - (point)) - 0) - ;; Finish repeation - (evil-repeat-finish-record-changes)))))) - -;;; Company -(eval-after-load 'company - '(progn - (mapc #'evil-declare-change-repeat - '(company-complete-mouse - company-complete-number - company-complete-selection - company-complete-common)) - - (mapc #'evil-declare-ignore-repeat - '(company-abort - company-select-next - company-select-previous - company-select-next-or-abort - company-select-previous-or-abort - company-select-mouse - company-show-doc-buffer - company-show-location - company-search-candidates - company-filter-candidates)))) - -;;; Eval last sexp -(defun evil--preceding-sexp (command &rest args) - "In Normal- or Motion-state, allow last sexp to end at point." - (save-excursion - (or evil-move-beyond-eol - (eolp) - (not (or (evil-normal-state-p) (evil-motion-state-p))) - (forward-char)) - (apply command args))) -(advice-add 'elisp--preceding-sexp :around #'evil--preceding-sexp) -(advice-add 'pp-last-sexp :around #'evil--preceding-sexp) -(advice-add 'lisp-eval-last-sexp :around #'evil--preceding-sexp) - -;;; Show key -(advice-add 'quail-show-key :around #'evil--in-emacs-state) -(advice-add 'describe-char :around #'evil--in-emacs-state) -(defun evil--in-emacs-state (orig-fun &rest args) - "Temporarily enter Emacs-state and apply ORIG-FUN to ARGS." - (evil-with-state emacs (apply orig-fun args))) - -;;; ace-jump-mode -(declare-function ace-jump-char-mode "ext:ace-jump-mode") -(declare-function ace-jump-word-mode "ext:ace-jump-mode") -(declare-function ace-jump-line-mode "ext:ace-jump-mode") -(defvar ace-jump-mode-scope) - -(defvar evil-ace-jump-active nil) - -(defmacro evil-enclose-ace-jump-for-motion (&rest body) - "Enclose ace-jump to make it suitable for motions. -This includes restricting `ace-jump-mode' to the current window -in visual and operator state, deactivating visual updates, saving -the mark and entering `recursive-edit'." - (declare (indent defun) - (debug t)) - `(let ((old-mark (mark)) - (ace-jump-mode-scope - (if (and (not (memq evil-state '(visual operator))) - (boundp 'ace-jump-mode-scope)) - ace-jump-mode-scope - 'window))) - (remove-hook 'pre-command-hook #'evil-visual-pre-command t) - (remove-hook 'post-command-hook #'evil-visual-post-command t) - (unwind-protect - (let ((evil-ace-jump-active 'prepare)) - (add-hook 'ace-jump-mode-end-hook - #'evil-ace-jump-exit-recursive-edit) - ,@body - (when evil-ace-jump-active - (setq evil-ace-jump-active t) - (recursive-edit))) - (remove-hook 'post-command-hook - #'evil-ace-jump-exit-recursive-edit) - (remove-hook 'ace-jump-mode-end-hook - #'evil-ace-jump-exit-recursive-edit) - (if (evil-visual-state-p) - (progn - (add-hook 'pre-command-hook #'evil-visual-pre-command nil t) - (add-hook 'post-command-hook #'evil-visual-post-command nil t) - (set-mark old-mark)) - (push-mark old-mark))))) - -(advice-add 'ace-jump-done :after #'evil--after-ace-jump-done) -(defun evil--after-ace-jump-done (&rest _) - (when evil-ace-jump-active - (add-hook 'post-command-hook #'evil-ace-jump-exit-recursive-edit))) - -(defun evil-ace-jump-exit-recursive-edit () - "Exit a recursive edit caused by an evil jump." - (cond - ((eq evil-ace-jump-active 'prepare) - (setq evil-ace-jump-active nil)) - (evil-ace-jump-active - (remove-hook 'post-command-hook #'evil-ace-jump-exit-recursive-edit) - (exit-recursive-edit)))) - -(evil-define-motion evil-ace-jump-char-mode (_count) - "Jump visually directly to a char using ace-jump." - :type inclusive - (evil-without-repeat - (let ((pnt (point)) - (buf (current-buffer))) - (evil-enclose-ace-jump-for-motion - (call-interactively 'ace-jump-char-mode)) - ;; if we jump backwards, motion type is exclusive, analogously - ;; to `evil-find-char-backward' - (when (and (equal buf (current-buffer)) - (< (point) pnt)) - (setq evil-this-type - (cond - ((eq evil-this-type 'exclusive) 'inclusive) - ((eq evil-this-type 'inclusive) 'exclusive))))))) - -(evil-define-motion evil-ace-jump-char-to-mode (_count) - "Jump visually to the char in front of a char using ace-jump." - :type inclusive - (evil-without-repeat - (let ((pnt (point)) - (buf (current-buffer))) - (evil-enclose-ace-jump-for-motion - (call-interactively 'ace-jump-char-mode)) - (if (and (equal buf (current-buffer)) - (< (point) pnt)) - (progn - (or (eobp) (forward-char)) - (setq evil-this-type - (cond - ((eq evil-this-type 'exclusive) 'inclusive) - ((eq evil-this-type 'inclusive) 'exclusive)))) - (backward-char))))) - -(evil-define-motion evil-ace-jump-line-mode (_count) - "Jump visually to the beginning of a line using ace-jump." - :type line - :repeat abort - (evil-without-repeat - (evil-enclose-ace-jump-for-motion - (call-interactively 'ace-jump-line-mode)))) - -(evil-define-motion evil-ace-jump-word-mode (_count) - "Jump visually to the beginning of a word using ace-jump." - :type exclusive - :repeat abort - (evil-without-repeat - (evil-enclose-ace-jump-for-motion - (call-interactively 'ace-jump-word-mode)))) - -(define-key evil-motion-state-map [remap ace-jump-char-mode] #'evil-ace-jump-char-mode) -(define-key evil-motion-state-map [remap ace-jump-line-mode] #'evil-ace-jump-line-mode) -(define-key evil-motion-state-map [remap ace-jump-word-mode] #'evil-ace-jump-word-mode) - -;;; avy -(declare-function avy-goto-word-or-subword-1 "ext:avy") -(declare-function avy-goto-line "ext:avy") -(declare-function avy-goto-char "ext:avy") -(declare-function avy-goto-char-2 "ext:avy") -(declare-function avy-goto-char-2-above "ext:avy") -(declare-function avy-goto-char-2-below "ext:avy") -(declare-function avy-goto-char-in-line "ext:avy") -(declare-function avy-goto-word-0 "ext:avy") -(declare-function avy-goto-word-1 "ext:avy") -(declare-function avy-goto-word-1-above "ext:avy") -(declare-function avy-goto-word-1-below "ext:avy") -(declare-function avy-goto-subword-0 "ext:avy") -(declare-function avy-goto-subword-1 "ext:avy") -(declare-function avy-goto-char-timer "ext:avy") -(defvar avy-all-windows) - -(defmacro evil-enclose-avy-for-motion (&rest body) - "Enclose avy to make it suitable for motions. -Based on `evil-enclose-ace-jump-for-motion'." - (declare (indent defun) - (debug t)) - `(let ((avy-all-windows - (if (and (not (memq evil-state '(visual operator))) - (boundp 'avy-all-windows)) - avy-all-windows - nil))) - ,@body)) - -(defmacro evil-define-avy-motion (command type) - (declare (indent defun) - (debug t)) - (let ((name (intern (format "evil-%s" command)))) - `(evil-define-motion ,name (_count) - ,(format "Evil motion for `%s'." command) - :type ,type - :jump t - :repeat abort - (evil-without-repeat - (evil-enclose-avy-for-motion - (call-interactively ',command)))))) - -;; define evil-avy-* motion commands for avy-* commands -(evil-define-avy-motion avy-goto-char inclusive) -(evil-define-avy-motion avy-goto-char-2 inclusive) -(evil-define-avy-motion avy-goto-char-2-above inclusive) -(evil-define-avy-motion avy-goto-char-2-below inclusive) -(evil-define-avy-motion avy-goto-char-in-line inclusive) -(evil-define-avy-motion avy-goto-char-timer inclusive) -(evil-define-avy-motion avy-goto-line line) -(evil-define-avy-motion avy-goto-line-above line) -(evil-define-avy-motion avy-goto-line-below line) -(evil-define-avy-motion avy-goto-subword-0 exclusive) -(evil-define-avy-motion avy-goto-subword-1 exclusive) -(evil-define-avy-motion avy-goto-symbol-1 exclusive) -(evil-define-avy-motion avy-goto-symbol-1-above exclusive) -(evil-define-avy-motion avy-goto-symbol-1-below exclusive) -(evil-define-avy-motion avy-goto-word-0 exclusive) -(evil-define-avy-motion avy-goto-word-1 exclusive) -(evil-define-avy-motion avy-goto-word-1-above exclusive) -(evil-define-avy-motion avy-goto-word-1-below exclusive) -(evil-define-avy-motion avy-goto-word-or-subword-1 exclusive) - -;; remap avy-* commands to evil-avy-* commands -(dolist (command '(avy-goto-char - avy-goto-char-2 - avy-goto-char-2-above - avy-goto-char-2-below - avy-goto-char-in-line - avy-goto-char-timer - avy-goto-line - avy-goto-line-above - avy-goto-line-below - avy-goto-subword-0 - avy-goto-subword-1 - avy-goto-symbol-1 - avy-goto-symbol-1-above - avy-goto-symbol-1-below - avy-goto-word-0 - avy-goto-word-1 - avy-goto-word-1-above - avy-goto-word-1-below - avy-goto-word-or-subword-1)) - (define-key evil-motion-state-map - (vector 'remap command) (intern-soft (format "evil-%s" command)))) - -;;; nXhtml/mumamo -;; ensure that mumamo does not toggle evil through its globalized mode -(eval-after-load 'mumamo - '(with-no-warnings - (push 'evil-mode-cmhh mumamo-change-major-mode-no-nos))) - -;; visual-line-mode integration -(when evil-respect-visual-line-mode - (evil-define-minor-mode-key 'motion 'visual-line-mode - "j" 'evil-next-visual-line - "gj" 'evil-next-line - "k" 'evil-previous-visual-line - "gk" 'evil-previous-line - "0" 'evil-beginning-of-visual-line - "g0" 'evil-beginning-of-line - "$" 'evil-end-of-visual-line - "g$" 'evil-end-of-line - "V" 'evil-visual-screen-line)) - -;;; abbrev.el -(defun evil-maybe-expand-abbrev () - (when (and abbrev-mode evil-want-abbrev-expand-on-insert-exit) - (expand-abbrev))) - -(eval-after-load 'abbrev - '(add-hook 'evil-insert-state-exit-hook #'evil-maybe-expand-abbrev)) - -;;; ElDoc -(eval-after-load 'eldoc - '(when (fboundp 'eldoc-add-command-completions) - (eldoc-add-command-completions "evil-window-"))) - -;;; XRef -(eval-after-load 'xref - '(progn - (evil-set-command-property 'xref-find-definitions :jump t) - (evil-set-command-property 'xref-find-references :jump t))) - -(provide 'evil-integration) - -;;; evil-integration.el ends here diff --git a/.config/emacs/lisp/evil/evil-jumps.el b/.config/emacs/lisp/evil/evil-jumps.el deleted file mode 100644 index a5ad8ba..0000000 --- a/.config/emacs/lisp/evil/evil-jumps.el +++ /dev/null @@ -1,358 +0,0 @@ -;;; evil-jumps.el --- Jump list implementation -*- lexical-binding: t -*- - -;; Author: Bailey Ling - -;; Version: 1.15.0 - -;; -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -(require 'cl-lib) -(require 'evil-core) -(require 'evil-states) - -;;; Code: - -(defgroup evil-jumps nil - "Evil jump list configuration options." - :prefix "evil-jumps" - :group 'evil) - -(defcustom evil-jumps-cross-buffers t - "When non-nil, the jump commands can cross borders between buffers. -Otherwise the jump commands act only within the current buffer." - :type 'boolean) - -(defcustom evil-jumps-max-length 100 - "The maximum number of jumps to keep track of." - :type 'integer) - -(defcustom evil-jumps-pre-jump-hook nil - "Hooks to run just before jumping to a location in the jump list." - :type 'hook) - -(defcustom evil-jumps-post-jump-hook nil - "Hooks to run just after jumping to a location in the jump list." - :type 'hook) - -(defcustom evil-jumps-ignored-file-patterns '("COMMIT_EDITMSG$" "TAGS$") - "List of regexps to exclude file path from inclusion in the jump list." - :type '(repeat string)) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(defvar savehist-additional-variables) - -(defvar evil--jumps-jumping nil) - -(defvar evil--jumps-jump-command nil - "Set by `evil--jump-backward', used and cleared in the -`post-command-hook' by `evil--jump-handle-buffer-crossing'") - -(eval-when-compile (defvar evil--jumps-debug nil)) - -(defvar evil--jumps-buffer-targets "\\*\\(new\\|scratch\\)\\*" - "Regexp to determine if buffer with `buffer-name' is a valid jump target.") - -(defvar evil--jumps-window-jumps (make-hash-table) - "Hashtable which stores all jumps on a per window basis.") - -(defvar evil-jumps-history nil - "History of `evil-mode' jumps that are persisted with `savehist'.") - -(cl-defstruct evil-jumps-struct - ring - (idx -1) - previous-pos) - -;; Is inlining this really worth it? -(defsubst evil--jumps-message (format &rest args) - (when (eval-when-compile evil--jumps-debug) - (with-current-buffer (get-buffer-create "*evil-jumps*") - (goto-char (point-max)) - (insert (apply #'format format args) "\n")))) - -(defun evil--jumps-get-current (&optional window) - (unless window (setq window (selected-window))) - (let ((jump-struct (gethash window evil--jumps-window-jumps))) - (unless jump-struct - (setq jump-struct (make-evil-jumps-struct)) - (puthash window jump-struct evil--jumps-window-jumps)) - jump-struct)) - -(defun evil--jumps-get-jumps (struct) - (let ((ring (evil-jumps-struct-ring struct))) - (unless ring - (setq ring (make-ring evil-jumps-max-length)) - (setf (evil-jumps-struct-ring struct) ring)) - ring)) - -(defun evil--jumps-get-window-jump-list () - (let ((struct (evil--jumps-get-current))) - (evil--jumps-get-jumps struct))) - -(defun evil--jumps-savehist-load () - (add-to-list 'savehist-additional-variables 'evil-jumps-history) - (let ((ring (make-ring evil-jumps-max-length))) - (cl-loop for jump in (reverse evil-jumps-history) - do (ring-insert ring jump)) - (setf (evil-jumps-struct-ring (evil--jumps-get-current)) ring)) - (add-hook 'savehist-save-hook #'evil--jumps-savehist-sync) - (remove-hook 'savehist-mode-hook #'evil--jumps-savehist-load)) - -(defun evil--jumps-savehist-sync () - "Update the printable value of window jumps for `savehist'." - (setq evil-jumps-history - (delq nil (mapcar #'(lambda (jump) - (let* ((mark (car jump)) - (pos (if (markerp mark) - (marker-position mark) - mark)) - (file-name (cadr jump))) - (when (and (not (file-remote-p file-name)) - (file-exists-p file-name) - pos) - (list pos file-name)))) - (ring-elements (evil--jumps-get-window-jump-list)))))) - -(defun evil--jumps-current-file-name () - "Get the current buffer file name for `evil--jumps-push'." - (or buffer-file-name - (when (derived-mode-p 'dired-mode) default-directory))) - -(defun evil--jumps-jump (idx shift) - (let ((target-list (evil--jumps-get-window-jump-list))) - (evil--jumps-message "jumping from %s by %s" idx shift) - (evil--jumps-message "target list = %s" target-list) - (setq idx (+ idx shift)) - (let ((current-file-name (or (evil--jumps-current-file-name) (buffer-name))) - (size (ring-length target-list))) - (unless evil-jumps-cross-buffers - ;; skip jump marks pointing to other buffers - (while (and (< idx size) (>= idx 0) - (not (string= current-file-name (cadr (ring-ref target-list idx))))) - (setq idx (+ idx shift)))) - (when (and (< idx size) (>= idx 0)) - ;; actual jump - (run-hooks 'evil-jumps-pre-jump-hook) - (let* ((place (ring-ref target-list idx)) - (pos (car place)) - (file-name (cadr place))) - (setq evil--jumps-jumping t) - (unless (string= current-file-name file-name) - (if (string-match-p evil--jumps-buffer-targets file-name) - (switch-to-buffer file-name) - (find-file file-name))) - (setq evil--jumps-jumping nil) - (goto-char pos) - (setf (evil-jumps-struct-idx (evil--jumps-get-current)) idx) - (run-hooks 'evil-jumps-post-jump-hook)))))) - -(defun evil--jumps-push () - "Push the current cursor/file position to the jump list." - (let ((target-list (evil--jumps-get-window-jump-list)) - (file-name (evil--jumps-current-file-name)) - (buffer-name (buffer-name)) - (current-pos (point-marker)) - (first-pos nil) - (first-file-name nil) - (excluded nil)) - (when (and (not file-name) - (string-match-p evil--jumps-buffer-targets buffer-name)) - (setq file-name buffer-name)) - (when file-name - (dolist (pattern evil-jumps-ignored-file-patterns) - (when (string-match-p pattern file-name) - (setq excluded t))) - (unless excluded - (unless (ring-empty-p target-list) - (setq first-pos (car (ring-ref target-list 0))) - (setq first-file-name (car (cdr (ring-ref target-list 0))))) - (unless (and (equal first-pos current-pos) - (equal first-file-name file-name)) - (evil--jumps-message "pushing %s on %s" current-pos file-name) - (ring-insert target-list `(,current-pos ,file-name))))) - (evil--jumps-message "%s %s" - (selected-window) - (and (not (ring-empty-p target-list)) - (ring-ref target-list 0))))) - -(evil-define-command evil-show-jumps () - "Display the contents of the jump list." - :repeat nil - (evil-with-view-list - :name "evil-jumps" - :mode "Evil Jump List" - :format [("Jump" 5 nil) - ("Marker" 8 nil) - ("File/text" 1000 t)] - :entries (let* ((jumps (evil--jumps-savehist-sync)) - (count 0)) - (cl-loop for jump in jumps - collect `(nil [,(number-to-string (cl-incf count)) - ,(number-to-string (car jump)) - (,(cadr jump))]))) - :select-action #'evil--show-jumps-select-action)) - -(defun evil--show-jumps-select-action (jump) - (let ((position (string-to-number (elt jump 1))) - (file (car (elt jump 2)))) - (kill-buffer) - (switch-to-buffer (find-file file)) - (goto-char position))) - -(defun evil-set-jump (&optional pos) - "Set jump point at POS. -POS defaults to point." - (save-excursion - (when (markerp pos) - (set-buffer (marker-buffer pos))) - - (unless (or (region-active-p) (evil-visual-state-p)) - (push-mark pos t)) - - (unless evil--jumps-jumping - ;; clear out intermediary jumps when a new one is set - (let* ((struct (evil--jumps-get-current)) - (target-list (evil--jumps-get-jumps struct)) - (idx (evil-jumps-struct-idx struct))) - (cl-loop repeat idx - do (ring-remove target-list)) - (setf (evil-jumps-struct-idx struct) -1)) - (when pos - (goto-char pos)) - (evil--jumps-push)))) -(put 'evil-set-jump 'permanent-local-hook t) - -(defun evil--jump-backward (count) - (setq evil--jumps-jump-command t) - (let ((count (or count 1))) - (evil-motion-loop (nil count) - (let* ((struct (evil--jumps-get-current)) - (idx (evil-jumps-struct-idx struct))) - (evil--jumps-message "jumping back %s" idx) - (when (= idx -1) - (setq idx 0) - (setf (evil-jumps-struct-idx struct) 0) - (evil--jumps-push)) - (evil--jumps-jump idx 1))))) - -(defun evil--jump-forward (count) - (setq evil--jumps-jump-command t) - (let ((count (or count 1))) - (evil-motion-loop (nil count) - (let* ((struct (evil--jumps-get-current)) - (idx (evil-jumps-struct-idx struct))) - (when (= idx -1) - (setq idx 0) - (setf (evil-jumps-struct-idx struct) 0) - (evil--jumps-push)) - (evil--jumps-jump idx -1))))) - -(defun evil--jumps-window-configuration-hook (&rest _args) - (let* ((window-list (window-list-1 nil nil t)) - (existing-window (selected-window)) - (new-window (previous-window))) - (when (and (not (eq existing-window new-window)) - (> (length window-list) 1)) - (let* ((target-jump-struct (evil--jumps-get-current new-window))) - (if (not (ring-empty-p (evil--jumps-get-jumps target-jump-struct))) - (evil--jumps-message "target window %s already has %s jumps" new-window - (ring-length (evil--jumps-get-jumps target-jump-struct))) - (evil--jumps-message "new target window detected; copying %s to %s" existing-window new-window) - (let* ((source-jump-struct (evil--jumps-get-current existing-window)) - (source-list (evil--jumps-get-jumps source-jump-struct))) - (when (= (ring-length (evil--jumps-get-jumps target-jump-struct)) 0) - (setf (evil-jumps-struct-previous-pos target-jump-struct) (evil-jumps-struct-previous-pos source-jump-struct)) - (setf (evil-jumps-struct-idx target-jump-struct) (evil-jumps-struct-idx source-jump-struct)) - (setf (evil-jumps-struct-ring target-jump-struct) (ring-copy source-list))))))) - ;; delete obsolete windows - (maphash (lambda (key _val) - (unless (member key window-list) - (evil--jumps-message "removing %s" key) - (remhash key evil--jumps-window-jumps))) - evil--jumps-window-jumps))) -(put 'evil--jumps-window-configuration-hook 'permanent-local-hook t) - -(defun evil--jump-hook (&optional command) - "`pre-command-hook' for evil-jumps. -Set jump point if COMMAND has a non-nil `:jump' property. Otherwise, -save the current position in case the command being executed will -change the current buffer." - (setq command (or command this-command)) - (if (evil-get-command-property command :jump) - (evil-set-jump) - (setf (evil-jumps-struct-previous-pos (evil--jumps-get-current)) - (point-marker)))) -(put 'evil--jump-hook 'permanent-local-hook t) - -(defun evil--jump-handle-buffer-crossing () - (let ((jump-command evil--jumps-jump-command)) - (setq evil--jumps-jump-command nil) - (dolist (frame (frame-list)) - (dolist (window (window-list frame)) - (let* ((struct (evil--jumps-get-current window)) - (previous-pos (evil-jumps-struct-previous-pos struct))) - (when previous-pos - (setf (evil-jumps-struct-previous-pos struct) nil) - (if (and - ;; `evil-jump-backward' and 'evil-jump-forward' need - ;; to be handled specially. When jumping backward - ;; multiple times, calling `evil-set-jump' is always - ;; wrong: If you jump back twice and we call - ;; `evil-set-jump' after the second time, we clear - ;; the forward jump list and `evil--jump-forward' - ;; won't work. - - ;; The first time you jump backward, setting a jump - ;; point is sometimes correct. But we don't do it - ;; here because this function is called after - ;; `evil--jump-backward' has updated our position in - ;; the jump list so, again, `evil-set-jump' would - ;; break `evil--jump-forward'. - (not jump-command) - (let ((previous-buffer (marker-buffer previous-pos))) - (and previous-buffer - (not (eq previous-buffer (window-buffer window)))))) - (evil-set-jump previous-pos) - (set-marker previous-pos nil)))))))) -(put 'evil--jump-handle-buffer-crossing 'permanent-local-hook t) - -(if (bound-and-true-p savehist-loaded) - (evil--jumps-savehist-load) - (add-hook 'savehist-mode-hook #'evil--jumps-savehist-load)) - -(defun evil--jumps-install-or-uninstall () - (if evil-local-mode - (progn - (add-hook 'pre-command-hook #'evil--jump-hook nil t) - (add-hook 'post-command-hook #'evil--jump-handle-buffer-crossing nil t) - (add-hook 'next-error-hook #'evil-set-jump nil t) - (add-hook 'window-configuration-change-hook #'evil--jumps-window-configuration-hook nil t)) - (remove-hook 'pre-command-hook #'evil--jump-hook t) - (remove-hook 'post-command-hook #'evil--jump-handle-buffer-crossing t) - (remove-hook 'next-error-hook #'evil-set-jump t) - (remove-hook 'window-configuration-change-hook #'evil--jumps-window-configuration-hook t))) - -(add-hook 'evil-local-mode-hook #'evil--jumps-install-or-uninstall) - -(provide 'evil-jumps) - -;;; evil-jumps.el ends here diff --git a/.config/emacs/lisp/evil/evil-keybindings.el b/.config/emacs/lisp/evil/evil-keybindings.el deleted file mode 100644 index 81a8b00..0000000 --- a/.config/emacs/lisp/evil/evil-keybindings.el +++ /dev/null @@ -1,124 +0,0 @@ -;;; evil-keybindings.el --- Add some Evil keybindings to other modules -*- lexical-binding: t -*- - -;; Author: Vegard Øye -;; Maintainer: Vegard Øye - -;; Version: 1.15.0 - -;; -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -;;; Commentary: - -;; This provides a set of keybindings for other emacs modes. This also includes -;; setting up the initial evil state of those other modes. - -;;; Code: - -(require 'evil-maps) -(require 'evil-core) -(require 'evil-macros) -(require 'evil-types) -(require 'evil-repeat) - -;; etags-select -;; FIXME: probably etags-select should be recomended in docs -(eval-after-load 'etags-select - '(progn - (define-key evil-motion-state-map "g]" 'etags-select-find-tag-at-point))) - -;;; Buffer-menu - -(evil-add-hjkl-bindings Buffer-menu-mode-map 'motion) - -;; dictionary.el - -(evil-add-hjkl-bindings dictionary-mode-map 'motion - "?" 'dictionary-help ; "h" - "C-o" 'dictionary-previous) ; "l" - -;;; Dired - -(eval-after-load 'dired - '(progn - ;; use the standard Dired bindings as a base - (defvar dired-mode-map) - (evil-make-overriding-map dired-mode-map 'normal) - (evil-add-hjkl-bindings dired-mode-map 'normal - "J" 'dired-goto-file ; "j" - "K" 'dired-do-kill-lines ; "k" - "r" 'dired-do-redisplay ; "l" - ;; ":d", ":v", ":s", ":e" - ";" (lookup-key dired-mode-map ":")))) - -;;; ERT - -(evil-add-hjkl-bindings ert-results-mode-map 'motion) - -;;; Info - -(evil-add-hjkl-bindings Info-mode-map 'motion - "0" 'evil-beginning-of-line - (kbd "\M-h") 'Info-help ; "h" - "\C-t" 'Info-history-back ; "l" - "\C-o" 'Info-history-back - " " 'Info-scroll-up - "\C-]" 'Info-follow-nearest-node - (kbd "DEL") 'Info-scroll-down) - -;;; Speedbar - -(evil-add-hjkl-bindings speedbar-mode-map 'motion - "h" 'backward-char - "j" 'speedbar-next - "k" 'speedbar-prev - "l" 'forward-char - "i" 'speedbar-item-info - "r" 'speedbar-refresh - "u" 'speedbar-up-directory - "o" 'speedbar-toggle-line-expansion - (kbd "RET") 'speedbar-edit-line) - -;; Ibuffer -(eval-after-load 'ibuffer - '(progn - (defvar ibuffer-mode-map) - (evil-make-overriding-map ibuffer-mode-map 'normal) - (evil-define-key 'normal ibuffer-mode-map - "j" 'evil-next-line - "k" 'evil-previous-line - (kbd "RET") 'ibuffer-visit-buffer))) - -;;; ag.el -(eval-after-load 'ag - '(progn - (defvar ag-mode-map) - (add-to-list 'evil-motion-state-modes 'ag-mode) - (evil-add-hjkl-bindings ag-mode-map 'motion))) - -;;; ELP - -(advice-add 'elp-results :after #'evil--set-motion-state) -(defun evil--set-motion-state (&rest _) - (evil-motion-state)) - -(provide 'evil-keybindings) - -;;; evil-keybindings.el ends here diff --git a/.config/emacs/lisp/evil/evil-macros.el b/.config/emacs/lisp/evil/evil-macros.el deleted file mode 100644 index 0f7fd59..0000000 --- a/.config/emacs/lisp/evil/evil-macros.el +++ /dev/null @@ -1,772 +0,0 @@ -;;; evil-macros.el --- Macros -*- lexical-binding: t -*- - -;; Author: Vegard Øye -;; Maintainer: Vegard Øye - -;; Version: 1.15.0 - -;; -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -;;; Code: - -(require 'evil-common) -(require 'evil-states) -(require 'evil-repeat) - -(declare-function evil-ex-p "evil-ex") -(declare-function evil-line-or-visual-line "evil-commands") - -;; set some error codes -(put 'beginning-of-line 'error-conditions '(beginning-of-line error)) -(put 'beginning-of-line 'error-message "Beginning of line") -(put 'end-of-line 'error-conditions '(end-of-line error)) -(put 'end-of-line 'error-message "End of line") -;; we don't want line boundaries to trigger the debugger -;; when `debug-on-error' is t -(cl-pushnew 'beginning-of-line debug-ignored-errors) -(cl-pushnew 'end-of-line debug-ignored-errors) - -(defun evil-motion-range (motion &optional count type) - "Execute a motion and return the buffer positions. -The return value is a list (BEG END TYPE)." - (let ((opoint (point)) - (omark (mark t)) - (obuffer (current-buffer)) - (evil-motion-marker (move-marker (make-marker) (point))) - range) - (evil-with-transient-mark-mode - (evil-narrow-to-field - (unwind-protect - (let ((current-prefix-arg count) - ;; Store type in global variable `evil-this-type'. - ;; If necessary, motions can change their type - ;; during execution by setting this variable. - (evil-this-type - (or type (evil-get-command-property motion :type 'exclusive)))) - (condition-case err - (let ((repeat-type (evil--repeat-type motion))) - (when (functionp repeat-type) (funcall repeat-type 'pre)) - (unless (with-local-quit - (setq range (call-interactively motion)) - t) - (evil-repeat-abort) - (setq quit-flag t)) - (when (functionp repeat-type) (funcall repeat-type 'post))) - (error - (evil-repeat-abort) - ;; some operators depend on succeeding motions, in - ;; particular for `evil-forward-char' (e.g., used by - ;; `evil-substitute'), therefore we let end-of-line - ;; and end-of-buffer pass - (if (memq (car err) '(end-of-line end-of-buffer)) - (message (error-message-string err)) - (signal (car err) (cdr err))))) - (cond - ;; the motion returned a range - ((evil-range-p range)) - ;; the motion made a Visual selection - ((evil-visual-state-p) - (setq range (evil-visual-range))) - ;; the motion made an active region - ((region-active-p) - (setq range (evil-range (region-beginning) (region-end) - evil-this-type))) - ;; default: range from previous position to current - (t (setq range (evil-expand-range - (evil-normalize evil-motion-marker - (point) - evil-this-type))))) - (unless (or (null type) (eq (evil-type range) type)) - (evil-set-type range type) - (evil-expand-range range)) - (evil-set-range-properties range nil) - range) - ;; restore point and mark like `save-excursion', - ;; but only if the motion hasn't disabled the operator - (unless evil-inhibit-operator - (set-buffer obuffer) - (evil-move-mark omark) - (goto-char opoint)) - ;; delete marker so it doesn't slow down editing - (move-marker evil-motion-marker nil)))))) - -(defmacro evil-define-motion (motion args &rest body) - "Define a motion command MOTION. -ARGS is a list of arguments. Motions can have any number of -arguments, but the first (if any) has the predefined meaning of -count. BODY must execute the motion by moving point. - -Optional keyword arguments are: -- `:type' - determines how the motion works after an operator (one of - `inclusive', `line', `block' and `exclusive', or a self-defined - motion type) -- `:jump' - if non-nil, the previous position is stored in the jump - list, so that it can be restored with \ -\\\\[evil-jump-backward] - -\(fn MOTION (COUNT ARGS...) DOC [[KEY VALUE]...] BODY...)" - (declare (indent defun) - (doc-string 3) - (debug (&define name lambda-list - [&optional stringp] - [&rest keywordp sexp] - [&optional ("interactive" [&rest form])] - def-body))) - (let (arg doc interactive key keys) - (when args - (setq args `(&optional ,@(delq '&optional args)) - ;; the count is either numerical or nil - interactive '(""))) - ;; collect docstring - (when (and (> (length body) 1) - (or (eq (car-safe (car body)) #'format) - (stringp (car body)))) - (setq doc (pop body))) - ;; collect keywords - (setq keys (plist-put keys :repeat 'motion)) - (while (keywordp (car body)) - (setq key (pop body) - arg (pop body) - keys (plist-put keys key arg))) - ;; collect `interactive' specification - (when (eq (car-safe (car body)) 'interactive) - (setq interactive (cdr (pop body)))) - ;; macro expansion - `(progn - ;; refresh echo area in Eldoc mode - (when ',motion - (eval-after-load 'eldoc - '(and (fboundp 'eldoc-add-command) - (eldoc-add-command ',motion)))) - (evil-define-command ,motion (,@args) - ,@(when doc `(,doc)) ; avoid nil before `interactive' - ,@keys - :keep-visual t - (interactive ,@interactive) - ,@body)))) - -(defmacro evil-narrow-to-line (&rest body) - "Narrow BODY to the current line. -BODY will signal `beginning-of-line' or `end-of-line' upon reaching -the beginning or end of the current line." - (declare (indent defun) (debug t)) - `(cl-destructuring-bind (beg end &rest) (evil-line-expand (point) (point)) - (when (save-excursion (goto-char end) (bolp)) - (setq end (max beg (1- end)))) - ;; Do not include the newline in Normal state - (or evil-move-beyond-eol - (evil-visual-state-p) (evil-operator-state-p) - (setq end (max beg (1- end)))) - (evil-with-restriction beg end - (condition-case err - (progn ,@body) - (beginning-of-buffer - (signal (if (= (point-min) beg) 'beginning-of-line (car err)) - (cdr err))) - (end-of-buffer - (signal (if (= (point-max) end) 'end-of-line (car err)) - (cdr err))))))) - -(defun evil-eobp (&optional pos) - "Whether point is at end-of-buffer with regard to end-of-line." - (save-excursion - (when pos (goto-char pos)) - (cond - ((eobp)) - ;; the rest only pertains to Normal state - ((not (evil-normal-state-p)) nil) - ;; at the end of the last line - ((eolp) - (forward-char) - (eobp)) - ;; at the last character of the last line - (t - (forward-char) - (cond - ((eobp)) - ((eolp) - (forward-char) - (eobp))))))) - -(defun evil-move-beginning (count forward &optional backward) - "Move to the beginning of the COUNT next object. -If COUNT is negative, move to the COUNT previous object. -FORWARD is a function which moves to the end of the object, and -BACKWARD is a function which moves to the beginning. -If one is unspecified, the other is used with a negative argument." - (let* ((count (or count 1)) - (backward (or backward - #'(lambda (count) - (funcall forward (- count))))) - (forward (or forward - #'(lambda (count) - (funcall backward (- count))))) - (opoint (point))) - (cond - ((< count 0) - (when (bobp) - (signal 'beginning-of-buffer nil)) - (unwind-protect - (evil-motion-loop (nil count count) - (funcall backward 1)) - (unless (zerop count) - (goto-char (point-min))))) - ((> count 0) - (when (evil-eobp) - (signal 'end-of-buffer nil)) - ;; Do we need to move past the current object? - (when (<= (save-excursion - (funcall forward 1) - (funcall backward 1) - (point)) - opoint) - (setq count (1+ count))) - (unwind-protect - (evil-motion-loop (nil count count) - (funcall forward 1)) - (if (zerop count) - ;; go back to beginning of object - (funcall backward 1) - (goto-char (point-max))))) - (t count)))) - -(defun evil-move-end (count forward &optional backward inclusive) - "Move to the end of the COUNT next object. -If COUNT is negative, move to the COUNT previous object. -FORWARD is a function which moves to the end of the object, and -BACKWARD is a function which moves to the beginning. -If one is unspecified, the other is used with a negative argument. -If INCLUSIVE is non-nil, then point is placed at the last character -of the object; otherwise it is placed at the end of the object." - (let* ((count (or count 1)) - (backward (or backward - #'(lambda (count) - (funcall forward (- count))))) - (forward (or forward - #'(lambda (count) - (funcall backward (- count))))) - (opoint (point))) - (cond - ((< count 0) - (when (bobp) - (signal 'beginning-of-buffer nil)) - ;; Do we need to move past the current object? - (when (>= (save-excursion - (funcall backward 1) - (funcall forward 1) - (point)) - (if inclusive - (1+ opoint) - opoint)) - (setq count (1- count))) - (unwind-protect - (evil-motion-loop (nil count count) - (funcall backward 1)) - (if (not (zerop count)) - (goto-char (point-min)) - ;; go to end of object - (funcall forward 1) - (when inclusive - (unless (bobp) (backward-char))) - (when (or (evil-normal-state-p) - (evil-motion-state-p)) - (evil-adjust-cursor))))) - ((> count 0) - (when (evil-eobp) - (signal 'end-of-buffer nil)) - (when inclusive - (forward-char)) - (unwind-protect - (evil-motion-loop (nil count count) - (funcall forward 1)) - (if (not (zerop count)) - (goto-char (point-max)) - (when inclusive - (unless (bobp) (backward-char))) - (when (or (evil-normal-state-p) - (evil-motion-state-p)) - (evil-adjust-cursor))))) - (t count)))) - -(defun evil-text-object-make-linewise (range) - "Turn the text object selection RANGE to linewise. -The selection is adjusted in a sensible way so that the selected -lines match the user intent. In particular, whitespace-only parts -at the first and last lines are omitted. This function returns -the new range." - ;; Bug #607 - ;; If new type is linewise and the selection of the - ;; first line consists of whitespace only, the - ;; beginning is moved to the start of the next line. If - ;; the selections of the last line consists of - ;; whitespace only, the end is moved to the end of the - ;; previous line. - (if (eq (evil-type range) 'line) - range - (let ((expanded (plist-get (evil-range-properties range) :expanded)) - (newrange (evil-expand-range range t))) - (save-excursion - ;; skip whitespace at the beginning - (goto-char (evil-range-beginning newrange)) - (skip-chars-forward " \t") - (when (and (not (bolp)) (eolp)) - (evil-set-range-beginning newrange (1+ (point)))) - ;; skip whitepsace at the end - (goto-char (evil-range-end newrange)) - (skip-chars-backward " \t") - (when (and (not (eolp)) (bolp)) - (evil-set-range-end newrange (1- (point)))) - ;; only modify range if result is not empty - (if (> (evil-range-beginning newrange) - (evil-range-end newrange)) - range - (unless expanded - (evil-contract-range newrange)) - newrange))))) - -(defmacro evil-define-text-object (object args &rest body) - "Define a text object command OBJECT. -BODY should return a range (BEG END) to the right of point -if COUNT is positive, and to the left of it if negative. - -Optional keyword arguments: -- `:type' - determines how the range applies after an operator - (`inclusive', `line', `block', and `exclusive', or a self-defined - motion type). -- `:extend-selection' - if non-nil (default), the text object always - enlarges the current selection. Otherwise, it replaces the current - selection. - -\(fn OBJECT (COUNT) DOC [[KEY VALUE]...] BODY...)" - (declare (indent defun) - (doc-string 3) - (debug (&define name lambda-list - [&optional stringp] - [&rest keywordp sexp] - def-body))) - (let* ((args (delq '&optional args)) - (count (or (pop args) 'count)) - (args (when args `(&optional ,@args))) - (interactive '(interactive "")) - doc keys) - ;; collect docstring - (when (stringp (car body)) - (setq doc (pop body))) - ;; collect keywords - (setq keys (plist-put keys :extend-selection t)) - (while (keywordp (car body)) - (setq keys (plist-put keys (pop body) (pop body)))) - ;; interactive - (when (eq (car-safe (car body)) 'interactive) - (setq interactive (pop body))) - ;; macro expansion - `(evil-define-motion ,object (,count ,@args) - ,@(when doc `(,doc)) - ,@keys - ,interactive - (setq ,count (or ,count 1)) - (when (/= ,count 0) - ;; FIXME: These let-bindings shadow variables in args - (let ((type (evil-type ',object evil-visual-char)) - (extend (and (evil-visual-state-p) - (evil-get-command-property - ',object :extend-selection - ',(plist-get keys :extend-selection)))) - (dir evil-visual-direction) - mark point range selection) - (cond - ;; Visual state: extend the current selection - ((and (evil-visual-state-p) - (called-interactively-p 'any)) - ;; if we are at the beginning of the Visual selection, - ;; go to the left (negative COUNT); if at the end, - ;; go to the right (positive COUNT) - (setq dir evil-visual-direction - ,count (* ,count dir)) - (setq range (progn ,@body)) - (when (evil-range-p range) - (setq range (evil-expand-range range)) - (evil-set-type range (evil-type range type)) - (setq range (evil-contract-range range)) - ;; the beginning is mark and the end is point - ;; unless the selection goes the other way - (setq mark (evil-range-beginning range) - point (evil-range-end range) - type (evil-type - (if evil-text-object-change-visual-type - range - (evil-visual-range)))) - (when (and (eq type 'line) - (not (eq type (evil-type range)))) - (let ((newrange (evil-text-object-make-linewise range))) - (setq mark (evil-range-beginning newrange) - point (evil-range-end newrange)))) - (when (< dir 0) - (evil-swap mark point)) - ;; select the union - (evil-visual-make-selection mark point type))) - ;; not Visual state: return a pair of buffer positions - (t - (setq range (progn ,@body)) - (unless (evil-range-p range) - (setq ,count (- ,count) - range (progn ,@body))) - (when (evil-range-p range) - (setq selection (evil-range (point) (point) type)) - (if extend - (setq range (evil-range-union range selection)) - (evil-set-type range (evil-type range type))) - ;; possibly convert to linewise - (when (eq evil-this-type-modified 'line) - (setq range (evil-text-object-make-linewise range))) - (evil-set-range-properties range nil) - range)))))))) - -(defmacro evil-define-operator (operator args &rest body) - "Define an operator command OPERATOR. -The operator acts on the range of characters BEG through -END. BODY must execute the operator by potentially manipulating -the buffer contents, or otherwise causing side effects to happen. - -Optional keyword arguments are: -- `:type' - force the input range to be of a given type (`inclusive', - `line', `block', and `exclusive', or a self-defined motion type). -- `:motion' - use a predetermined motion instead of waiting for one - from the keyboard. This does not affect the behavior in visual - state, where selection boundaries are always used. -- `:repeat' - if non-nil (default), then \ - \\\\[evil-repeat] will repeat the - operator. -- `:move-point' - if non-nil (default), the cursor will be moved to - the beginning of the range before the body executes -- `:keep-visual' - if non-nil, the selection is not disabled when the - operator is executed in visual state. By default, visual state is - exited automatically. -- `:restore-point' - if non-nil, point is restored when the - operator is executed from ex. - -\(fn OPERATOR (BEG END ARGS...) DOC [[KEY VALUE]...] BODY...)" - (declare (indent defun) - (doc-string 3) - (debug (&define name lambda-list - [&optional stringp] - [&rest keywordp sexp] - [&optional ("interactive" [&rest form])] - def-body))) - (let* ((args (delq '&optional args)) - (interactive (if (> (length args) 2) '("") '(""))) - (args (if (> (length args) 2) - `(,(nth 0 args) ,(nth 1 args) - &optional ,@(nthcdr 2 args)) - args)) - (end-marker (make-symbol "end-marker")) - arg doc key keys visual) - ;; collect docstring - (when (and (> (length body) 1) - (or (eq (car-safe (car-safe body)) 'format) - (stringp (car-safe body)))) - (setq doc (pop body))) - ;; collect keywords - (setq keys (plist-put keys :move-point t)) - (while (keywordp (car-safe body)) - (setq key (pop body) - arg (pop body)) - (cond - ((eq key :keep-visual) - (setq visual arg)) - (t - (setq keys (plist-put keys key arg))))) - ;; collect `interactive' specification - (when (eq (car-safe (car-safe body)) 'interactive) - (setq interactive (cdr-safe (pop body)))) - ;; transform extended interactive specs - (setq interactive (apply #'evil-interactive-form interactive)) - (setq keys (evil-concat-plists keys (cdr-safe interactive)) - interactive (car-safe interactive)) - ;; macro expansion - `(evil-define-command ,operator ,args - ,@(when doc `(,doc)) - ,@keys - :keep-visual t - :suppress-operator t - (interactive - (let* ((props (evil-command-properties ',operator)) - (evil-operator-range-motion - (let ((p (plist-member props :motion))) - ;; :motion nil is equivalent to :motion undefined - (when p (or (cadr p) #'undefined)))) - (evil-operator-range-type (plist-get props :type)) - evil-operator-range-beginning evil-operator-range-end - evil-inhibit-operator) - (setq evil-inhibit-operator-value nil - evil-this-operator this-command - evil-operator-start-col (current-column)) - (prog1 ,interactive - (setq evil-inhibit-operator-value evil-inhibit-operator) - (if ,visual - (when (evil-visual-state-p) (evil-visual-expand-region)) - (setq deactivate-mark t)) - (cond - ((evil-visual-state-p) - (evil-visual-rotate 'upper-left)) - ((plist-get props :move-point) - (when evil-operator-range-beginning - (goto-char evil-operator-range-beginning))))))) - (unwind-protect - (let ((evil-inhibit-operator evil-inhibit-operator-value) - (,end-marker (make-marker))) - (set-marker ,end-marker ,(cadr args)) - (unless (and evil-inhibit-operator - (called-interactively-p 'any)) - ,@body) - (evil-set-marker ?\[ (or ,(car args) (point-max))) - (evil-set-marker ?\] (max (or ,(car args) (point-max)) - (1- (or (marker-position ,end-marker) (point-max))))) - (set-marker ,end-marker nil)) - (setq evil-inhibit-operator-value nil))))) - -;; this is used in the `interactive' specification of an operator command -(defun evil-operator-range (&optional return-type) - "Read a motion from the keyboard and return its buffer positions. -The return value is a list (BEG END), or (BEG END TYPE) if -RETURN-TYPE is non-nil." - (let ((motion (or evil-operator-range-motion - (when evil-called-from-ex-p 'evil-line))) - (type evil-operator-range-type) - range count) - (setq evil-this-type-modified nil) - (cond - ;; Ex command - ((and evil-called-from-ex-p evil-ex-range) - (setq range evil-ex-range)) - ;; Visual selection - ((and (not evil-called-from-ex-p) (evil-visual-state-p)) - (setq range (evil-visual-range))) - ;; active region - ((and (not evil-called-from-ex-p) (region-active-p)) - (setq range (evil-range (region-beginning) (region-end) - (or evil-this-type 'exclusive)))) - ;; motion - (t - (evil-save-echo-area - (evil-save-state - (unless motion - ;; Make linewise operator shortcuts. E.g., "d" yields the - ;; shortcut "dd", and "g?" yields shortcuts "g??" and "g?g?". - (let ((keys (nth 2 (evil-extract-count (this-command-keys))))) - (evil-change-state 'operator) - (cl-loop for keys on (listify-key-sequence keys) do - (define-key evil-operator-shortcut-map - (vconcat keys) #'evil-line-or-visual-line))) - ;; read motion from keyboard - (let ((command (evil-read-motion motion))) - (setq motion (car command) - count (cadr command) - type (or type (nth 2 command))))) - (cond - ((eq motion #'undefined) - (setq range (list nil nil) - motion nil)) - ((or (null motion) ; keyboard-quit - (evil-get-command-property motion :suppress-operator)) - (evil-repeat-abort) - (setq quit-flag t - range (evil-range (point) (point)) ; zero-len range - motion nil)) - (evil-repeat-count - (setq count evil-repeat-count - ;; only the first operator's count is overwritten - evil-repeat-count nil)) - ((or count current-prefix-arg) - ;; multiply operator count and motion count together - (setq count - (* (prefix-numeric-value count) - (prefix-numeric-value current-prefix-arg))))) - (when motion - (let ((evil-state 'operator) - mark-active) - ;; calculate motion range - (setq range (evil-motion-range motion count type)))) - ;; update global variables - (setq evil-this-motion motion - evil-this-motion-count count - type (evil-type range type) - evil-this-type type))))) - (unless (or (null type) (eq (evil-type range) type)) - (evil-contract-range range) - (evil-set-range-type range type) - (evil-expand-range range)) - (setq evil-operator-range-beginning (evil-range-beginning range) - evil-operator-range-end (evil-range-end range) - evil-operator-range-type (evil-type range)) - (setcdr (cdr range) - (when return-type (list (evil-type range)))) - range)) - -(defmacro evil-define-type (type doc &rest body) - "Define type TYPE. -DOC is a general description and shows up in all docstrings. - -Optional keyword arguments: -- `:expand' - expansion function. This function should accept two - positions in the current buffer, BEG and END,and return a pair of - expanded buffer positions. -- `:contract' - the opposite of `:expand'. Optional. -- `:one-to-one' - non-nil if expansion is one-to-one. This means that - `:expand' followed by `:contract' always return the original range. -- `:normalize' - normalization function. This function should accept - two unexpanded positions and adjust them before expansion. May be - used to deal with buffer boundaries. -- `:string' - description function. Takes two buffer positions and - returns a human-readable string. For example \"2 lines\" - -If further keywords and functions are specified, they are assumed to -be transformations on buffer positions, like `:expand' and `:contract'. - -\(fn TYPE DOC [[KEY FUNC]...])" - (declare (indent defun) - (doc-string 2) - (debug (&define name - [&optional stringp] - [&rest [keywordp function-form]]))) - (let ((plist (list :one-to-one t)) ; standard values - args defun-forms func key name string sym val) - ;; keywords - (while (keywordp (car-safe body)) - (setq key (pop body) - val (pop body)) - (if (plist-member plist key) ; not a function - (setq plist (plist-put plist key val)) - (setq func val - sym (intern (replace-regexp-in-string - "^:" "" (symbol-name key))) - name (intern (format "evil-%s-%s" type sym)) - args (car (cdr-safe func)) - string (cadr (cdr-safe func)) - string (if (stringp string) - (format "%s\n\n" string) "") - plist (plist-put plist key `',name)) - (push - (cond - ((eq key :string) - `(defun ,name (beg end &rest properties) - ,(format "Return size of %s from BEG to END \ -with PROPERTIES.\n\n%s%s" type string doc) - (let ((type ',type) - plist range) - (when (and beg end) - (evil-sort beg end) - (save-excursion - (unless (plist-get properties :expanded) - (setq range (apply #'evil-expand - beg end type properties) - beg (evil-range-beginning range) - end (evil-range-end range) - type (evil-type range type) - plist (evil-range-properties range)) - (setq properties - (evil-concat-plists properties plist))) - (or (apply #',func beg end - (when ,(> (length args) 2) - properties)) - "")))))) - (t - `(defun ,name (beg end &rest properties) - ,(format "Perform %s transformation on %s from BEG to END \ -with PROPERTIES.\n\n%s%s" sym type string doc) - (let ((type ',type) - plist range) - (when (and beg end) - (evil-sort beg end) - (save-excursion - (when (memq ,key '(:expand :contract)) - (setq properties - (plist-put properties - :expanded ,(eq key :expand)))) - (setq range (or (apply #',func beg end - (when ,(> (length args) 2) - properties)) - (apply #'evil-range - beg end type properties)) - beg (evil-range-beginning range) - end (evil-range-end range) - type (evil-type range type) - plist (evil-range-properties range)) - (setq properties - (evil-concat-plists properties plist)) - (apply #'evil-range beg end type properties))))))) - defun-forms))) - ;; :one-to-one requires both or neither of :expand and :contract - (when (plist-get plist :expand) - (setq plist (plist-put plist :one-to-one - (and (plist-get plist :contract) - (plist-get plist :one-to-one))))) - `(progn - (evil--add-to-alist evil-type-properties ',type (list ,@plist)) - ,@defun-forms - ',type))) - -(defmacro evil-define-interactive-code (code &rest body) - "Define an interactive code. -PROMPT, if given, is the remainder of the interactive string -up to the next newline. Command properties may be specified -via KEY-VALUE pairs. BODY should evaluate to a list of values. - -\(fn CODE (PROMPT) [[KEY VALUE]...] BODY...)" - (declare (indent defun)) - (let* ((args (and (> (length body) 1) (listp (car body)) - (pop body))) - (doc (when (stringp (car body)) (pop body))) - (properties - (cl-loop while (keywordp (car body)) - collect (pop body) collect (pop body))) - (func (if args - `(lambda ,args - ,@(when doc `(,doc)) - ,@body) - `',(macroexp-progn body)))) - `(eval-and-compile - (evil--add-to-alist - evil-interactive-alist ,code (cons ,func ',properties)) - ,code))) - -;;; Highlighting - -(when (fboundp 'font-lock-add-keywords) - (font-lock-add-keywords - 'emacs-lisp-mode - ;; Match all `evil-define-' forms except `evil-define-key'. - ;; (In the interests of speed, this expression is incomplete - ;; and does not match all three-letter words.) - '(("(\\(evil-\\(?:ex-\\)?define-\ -\\(?:[^ k][^ e][^ y]\\|[-[:word:]]\\{4,\\}\\)\\)\ -\\>[ \f\t\n\r\v]*\\(\\(?:\\sw\\|\\s_\\)+\\)?" - (1 'font-lock-keyword-face) - (2 'font-lock-function-name-face nil t)) - ("(\\(evil-\\(?:delay\\|narrow\\|signal\\|save\\|with\\(?:out\\)?\\)\ -\\(?:-[-[:word:]]+\\)?\\)\\>\[ \f\t\n\r\v]+" - 1 'font-lock-keyword-face) - ("(\\(evil-\\(?:[-[:word:]]\\)*loop\\)\\>[ \f\t\n\r\v]+" - 1 'font-lock-keyword-face)))) - -(provide 'evil-macros) - -;;; evil-macros.el ends here diff --git a/.config/emacs/lisp/evil/evil-maps.el b/.config/emacs/lisp/evil/evil-maps.el deleted file mode 100644 index 6778023..0000000 --- a/.config/emacs/lisp/evil/evil-maps.el +++ /dev/null @@ -1,686 +0,0 @@ -;;; evil-maps.el --- Default keymaps -*- lexical-binding: t -*- - -;; Author: Vegard Øye -;; Maintainer: Vegard Øye - -;; Version: 1.15.0 - -;; -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -;;; Code: - -(require 'evil-states) -(require 'evil-ex) -(require 'evil-commands) -(require 'evil-command-window) -(require 'evil-common) - -;;; Normal state - -(define-key evil-normal-state-map "a" 'evil-append) -(define-key evil-normal-state-map "A" 'evil-append-line) -(define-key evil-normal-state-map "c" 'evil-change) -(define-key evil-normal-state-map "C" 'evil-change-line) -(define-key evil-normal-state-map "d" 'evil-delete) -(define-key evil-normal-state-map "D" 'evil-delete-line) -(define-key evil-normal-state-map "i" 'evil-insert) -(define-key evil-normal-state-map (kbd "") 'evil-insert) -(define-key evil-normal-state-map (kbd "") 'evil-insert) -(define-key evil-normal-state-map "I" 'evil-insert-line) -(define-key evil-normal-state-map "J" 'evil-join) -(define-key evil-normal-state-map "m" 'evil-set-marker) -(define-key evil-normal-state-map "o" 'evil-open-below) -(define-key evil-normal-state-map "O" 'evil-open-above) -(define-key evil-normal-state-map "p" 'evil-paste-after) -(define-key evil-normal-state-map "P" 'evil-paste-before) -(define-key evil-normal-state-map "q" 'evil-record-macro) -(define-key evil-normal-state-map "Q" 'evil-execute-last-recorded-macro) -(define-key evil-normal-state-map "r" 'evil-replace) -(define-key evil-normal-state-map "R" 'evil-enter-replace-state) -(define-key evil-normal-state-map "s" 'evil-substitute) -(define-key evil-normal-state-map "S" 'evil-change-whole-line) -(define-key evil-normal-state-map "x" 'evil-delete-char) -(define-key evil-normal-state-map "X" 'evil-delete-backward-char) -(define-key evil-normal-state-map [deletechar] 'evil-delete-char) -(define-key evil-normal-state-map "y" 'evil-yank) -(define-key evil-normal-state-map "Y" 'evil-yank-line) -(define-key evil-normal-state-map "&" 'evil-ex-repeat-substitute) -(define-key evil-normal-state-map "g&" 'evil-ex-repeat-global-substitute) -(define-key evil-normal-state-map "g8" 'what-cursor-position) -(define-key evil-normal-state-map "ga" 'what-cursor-position) -(define-key evil-normal-state-map "gi" 'evil-insert-resume) -(define-key evil-normal-state-map "gI" 'evil-insert-0-line) -(define-key evil-normal-state-map "gJ" 'evil-join-whitespace) -(define-key evil-normal-state-map "gp" 'evil-paste-after-cursor-after) -(define-key evil-normal-state-map "gP" 'evil-paste-before-cursor-after) -(define-key evil-normal-state-map "gq" 'evil-fill-and-move) -(define-key evil-normal-state-map "gw" 'evil-fill) -(define-key evil-normal-state-map "gu" 'evil-downcase) -(define-key evil-normal-state-map "gU" 'evil-upcase) -(define-key evil-normal-state-map "gf" 'find-file-at-point) -(define-key evil-normal-state-map "]f" 'find-file-at-point) -(define-key evil-normal-state-map "[f" 'find-file-at-point) -(define-key evil-normal-state-map "gF" 'evil-find-file-at-point-with-line) -(define-key evil-normal-state-map "]F" 'evil-find-file-at-point-with-line) -(define-key evil-normal-state-map "[F" 'evil-find-file-at-point-with-line) -(define-key evil-normal-state-map "gx" 'browse-url-at-point) -(define-key evil-normal-state-map "g?" 'evil-rot13) -(define-key evil-normal-state-map "g~" 'evil-invert-case) -(define-key evil-normal-state-map "zo" 'evil-open-fold) -(define-key evil-normal-state-map "zO" 'evil-open-fold-rec) -(define-key evil-normal-state-map "zc" 'evil-close-fold) -(define-key evil-normal-state-map "za" 'evil-toggle-fold) -(define-key evil-normal-state-map "zr" 'evil-open-folds) -(define-key evil-normal-state-map "zm" 'evil-close-folds) -(define-key evil-normal-state-map "z=" 'ispell-word) -(define-key evil-normal-state-map "\C-n" 'evil-paste-pop-next) -(define-key evil-normal-state-map "\C-p" 'evil-paste-pop) -(define-key evil-normal-state-map "\C-t" 'pop-tag-mark) -(define-key evil-normal-state-map (kbd "C-.") 'evil-repeat-pop) -(define-key evil-normal-state-map (kbd "M-.") 'evil-repeat-pop-next) -(define-key evil-normal-state-map "." 'evil-repeat) -(define-key evil-normal-state-map "@" 'evil-execute-macro) -(define-key evil-normal-state-map "\"" 'evil-use-register) -(define-key evil-normal-state-map "~" 'evil-invert-char) -(define-key evil-normal-state-map "=" 'evil-indent) -(define-key evil-normal-state-map "<" 'evil-shift-left) -(define-key evil-normal-state-map ">" 'evil-shift-right) -(define-key evil-normal-state-map "ZZ" 'evil-save-modified-and-close) -(define-key evil-normal-state-map "ZQ" 'evil-quit) -(define-key evil-normal-state-map (kbd "DEL") 'evil-backward-char) -(define-key evil-normal-state-map [escape] 'evil-force-normal-state) -(define-key evil-normal-state-map [remap cua-paste-pop] 'evil-paste-pop) -(define-key evil-normal-state-map [remap yank-pop] 'evil-paste-pop) - -;; go to last change -(define-key evil-normal-state-map "g;" 'evil-goto-last-change) -(define-key evil-normal-state-map "g," 'evil-goto-last-change-reverse) - -;; undo -(define-key evil-normal-state-map "u" 'evil-undo) -(define-key evil-normal-state-map "\C-r" 'evil-redo) - -;; window commands -(define-prefix-command 'evil-window-map) -(define-key evil-window-map "b" 'evil-window-bottom-right) -(define-key evil-window-map "c" 'evil-window-delete) -(define-key evil-window-map "f" 'ffap-other-window) -(define-key evil-window-map "h" 'evil-window-left) -(define-key evil-window-map "H" 'evil-window-move-far-left) -(define-key evil-window-map "j" 'evil-window-down) -(define-key evil-window-map "J" 'evil-window-move-very-bottom) -(define-key evil-window-map "k" 'evil-window-up) -(define-key evil-window-map "K" 'evil-window-move-very-top) -(define-key evil-window-map "l" 'evil-window-right) -(define-key evil-window-map "L" 'evil-window-move-far-right) -(define-key evil-window-map "n" 'evil-window-new) -(define-key evil-window-map "o" 'delete-other-windows) -(define-key evil-window-map "p" 'evil-window-mru) -(define-key evil-window-map "q" 'evil-quit) -(define-key evil-window-map "r" 'evil-window-rotate-downwards) -(define-key evil-window-map "R" 'evil-window-rotate-upwards) -(define-key evil-window-map "s" 'evil-window-split) -(define-key evil-window-map "S" 'evil-window-split) -(define-key evil-window-map "t" 'evil-window-top-left) -(when (featurep 'tab-bar) - (define-key evil-window-map "T" 'tab-window-detach)) -(define-key evil-window-map "v" 'evil-window-vsplit) -(define-key evil-window-map "w" 'evil-window-next) -(define-key evil-window-map "W" 'evil-window-prev) -(define-key evil-window-map "x" 'evil-window-exchange) -(define-key evil-window-map "+" 'evil-window-increase-height) -(define-key evil-window-map "-" 'evil-window-decrease-height) -(define-key evil-window-map ":" 'evil-ex) -(define-key evil-window-map "_" 'evil-window-set-height) -(define-key evil-window-map "<" 'evil-window-decrease-width) -(define-key evil-window-map ">" 'evil-window-increase-width) -(define-key evil-window-map "=" 'balance-windows) -(define-key evil-window-map (kbd "C-=") 'balance-windows) -(define-key evil-window-map "|" 'evil-window-set-width) -(define-key evil-window-map [down] 'evil-window-down) -(define-key evil-window-map [up] 'evil-window-up) -(define-key evil-window-map [left] 'evil-window-left) -(define-key evil-window-map [right] 'evil-window-right) -(define-key evil-window-map "\C-b" 'evil-window-bottom-right) -(define-key evil-window-map "\C-c" 'evil-window-delete) -(define-key evil-window-map "\C-f" 'ffap-other-window) -(define-key evil-window-map "\C-h" 'evil-window-left) -(define-key evil-window-map (kbd "C-S-h") 'evil-window-move-far-left) -(define-key evil-window-map "\C-j" 'evil-window-down) -(define-key evil-window-map (kbd "C-S-j") 'evil-window-move-very-bottom) -(define-key evil-window-map "\C-k" 'evil-window-up) -(define-key evil-window-map (kbd "C-S-k") 'evil-window-move-very-top) -(define-key evil-window-map "\C-l" 'evil-window-right) -(define-key evil-window-map (kbd "C-S-l") 'evil-window-move-far-right) -(define-key evil-window-map "\C-n" 'evil-window-new) -(define-key evil-window-map "\C-o" 'delete-other-windows) -(define-key evil-window-map "\C-p" 'evil-window-mru) -(define-key evil-window-map "\C-q" 'evil-quit) -(define-key evil-window-map "\C-r" 'evil-window-rotate-downwards) -(define-key evil-window-map (kbd "C-S-r") 'evil-window-rotate-upwards) -(define-key evil-window-map "\C-s" 'evil-window-split) -(define-key evil-window-map (kbd "C-S-s") 'evil-window-split) -(define-key evil-window-map "\C-t" 'evil-window-top-left) -(define-key evil-window-map "\C-v" 'evil-window-vsplit) -(define-key evil-window-map "\C-w" 'evil-window-next) -(define-key evil-window-map (kbd "C-S-W") 'evil-window-prev) -(define-key evil-window-map "\C-x" 'evil-window-exchange) -(define-key evil-window-map "\C-_" 'evil-window-set-height) -(define-key evil-window-map [C-down] 'evil-window-down) -(define-key evil-window-map [C-up] 'evil-window-up) -(define-key evil-window-map [C-left] 'evil-window-left) -(define-key evil-window-map [C-right] 'evil-window-right) -(define-key evil-window-map "0" 'evil-window-digit-argument) -(define-key evil-window-map "1" 'evil-window-digit-argument) -(define-key evil-window-map "2" 'evil-window-digit-argument) -(define-key evil-window-map "3" 'evil-window-digit-argument) -(define-key evil-window-map "4" 'evil-window-digit-argument) -(define-key evil-window-map "5" 'evil-window-digit-argument) -(define-key evil-window-map "6" 'evil-window-digit-argument) -(define-key evil-window-map "7" 'evil-window-digit-argument) -(define-key evil-window-map "8" 'evil-window-digit-argument) -(define-key evil-window-map "9" 'evil-window-digit-argument) - -(when (featurep 'tab-bar) - (define-key evil-motion-state-map "gt" 'evil-tab-next) - (define-key evil-window-map "gt" 'evil-tab-next) - (define-key evil-motion-state-map "gT" 'tab-bar-switch-to-prev-tab) - (define-key evil-window-map "gT" 'tab-bar-switch-to-prev-tab)) - -;;; Motion state - -;; "0" is a special command when called first -(define-key evil-motion-state-map "0" 'evil-beginning-of-line) -(define-key evil-motion-state-map "1" 'digit-argument) -(define-key evil-motion-state-map "2" 'digit-argument) -(define-key evil-motion-state-map "3" 'digit-argument) -(define-key evil-motion-state-map "4" 'digit-argument) -(define-key evil-motion-state-map "5" 'digit-argument) -(define-key evil-motion-state-map "6" 'digit-argument) -(define-key evil-motion-state-map "7" 'digit-argument) -(define-key evil-motion-state-map "8" 'digit-argument) -(define-key evil-motion-state-map "9" 'digit-argument) -(define-key evil-motion-state-map "b" 'evil-backward-word-begin) -(define-key evil-motion-state-map "B" 'evil-backward-WORD-begin) -(define-key evil-motion-state-map "e" 'evil-forward-word-end) -(define-key evil-motion-state-map "E" 'evil-forward-WORD-end) -(define-key evil-motion-state-map "f" 'evil-find-char) -(define-key evil-motion-state-map "F" 'evil-find-char-backward) -(define-key evil-motion-state-map "G" 'evil-goto-line) -(define-key evil-motion-state-map "h" 'evil-backward-char) -(define-key evil-motion-state-map "H" 'evil-window-top) -(define-key evil-motion-state-map "j" 'evil-next-line) -(define-key evil-motion-state-map "k" 'evil-previous-line) -(define-key evil-motion-state-map "l" 'evil-forward-char) -(define-key evil-motion-state-map " " 'evil-forward-char) -(define-key evil-motion-state-map "K" 'evil-lookup) -(define-key evil-motion-state-map "L" 'evil-window-bottom) -(define-key evil-motion-state-map "M" 'evil-window-middle) -(define-key evil-motion-state-map "n" 'evil-search-next) -(define-key evil-motion-state-map "N" 'evil-search-previous) -(define-key evil-motion-state-map "t" 'evil-find-char-to) -(define-key evil-motion-state-map "T" 'evil-find-char-to-backward) -(define-key evil-motion-state-map "w" 'evil-forward-word-begin) -(define-key evil-motion-state-map "W" 'evil-forward-WORD-begin) -(define-key evil-motion-state-map "y" 'evil-yank) -(define-key evil-motion-state-map "Y" 'evil-yank-line) -(define-key evil-motion-state-map "gd" 'evil-goto-definition) -(define-key evil-motion-state-map "ge" 'evil-backward-word-end) -(define-key evil-motion-state-map "gE" 'evil-backward-WORD-end) -(define-key evil-motion-state-map "gg" 'evil-goto-first-line) -(define-key evil-motion-state-map "gj" 'evil-next-visual-line) -(define-key evil-motion-state-map (vconcat "g" [down]) 'evil-next-visual-line) -(define-key evil-motion-state-map "gk" 'evil-previous-visual-line) -(define-key evil-motion-state-map (vconcat "g" [up]) 'evil-previous-visual-line) -(define-key evil-motion-state-map "g0" 'evil-beginning-of-visual-line) -(define-key evil-motion-state-map "g_" 'evil-last-non-blank) -(define-key evil-motion-state-map "g^" 'evil-first-non-blank-of-visual-line) -(define-key evil-motion-state-map (vconcat "g" [home]) 'evil-first-non-blank-of-visual-line) -(define-key evil-motion-state-map "gm" 'evil-middle-of-visual-line) -(define-key evil-motion-state-map "gM" 'evil-percentage-of-line) -(define-key evil-motion-state-map "go" 'evil-goto-char) -(define-key evil-motion-state-map "g$" 'evil-end-of-visual-line) -(define-key evil-motion-state-map (vconcat "g" [end]) 'evil-end-of-visual-line) -(define-key evil-motion-state-map "g\C-]" 'evil-jump-to-tag) -(define-key evil-motion-state-map "{" 'evil-backward-paragraph) -(define-key evil-motion-state-map "}" 'evil-forward-paragraph) -(define-key evil-motion-state-map "#" 'evil-search-word-backward) -(define-key evil-motion-state-map "g#" 'evil-search-unbounded-word-backward) -(define-key evil-motion-state-map "$" 'evil-end-of-line) -(define-key evil-motion-state-map [end] 'evil-end-of-line) -(define-key evil-motion-state-map [home] 'evil-beginning-of-line) -(define-key evil-motion-state-map "%" 'evil-jump-item) -(define-key evil-motion-state-map "`" 'evil-goto-mark) -(define-key evil-motion-state-map "'" 'evil-goto-mark-line) -(define-key evil-motion-state-map "(" 'evil-backward-sentence-begin) -(define-key evil-motion-state-map ")" 'evil-forward-sentence-begin) -(define-key evil-motion-state-map "]]" 'evil-forward-section-begin) -(define-key evil-motion-state-map "][" 'evil-forward-section-end) -(define-key evil-motion-state-map "[[" 'evil-backward-section-begin) -(define-key evil-motion-state-map "[]" 'evil-backward-section-end) -(define-key evil-motion-state-map "[(" 'evil-previous-open-paren) -(define-key evil-motion-state-map "])" 'evil-next-close-paren) -(define-key evil-motion-state-map "[{" 'evil-previous-open-brace) -(define-key evil-motion-state-map "]}" 'evil-next-close-brace) -(define-key evil-motion-state-map "]'" 'evil-next-mark-line) -(define-key evil-motion-state-map "]`" 'evil-next-mark) -(define-key evil-motion-state-map "['" 'evil-previous-mark-line) -(define-key evil-motion-state-map "[`" 'evil-previous-mark) -(define-key evil-motion-state-map "]s" 'evil-next-flyspell-error) -(define-key evil-motion-state-map "[s" 'evil-prev-flyspell-error) -(define-key evil-motion-state-map "*" 'evil-search-word-forward) -(define-key evil-motion-state-map "g*" 'evil-search-unbounded-word-forward) -(define-key evil-motion-state-map "," 'evil-repeat-find-char-reverse) -(define-key evil-motion-state-map "/" 'evil-search-forward) -(define-key evil-motion-state-map ";" 'evil-repeat-find-char) -(define-key evil-motion-state-map "?" 'evil-search-backward) -(define-key evil-motion-state-map "|" 'evil-goto-column) -(define-key evil-motion-state-map "^" 'evil-first-non-blank) -(define-key evil-motion-state-map "+" 'evil-next-line-first-non-blank) -(define-key evil-motion-state-map "_" 'evil-next-line-1-first-non-blank) -(define-key evil-motion-state-map "-" 'evil-previous-line-first-non-blank) -(define-key evil-motion-state-map "\C-w" 'evil-window-map) -(define-key evil-motion-state-map (kbd "C-6") 'evil-switch-to-windows-last-buffer) -(define-key evil-motion-state-map "\C-]" 'evil-jump-to-tag) -(define-key evil-motion-state-map (kbd "C-b") 'evil-scroll-page-up) -(define-key evil-motion-state-map (kbd "C-e") 'evil-scroll-line-down) -(define-key evil-motion-state-map (kbd "C-f") 'evil-scroll-page-down) -(define-key evil-motion-state-map (kbd "C-o") 'evil-jump-backward) -(define-key evil-motion-state-map (kbd "C-y") 'evil-scroll-line-up) -(define-key evil-motion-state-map (kbd "RET") 'evil-ret) -(define-key evil-motion-state-map "\\" 'evil-execute-in-emacs-state) -(define-key evil-motion-state-map "z^" 'evil-scroll-top-line-to-bottom) -(define-key evil-motion-state-map "z+" 'evil-scroll-bottom-line-to-top) -(define-key evil-motion-state-map "zt" 'evil-scroll-line-to-top) -;; TODO: z RET has an advanced form taking an count before the RET -;; but this requires again a special state with a single command -;; bound to RET -(define-key evil-motion-state-map (vconcat "z" [return]) 'evil-scroll-line-to-top-first-non-blank) -(define-key evil-motion-state-map (kbd "z RET") 'evil-scroll-line-to-top-first-non-blank) -(define-key evil-motion-state-map "zz" 'evil-scroll-line-to-center) -(define-key evil-motion-state-map "z." 'evil-scroll-line-to-center-first-non-blank) -(define-key evil-motion-state-map "zb" 'evil-scroll-line-to-bottom) -(define-key evil-motion-state-map "z-" 'evil-scroll-line-to-bottom-first-non-blank) -(define-key evil-motion-state-map "v" 'evil-visual-char) -(define-key evil-motion-state-map "V" 'evil-visual-line) -(define-key evil-motion-state-map "\C-v" 'evil-visual-block) -(define-key evil-motion-state-map "gv" 'evil-visual-restore) -(define-key evil-motion-state-map (kbd "C-^") 'evil-buffer) -(define-key evil-motion-state-map [left] 'evil-backward-char) -(define-key evil-motion-state-map [right] 'evil-forward-char) -(define-key evil-motion-state-map [up] 'evil-previous-line) -(define-key evil-motion-state-map [down] 'evil-next-line) -(define-key evil-motion-state-map "zl" 'evil-scroll-column-right) -(define-key evil-motion-state-map [?z right] 'evil-scroll-column-right) -(define-key evil-motion-state-map "zh" 'evil-scroll-column-left) -(define-key evil-motion-state-map [?z left] 'evil-scroll-column-left) -(define-key evil-motion-state-map "ze" 'evil-scroll-end-column) -(define-key evil-motion-state-map "zs" 'evil-scroll-start-column) -(define-key evil-motion-state-map "zH" 'evil-scroll-left) -(define-key evil-motion-state-map [?z S-left] 'evil-scroll-left) -(define-key evil-motion-state-map "zL" 'evil-scroll-right) -(define-key evil-motion-state-map [?z S-right] 'evil-scroll-right) -(define-key evil-motion-state-map - (read-kbd-macro evil-toggle-key) 'evil-emacs-state) - -;; text objects -(define-key evil-outer-text-objects-map "w" 'evil-a-word) -(define-key evil-outer-text-objects-map "W" 'evil-a-WORD) -(define-key evil-outer-text-objects-map "s" 'evil-a-sentence) -(define-key evil-outer-text-objects-map "p" 'evil-a-paragraph) -(define-key evil-outer-text-objects-map "b" 'evil-a-paren) -(define-key evil-outer-text-objects-map "(" 'evil-a-paren) -(define-key evil-outer-text-objects-map ")" 'evil-a-paren) -(define-key evil-outer-text-objects-map "[" 'evil-a-bracket) -(define-key evil-outer-text-objects-map "]" 'evil-a-bracket) -(define-key evil-outer-text-objects-map "B" 'evil-a-curly) -(define-key evil-outer-text-objects-map "{" 'evil-a-curly) -(define-key evil-outer-text-objects-map "}" 'evil-a-curly) -(define-key evil-outer-text-objects-map "<" 'evil-an-angle) -(define-key evil-outer-text-objects-map ">" 'evil-an-angle) -(define-key evil-outer-text-objects-map "'" 'evil-a-single-quote) -(define-key evil-outer-text-objects-map "\"" 'evil-a-double-quote) -(define-key evil-outer-text-objects-map "`" 'evil-a-back-quote) -(define-key evil-outer-text-objects-map "t" 'evil-a-tag) -(define-key evil-outer-text-objects-map "o" 'evil-a-symbol) -(define-key evil-inner-text-objects-map "w" 'evil-inner-word) -(define-key evil-inner-text-objects-map "W" 'evil-inner-WORD) -(define-key evil-inner-text-objects-map "s" 'evil-inner-sentence) -(define-key evil-inner-text-objects-map "p" 'evil-inner-paragraph) -(define-key evil-inner-text-objects-map "b" 'evil-inner-paren) -(define-key evil-inner-text-objects-map "(" 'evil-inner-paren) -(define-key evil-inner-text-objects-map ")" 'evil-inner-paren) -(define-key evil-inner-text-objects-map "[" 'evil-inner-bracket) -(define-key evil-inner-text-objects-map "]" 'evil-inner-bracket) -(define-key evil-inner-text-objects-map "B" 'evil-inner-curly) -(define-key evil-inner-text-objects-map "{" 'evil-inner-curly) -(define-key evil-inner-text-objects-map "}" 'evil-inner-curly) -(define-key evil-inner-text-objects-map "<" 'evil-inner-angle) -(define-key evil-inner-text-objects-map ">" 'evil-inner-angle) -(define-key evil-inner-text-objects-map "'" 'evil-inner-single-quote) -(define-key evil-inner-text-objects-map "\"" 'evil-inner-double-quote) -(define-key evil-inner-text-objects-map "`" 'evil-inner-back-quote) -(define-key evil-inner-text-objects-map "t" 'evil-inner-tag) -(define-key evil-inner-text-objects-map "o" 'evil-inner-symbol) -(define-key evil-motion-state-map "gn" 'evil-next-match) -(define-key evil-motion-state-map "gN" 'evil-previous-match) - -(when evil-want-C-i-jump - (define-key evil-motion-state-map (kbd "C-i") 'evil-jump-forward)) - -(when evil-want-C-u-scroll - (define-key evil-motion-state-map (kbd "C-u") 'evil-scroll-up)) - -(when evil-want-C-d-scroll - (define-key evil-motion-state-map (kbd "C-d") 'evil-scroll-down)) - -(when evil-want-C-g-bindings - (define-key evil-motion-state-map "g\C-g" 'count-words)) - -;;; Visual state - -(define-key evil-visual-state-map "A" 'evil-append) -(define-key evil-visual-state-map "I" 'evil-insert) -(define-key evil-visual-state-map "o" 'exchange-point-and-mark) -(define-key evil-visual-state-map "O" 'evil-visual-exchange-corners) -(define-key evil-visual-state-map "R" 'evil-change-whole-line) -(define-key evil-visual-state-map "u" 'evil-downcase) -(define-key evil-visual-state-map "U" 'evil-upcase) -(define-key evil-visual-state-map "X" 'evil-delete-line) -(define-key evil-visual-state-map "a" evil-outer-text-objects-map) -(define-key evil-visual-state-map "i" evil-inner-text-objects-map) -(define-key evil-visual-state-map (kbd "") 'undefined) -(define-key evil-visual-state-map (kbd "") 'undefined) -(define-key evil-visual-state-map [remap evil-repeat] 'undefined) -(define-key evil-visual-state-map [escape] 'evil-exit-visual-state) -(define-key evil-visual-state-map "gf" 'evil-find-file-at-point-visual) - -;;; Operator-Pending state - -(define-key evil-operator-state-map "a" evil-outer-text-objects-map) -(define-key evil-operator-state-map "i" evil-inner-text-objects-map) -;; (define-key evil-operator-state-map [escape] 'keyboard-quit) - -;;; Insert state - -(defvar evil-insert-state-bindings - `(([insert] . evil-enter-replace-state) - ("\C-q" . evil-quoted-insert) - ("\C-v" . evil-quoted-insert) - ("\C-k" . evil-insert-digraph) - ("\C-o" . evil-execute-in-normal-state) - ("\C-r" . evil-paste-from-register) - ("\C-y" . evil-copy-from-above) - ("\C-e" . evil-copy-from-below) - ("\C-n" . evil-complete-next) ;; Completion commands - ("\C-p" . evil-complete-previous) ;; don't yet behave correctly - ("\C-x\C-n" . evil-complete-next-line) ;; in replace state - ("\C-x\C-p" . evil-complete-previous-line) ;; TODO - fix this - ("\C-t" . evil-shift-right-line) - ("\C-d" . evil-shift-left-line) - ("\C-a" . evil-paste-last-insertion) - ("\C-@" . evil-paste-last-insertion-and-stop-insert) - ([remap delete-backward-char] . evil-delete-backward-char-and-join) - ([S-left] . evil-backward-word-begin) - ([S-right] . evil-forward-word-begin) - ,(if evil-want-C-w-delete - '("\C-w" . evil-delete-backward-word) - '("\C-w" . evil-window-map)) - ,@(when evil-want-C-u-delete - '(("\C-u" . evil-delete-back-to-indentation))) - ,@(when evil-want-C-h-delete - '(("\C-h" . evil-delete-backward-char-and-join))) - ([mouse-2] . mouse-yank-primary)) - "Evil's bindings for insert & replace states. -Used in `evil-insert-state-map' and `evil-replace-state-map', -excluding , , and `evil-toggle-key'.") - -(defun evil-update-insert-state-bindings (&optional _option-name remove force) - "Update bindings in `evil-insert-state-map'. -If no arguments are given add the bindings specified in -`evil-insert-state-bindings'. If REMOVE is non nil, remove only -these bindings. Unless FORCE is non nil, this will not -overwriting existing bindings, which means bindings will not be -added if one already exists for a key and only default bindings -are removed. - -Note that , and `evil-toggle-key' are not -included in `evil-insert-state-bindings' by default." - (interactive) - (dolist (binding evil-insert-state-bindings) - (cond - ((and remove - (or force - ;; Only remove if the default binding has not changed - (eq (evil-lookup-key evil-insert-state-map (car binding)) - (cdr binding)))) - (define-key evil-insert-state-map (car binding) nil)) - ((and (null remove) - (or force - ;; Check to see that nothing is bound here before adding - (not (evil-lookup-key evil-insert-state-map (car binding))))) - (define-key evil-insert-state-map (car binding) (cdr binding)))))) - -(define-key evil-insert-state-map [delete] 'delete-char) -(define-key evil-insert-state-map [escape] 'evil-normal-state) -(define-key evil-insert-state-map - (read-kbd-macro evil-toggle-key) 'evil-emacs-state) - -;;; Replace state - -(dolist (binding evil-insert-state-bindings) - (define-key evil-replace-state-map (car binding) (cdr binding))) -(define-key evil-replace-state-map (kbd "DEL") 'evil-replace-backspace) -(when evil-want-C-h-delete - (define-key evil-replace-state-map "\C-h" 'evil-replace-backspace)) -(define-key evil-replace-state-map [escape] 'evil-normal-state) -(define-key evil-replace-state-map [insert] 'evil-append) - -;;; Emacs state - -(define-key evil-emacs-state-map - (read-kbd-macro evil-toggle-key) 'evil-exit-emacs-state) - -(when evil-want-C-w-in-emacs-state - (define-key evil-emacs-state-map "\C-w" 'evil-window-map)) - -;;; Mouse -(define-key evil-motion-state-map [down-mouse-1] 'evil-mouse-drag-region) -(define-key evil-visual-state-map [mouse-2] 'evil-exit-visual-and-repeat) -(define-key evil-normal-state-map [mouse-2] 'mouse-yank-primary) - -;; Ex -(define-key evil-motion-state-map ":" 'evil-ex) -(define-key evil-motion-state-map "!" 'evil-shell-command) - -(evil-ex-define-cmd "e[dit]" 'evil-edit) -(evil-ex-define-cmd "vie[w]" 'evil-view) -(evil-ex-define-cmd "w[rite]" 'evil-write) -(evil-ex-define-cmd "up[date]" 'evil-update) -(evil-ex-define-cmd "wa[ll]" 'evil-write-all) -(evil-ex-define-cmd "sav[eas]" 'evil-save) -(evil-ex-define-cmd "r[ead]" 'evil-read) -(evil-ex-define-cmd "b[uffer]" 'evil-buffer) -(evil-ex-define-cmd "bad[d]" 'evil-buffer-add) -(evil-ex-define-cmd "bn[ext]" 'evil-next-buffer) -(evil-ex-define-cmd "bp[revious]" 'evil-prev-buffer) -(evil-ex-define-cmd "bN[ext]" "bprevious") -(evil-ex-define-cmd "sb[uffer]" 'evil-split-buffer) -(evil-ex-define-cmd "sbn[ext]" 'evil-split-next-buffer) -(evil-ex-define-cmd "sbp[revious]" 'evil-split-prev-buffer) -(evil-ex-define-cmd "sbN[ext]" "sbprevious") -(evil-ex-define-cmd "buffers" 'buffer-menu) -(evil-ex-define-cmd "files" 'evil-show-files) -(evil-ex-define-cmd "ls" "buffers") - -(evil-ex-define-cmd "c[hange]" 'evil-change) -(evil-ex-define-cmd "co[py]" 'evil-copy) -(evil-ex-define-cmd "t" "copy") -(evil-ex-define-cmd "m[ove]" 'evil-move) -(evil-ex-define-cmd "d[elete]" 'evil-ex-delete) -(evil-ex-define-cmd "y[ank]" 'evil-ex-yank) -(evil-ex-define-cmd "pu[t]" 'evil-ex-put) -(evil-ex-define-cmd "go[to]" 'evil-goto-char) -(evil-ex-define-cmd "j[oin]" 'evil-ex-join) -(evil-ex-define-cmd "le[ft]" 'evil-align-left) -(evil-ex-define-cmd "ri[ght]" 'evil-align-right) -(evil-ex-define-cmd "ce[nter]" 'evil-align-center) -(evil-ex-define-cmd "sp[lit]" 'evil-window-split) -(evil-ex-define-cmd "sv[iew]" 'evil-window-split-view) -(evil-ex-define-cmd "vs[plit]" 'evil-window-vsplit) -(evil-ex-define-cmd "new" 'evil-window-new) -(evil-ex-define-cmd "ene[w]" 'evil-buffer-new) -(evil-ex-define-cmd "vne[w]" 'evil-window-vnew) -(evil-ex-define-cmd "clo[se]" 'evil-window-delete) -(evil-ex-define-cmd "on[ly]" 'delete-other-windows) -(evil-ex-define-cmd "q[uit]" 'evil-quit) -(evil-ex-define-cmd "wq" 'evil-save-and-close) -(evil-ex-define-cmd "quita[ll]" 'evil-quit-all) -(evil-ex-define-cmd "qa[ll]" "quitall") -(evil-ex-define-cmd "cq[uit]" 'evil-quit-all-with-error-code) -(evil-ex-define-cmd "wqa[ll]" 'evil-save-and-quit) -(evil-ex-define-cmd "xa[ll]" "wqall") -(evil-ex-define-cmd "x[it]" 'evil-save-modified-and-close) -(evil-ex-define-cmd "exi[t]" 'evil-save-modified-and-close) -(evil-ex-define-cmd "bd[elete]" 'evil-delete-buffer) -(evil-ex-define-cmd "bw[ipeout]" 'evil-delete-buffer) -(evil-ex-define-cmd "g[lobal]" 'evil-ex-global) -(evil-ex-define-cmd "v[global]" 'evil-ex-global-inverted) -(evil-ex-define-cmd "norm[al]" 'evil-ex-normal) -(evil-ex-define-cmd "s[ubstitute]" 'evil-ex-substitute) -(evil-ex-define-cmd "&" 'evil-ex-repeat-substitute) -(evil-ex-define-cmd "&&" 'evil-ex-repeat-substitute-with-flags) -(evil-ex-define-cmd "~" 'evil-ex-repeat-substitute-with-search) -(evil-ex-define-cmd "~&" 'evil-ex-repeat-substitute-with-search-and-flags) -(evil-ex-define-cmd "mat[ch]" 'evil-ex-match) -(evil-ex-define-cmd "registers" 'evil-show-registers) -(evil-ex-define-cmd "di[splay]" "registers") -(evil-ex-define-cmd "ma[rk]" 'evil-set-col-0-mark) -(evil-ex-define-cmd "marks" 'evil-show-marks) -(evil-ex-define-cmd "delm[arks]" 'evil-delete-marks) -(evil-ex-define-cmd "ju[mps]" 'evil-show-jumps) -(evil-ex-define-cmd "noh[lsearch]" 'evil-ex-nohighlight) -(evil-ex-define-cmd "f[ile]" 'evil-show-file-info) -(evil-ex-define-cmd "<" 'evil-shift-left) -(evil-ex-define-cmd ">" 'evil-shift-right) -(evil-ex-define-cmd "=" 'evil-ex-line-number) -(evil-ex-define-cmd "!" 'evil-shell-command) -(evil-ex-define-cmd "@:" 'evil-ex-repeat) -(evil-ex-define-cmd "mak[e]" 'evil-make) -(evil-ex-define-cmd "cc" 'evil-goto-error) -(evil-ex-define-cmd "cfir[st]" 'first-error) -(evil-ex-define-cmd "cr[ewind]" 'first-error) -(evil-ex-define-cmd "cn[ext]" 'next-error) -(evil-ex-define-cmd "cp[revious]" 'previous-error) -(evil-ex-define-cmd "set-initial-state" 'evil-ex-set-initial-state) -(evil-ex-define-cmd "show-digraphs" 'evil-ex-show-digraphs) -(evil-ex-define-cmd "sor[t]" 'evil-ex-sort) -(evil-ex-define-cmd "res[ize]" 'evil-ex-resize) -(evil-ex-define-cmd "u[ndo]" 'evil-undo) -(evil-ex-define-cmd "red[o]" 'evil-redo) -(evil-ex-define-cmd "p[rint]" 'evil-ex-print) -(evil-ex-define-cmd "P[rint]" 'evil-ex-print) -(evil-ex-define-cmd "nu[mber]" 'evil-ex-numbered-print) -(evil-ex-define-cmd "#" 'evil-ex-numbered-print) -(evil-ex-define-cmd "z" 'evil-ex-z) -(evil-ex-define-cmd "ret[ab]" 'evil-retab) - -(when (featurep 'tab-bar) - (evil-ex-define-cmd "tabnew" 'tab-bar-new-tab) - (evil-ex-define-cmd "tabc[lose]" 'tab-bar-close-tab) - (evil-ex-define-cmd "tabo[nly]" 'tab-bar-close-other-tabs) - (evil-ex-define-cmd "tabn[ext]" 'evil-tab-next) - (evil-ex-define-cmd "tabp[revious]" 'tab-bar-switch-to-prev-tab)) - -;; Command-line editing -(define-key evil-command-line-map "\d" #'evil-ex-delete-backward-char) -(define-key evil-command-line-map "\t" #'completion-at-point) -(define-key evil-command-line-map [tab] #'completion-at-point) -(define-key evil-command-line-map "\C-a" #'completion-at-point) -(define-key evil-command-line-map "\C-b" #'move-beginning-of-line) -(define-key evil-command-line-map "\C-c" #'abort-recursive-edit) -(define-key evil-command-line-map "\C-d" #'completion-at-point) -(define-key evil-command-line-map "\C-f" 'evil-command-window) -(define-key evil-command-line-map "\C-g" #'abort-minibuffers) -(define-key evil-command-line-map "\C-k" 'evil-insert-digraph) -(define-key evil-command-line-map "\C-l" #'completion-at-point) -(define-key evil-command-line-map "\C-n" #'next-history-element) -(define-key evil-command-line-map "\C-p" #'previous-history-element) -(define-key evil-command-line-map "\C-r" 'evil-paste-from-register) -(define-key evil-command-line-map "\C-u" 'evil-delete-whole-line) -(define-key evil-command-line-map "\C-v" #'quoted-insert) -(when evil-want-C-w-delete - (define-key evil-command-line-map "\C-w" #'evil-delete-backward-word)) -(define-key evil-command-line-map [escape] #'abort-recursive-edit) -(define-key evil-command-line-map [S-left] #'backward-word) -(define-key evil-command-line-map [S-right] #'forward-word) -(define-key evil-command-line-map [up] #'previous-complete-history-element) -(define-key evil-command-line-map [down] #'next-complete-history-element) -(define-key evil-command-line-map [prior] #'previous-history-element) -(define-key evil-command-line-map [next] #'next-history-element) -(define-key evil-command-line-map [return] #'exit-minibuffer) -(define-key evil-command-line-map (kbd "RET") #'exit-minibuffer) - -;; search command line -(set-keymap-parent evil-ex-search-keymap evil-command-line-map) -(unless evil-want-C-w-delete - (define-key evil-ex-search-keymap "\C-w" 'evil-search-yank-word)) - -;; Ex command line -(set-keymap-parent evil-ex-completion-map evil-command-line-map) - -;; eval prompt (the `=' register) -(define-key evil-eval-map "\C-b" 'move-beginning-of-line) -(define-key evil-eval-map "\C-c" 'abort-recursive-edit) -(define-key evil-eval-map "\C-g" 'abort-recursive-edit) -(define-key evil-eval-map "\C-k" 'evil-insert-digraph) -(define-key evil-eval-map "\C-p" #'previous-complete-history-element) -(define-key evil-eval-map "\C-r" 'evil-paste-from-register) -(define-key evil-eval-map "\C-n" #'next-complete-history-element) -(define-key evil-eval-map "\C-u" 'evil-delete-whole-line) -(define-key evil-eval-map "\C-v" #'quoted-insert) -(define-key evil-eval-map "\C-w" 'evil-delete-backward-word) -(define-key evil-eval-map [escape] 'abort-recursive-edit) -(define-key evil-eval-map [S-left] 'backward-word) -(define-key evil-eval-map [S-right] 'forward-word) -(define-key evil-eval-map [up] 'previous-complete-history-element) -(define-key evil-eval-map [down] 'next-complete-history-element) -(define-key evil-eval-map [prior] 'previous-history-element) -(define-key evil-eval-map [next] 'next-history-element) -(define-key evil-eval-map [return] 'exit-minibuffer) -(define-key evil-eval-map (kbd "RET") 'exit-minibuffer) - -;; evil-read-key -(define-key evil-read-key-map (kbd "ESC") #'keyboard-quit) -(define-key evil-read-key-map (kbd "C-]") #'keyboard-quit) -(define-key evil-read-key-map (kbd "C-g") #'keyboard-quit) -(define-key evil-read-key-map (kbd "C-q") #'evil-read-quoted-char) -(define-key evil-read-key-map (kbd "C-v") #'evil-read-quoted-char) -(define-key evil-read-key-map (kbd "C-k") #'evil-read-digraph-char) -(define-key evil-read-key-map "\r" "\n") - -;; command line window -(evil-define-key* '(normal insert) evil-command-window-mode-map - (kbd "RET") 'evil-command-window-execute) - -(provide 'evil-maps) - -;;; evil-maps.el ends here diff --git a/.config/emacs/lisp/evil/evil-repeat.el b/.config/emacs/lisp/evil/evil-repeat.el deleted file mode 100644 index 75727ef..0000000 --- a/.config/emacs/lisp/evil/evil-repeat.el +++ /dev/null @@ -1,641 +0,0 @@ -;;; evil-repeat.el --- Repeat system -*- lexical-binding: t -*- - -;; Author: Frank Fischer -;; Maintainer: Vegard Øye - -;; Version: 1.15.0 - -;; -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -;;; Commentary: - -;; A repeat begins when leaving Normal state; it ends when re-entering -;; Normal state. The diagram below shows possible routes between -;; Normal state (N), Insert state (I), Visual state (V), -;; Operator-Pending state (O) and Replace state (R). (Emacs state -;; is an exception: nothing is repeated in that state.) -;; ___ -;; / \ -;; | R | -;; \___/ -;; ^ | -;; | | -;; ___ |___V ___ -;; / \ <------- / \ -------> / \ -;; | V | | N | | O | -;; \___/ -------> \___/ <------- \___/ -;; | | ^ | -;; | | | | -;; | V___| | -;; | / \ | -;; +--------> | I | <--------+ -;; \___/ -;; -;; The recording of a repeat is started in one of two cases: Either a -;; command is about to be executed (in pre-command-hook) or normal -;; state is exited. The recording is stopped whenever a command has -;; been completed and evil is in normal state afterwards. Therefore, -;; a non-inserting command in normal-state is recorded as a single -;; repeat unit. In contrast, if the command leaves normal state and -;; starts insert-state, all commands that are executed until -;; insert-state is left and normal state is reactivated are recorded -;; together in one repeat unit. In other words, a repeat unit consists -;; of all commands that are executed starting and ending in normal -;; state. -;; -;; Not all commands are recorded. There are several commands that are -;; completely ignored and other commands that even abort the currently -;; active recording, e.g., commands that switch buffer. -;; -;; During recording the repeat information is appended to the variable -;; `evil-repeat-info', which is cleared when the recording -;; starts. This accumulated repeat information is put into the -;; `evil-repeat-ring' when the recording is finished. The dot command, -;; `\[evil-repeat]' (`evil-repeat') replays the most recent entry in -;; the ring, preceeding repeats can be replayed using -;; `\[evil-repeat-pop]' (`evil-repeat-pop'). -;; -;; Repeat information can be stored in almost arbitrary form. How the -;; repeat information for each single command is recorded is -;; determined by the :repeat property of the command. This property -;; has the following interpretation: -;; -;; t record commands by storing the key-sequence that invoked it -;; nil ignore this command completely -;; ignore synonym to nil -;; motion command is recorded by storing the key-sequence but only in -;; insert state, otherwise it is ignored. -;; abort stop recording of repeat information immediately -;; change record commands by storing buffer changes -;; SYMBOL if SYMBOL is contained as key in `evil-repeat-types' call -;; the corresponding (function-)value, otherwise call the -;; function associated with SYMBOL. In both cases the -;; function should take exactly one argument which is either -;; `pre', `pre-read-key-sequence' or `post' specifying on -;; whether the function is called before or after the -;; execution of the command. -;; -;; Therefore, using a certain SYMBOL one can write specific repeation -;; functions for each command. -;; -;; Each value of ring `evil-repeat-info', i.e., each single repeat -;; information must be one of the following two possibilities: -;; If element is a sequence, it is regarded as a key-sequence to -;; be repeated. Otherwise the element must be a list -;; (FUNCTION PARAMS ...) which will be called using -;; (apply FUNCTION PARAMS) whenever this repeat is being executed. -;; -;; A user supplied repeat function can use the functions -;; `evil-record-repeat' to append further repeat-information of the -;; form described above to `evil-repeat-info'. See the implementation -;; of `evil-repeat-keystrokes' and `evil-repeat-changes' for examples. -;; -;; The repeat information is executed with `evil-execute-repeat-info', -;; which passes key-sequence elements to `execute-kbd-macro' and -;; executes other elements as defined above. A special version is -;; `evil-execute-repeat-info-with-count'. This function works as -;; `evil-execute-repeat-info', but replaces the count of the first -;; command. This is done by parsing the key-sequence, ignoring all -;; calls to `digit-prefix-argument' and `negative-argument', and -;; prepending the count as a string to the vector of the remaining -;; key-sequence. - -;;; Code: - -(require 'evil-states) - -(defmacro evil-without-repeat (&rest body) - (declare (indent defun) - (debug t)) - `(let ((pre-command-hook (remq 'evil-repeat-pre-hook pre-command-hook)) - (post-command-hook (remq 'evil-repeat-post-hook post-command-hook))) - ,@body - (evil-repeat-abort))) - -(defsubst evil-repeat-recording-p () - "Return non-nil if a recording is in progress." - (eq evil-recording-repeat t)) - -(defun evil-repeat-start () - "Start recording a new repeat into `evil-repeat-info'." - (evil-repeat-reset t) - (evil-repeat-record-buffer) - (when (evil-visual-state-p) - (let* ((range (evil-visual-range)) - (beg (evil-range-beginning range)) - (end (max 1 (1- (evil-range-end range)))) - (nfwdlines (evil-count-lines beg end))) - (evil-repeat-record - (cond - ((eq evil-visual-selection 'char) - (list #'evil-repeat-visual-char - nfwdlines - (- end - (if (zerop nfwdlines) - beg - (save-excursion - (goto-char end) - (line-beginning-position)))))) - ((eq evil-visual-selection 'line) - (list #'evil-repeat-visual-line nfwdlines)) - ((eq evil-visual-selection 'block) - (list #'evil-repeat-visual-block - nfwdlines - (abs (- (evil-column beg) (evil-column end)))))))))) - -(defun evil-repeat-stop () - "Stop recording a repeat. -Update `evil-repeat-ring' with the accumulated changes -in `evil-repeat-info' and clear variables." - (unwind-protect - (when (evil-repeat-recording-p) - (setq evil-repeat-info (evil-normalize-repeat-info evil-repeat-info)) - (when (and evil-repeat-info evil-repeat-ring) - (ring-insert evil-repeat-ring evil-repeat-info))) - (evil-repeat-reset nil))) - -(defun evil-repeat-abort () - "Abort current repeation." - (evil-repeat-reset 'abort)) - -(defun evil-repeat-reset (flag) - "Clear all repeat recording variables. -Set `evil-recording-repeat' to FLAG." - (setq evil-recording-repeat flag - evil-repeat-info nil - evil-repeat-buffer nil)) - -(defsubst evil-repeat-record-position (&optional pos) - "Set `evil-repeat-pos' to POS or point." - (setq evil-repeat-pos (or pos (point)))) - -(defun evil-repeat-record-buffer () - "Set `evil-repeat-buffer' to the current buffer." - (unless (minibufferp) - (setq evil-repeat-buffer (current-buffer)))) - -(defmacro evil-save-repeat-info (&rest body) - "Execute BODY, protecting the values of repeat variables." - (declare (indent defun) - (debug t)) - `(let (evil-repeat-ring - evil-recording-repeat - evil-recording-current-command - evil-repeat-info - evil-repeat-changes - evil-repeat-pos - evil-repeat-keys - evil-repeat-buffer - this-command - last-command) - ,@body)) - -(defun evil-repeat-different-buffer-p (&optional strict) - "Whether the buffer has changed in a repeat. -If STRICT is non-nil, returns t if the previous buffer -is unknown; otherwise returns t only if the previous -buffer is known and different from the current buffer." - (and (or (buffer-live-p evil-repeat-buffer) strict) - (not (minibufferp)) - (not (eq (current-buffer) evil-repeat-buffer)))) - -(defvar evil-repeat-types - '((t . evil-repeat-keystrokes) - (change . evil-repeat-changes) - (motion . evil-repeat-motion) - (insert-at-point . evil-repeat-insert-at-point) - (ignore . nil)) - "Alist of defined repeat-types.") - -(defun evil--repeat-type (command) - "Return the :repeat property of COMMAND." - (when (functionp command) ; ignore keyboard macros - (let* ((type (evil-get-command-property command :repeat t)) - (repeat-type (assq type evil-repeat-types))) - (if repeat-type (cdr repeat-type) type)))) - -(defun evil-repeat-type (command &optional default) - "Return the :repeat property of COMMAND. -If COMMAND doesn't have this property, return DEFAULT." - (declare (obsolete evil--repeat-type "1.15.0")) - (when (functionp command) ; ignore keyboard macros - (let* ((type (evil-get-command-property command :repeat default)) - (repeat-type (assq type evil-repeat-types))) - (if repeat-type (cdr repeat-type) type)))) - -(defun evil-repeat-force-abort-p (repeat-type) - "Whether the current command should abort the recording of repeat information. -Return non-nil if so." - (or (evil-repeat-different-buffer-p) ; ... buffer changed - (eq repeat-type 'abort) ; ... explicitly forced - (eq evil-recording-repeat 'abort) ; ... already aborted - (evil-emacs-state-p) ; ... in Emacs state - (and (evil-mouse-events-p ; ... mouse events - (this-command-keys-vector)) - (null repeat-type)) - (minibufferp))) ; ... minibuffer activated - -(defun evil-repeat-record (info) - "Append INFO to `evil-repeat-info'." - (when (evil-repeat-recording-p) - (setq evil-repeat-info (nconc evil-repeat-info (list info))))) - -;; called from `pre-command-hook' -(defun evil-repeat-pre-hook () - "Prepare the current command for recording the repeation." - (when evil-local-mode - (let ((repeat-type (evil--repeat-type this-command))) - (cond - ;; abort the repeat - ((evil-repeat-force-abort-p repeat-type) - ;; We mark the current record as being aborted, because there - ;; may be further pre-hooks following before the post-hook is - ;; called. - (evil-repeat-abort)) - ;; ignore those commands completely - ((or (null repeat-type) - (evil-mouse-events-p (this-command-keys-vector)))) - ;; record command - (t - ;; In normal-state or visual state, each command is a single - ;; repeation, therefore start a new repeation. - (when (or (evil-normal-state-p) - (evil-visual-state-p)) - (evil-repeat-start)) - (setq evil-recording-current-command t) - (funcall repeat-type 'pre)))))) -(put 'evil-repeat-pre-hook 'permanent-local-hook t) - -;; called from `post-command-hook' -(defun evil-repeat-post-hook () - "Finish recording of repeat-information for the current-command." - (when (and evil-local-mode evil-recording-repeat) - (let ((repeat-type (evil--repeat-type this-command))) - (cond - ;; abort the repeat - ((evil-repeat-force-abort-p repeat-type) - ;; The command has been aborted but is complete, so just reset - ;; the recording state. - (evil-repeat-reset nil)) - ;; ignore if command should not be recorded or the current - ;; command is not being recorded - ((or (null repeat-type) - (not evil-recording-current-command))) - ;; record command - (t - (funcall repeat-type 'post) - ;; In normal state, the repeat sequence is complete, so record it. - (when (evil-normal-state-p) - (evil-repeat-stop))))) - ;; done with recording the current command - (setq evil-recording-current-command nil))) -(put 'evil-repeat-post-hook 'permanent-local-hook t) - -(defun evil-clear-command-keys () - "Clear `this-command-keys' and all information about the current command keys. -Calling this function prevents further recording of the keys that -invoked the current command" - (clear-this-command-keys t) - (setq evil-repeat-keys "")) - -(defun evil-this-command-keys (&optional post-cmd) - "Version of `this-command-keys' with finer control over prefix args." - (vconcat - (let ((arg (if post-cmd current-prefix-arg prefix-arg))) - (and (numberp arg) - ;; Only add prefix if no repeat info recorded yet - (null evil-repeat-info) - (number-to-string arg))) - (this-single-command-keys))) - -(defun evil-repeat-keystrokes (flag) - "Repeation recording function for commands that are repeated by keystrokes." - (cond - ((eq flag 'pre) - (when evil-this-register - (evil-repeat-record - `(set evil-this-register ,evil-this-register))) - (setq evil-repeat-keys (evil-this-command-keys))) - ((memq flag '(post pre-read-key-sequence)) - (evil-repeat-record (if (zerop (length (evil-this-command-keys t))) - evil-repeat-keys - (evil-this-command-keys t))) - ;; erase commands keys to prevent double recording - (evil-clear-command-keys)))) - -(defun evil-repeat-motion (flag) - "Repetition for motions. -Motions are recorded by keystroke but only in Insert state." - (when (memq evil-state '(insert replace)) - (evil-repeat-keystrokes flag))) - -(defun evil-repeat-changes (flag) - "Repeation recording function for commands that are repeated by buffer changes." - (cond - ((eq flag 'pre) - (add-hook 'after-change-functions #'evil-repeat-change-hook nil t) - (evil-repeat-start-record-changes)) - ((eq flag 'post) - (remove-hook 'after-change-functions #'evil-repeat-change-hook t) - (evil-repeat-finish-record-changes)))) - -;; called from the `after-change-functions' hook -(defun evil-repeat-change-hook (beg end length) - "Record change information for current command." - (let ((repeat-type (evil--repeat-type this-command))) - (when (and (evil-repeat-recording-p) - (eq repeat-type 'evil-repeat-changes) - (not (evil-emacs-state-p)) - (not (evil-repeat-different-buffer-p t)) - evil-state) - (unless (evil-repeat-recording-p) - (evil-repeat-start)) - (evil-repeat-record-change (- beg evil-repeat-pos) - (buffer-substring beg end) - length)))) -(put 'evil-repeat-change-hook 'permanent-local-hook t) - -(defun evil-repeat-record-change (relpos ins ndel) - "Record the current buffer changes during a repeat. -If CHANGE is specified, it is added to `evil-repeat-changes'." - (when (evil-repeat-recording-p) - (push (list relpos ins ndel) evil-repeat-changes))) - -(defun evil-repeat-start-record-changes () - "Start the recording of a new set of buffer changes." - (setq evil-repeat-changes nil) - (evil-repeat-record-position)) - -(defun evil-repeat-finish-record-changes () - "Finish the recording of buffer changes and record them as repeat." - (when (evil-repeat-recording-p) - (evil-repeat-record `(evil-execute-change - ,(nreverse evil-repeat-changes) - ,(- (point) evil-repeat-pos))) - (setq evil-repeat-changes nil))) - -(defun evil-repeat-insert-at-point (flag) - "Repeation recording function for commands that insert text in region. -For example `mouse-yank-primary'. This records text insertion when a command -inserts some text in a buffer between (point) and (mark)." - (cond - ((eq flag 'pre) - (add-hook 'after-change-functions #'evil-repeat-insert-at-point-hook nil t)) - ((eq flag 'post) - (remove-hook 'after-change-functions #'evil-repeat-insert-at-point-hook t)))) - -(defun evil-repeat-insert-at-point-hook (beg end _length) - (let ((repeat-type (evil--repeat-type this-command))) - (when (and (evil-repeat-recording-p) - (eq repeat-type 'evil-repeat-insert-at-point) - (not (evil-emacs-state-p)) - (not (evil-repeat-different-buffer-p t)) - evil-state) - (setq evil-repeat-pos beg) - (evil-repeat-record (list 'insert (buffer-substring beg end)))))) -(put 'evil-repeat-insert-at-point-hook 'permanent-local-hook t) - -(defun evil-normalize-repeat-info (repeat-info) - "Concatenate consecutive arrays in REPEAT-INFO. -Return a single array." - (let* ((result (cons nil nil)) - (result-last result) - cur cur-last) - (dolist (rep repeat-info) - (cond - ((null rep)) - ((arrayp rep) - (setq rep (listify-key-sequence rep)) - (cond - (cur - (setcdr cur-last (cons rep nil)) - (setq cur-last (cdr cur-last))) - (t (setq cur (cons rep nil) - cur-last cur)))) - (t - (when cur - (setcdr result-last (cons (apply #'vconcat cur) nil)) - (setq result-last (cdr result-last) - cur nil)) - (setcdr result-last (cons rep nil)) - (setq result-last (cdr result-last))))) - (when cur - (setcdr result-last (cons (apply #'vconcat cur) nil))) - (cdr result))) - -(defun evil-repeat-visual-char (nfwdlines nfwdchars) - "Restore a character visual selection. -If the selection is in a single line, the restored visual -selection covers the same number of characters. If the selection -covers several lines, the restored selection covers the same -number of lines and the same number of characters in the last -line as the original selection." - (evil-visual-char) - (when (> nfwdlines 0) - (forward-line nfwdlines)) - (forward-char nfwdchars)) - -(defun evil-repeat-visual-line (nfwdlines) - "Restore a character visual selection. -If the selection is in a single line, the restored visual -selection covers the same number of characters. If the selection -covers several lines, the restored selection covers the same -number of lines and the same number of characters in the last -line as the original selection." - (evil-visual-line) - (forward-line nfwdlines)) - -(defun evil-repeat-visual-block (nfwdlines nfwdchars) - "Restore a character visual selection. -If the selection is in a single line, the restored visual -selection covers the same number of characters. If the selection -covers several lines, the restored selection covers the same -number of lines and the same number of characters in the last -line as the original selection." - (evil-visual-block) - (let ((col (current-column))) - (forward-line nfwdlines) - (move-to-column (+ col nfwdchars) t))) - -(defun evil-execute-change (changes rel-point) - "Execute as list of changes. - -CHANGES is a list of triples (REL-BEG INSERT-TEXT NDEL). -REL-BEG is the relative position (to point) where the change -takes place. INSERT-TEXT is the text to be inserted at that -position and NDEL the number of characters to be deleted at that -position before insertion. - -REL-POINT is the relative position to point before the changed -where point should be placed after all changes." - (evil-save-repeat-info - (let ((point (point))) - (dolist (change changes) - (goto-char (+ point (nth 0 change))) - (delete-char (nth 2 change)) - (insert (nth 1 change))) - (goto-char (+ point rel-point))))) - -(defun evil-execute-repeat-info (repeat-info) - "Execute a repeat-information REPEAT-INFO." - (evil-save-repeat-info - (dolist (rep repeat-info) - (cond - ((or (arrayp rep) (stringp rep)) - (let ((input-method current-input-method) - (evil-input-method nil)) - (deactivate-input-method) - (unwind-protect - (execute-kbd-macro rep) - (activate-input-method input-method)))) - ((consp rep) - (when (and (= 3 (length rep)) - (eq (nth 0 rep) 'set) - (eq (nth 1 rep) 'evil-this-register) - (>= (nth 2 rep) ?0) - (< (nth 2 rep) ?9)) - (setcar (nthcdr 2 rep) (1+ (nth 2 rep)))) - (apply (car rep) (cdr rep))) - (t (error "Unexpected repeat-info: %S" rep)))))) - -;; TODO: currently we prepend the replacing count before the -;; key-sequence that calls the command. Can we use direct -;; modification of prefix-arg instead? Does it work in -;; conjunction with `execute-kbd-macro'? -(defun evil-execute-repeat-info-with-count (count repeat-info) - "Repeat the repeat-information REPEAT-INFO with the count of -the first command replaced by COUNT. The count is replaced if -and only if COUNT is non-nil." - (evil-save-repeat-info - (cond - ;; do nothing (zero repeating) - ((and count (zerop count))) - ;; replace count - (count - (let ((evil-repeat-count count) - done) - (while (and repeat-info - (arrayp (car repeat-info)) - (not done)) - (let* ((count-and-cmd (evil-extract-count (pop repeat-info)))) - (push (vconcat (number-to-string count) - (nth 2 count-and-cmd) - (nth 3 count-and-cmd)) - repeat-info) - (setq done t))) - (evil-execute-repeat-info repeat-info))) - ;; repeat with original count - (t (evil-execute-repeat-info repeat-info))))) - -;; Keep the compiler happy - this is a buffer local var -(defvar evil--execute-normal-return-state) - -(evil-define-command evil-repeat (count &optional save-point) - "Repeat the last editing command with count replaced by COUNT. -If SAVE-POINT is non-nil, do not move point." - :repeat ignore - :suppress-operator t - (interactive (list current-prefix-arg - (not evil-repeat-move-cursor))) - (cond - ((null evil-repeat-ring) - (error "Already executing repeat")) - (save-point - (save-excursion - (evil-repeat count))) - (t - (unwind-protect - (let ((evil-last-find-temp evil-last-find) - (confirm-kill-emacs t) - (kill-buffer-hook - (cons #'(lambda () - (user-error "Cannot delete buffer in repeat command")) - kill-buffer-hook)) - (undo-pointer buffer-undo-list)) - (evil-with-single-undo - (setq evil-last-repeat (list (point) count undo-pointer)) - (evil-execute-repeat-info-with-count - count (ring-ref evil-repeat-ring 0)) - (setq evil-last-find evil-last-find-temp))) - (if (eq 'evil-execute-in-normal-state last-command) - (evil-change-state evil--execute-normal-return-state) - (evil-normal-state)))))) - -;; TODO: the same issue concerning disabled undos as for `evil-paste-pop' -(evil-define-command evil-repeat-pop (count &optional save-point) - "Replace the just repeated command with a previously executed command. -Only allowed after `evil-repeat', `evil-repeat-pop' or -`evil-repeat-pop-next'. Uses the same repeat count that -was used for the first repeat. - -The COUNT argument inserts the COUNT-th previous kill. -If COUNT is negative, this is a more recent kill." - :repeat nil - :suppress-operator t - (interactive (list (prefix-numeric-value current-prefix-arg) - (not evil-repeat-move-cursor))) - (cond - ((not (and (eq last-command #'evil-repeat) - evil-last-repeat)) - (user-error "Previous command was not evil-repeat: %s" last-command)) - (save-point - (save-excursion - (evil-repeat-pop count))) - (t - (unless (eq buffer-undo-list (nth 2 evil-last-repeat)) - (evil-undo-pop)) - (goto-char (car evil-last-repeat)) - ;; rotate the repeat-ring - (while (> count 0) - (when evil-repeat-ring - (ring-insert-at-beginning evil-repeat-ring - (ring-remove evil-repeat-ring 0))) - (setq count (1- count))) - (while (< count 0) - (when evil-repeat-ring - (ring-insert evil-repeat-ring - (ring-remove evil-repeat-ring))) - (setq count (1+ count))) - (setq this-command #'evil-repeat) - (evil-repeat (cadr evil-last-repeat))))) - -(evil-define-command evil-repeat-pop-next (count &optional save-point) - "Same as `evil-repeat-pop', but with negative COUNT." - :repeat nil - :suppress-operator t - (interactive (list (prefix-numeric-value current-prefix-arg) - (not evil-repeat-move-cursor))) - (evil-repeat-pop (- count) save-point)) - -(defun evil--read-key-sequence-advice (&rest _) - "Record `this-command-keys' before it is overwritten." - (when (and (evil-repeat-recording-p) - evil-recording-current-command) - (let ((repeat-type (evil--repeat-type this-command))) - (when (functionp repeat-type) - (funcall repeat-type 'pre-read-key-sequence))))) - -(advice-add 'read-key-sequence :before #'evil--read-key-sequence-advice) -(advice-add 'read-key-sequence-vector :before #'evil--read-key-sequence-advice) - -(provide 'evil-repeat) - -;;; evil-repeat.el ends here diff --git a/.config/emacs/lisp/evil/evil-search.el b/.config/emacs/lisp/evil/evil-search.el deleted file mode 100644 index c882a8e..0000000 --- a/.config/emacs/lisp/evil/evil-search.el +++ /dev/null @@ -1,1249 +0,0 @@ -;;; evil-search.el --- Search and substitute -*- lexical-binding: t -*- - -;; Author: Vegard Øye -;; Maintainer: Vegard Øye - -;; Version: 1.15.0 - -;; -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -;;; Code: - -(require 'evil-core) -(require 'evil-common) -(require 'evil-ex) - -(defun evil-select-search-module (option module) - "Change the search module according to MODULE. -If MODULE is `isearch', then Emacs' isearch module is used. -If MODULE is `evil-search', then Evil's own interactive -search module is used." - (let ((search-functions - '(forward - backward - word-forward - word-backward - unbounded-word-forward - unbounded-word-backward - next - previous))) - (dolist (fun search-functions) - (let ((isearch (intern (format "evil-search-%s" fun))) - (evil-search (intern (format "evil-ex-search-%s" fun)))) - (if (eq module 'isearch) - (substitute-key-definition - evil-search isearch evil-motion-state-map) - (substitute-key-definition - isearch evil-search evil-motion-state-map))))) - (set-default option module)) - -;; this customization is here because it requires -;; the knowledge of `evil-select-search-mode' -(defcustom evil-search-module 'isearch - "The search module to be used. May be either `isearch', for -Emacs' isearch module, or `evil-search', for Evil's own -interactive search module. N.b. changing this will not affect keybindings. -To swap out relevant keybindings, see `evil-select-search-module' function." - :type '(radio (const :tag "Emacs built-in isearch." :value isearch) - (const :tag "Evil interactive search." :value evil-search)) - :group 'evil - :set #'evil-select-search-module - :initialize #'evil-custom-initialize-pending-reset) - -(defun evil-push-search-history (string forward) - "Push STRING into the appropriate search history (determined by FORWARD)." - (let ((var (if forward - 'evil-search-forward-history - 'evil-search-backward-history))) - (unless (equal string (car (symbol-value var))) - (push string (symbol-value var))))) - -(defun evil-search-incrementally (forward regexp-p) - "Search incrementally for user-entered text." - (let ((evil-search-prompt (evil-search-prompt forward)) - (isearch-search-fun-function 'evil-isearch-function) - (point (point)) - search-nonincremental-instead) - (setq isearch-forward forward) - (evil-save-echo-area - (evil-without-input-method-hooks - ;; set the input method locally rather than globally to ensure that - ;; isearch clears the input method when it's finished - (setq current-input-method evil-input-method) - (if forward - (isearch-forward regexp-p) - (isearch-backward regexp-p)) - (evil-push-search-history isearch-string forward) - (setq current-input-method nil)) - (when (/= (point) point) - ;; position the point at beginning of the match only if the call to - ;; `isearch' has really moved the point. `isearch' doesn't move the - ;; point only if "C-g" is hit twice to exit the search, in which case we - ;; shouldn't move the point either. - (when (and forward isearch-other-end) - (goto-char isearch-other-end)) - (when (and (eq point (point)) - (not (string= isearch-string ""))) - (if forward - (isearch-repeat-forward) - (isearch-repeat-backward)) - (isearch-exit) - (when (and forward isearch-other-end) - (goto-char isearch-other-end))) - (evil-flash-search-pattern - (evil-search-message isearch-string forward)))))) - -(defun evil-flash-search-pattern (string &optional all) - "Flash last search matches for duration of `evil-flash-delay'. -If ALL is non-nil, flash all matches. STRING is a message -to display in the echo area." - (let ((lazy-highlight-initial-delay 0) - (isearch-search-fun-function 'evil-isearch-function) - (isearch-case-fold-search case-fold-search) - (disable #'(lambda (&optional _arg) (evil-flash-hook t)))) - (when evil-flash-timer - (cancel-timer evil-flash-timer)) - (unless (or (null string) - (string= string "")) - (evil-echo-area-save) - (evil-echo "%s" string) - (isearch-highlight (match-beginning 0) (match-end 0)) - (when all - (setq isearch-lazy-highlight-wrapped nil - isearch-lazy-highlight-start (point) - isearch-lazy-highlight-end (point)) - (isearch-lazy-highlight-new-loop) - (unless isearch-lazy-highlight-overlays - (isearch-lazy-highlight-update))) - (add-hook 'pre-command-hook #'evil-flash-hook nil t) - (add-hook 'evil-operator-state-exit-hook #'evil-flash-hook nil t) - (add-hook 'pre-command-hook #'evil-clean-isearch-overlays nil t) - (setq evil-flash-timer - (run-at-time evil-flash-delay nil disable))))) - -(defun evil-clean-isearch-overlays () - "Clean isearch overlays unless `this-command' is search." - (remove-hook 'pre-command-hook #'evil-clean-isearch-overlays t) - (unless (memq this-command - '(evil-search-backward - evil-search-forward - evil-search-next - evil-search-previous - evil-search-word-backward - evil-search-word-forward)) - (isearch-clean-overlays))) -(put 'evil-clean-isearch-overlays 'permanent-local-hook t) - -(defun evil-flash-hook (&optional force) - "Disable hightlighting if `this-command' is not search. -Disable anyway if FORCE is t." - (when (or force - ;; to avoid flicker, don't disable highlighting - ;; if the next command is also a search command - (not (memq this-command - '(evil-search-backward - evil-search-forward - evil-search-next - evil-search-previous - evil-search-word-backward - evil-search-word-forward)))) - (evil-echo-area-restore) - (isearch-dehighlight) - (setq isearch-lazy-highlight-last-string nil) - (lazy-highlight-cleanup t) - (when evil-flash-timer - (cancel-timer evil-flash-timer))) - (remove-hook 'pre-command-hook #'evil-flash-hook t) - (remove-hook 'evil-operator-state-exit-hook #'evil-flash-hook t)) -(put 'evil-flash-hook 'permanent-local-hook t) - -(defun evil-search-with-predicate (search-fun pred string bound noerror count) - "Execute a search with a predicate function. -SEARCH-FUN is a search function (e.g. `re-search-forward') and -PREDICATE is a two-argument function satisfying the interface of -`isearch-filter-predicate', or `nil'. STRING, BOUND, NOERROR and -COUNT are passed unchanged to SEARCH-FUN. The first match -satisfying the predicate (or `nil') is returned." - (catch 'done - (while t - (let ((result (funcall search-fun string bound noerror count))) - (cond - ((not result) (throw 'done nil)) - ((not pred) (throw 'done result)) - ((funcall pred (match-beginning 0) (match-end 0)) (throw 'done result))))))) - -(defun evil-search-function (&optional forward regexp-p wrap predicate) - "Return a search function. -If FORWARD is nil, search backward, otherwise forward. -If REGEXP-P is non-nil, the input is a regular expression. -If WRAP is non-nil, the search wraps around the top or bottom -of the buffer. -If PREDICATE is non-nil, it must be a function accepting two -arguments: the bounds of a match, returning non-nil if that match is -acceptable." - `(lambda (string &optional bound noerror count) - (let ((start (point)) - (search-fun ',(if regexp-p - (if forward - 're-search-forward - 're-search-backward) - (if forward - 'search-forward - 'search-backward))) - result) - (setq result (evil-search-with-predicate - search-fun ,predicate string - bound ,(if wrap t 'noerror) count)) - (when (and ,wrap (null result)) - (goto-char ,(if forward '(point-min) '(point-max))) - (unwind-protect - (setq result (evil-search-with-predicate - search-fun ,predicate string bound noerror count)) - (unless result - (goto-char start)))) - result))) - -(defun evil-isearch-function () - "Return a search function for use with isearch. -Based on `isearch-regexp' and `isearch-forward'." - (evil-search-function isearch-forward evil-regexp-search evil-search-wrap 'isearch-filter-predicate)) - -(defun evil-search (string forward &optional regexp-p start) - "Search for STRING and highlight matches. -If FORWARD is nil, search backward, otherwise forward. -If REGEXP-P is non-nil, STRING is taken to be a regular expression. -START is the position to search from; if unspecified, it is -one more than the current position." - (when (and (stringp string) - (not (string= string ""))) - (let* ((orig (point)) - (start (or start - (if forward - (min (point-max) (1+ orig)) - orig))) - (isearch-regexp regexp-p) - (isearch-forward forward) - (case-fold-search - (unless (and search-upper-case - (not (isearch-no-upper-case-p string nil))) - case-fold-search)) - (search-func (evil-search-function - forward regexp-p evil-search-wrap 'isearch-filter-predicate))) - ;; no text properties, thank you very much - (set-text-properties 0 (length string) nil string) - ;; position to search from - (goto-char start) - (setq isearch-string string) - (isearch-update-ring string regexp-p) - (condition-case nil - (funcall search-func string) - (search-failed - (goto-char orig) - (user-error "\"%s\": %s not found" - string (if regexp-p "pattern" "string")))) - ;; always position point at the beginning of the match - (goto-char (match-beginning 0)) - ;; determine message for echo area - (cond - ((and forward (< (point) start)) - (when evil-search-wrap-ring-bell (ding)) - (setq string "Search wrapped around BOTTOM of buffer")) - ((and (not forward) (> (point) start)) - (when evil-search-wrap-ring-bell (ding)) - (setq string "Search wrapped around TOP of buffer")) - (t - (setq string (evil-search-message string forward)))) - (evil-flash-search-pattern string t)))) - -(defun evil-search-word (forward unbounded symbol) - "Search for word near point. -If FORWARD is nil, search backward, otherwise forward. If SYMBOL -is non-nil then the functions searches for the symbol at point, -otherwise for the word at point." - (let ((string (car regexp-search-ring))) - (setq isearch-forward forward) - (cond - ((and (memq last-command - '(evil-search-word-forward - evil-search-word-backward)) - (stringp string) - (not (string= string ""))) - (evil-search string forward t)) - (t - (setq string (evil-find-thing forward (if symbol 'symbol 'evil-word))) - (cond - ((null string) - (user-error "No word under point")) - (unbounded - (setq string (regexp-quote string))) - (t - (setq string - (format (if symbol "\\_<%s\\_>" "\\<%s\\>") - (regexp-quote string))))) - (evil-push-search-history string forward) - (evil-search string forward t))))) - -(defun evil--find-thing (forward thing) - "Return a cons of THING near point as a string and its position. -THING should be a symbol understood by `thing-at-point', -e.g. `symbol' or `word'. If FORWARD is nil, search backward, -otherwise forward. Returns nil if nothing is found." - (let ((move (if forward #'forward-char #'backward-char)) - (end (if forward #'eobp #'bobp)) - string) - (save-excursion - (setq string (thing-at-point thing)) - ;; if there's nothing under point, go forwards - ;; (or backwards) to find it - (while (and (null string) (not (funcall end))) - (funcall move) - (setq string (thing-at-point thing))) - (when (stringp string) - (set-text-properties 0 (length string) nil string)) - (when (> (length string) 0) - (cons string (point)))))) - -(defun evil-find-thing (forward thing) - "Return a THING near point as a string. -THING should be a symbol understood by `thing-at-point', -e.g. `symbol' or `word'. If FORWARD is nil, search backward, -otherwise forward. Returns nil if nothing is found." - (car (evil--find-thing forward thing))) - -(defun evil-find-word (forward) - "Return word near point as a string. -If FORWARD is nil, search backward, otherwise forward. Returns -nil if nothing is found." - (evil-find-thing forward 'word)) - -(defun evil-find-symbol (forward) - "Return word near point as a string. -If FORWARD is nil, search backward, otherwise forward. Returns -nil if nothing is found." - (evil-find-thing forward 'symbol)) - -(defun evil-search-prompt (forward) - "Return the search prompt for the given direction." - (if forward "/" "?")) - -(defun evil-search-message (string forward) - "Prefix STRING with the search prompt." - (format "%s%s" (evil-search-prompt forward) string)) - -(advice-add 'isearch-message-prefix :around #'evil--use-search-prompt) -(defun evil--use-search-prompt (orig-fun &rest args) - "Use `evil-search-prompt'." - (or evil-search-prompt - (apply orig-fun args))) - -(advice-add 'isearch-delete-char :around #'evil--exit-search-when-empty) -(defun evil--exit-search-when-empty (orig-fun &rest args) - "Exit search if no search string." - (cond - ((and evil-search-prompt (string= isearch-string "")) - (let (search-nonincremental-instead) - (setq isearch-success nil) - (isearch-exit))) - (t (apply orig-fun args)))) - -(advice-add 'isearch-lazy-highlight-search :around #'evil--without-search-wrap) -(defun evil--without-search-wrap (orig-fun &rest args) - "Never wrap the search in this context." - (let (evil-search-wrap) - (apply orig-fun args))) - -;;; Ex search - -(defun evil-ex-regex-without-case (re) - "Return the regular expression without all occurrences of \\c and \\C." - (evil-transform-regexp re '((?c . "") (?C . "")))) - -(defun evil-ex-regex-case (re default-case) - "Return the case as implied by \\c or \\C in regular expression RE. -If \\c appears anywhere in the pattern, the pattern is case -insensitive. If \\C appears, the pattern is case sensitive. -Only the first occurrence of \\c or \\C is used, all others are -ignored. If neither \\c nor \\C appears in the pattern, the case -specified by DEFAULT-CASE is used. DEFAULT-CASE should be either -`sensitive', `insensitive' or `smart'. In the latter case, the pattern -will be case-sensitive if and only if it contains an upper-case -letter, otherwise it will be case-insensitive." - (cond - ((string-match "\\(?:^\\|[^\\\\]\\)\\(?:\\\\\\\\\\)*\\\\\\([cC]\\)" re) - (if (eq (aref (match-string 1 re) 0) ?c) 'insensitive 'sensitive)) - ((eq default-case 'smart) - (if (isearch-no-upper-case-p re t) 'insensitive 'sensitive)) - (t default-case))) - -;; a pattern -(defun evil-ex-make-substitute-pattern (regexp flags) - "Create a PATTERN for substitution with FLAGS. -This function respects the values of `evil-ex-substitute-case' -and `evil-ex-substitute-global'." - (evil-ex-make-pattern - regexp - (cond ((memq ?i flags) 'insensitive) - ((memq ?I flags) 'sensitive) - ((not evil-ex-substitute-case) evil-ex-search-case) - (t evil-ex-substitute-case)) - (if (memq ?g flags) - (not evil-ex-substitute-global) - evil-ex-substitute-global))) - -(defun evil-ex-make-search-pattern (regexp) - "Create a PATTERN for search. -This function respects the values of `evil-ex-search-case'." - (evil-ex-make-pattern regexp evil-ex-search-case t)) - -(defun evil-ex-make-pattern (regexp case whole-line) - "Create a new search pattern. -REGEXP is the regular expression to be searched for. CASE should -be either `sensitive', `insensitive' for case-sensitive and -case-insensitive search respectively, or `smart'. In the latter case -the pattern is smart-case, i.e. it is automatically sensitive of the -pattern contains an upper case letter, otherwise it is insensitive. -The input REGEXP is considered a Vim-style regular expression if -`evil-ex-search-vim-style-regexp' is non-nil, in which case it is -transformed to an Emacs style regular expression (i.e. certain -backslash-codes are transformed. Otherwise REGEXP must be an Emacs -style regular expression and is not transformed." - (let ((re (evil-ex-regex-without-case regexp)) - (ignore-case (eq (evil-ex-regex-case regexp case) 'insensitive))) - ;; possibly transform regular expression from vim-style to - ;; Emacs-style. - (if (and evil-ex-search-vim-style-regexp - (not (or (string-prefix-p "\\_<" regexp) - (string-suffix-p "\\_>" regexp)))) - (setq re (evil-transform-vim-style-regexp re)) - ;; Even for Emacs regular expressions we translate certain - ;; whitespace sequences - (setq re (evil-transform-regexp re '((?t . "\t") - (?n . "\n") - (?r . "\r"))))) - (list re ignore-case whole-line))) - -(defun evil-ex-pattern-regex (pattern) - "Return the regular expression of a search PATTERN." - (nth 0 pattern)) - -(defun evil-ex-pattern-ignore-case (pattern) - "Return t if and only if PATTERN should ignore case." - (nth 1 pattern)) - -(defun evil-ex-pattern-whole-line (pattern) - "Return t if and only if PATTERN should match all occurences of a line. -Otherwise PATTERN matches only the first occurence." - (nth 2 pattern)) - -;;; Highlight - -(cl-defstruct (evil-ex-hl (:type vector) (:constructor nil) - (:copier nil) (:predicate nil)) - (name nil :read-only t) pattern - (face nil :read-only t) (window nil :read-only t) - (min nil :documentation "The minimal buffer position of the highlight.") - (max nil :documentation "The maximal buffer position of the highlight.") - (match-hook nil :read-only t) (update-hook nil :read-only t) - (overlays nil :documentation "The active overlays of the highlight.")) - -(cl-defun evil-ex-make-hl - (name &key (face 'evil-ex-lazy-highlight) (win (selected-window)) - min max match-hook update-hook) - "Create a new highlight object with name NAME and properties ARGS. -The following properties are supported: -:face The face to be used for the highlighting overlays. -:win The window in which the highlighting should be shown. - Note that the highlight will be visible in all windows showing - the corresponding buffer, but only the matches visible in the - specified window will actually be highlighted. If :win is nil, - the matches in all windows will be highlighted. -:min The minimal buffer position for highlighted matches. -:max The maximal buffer position for highlighted matches. -:match-hook A hook to be called once for each highlight. - The hook must take two arguments, the highlight and - the overlay for that highlight. -:update-hook A hook called once after updating the highlighting - with two arguments, the highlight and a message string - describing the current match status." - (unless (symbolp name) - (user-error "Expected symbol as name of highlight")) - (when (assq name evil-ex-active-highlights-alist) - (evil-ex-delete-hl name)) - (unless evil-ex-active-highlights-alist - (add-hook 'window-scroll-functions - #'evil-ex-hl-update-highlights-scroll nil t) - (add-hook 'window-size-change-functions - #'evil-ex-hl-update-highlights-resize nil)) - (push (cons name (vector name - nil - face - win - min max - match-hook update-hook - nil)) - evil-ex-active-highlights-alist)) - -(defun evil-ex-delete-hl (name) - "Remove the highlighting object with a certain NAME." - (let ((hl (cdr (assq name evil-ex-active-highlights-alist)))) - (when hl - (mapc #'delete-overlay (evil-ex-hl-overlays hl)) - (setq evil-ex-active-highlights-alist - (assq-delete-all name evil-ex-active-highlights-alist)) - (evil-ex-hl-update-highlights)) - (unless evil-ex-active-highlights-alist - (remove-hook 'window-scroll-functions - #'evil-ex-hl-update-highlights-scroll t) - (remove-hook 'window-size-change-functions - #'evil-ex-hl-update-highlights-resize)))) - -(defun evil-ex-hl-active-p (name) - "Whether the highlight with a certain NAME is active." - (and (assq name evil-ex-active-highlights-alist) t)) - -(defun evil-ex-hl-change (name pattern) - "Set the regular expression of highlight NAME to PATTERN." - (let ((hl (cdr (assq name evil-ex-active-highlights-alist)))) - (when hl - (setf (evil-ex-hl-pattern hl) pattern) - (evil-ex-hl-idle-update)))) - -(defun evil-ex-hl-set-region (name beg end &optional _type) - "Set minimal and maximal position of highlight NAME to BEG and END." - (let ((hl (cdr (assq name evil-ex-active-highlights-alist)))) - (when hl - (setf (evil-ex-hl-min hl) beg - (evil-ex-hl-max hl) end) - (evil-ex-hl-idle-update)))) - -(defun evil-ex-hl-get-max (name) - "Return the maximal position of the highlight with name NAME." - (let ((hl (cdr (assq name evil-ex-active-highlights-alist)))) - (and hl (evil-ex-hl-max hl)))) - -(defun evil-ex-hl-update-highlights () - "Update the overlays of all active highlights." - (dolist (hl (mapcar #'cdr evil-ex-active-highlights-alist)) - (let* ((old-ovs (evil-ex-hl-overlays hl)) - new-ovs - (pattern (evil-ex-hl-pattern hl)) - (case-fold-search (evil-ex-pattern-ignore-case pattern)) - (case-replace case-fold-search) - (face (evil-ex-hl-face hl)) - (match-hook (evil-ex-hl-match-hook hl)) - result) - (if pattern - ;; collect all visible ranges - (let (ranges sranges) - (dolist (win (if (eq evil-ex-interactive-search-highlight - 'all-windows) - (get-buffer-window-list (current-buffer) nil t) - (list (evil-ex-hl-window hl)))) - (when (window-live-p win) - (let ((beg (max (window-start win) - (or (evil-ex-hl-min hl) (point-min)))) - (end (min (window-end win) - (or (evil-ex-hl-max hl) (point-max))))) - (when (< beg end) - (push (cons beg end) ranges))))) - (setq ranges (sort ranges #'car-less-than-car)) - (while ranges - (let ((r1 (pop ranges)) - (r2 (pop ranges))) - (cond - ;; last range - ((null r2) (push r1 sranges)) - ;; ranges overlap, union - ((>= (cdr r1) (car r2)) - (push (cons (car r1) - (max (cdr r1) (cdr r2))) - ranges)) - ;; ranges distinct - (t (push r1 sranges) - (push r2 ranges))))) - - ;; run through all ranges - (condition-case lossage - (save-match-data - (dolist (r sranges) - (let ((beg (car r)) - (end (cdr r))) - (save-excursion - (goto-char beg) - ;; set the overlays for the current highlight, - ;; reusing old overlays (if possible) - (while (and (not (eobp)) - (evil-ex-search-find-next-pattern pattern) - (<= (match-end 0) end) - (not (and (= (match-beginning 0) end) - (save-excursion - (goto-char (match-beginning 0)) - (bolp))))) - (let ((ov (or (pop old-ovs) (make-overlay 0 0)))) - (move-overlay ov (match-beginning 0) (match-end 0)) - (overlay-put ov 'face face) - (overlay-put ov 'evil-ex-hl (evil-ex-hl-name hl)) - (overlay-put ov 'priority 1000) - (push ov new-ovs) - (when match-hook (funcall match-hook hl ov))) - (cond - ((not (or (evil-ex-pattern-whole-line pattern) - (save-excursion - (goto-char (match-beginning 0)) - (search-forward "\n" (match-end 0) t)))) - (forward-line)) - ((= (match-beginning 0) (match-end 0)) - (forward-char)) - (t (goto-char (match-end 0)))))))) - (mapc #'delete-overlay old-ovs) - (setf (evil-ex-hl-overlays hl) new-ovs) - (if (or (null pattern) new-ovs) - (setq result t) - ;; Maybe the match could just not be found somewhere else? - (save-excursion - (goto-char (or (evil-ex-hl-min hl) (point-min))) - (if (and (evil-ex-search-find-next-pattern pattern) - (< (match-end 0) (or (evil-ex-hl-max hl) - (point-max)))) - (setq result (format "Match in line %d" - (line-number-at-pos - (match-beginning 0)))) - (setq result "No match"))))) - - (invalid-regexp (setq result (cadr lossage))) - (search-failed (setq result (nth 2 lossage))) - (error (setq result (format "%s" (cadr lossage)))))) - ;; no pattern, remove all highlights - (mapc #'delete-overlay old-ovs) - (setf (evil-ex-hl-overlays hl) new-ovs)) - (when (evil-ex-hl-update-hook hl) - (funcall (evil-ex-hl-update-hook hl) hl result))))) - -(defun evil-ex-search-find-next-pattern (pattern &optional direction) - "Look for the next occurrence of PATTERN in a certain DIRECTION. -Note that this function ignores the whole-line property of PATTERN." - (setq direction (or direction 'forward)) - (let ((case-fold-search (evil-ex-pattern-ignore-case pattern))) - (cond - ((eq direction 'forward) - (re-search-forward (evil-ex-pattern-regex pattern) nil t)) - ((eq direction 'backward) - (let* ((pnt (point)) - (ret (re-search-backward (evil-ex-pattern-regex pattern) nil t)) - (m (and ret (match-data)))) - (if ret - (forward-char) - (goto-char (point-min))) - (let ((fwdret - (re-search-forward (evil-ex-pattern-regex pattern) nil t))) - (cond - ((and fwdret (< (match-beginning 0) pnt)) - (setq ret fwdret) - (goto-char (match-beginning 0))) - (ret - (set-match-data m) - (goto-char (match-beginning 0))) - (t - (goto-char pnt) - ret))))) - (t (user-error "Unknown search direction `%s'" direction))))) - -(defun evil-ex-hl-idle-update () - "Trigger the timer to update the highlights in the current buffer." - (when (and evil-ex-interactive-search-highlight - evil-ex-active-highlights-alist) - (when evil-ex-hl-update-timer - (cancel-timer evil-ex-hl-update-timer)) - (setq evil-ex-hl-update-timer - (run-at-time evil-ex-hl-update-delay nil - #'evil-ex-hl-do-update-highlight - (current-buffer))))) - -(defun evil-ex-hl-do-update-highlight (&optional buffer) - "Timer function for updating the highlights." - (when (buffer-live-p buffer) - (with-current-buffer buffer - (evil-ex-hl-update-highlights))) - (setq evil-ex-hl-update-timer nil)) - -(defun evil-ex-hl-update-highlights-scroll (win _beg) - "Update highlights after scrolling in some window." - (with-current-buffer (window-buffer win) - (evil-ex-hl-idle-update))) -(put 'evil-ex-hl-update-highlights-scroll 'permanent-local-hook t) - -(defun evil-ex-hl-update-highlights-resize (frame) - "Update highlights after resizing a window." - (let ((buffers (delete-dups (mapcar #'window-buffer (window-list frame))))) - (dolist (buf buffers) - (with-current-buffer buf - (evil-ex-hl-idle-update))))) -(put 'evil-ex-hl-update-highlights-resize 'permanent-local-hook t) - -;; interactive search -(defun evil-ex-search-activate-highlight (pattern) - "Activate highlighting of the search pattern set to PATTERN. -This function does nothing if `evil-ex-search-interactive' or -`evil-ex-search-highlight-all' is nil. " - (when (and evil-ex-search-interactive evil-ex-search-highlight-all) - (with-current-buffer (or evil-ex-original-buffer (current-buffer)) - (unless (evil-ex-hl-active-p 'evil-ex-search) - (evil-ex-make-hl 'evil-ex-search - :win (or (minibuffer-selected-window) (selected-window)))) - (when pattern - (evil-ex-hl-change 'evil-ex-search pattern))))) - -(defun evil-ex-search (&optional count) - "Search forward or backward COUNT times for the current Ex search pattern. -The search pattern is determined by `evil-ex-search-pattern', and the -direction by `evil-ex-search-direction'." - (setq evil-ex-search-start-point (point) - evil-ex-last-was-search t - count (or count 1)) - (let ((orig (point)) - wrapped) - (dotimes (_ (or count 1)) - (when (and (eq evil-ex-search-direction 'forward) (not (eobp))) - (forward-char) - ;; maybe skip end-of-line - (and (not evil-move-beyond-eol) (eolp) (not (eobp)) - (forward-char))) - (let ((res (evil-ex-find-next nil nil (not evil-search-wrap)))) - (cond - ((not res) - (goto-char orig) - (signal 'search-failed - (list (evil-ex-pattern-regex evil-ex-search-pattern)))) - ((eq res 'wrapped) (setq wrapped t))))) - (if wrapped - (let (message-log-max) - (when evil-search-wrap-ring-bell (ding)) - (message "Search wrapped"))) - (goto-char (match-beginning 0)) - (setq evil-ex-search-match-beg (match-beginning 0) - evil-ex-search-match-end (match-end 0)) - (evil-ex-search-goto-offset evil-ex-search-offset) - (evil-ex-search-activate-highlight evil-ex-search-pattern))) - -(defun evil-ex-find-next (&optional pattern direction nowrap) - "Search for the next occurrence of the PATTERN in DIRECTION. -PATTERN must be created using `evil-ex-make-pattern', DIRECTION is -either `forward' or `backward'. If NOWRAP is non-nil, the search does -not wrap at buffer boundaries. Furthermore this function only searches -invisible text if `search-invisible' is t. If PATTERN is not specified -the current global pattern `evil-ex-search-pattern' and if DIRECTION -is not specified the current global direction -`evil-ex-search-direction' is used. This function returns t if the -search was successful, nil if it was unsuccessful and `wrapped' if the -search was successful but wrapped around at buffer boundaries." - (setq pattern (or pattern evil-ex-search-pattern) - direction (or direction evil-ex-search-direction)) - (unless (and pattern (evil-ex-pattern-regex pattern)) - (signal 'search-failed (list "No search pattern"))) - (catch 'done - (let (wrapped) - (while t - (if (evil-ex-search-find-next-pattern pattern direction) - (when (or (eq search-invisible t) - (not (isearch-range-invisible - (match-beginning 0) (match-end 0)))) - ;; Successful search and not invisible - (throw 'done (if wrapped 'wrapped t))) - ;; Unsuccessful search - (if nowrap - (throw 'done nil) - (setq nowrap t - wrapped t) - (goto-char (if (eq direction 'forward) - (point-min) - (point-max))))))))) - -(defun evil-ex-search-update (pattern offset beg end) - "Update the highlighting for the search pattern. -PATTERN is the search pattern and OFFSET the associated offset. -BEG and END specify the current match." - (cond - ((and beg end) - ;; update overlay - (if evil-ex-search-overlay - (move-overlay evil-ex-search-overlay beg end) - (setq evil-ex-search-overlay (make-overlay beg end)) - (overlay-put evil-ex-search-overlay 'priority 1001) - (overlay-put evil-ex-search-overlay 'face 'evil-ex-search)) - ;; move point - (goto-char beg) - (evil-ex-search-goto-offset offset) - ;; update highlights - (when evil-ex-search-highlight-all - (evil-ex-hl-change 'evil-ex-search pattern))) - (t - ;; no match - (when evil-ex-search-overlay - ;; remove overlay - (delete-overlay evil-ex-search-overlay) - (setq evil-ex-search-overlay nil)) - ;; no highlights - (when evil-ex-search-highlight-all - (evil-ex-hl-change 'evil-ex-search nil)) - ;; and go to initial position - (goto-char evil-ex-search-start-point)))) - -(defvar evil--ex-search-update-timer nil - "Timer to coalesce `evil-ex-search-update-pattern' calls after pattern changes.") - -(defun evil-ex-search-after-change-function (_beg _end _old-len) - (when evil--ex-search-update-timer - (cancel-timer evil--ex-search-update-timer)) - (setq evil--ex-search-update-timer - (run-with-idle-timer 0 nil #'evil-ex-search-update-pattern))) - -(defun evil-ex-search-start-session () - "Initialize Ex for interactive search." - (add-hook 'pre-command-hook #'evil-ex-remove-default nil t) - (and evil-ex-search-interactive evil-ex-search-incremental - (add-hook 'after-change-functions - #'evil-ex-search-after-change-function nil t)) - (add-hook 'minibuffer-exit-hook #'evil-ex-search-stop-session nil t) - (add-hook 'mouse-leave-buffer-hook #'evil-ex-search-exit) - (evil-ex-search-activate-highlight nil)) - -(defvar evil-ex-search-yank-point nil) - -(defun evil-ex-search-stop-session () - "Stop interactive search." - (with-current-buffer evil-ex-original-buffer - ;; TODO: This is a bad fix to remove duplicates. The duplicates - ;; exist because `isearch-range-invisible' may add a single - ;; overlay multiple times if we are in an unlucky situation - ;; of overlapping overlays. This happens in our case because - ;; of the overlays that are used for (lazy) highlighting. - ;; Perhaps it would be better to disable those overlays - ;; temporarily before calling `isearch-range-invisible'. - (setq isearch-opened-overlays (delete-dups isearch-opened-overlays)) - (isearch-clean-overlays)) - (remove-hook 'mouse-leave-buffer-hook #'evil-ex-search-exit) - (when evil--ex-search-update-timer - (cancel-timer evil--ex-search-update-timer) - (setq evil--ex-search-update-timer nil)) - (when evil-ex-search-overlay - (delete-overlay evil-ex-search-overlay) - (setq evil-ex-search-overlay nil)) - (setq evil-ex-search-yank-point nil)) - -(defun evil-ex-split-search-pattern (pattern direction) - "Split PATTERN in regexp, offset and next-pattern parts. -Return a triplet (REGEXP OFFSET NEXT-SEARCH)." - (if (string-match - (if (eq direction 'forward) - "\\(?:^\\|[^\\\\]\\)\\(?:\\\\\\\\\\)*\\(/\\([^;]*\\)\\(?:;\\([/?].*\\)?\\)?\\)?$" - "\\(?:^\\|[^\\\\]\\)\\(?:\\\\\\\\\\)*\\(\\?\\([^;]*\\)\\(?:;\\([/?].*\\)?\\)?\\)?$") - pattern) - (list (substring pattern 0 (match-beginning 1)) - (match-string 2 pattern) - (match-string 3 pattern)) - (list pattern nil nil))) - -(defun evil-ex-search-full-pattern (string count direction) - "Search for a full search pattern STRING in DIRECTION. -This function splits STRING into \"pattern/offset/;next-pattern\" -parts and performs the search in DIRECTION which must be either -`forward' or `backward'. The first search is repeated COUNT times. If -the pattern part of STRING is empty, the last global pattern stored in -`evil-ex-search-pattern' is used instead if in addition the offset -part is nil (i.e. no pattern/offset separator), the last global offset -stored in `evil-ex-search-offset' is used as offset. The current match -data will correspond to the last successful match. This function -returns a triplet (RESULT PATTERN OFFSET) where RESULT is one of - - t the search was successful without wrapping - `wrap' the search was successful with wrapping - `empty-pattern' the last pattern was empty - nil the search was unsuccessful - -and PATTERN and OFFSET are the last pattern and offset this -function searched for. Note that this function does not handle -any error conditions." - (setq count (or count 1)) - (catch 'done - (while t - (let* ((res (evil-ex-split-search-pattern string direction)) - (pat (pop res)) - (offset (pop res)) - (next-pat (pop res)) - (orig-pat pat) - new-dir repeat-last wrapped) - (if (> (length pat) 0) - (setq pat (evil-ex-make-search-pattern pat)) - ;; use last pattern if no new pattern has been specified - (setq pat (or evil-ex-search-pattern - (throw 'done (list 'empty-pattern pat offset))) - offset (or offset evil-ex-search-offset))) - (while (> count 0) - (when (eq (or (evil-ex-find-next pat direction - (not evil-search-wrap)) - (throw 'done (list nil pat offset))) - 'wrapped) - (setq wrapped t)) - (setq count (1- count))) - (cond - ;; no next pattern, search complete - ((zerop (length next-pat)) - (evil-ex-search-goto-offset offset) - (throw 'done (list (if wrapped 'wrap t) pat offset))) - ;; single \"?\" or \"/\" means repeat last pattern and finish - ((= 1 (length next-pat)) - (evil-ex-search-goto-offset offset) - (setq new-dir (if (string= "/" next-pat) 'forward 'backward) - count (if (eq direction new-dir) 1 2) - string orig-pat - direction new-dir)) - ;; next non-empty pattern, next search iteration - (t (evil-ex-search-goto-offset offset) - (setq new-dir (if (= (aref next-pat 0) ?/) 'forward 'backward) - repeat-last (when (<= 2 (length next-pat)) - (member (substring next-pat 0 2) '("//" "??"))) - count (if (or (eq direction new-dir) (not repeat-last)) 1 2) - string (if repeat-last - (concat orig-pat (substring next-pat 1)) - (substring next-pat 1)) - direction new-dir))))))) - -(defun evil-ex-search-update-pattern () - "Update the current search pattern." - (let ((pattern-string (minibuffer-contents-no-properties)) - message) - (with-selected-window (minibuffer-selected-window) - (goto-char (1+ evil-ex-search-start-point)) - (condition-case err - (cl-destructuring-bind (success pattern offset) - (evil-ex-search-full-pattern pattern-string - (or evil-ex-search-count 1) - evil-ex-search-direction) - (cond - ((eq success 'wrap) - (evil-ex-search-update pattern offset - (match-beginning 0) (match-end 0)) - (setq message "Wrapped")) - ((eq success 'empty-pattern) - (evil-ex-search-update nil nil nil nil)) - (success - (evil-ex-search-update pattern offset - (match-beginning 0) (match-end 0))) - (t (evil-ex-search-update nil nil nil nil) - (setq message "Search failed")))) - (invalid-regexp - (evil-ex-search-update nil nil nil nil) - (setq message (cadr err))) - (error - (evil-ex-search-update nil nil nil nil) - (setq message (error-message-string err))))) - (when message (evil-ex-echo "%s" message)))) - -(defun evil-ex-search-exit () - "Exit interactive search, keeping lazy highlighting active." - (interactive) - (exit-minibuffer)) - -(defun evil-ex-search-abort () - "Abort interactive search, disabling lazy highlighting." - (interactive) - (evil-ex-delete-hl 'evil-ex-search) - (abort-recursive-edit)) - -(defun evil-ex-search-goto-offset (offset) - "Move point according to search OFFSET and set `evil-this-type' accordingly. -This function assumes that the current match data represents the -current search result." - (unless (zerop (length offset)) - (let ((beg (match-beginning 0)) - (end (match-end 0))) - (save-match-data - (unless (string-match - "^\\([esb]\\)?\\(\\([-+]\\)?\\([0-9]*\\)\\)$" - offset) - (user-error "Invalid search offset: %s" offset)) - (let ((count (if (= (match-beginning 4) (match-end 4)) - (cond - ((not (match-beginning 3)) 0) - ((= (aref offset (match-beginning 3)) ?+) +1) - (t -1)) - (string-to-number (match-string 2 offset))))) - (cond - ((not (match-beginning 1)) - (setq evil-this-type 'line) - (forward-line count)) - ((= (aref offset (match-beginning 1)) ?e) - (goto-char (+ end count -1)) - (setq evil-this-type 'inclusive)) - ((memq (aref offset (match-beginning 1)) '(?s ?b)) - (goto-char (+ beg count)) - (setq evil-this-type 'inclusive)))))))) - -(defun evil-ex-start-search (direction count) - "Start a new search in a certain DIRECTION." - (setq evil-ex-search-count count - evil-ex-search-direction direction - evil-ex-search-start-point (point) - evil-ex-last-was-search t) - ;; store buffer and window where the search started - (let* ((evil-ex-original-buffer (current-buffer)) - ;; read the search string - (minibuffer-local-map evil-ex-search-keymap) - (search-string - (condition-case err - (minibuffer-with-setup-hook #'evil-ex-search-start-session - (read-string - (if (eq evil-ex-search-direction 'forward) "/" "?") - (when evil-ex-search-history - (propertize (car evil-ex-search-history) 'face 'shadow)) - 'evil-ex-search-history)) - (quit - (evil-ex-delete-hl 'evil-ex-search) - (goto-char evil-ex-search-start-point) - (signal (car err) (cdr err)))))) - ;; pattern entered successful - (goto-char (if (eq evil-ex-search-direction 'forward) - (1+ evil-ex-search-start-point) - (1- evil-ex-search-start-point))) - (cl-destructuring-bind (success pattern offset) - (evil-ex-search-full-pattern search-string - evil-ex-search-count - evil-ex-search-direction) - (setq evil-ex-search-pattern pattern - evil-ex-search-offset offset) - (cond - ((memq success '(t wrap)) - (goto-char (match-beginning 0)) - (setq evil-ex-search-match-beg (match-beginning 0) - evil-ex-search-match-end (match-end 0)) - (evil-ex-search-goto-offset offset) - (evil-push-search-history search-string (eq direction 'forward)) - (if evil-ex-search-incremental - (unless evil-ex-search-persistent-highlight - (evil-ex-delete-hl 'evil-ex-search)) - (when evil-ex-search-highlight-all - (evil-ex-search-activate-highlight pattern)))) - (t - (goto-char evil-ex-search-start-point) - (evil-ex-delete-hl 'evil-ex-search) - (signal 'search-failed (list search-string))))))) - -(declare-function evil-ex-search-next "evil-commands") -(defun evil-ex-start-word-search (unbounded direction count &optional symbol) - "Search for the symbol under point. -The search matches the COUNT-th occurrence of the word. If the -UNBOUNDED argument is nil, the search matches only at symbol -boundaries, otherwise it matches anywhere. The DIRECTION -argument should be either `forward' or `backward', determining -the search direction. If SYMBOL is non-nil then the functions -searches for the symbol at point, otherwise for the word at -point." - (let* ((string (or (evil-find-thing (eq direction 'forward) - (if symbol 'symbol 'word)) - (user-error "No word under point"))) - (regex (if unbounded - (regexp-quote string) - (format (if symbol "\\_<%s\\_>" "\\<%s\\>") - (regexp-quote string))))) - (setq evil-ex-search-count count - evil-ex-search-direction direction - evil-ex-search-pattern - (let (evil-ex-search-vim-style-regexp) - (evil-ex-make-search-pattern regex)) - evil-ex-search-offset nil - evil-ex-last-was-search t) - ;; update search history unless this pattern equals the - ;; previous pattern - (unless (equal regex (car evil-ex-search-history)) - (push regex evil-ex-search-history)) - (evil-push-search-history regex (eq direction 'forward))) - (evil-ex-delete-hl 'evil-ex-search) - (evil-ex-search-next count)) - -;; substitute -(evil-ex-define-argument-type substitution - "A substitution pattern argument /pattern/replacement/flags. -This handler highlights the pattern of the current substitution." - :runner - (lambda (flag &optional arg) - (with-current-buffer evil-ex-original-buffer - (cond - ((eq flag 'start) - (evil-ex-make-hl - 'evil-ex-substitute - :face 'evil-ex-substitute-matches - :win (minibuffer-selected-window) - :update-hook #'evil-ex-pattern-update-ex-info - :match-hook (and evil-ex-substitute-interactive-replace - #'evil-ex-pattern-update-replacement)) - (setq flag 'update)) - ((eq flag 'stop) - (evil-ex-delete-hl 'evil-ex-substitute))) - - (when (and (eq flag 'update) - evil-ex-substitute-highlight-all - (> (length arg) 0)) - (condition-case err - (cl-destructuring-bind (pattern replacement _flags) - (evil-ex-get-substitute-info (or arg "") t) - (evil-ex-hl-change 'evil-ex-substitute pattern) - (setq evil-ex-substitute-current-replacement replacement) - (cl-destructuring-bind (beg end &rest) - (if evil-ex-range - (evil-expand-range evil-ex-range t) - (evil-range (line-beginning-position) (line-end-position) - 'line :expanded t)) - (evil-ex-hl-set-region 'evil-ex-substitute beg end))) - (end-of-file (evil-ex-echo "Incomplete replacement")) - (user-error (evil-ex-echo (error-message-string err)))))))) - -(defun evil-ex-pattern-update-ex-info (_hl result) - "Update the Ex info string." - (when (stringp result) - (evil-ex-echo "%s" result))) - -(defun evil-ex-pattern-update-replacement (_hl overlay) - "Update the replacement display." - (let ((repl (if evil-ex-substitute-current-replacement - (evil-match-substitute-replacement - evil-ex-substitute-current-replacement - (not case-replace)) - ""))) - (put-text-property 0 (length repl) - 'face 'evil-ex-substitute-replacement - repl) - (overlay-put overlay 'after-string repl))) - -(defun evil-ex-parse-global (string) - "Parse STRING as a global argument." - (let* ((pattern (nth 0 (evil-delimited-arguments string 2))) - (command (and pattern - (>= (- (length string) (length pattern)) 2) - (substring string (+ (length pattern) 2))))) - ;; use last pattern if none given - (when (zerop (length pattern)) - (setq pattern - (cond - ((and (eq evil-search-module 'evil-search) evil-ex-search-pattern) - (evil-ex-pattern-regex evil-ex-search-pattern)) - ((and (eq evil-search-module 'isearch) (not (zerop (length isearch-string)))) - isearch-string) - (t (user-error "No previous pattern"))))) - (list pattern command))) - -(defun evil-ex-get-substitute-info (string &optional implicit-r) - "Return the substitution info of :substitute argument STRING. -The result is a triplet \(PATTERN REPLACEMENT FLAGS). PATTERN is an -Ex-pattern (see `evil-ex-make-pattern') and REPLACEMENT is a compiled -replacement expression (see `evil-compile-replacement'). The -information returned is the actual substitution information w.r.t. to -special situations like empty patterns or repetition of previous -substitution commands. If IMPLICIT-R is non-nil, then the \"r\" flag -is assumed, i.e. in case of an empty pattern the last search pattern -is used. It is meant for :substitute commands with arguments." - (let (pattern replacement flags using-prev-pattern) - (cond - ((or (string= string "") (string-match-p "\\`[a-zA-Z]" string)) - ;; No pattern, since it starts with a letter which cannot be a - ;; separator: Repeat last substitute. - (setq replacement evil-ex-substitute-replacement) - ;; flags are everything that is not whitespace - (when (string-match "[^[:space:]]+" string) - (setq flags (match-string 0 string)))) - (t (let ((args (evil-delimited-arguments string 3))) - (setq pattern (pop args) - replacement (pop args) - flags (pop args)) - ;; if replacment equals "~" use previous replacement - (setq replacement (if (equal replacement "~") - evil-ex-substitute-replacement - (evil-compile-replacement replacement))) - ;; append implicit "r" flag if required - (when (and implicit-r (not (memq ?r (append flags nil)))) - (setq flags (concat flags "r")))))) - ;; if flags equals "&" add previous flags - (setq flags - (if (and (> (length flags) 0) (= (aref flags 0) ?&)) - (append (substring flags 1) evil-ex-substitute-flags) - (append flags nil))) - ;; if no pattern, use previous pattern, either search or - ;; substitute pattern depending on `evil-ex-last-was-search' and - ;; the r flag - (when (zerop (length pattern)) - (setq pattern - (if (eq evil-search-module 'evil-search) - (if (and evil-ex-last-was-search (memq ?r flags)) - (and evil-ex-search-pattern - (setq using-prev-pattern t) - (evil-ex-pattern-regex evil-ex-search-pattern)) - (and evil-ex-substitute-pattern - (setq using-prev-pattern t) - (evil-ex-pattern-regex evil-ex-substitute-pattern))) - (if (eq case-fold-search t) - isearch-string - (concat isearch-string "\\C"))) - flags (remq ?r flags))) - (when (and using-prev-pattern - (not (evil-ex-pattern-ignore-case evil-ex-search-pattern))) - (setq pattern (concat pattern "\\C"))) - ;; generate pattern - (when pattern - ;; Disable vim-style regexp conversion if using a previous pattern, because - ;; this conversion will already have been done before storing it - (let ((evil-ex-search-vim-style-regexp (and evil-ex-search-vim-style-regexp - (not using-prev-pattern)))) - (setq pattern (evil-ex-make-substitute-pattern pattern flags)))) - (list pattern replacement flags))) - -(defun evil-ex-nohighlight () - "Disable the active search highlightings." - (interactive) - (evil-ex-delete-hl 'evil-ex-substitute) - (evil-ex-delete-hl 'evil-ex-search)) - -(defun evil-search-yank-word () - "Pull next word from buffer into search string." - (interactive) - (let ((minibuf-content (minibuffer-contents-no-properties)) - (word "") start) - (with-current-buffer evil-ex-original-buffer - ;; Start to initial point if C-w have never been hit. - (unless evil-ex-search-yank-point - (if (string= "" minibuf-content) - (setq evil-ex-search-yank-point evil-ex-search-start-point) - (setq evil-ex-search-yank-point (point)))) - (save-excursion - (goto-char evil-ex-search-yank-point) - (setq start (point)) - (when (looking-at-p (regexp-quote minibuf-content)) - (forward-char (length minibuf-content)) - (setq start (point)) - (forward-word)) - (setq word (buffer-substring-no-properties start (point))))) - (and (eq evil-ex-search-case 'smart) - (let (case-fold-search) - (not (string-match-p "[A-Z]" minibuf-content))) - (setq word (downcase word))) - (insert word))) - -(provide 'evil-search) - -;;; evil-search.el ends here diff --git a/.config/emacs/lisp/evil/evil-states.el b/.config/emacs/lisp/evil/evil-states.el deleted file mode 100644 index 499154e..0000000 --- a/.config/emacs/lisp/evil/evil-states.el +++ /dev/null @@ -1,930 +0,0 @@ -;;; evil-states.el --- States -*- lexical-binding: t -*- - -;; Author: Vegard Øye -;; Maintainer: Vegard Øye - -;; Version: 1.15.0 - -;; -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -;;; Code: - -(require 'evil-core) - -;;; Normal state - -(evil-define-state normal - "Normal state. -AKA \"Command\" state." - :tag " " - :enable (motion) - (cond - ((evil-normal-state-p) - (overwrite-mode -1) - (add-hook 'post-command-hook #'evil-normal-post-command nil t)) - (t - (remove-hook 'post-command-hook #'evil-normal-post-command t)))) - -(defun evil-normal-post-command (&optional command) - "Reset command loop variables in Normal state. -Also prevent point from reaching the end of the line. -If the region is activated, enter Visual state." - (unless (null this-command) - (setq command (or command this-command)) - (when (evil-normal-state-p) - (setq evil-this-type nil - evil-this-operator nil - evil-this-motion nil - evil-this-motion-count nil - evil-inhibit-operator nil - evil-inhibit-operator-value nil) - (unless (memq command '(evil-use-register - digit-argument - negative-argument - universal-argument - universal-argument-minus - universal-argument-more - universal-argument-other-key)) - (setq evil-this-register nil)) - (evil-adjust-cursor)))) -(put 'evil-normal-post-command 'permanent-local-hook t) - -;;; Insert state - -(defun evil-maybe-remove-spaces (&optional do-remove) - "Remove space from newly opened empty line. -This function removes (indentation) spaces that have been -inserted by opening a new empty line. The behavior depends on the -variable `evil-maybe-remove-spaces'. If this variable is nil the -function does nothing. Otherwise the behavior depends on -DO-REMOVE. If DO-REMOVE is non-nil the spaces are -removed. Otherwise `evil-maybe-remove-spaces' is set to nil -unless the last command opened yet another new line. - -This function should be added as a post-command-hook to track -commands opening a new line." - (cond - ((not evil-maybe-remove-spaces) - (remove-hook 'post-command-hook #'evil-maybe-remove-spaces)) - (do-remove - (when (save-excursion - (beginning-of-line) - (looking-at "^\\s-*$")) - (delete-region (line-beginning-position) - (line-end-position))) - (setq evil-maybe-remove-spaces nil) - (remove-hook 'post-command-hook #'evil-maybe-remove-spaces)) - ((not (memq this-command - '(evil-open-above - evil-open-below - evil-append - evil-append-line - evil-change-whole-line - newline - newline-and-indent - indent-and-newline))) - (setq evil-maybe-remove-spaces nil) - (remove-hook 'post-command-hook #'evil-maybe-remove-spaces)))) - -(evil-define-state insert - "Insert state." - :tag " " - :cursor (bar . 2) - :message "-- INSERT --" - :entry-hook (evil-start-track-last-insertion) - :exit-hook (evil-cleanup-insert-state evil-stop-track-last-insertion) - :input-method t - (cond - ((evil-insert-state-p) - (add-hook 'post-command-hook #'evil-maybe-remove-spaces) - (add-hook 'pre-command-hook #'evil-insert-repeat-hook) - (setq evil-maybe-remove-spaces t) - (unless (eq evil-want-fine-undo t) - (evil-start-undo-step))) - (t - (remove-hook 'post-command-hook #'evil-maybe-remove-spaces) - (remove-hook 'pre-command-hook #'evil-insert-repeat-hook) - (evil-maybe-remove-spaces t) - (setq evil-insert-repeat-info evil-repeat-info) - (evil-set-marker ?^ nil t) - (unless (eq evil-want-fine-undo t) - (evil-end-undo-step)) - (when (or (evil-normal-state-p evil-next-state) - (evil-motion-state-p evil-next-state)) - (evil-move-cursor-back - (and (eolp) (not evil-move-beyond-eol))))))) - -(defun evil-insert-repeat-hook () - "Record insertion keys in `evil-insert-repeat-info'." - (setq evil-insert-repeat-info (last evil-repeat-info)) - (remove-hook 'pre-command-hook #'evil-insert-repeat-hook)) -(put 'evil-insert-repeat-hook 'permanent-local-hook t) - -(eval-when-compile - ;; TODO remove this once support for emacs 26 is dropped - (unless (fboundp 'combine-change-calls) - (defmacro combine-change-calls (_beg _end &rest body) `(progn ,@body)))) -(declare-function evil-execute-repeat-info "evil-repeat") -(defun evil-cleanup-insert-state () - "Called when Insert or Replace state is about to be exited. -Handles the repeat-count of the insertion command." - (when evil-insert-count - (let (pre-command-hook post-command-hook) - (dotimes (_ (1- evil-insert-count)) - (when evil-insert-lines - (evil-insert-newline-below) - (when evil-auto-indent - (indent-according-to-mode))) - (evil-execute-repeat-info (cdr evil-insert-repeat-info))))) - (when evil-insert-vcount - (let ((buffer-invisibility-spec - (if (listp buffer-invisibility-spec) - ;; make all lines hidden by hideshow temporarily visible - (cl-remove-if (lambda (x) (eq (or (car-safe x) x) 'hs)) - buffer-invisibility-spec) - buffer-invisibility-spec))) - (cl-destructuring-bind (line col vcount) evil-insert-vcount - (save-excursion - (combine-change-calls ; For performance - (progn (goto-char (point-min)) - (line-beginning-position line)) - (line-end-position (+ line vcount -1)) - (let (pre-command-hook post-command-hook) ; For performance - (dotimes (v (1- vcount)) - (goto-char (point-min)) - (forward-line (+ line v)) - (when (or (not evil-insert-skip-empty-lines) - (not (integerp col)) - (save-excursion - (evil-move-end-of-line) - (>= (current-column) col))) - (if (integerp col) - (move-to-column col t) - (funcall col)) - (dotimes (_ (or evil-insert-count 1)) - (evil-execute-repeat-info (cdr evil-insert-repeat-info))))))))))) - (and evil-want-fine-undo (evil-end-undo-step))) - -;;; Visual state - -;; Visual selections are implemented in terms of types, and are -;; compatible with the Emacs region. This is achieved by "translating" -;; the region to the selected text right before a command is executed. -;; If the command is a motion, the translation is postponed until a -;; non-motion command is invoked (distinguished by the :keep-visual -;; command property). -;; -;; Visual state activates the region, enabling Transient Mark mode if -;; not already enabled. This is only temporay: if Transient Mark mode -;; was disabled before entering Visual state, it is disabled when -;; exiting Visual state. This allows Visual state to harness the -;; "transient" behavior of many commands without overriding the user's -;; preferences in other states. - -(defmacro evil-define-visual-selection (selection doc &rest body) - "Define a Visual selection SELECTION. -Creates a command evil-visual-SELECTION for enabling the selection. -DOC is the function's documentation string. The following keywords -may be specified in BODY: - -:message STRING Status message when enabling the selection. -:type TYPE Type to use (defaults to SELECTION). - -Following the keywords is optional code which is executed each time -the selection is enabled. - -\(fn SELECTION DOC [[KEY VAL]...] BODY...)" - (declare (indent defun) - (doc-string 2) - (debug (&define name stringp - [&rest keywordp sexp] - def-body))) - (let* ((name (intern (format "evil-visual-%s" selection))) - (message (intern (format "%s-message" name))) - (tagvar (intern (format "%s-tag" name))) - (type selection) - (tag " ") - arg key string) - ;; collect keywords - (while (keywordp (car-safe body)) - (setq key (pop body) - arg (pop body)) - (cond - ((eq key :message) - (setq string arg)) - ((eq key :type) - (setq type arg)) - ((eq key :tag) - (setq tag arg)))) - ;; macro expansion - `(progn - (add-to-list 'evil-visual-alist (cons ',selection ',name)) - (defvar ,name ',type ,(format "*%s" doc)) - (defvar ,message ,string ,doc) - (defvar ,tagvar ,tag ,doc) - (evil-define-command ,name (&optional mark point type message) - ,@(when doc `(,doc)) - :keep-visual t - :repeat nil - (interactive - (list nil nil - (if (and (evil-visual-state-p) - (eq evil-visual-selection ',selection)) - 'exit ,name) t)) - (setq evil--region-from-mouse nil) - (if (eq type 'exit) - (evil-exit-visual-state) - (setq type (or type ,name) - evil-visual-selection ',selection) - (evil-visual-make-region mark point type message) - ,@body)) - ',selection))) - -(evil-define-visual-selection char - "Characterwise selection." - :type inclusive - :message "-- VISUAL --" - :tag " ") - -(evil-define-visual-selection line - "Linewise selection." - :message "-- VISUAL LINE --" - :tag " ") - -(evil-define-visual-selection screen-line - "Linewise selection in `visual-line-mode'." - :message "-- SCREEN LINE --" - :tag " ") - -(evil-define-visual-selection block - "Blockwise selection." - :message "-- VISUAL BLOCK --" - :tag " " - (evil-transient-mark -1) - ;; refresh the :corner property - (setq evil-visual-properties - (plist-put evil-visual-properties :corner - (evil-visual-block-corner)))) - -(evil-define-state visual - "Visual state." - :tag 'evil-visual-tag - :enable (motion normal) - :message 'evil-visual-message - (cond - ((evil-visual-state-p) - (evil-save-transient-mark-mode) - (setq select-active-regions nil) - (cond - ((region-active-p) - (if (< (evil-visual-direction) 0) - (evil-visual-select (region-beginning) (region-end) - evil-visual-char - (evil-visual-direction)) - (evil-visual-make-selection (mark t) (point) - evil-visual-char)) - (evil-visual-highlight)) - (t - (evil-visual-make-region (point) (point) evil-visual-char))) - (add-hook 'pre-command-hook #'evil-visual-pre-command nil t) - (add-hook 'post-command-hook #'evil-visual-post-command nil t) - (add-hook 'deactivate-mark-hook #'evil-visual-deactivate-hook nil t)) - (t - ;; Postpone deactivation of region if next state is Insert. - ;; This gives certain insertion commands (auto-pairing characters, - ;; for example) an opportunity to access the region. - (if (and (eq evil-next-state 'insert) - (eq evil-visual-selection 'char)) - (add-hook 'evil-normal-state-entry-hook - #'evil-visual-deactivate-hook nil t) - (evil-visual-deactivate-hook)) - (setq evil-visual-region-expanded nil) - (remove-hook 'pre-command-hook #'evil-visual-pre-command t) - (remove-hook 'post-command-hook #'evil-visual-post-command t) - (remove-hook 'deactivate-mark-hook #'evil-visual-deactivate-hook t) - (evil-visual-highlight -1)))) - -(defun evil-visual-pre-command (&optional command) - "Run before each COMMAND in Visual state. -Expand the region to the selection unless COMMAND is a motion." - (when (evil-visual-state-p) - (setq command (or command this-command)) - (if (and evil-transient-mouse-selection - evil--region-from-mouse - (not (rassq command evil-visual-alist))) - (progn (setq evil--region-from-mouse nil) - (evil-exit-visual-state)) - (when (and evil-transient-mouse-selection - evil--region-from-mouse - (rassq command evil-visual-alist)) - (setq evil-visual-selection nil ;; maintain visual state - evil--region-from-mouse nil)) - (when evil-visual-x-select-timer - (cancel-timer evil-visual-x-select-timer)) - (unless (evil-get-command-property command :keep-visual) - (evil-visual-update-x-selection) - (evil-visual-expand-region - ;; exclude final newline from linewise selection - ;; unless the command has real need of it - (and (eq (evil-visual-type) 'line) - (evil-get-command-property command :exclude-newline))))))) - -(put 'evil-visual-pre-command 'permanent-local-hook t) - -(defun evil-visual-post-command (&optional command) - "Run after each COMMAND in Visual state. -If COMMAND is a motion, refresh the selection; -otherwise exit Visual state." - (when (evil-visual-state-p) - (setq command (or command this-command)) - (if (or quit-flag - (memq command '(keyboard-quit keyboard-escape-quit)) - ;; Is `mark-active' nil for an unexpanded region? - deactivate-mark - (and (not evil-visual-region-expanded) - (not (region-active-p)) - (not (eq evil-visual-selection 'block)) - transient-mark-mode)) - (progn - (evil-exit-visual-state) - (evil-adjust-cursor)) - (if evil-visual-region-expanded - (evil-visual-contract-region) - (evil-visual-refresh)) - (setq evil-visual-x-select-timer - (run-with-idle-timer evil-visual-x-select-timeout nil - #'evil-visual-update-x-selection - (current-buffer))) - (evil-visual-highlight)))) -(put 'evil-visual-post-command 'permanent-local-hook t) - -(defun evil-visual-update-x-selection (&optional buffer) - "Update the X selection with the current visual region of BUFFER." - (let ((buf (or buffer (current-buffer)))) - (when (and evil-visual-update-x-selection-p - (buffer-live-p buf) - (evil-visual-state-p) - (display-selections-p) - (not (eq evil-visual-selection 'block))) - (with-current-buffer buf - (evil-set-selection 'PRIMARY (buffer-substring-no-properties - evil-visual-beginning - evil-visual-end)))))) - -(defun evil-visual-activate-hook (&optional _command) - "Enable Visual state if the region is activated." - (unless (evil-visual-state-p) - (evil-with-delay nil - (post-command-hook nil t "evil-activate-visual-state") - ;; the activation may only be momentary, so re-check - ;; in `post-command-hook' before entering Visual state - (unless (or (evil-visual-state-p) - (evil-insert-state-p) - (evil-emacs-state-p)) - (when (and (region-active-p) - (not deactivate-mark)) - (evil-visual-state)))))) -(put 'evil-visual-activate-hook 'permanent-local-hook t) - -(defun evil-visual-deactivate-hook (&optional command) - "Deactivate the region and restore Transient Mark mode." - (setq command (or command this-command)) - (remove-hook 'deactivate-mark-hook - #'evil-visual-deactivate-hook t) - (remove-hook 'evil-normal-state-entry-hook - #'evil-visual-deactivate-hook t) - (cond - ((and (evil-visual-state-p) command - (not (evil-get-command-property command :keep-visual))) - (setq evil-visual-region-expanded nil) - (evil-exit-visual-state)) - ((not (evil-visual-state-p)) - (evil-active-region -1) - (evil-restore-transient-mark-mode)))) -(put 'evil-visual-deactivate-hook 'permanent-local-hook t) - -(evil-define-command evil-exit-visual-state (&optional later buffer) - "Exit from Visual state to the previous state. -If LATER is non-nil, exit after the current command." - :keep-visual t - :repeat abort - (with-current-buffer (or buffer (current-buffer)) - (when (evil-visual-state-p) - (if later - (setq deactivate-mark t) - (when evil-visual-region-expanded - (evil-visual-contract-region)) - (setq evil-this-register nil - evil-prev-visual-selection evil-visual-selection - evil-prev-visual-mark (copy-marker evil-visual-mark) - evil-prev-visual-point (copy-marker evil-visual-point)) - (evil-change-to-previous-state))))) - -(defun evil-visual-tag (&optional selection) - "Return a mode-line tag for SELECTION. -SELECTION is a kind of selection as defined by -`evil-define-visual-selection', such as `char', `line' -or `block'." - (setq selection (or selection evil-visual-selection)) - (when selection - (symbol-value (intern (format "evil-visual-%s-tag" selection))))) - -(defun evil-visual-message (&optional selection) - "Create an echo area message for SELECTION. -SELECTION is a kind of selection as defined by -`evil-define-visual-selection', such as `char', `line' -or `block'." - (unless selection (setq selection evil-visual-selection)) - (when selection - (let ((message (symbol-value (intern (format "evil-visual-%s-message" - selection))))) - (cond - ((functionp message) (funcall message)) - ((stringp message) (evil-echo "%s" message)))))) - -(defun evil-visual-select (beg end &optional type dir message) - "Create a Visual selection of type TYPE from BEG to END. -Point and mark are positioned so that the resulting selection -has the specified boundaries. If DIR is negative, point precedes mark, -otherwise it succedes it. To specify point and mark directly, -use `evil-visual-make-selection'." - (let* ((range (evil-contract beg end type)) - (mark (evil-range-beginning range)) - (point (evil-range-end range)) - (dir (or dir 1))) - (when (< dir 0) - (evil-swap mark point)) - (evil-visual-make-selection mark point type message))) - -(defun evil-visual-make-selection (mark point &optional type message) - "Create a Visual selection with point at POINT and mark at MARK. -The boundaries of the selection are inferred from these -and the current TYPE. To specify the boundaries and infer -mark and point, use `evil-visual-select' instead." - (let* ((selection (evil-visual-selection-for-type type)) - (func (evil-visual-selection-function selection)) - (prev (and (evil-visual-state-p) evil-visual-selection)) - (mark (evil-normalize-position mark)) - (point (evil-normalize-position point)) - (state evil-state)) - (unless (evil-visual-state-p) - (evil-visual-state)) - (setq evil-visual-selection selection) - (funcall func mark point type - ;; signal a message when changing the selection - (when (or (not (evil-visual-state-p state)) - (not (eq selection prev))) - message)))) - -(defun evil-visual-make-region (mark point &optional type message) - "Create an active region from MARK to POINT. -If TYPE is given, also set the Visual type. -If MESSAGE is given, display it in the echo area." - (interactive) - (let* ((point (or point (point))) - (mark (or mark - (when (or (evil-visual-state-p) - (region-active-p)) - (mark t)) - point))) - (unless (evil-visual-state-p) - (evil-visual-state)) - (evil-active-region 1) - (setq evil-visual-region-expanded nil) - (evil-visual-refresh mark point type) - (cond - ((null evil-echo-state)) - ((stringp message) - (evil-echo "%s" message)) - (message - (cond - ((stringp evil-visual-state-message) - (evil-echo "%s" evil-visual-state-message)) - ((functionp evil-visual-state-message) - (funcall evil-visual-state-message))))))) - -(defun evil-visual-expand-region (&optional exclude-newline) - "Expand the region to the Visual selection. -If EXCLUDE-NEWLINE is non-nil and the selection ends with a newline, -exclude that newline from the region." - (when (and (evil-visual-state-p) - (not evil-visual-region-expanded)) - (let ((mark evil-visual-beginning) - (point evil-visual-end)) - (when (< evil-visual-direction 0) - (evil-swap mark point)) - (setq evil-visual-region-expanded t) - (evil-visual-refresh mark point) - (when (and exclude-newline - (save-excursion - (goto-char evil-visual-end) - (and (bolp) (not (bobp))))) - (if (< evil-visual-direction 0) - (evil-move-mark (max point (1- (mark)))) - (goto-char (max mark (1- (point))))))))) - -(defun evil-visual-contract-region () - "The inverse of `evil-visual-expand-region'. -Create a Visual selection that expands to the current region." - (evil-visual-refresh) - (setq evil-visual-region-expanded nil) - (evil-visual-refresh evil-visual-mark evil-visual-point)) - -(defun evil-visual-refresh (&optional mark point type &rest properties) - "Refresh point, mark and Visual variables. -Refreshes `evil-visual-beginning', `evil-visual-end', -`evil-visual-mark', `evil-visual-point', `evil-visual-selection', -`evil-visual-direction', `evil-visual-properties' and `evil-this-type'." - (let* ((point (or point (point))) - (mark (or mark (mark t) point)) - (dir (evil-visual-direction)) - (type (or type (evil-visual-type evil-visual-selection) - (evil-visual-type))) - range) - (evil-move-mark mark) - (goto-char point) - (setq evil-visual-beginning - (or evil-visual-beginning - (let ((marker (make-marker))) - (move-marker marker (min point mark)))) - evil-visual-end - (or evil-visual-end - (let ((marker (make-marker))) - (set-marker-insertion-type marker t) - (move-marker marker (max point mark)))) - evil-visual-mark - (or evil-visual-mark - (let ((marker (make-marker))) - (move-marker marker mark))) - evil-visual-point - (or evil-visual-point - (let ((marker (make-marker))) - (move-marker marker point)))) - (setq evil-visual-properties - (evil-concat-plists evil-visual-properties properties)) - (cond - (evil-visual-region-expanded - (setq type (or (evil-visual-type) type)) - (move-marker evil-visual-beginning (min point mark)) - (move-marker evil-visual-end (max point mark)) - ;; if the type is one-to-one, we can safely refresh - ;; the unexpanded positions as well - (when (evil-type-property type :one-to-one) - (setq range (apply #'evil-contract point mark type - evil-visual-properties) - mark (evil-range-beginning range) - point (evil-range-end range)) - (when (< dir 0) - (evil-swap mark point)) - (move-marker evil-visual-mark mark) - (move-marker evil-visual-point point))) - (t - (setq range (apply #'evil-expand point mark type - evil-visual-properties) - type (evil-type range type)) - (move-marker evil-visual-beginning (evil-range-beginning range)) - (move-marker evil-visual-end (evil-range-end range)) - (move-marker evil-visual-mark mark) - (move-marker evil-visual-point point))) - (setq evil-visual-direction dir - evil-this-type type))) - -(defun evil-visual-highlight (&optional arg) - "Highlight Visual selection, depending on the Visual type. -With negative ARG, disable highlighting." - (cond - ((and (numberp arg) (< arg 1)) - (when evil-visual-overlay - (delete-overlay evil-visual-overlay) - (setq evil-visual-overlay nil)) - (when evil-visual-block-overlays - (mapc #'delete-overlay evil-visual-block-overlays) - (setq evil-visual-block-overlays nil))) - ((eq evil-visual-selection 'block) - (when evil-visual-overlay - (evil-visual-highlight -1)) - (evil-visual-highlight-block - evil-visual-beginning - evil-visual-end)) - (t - (when evil-visual-block-overlays - (evil-visual-highlight -1)) - (if evil-visual-overlay - (move-overlay evil-visual-overlay - evil-visual-beginning evil-visual-end) - (setq evil-visual-overlay - (make-overlay evil-visual-beginning evil-visual-end))) - (overlay-put evil-visual-overlay 'face 'region) - (overlay-put evil-visual-overlay 'priority 99)))) - -(defun evil-visual-highlight-block (beg end &optional overlays) - "Highlight rectangular region from BEG to END. -Do this by putting an overlay on each line within the rectangle. -Each overlay extends across all the columns of the rectangle. -Reuse overlays where possible to prevent flicker." - (let* ((point (point)) - (overlays (or overlays 'evil-visual-block-overlays)) - (old (symbol-value overlays)) - beg-col end-col new nlines overlay window-beg window-end) - (save-excursion - ;; calculate the rectangular region represented by BEG and END, - ;; but put BEG in the upper-left corner and END in the - ;; lower-right if not already there - (setq beg-col (evil-column beg) - end-col (evil-column end)) - (when (>= beg-col end-col) - (if (= beg-col end-col) - (setq end-col (1+ end-col)) - (evil-swap beg-col end-col)) - (setq beg (progn (goto-char beg) (evil-move-to-column beg-col)) - end (progn (goto-char end) (evil-move-to-column end-col 1)))) - ;; maybe extend end column to EOL - (and (memq this-command '(next-line previous-line evil-use-register)) - (eq temporary-goal-column most-positive-fixnum) - (setq end-col most-positive-fixnum)) - ;; force a redisplay so we can do reliable window - ;; BEG/END calculations - (sit-for 0) - (setq window-beg (max (window-start) beg) - window-end (min (window-end) (1+ end)) - nlines (count-lines window-beg - (min window-end (point-max)))) - ;; iterate over those lines of the rectangle which are - ;; visible in the currently selected window - (goto-char window-beg) - (dotimes (_ nlines) - (let (before after row-beg row-end) - ;; beginning of row - (evil-move-to-column beg-col) - (when (< (current-column) beg-col) - ;; prepend overlay with virtual spaces if unable to - ;; move directly to the first column - (setq before - (propertize - (make-string - (- beg-col (current-column)) ?\s) - 'face - (or (get-text-property (1- (point)) 'face) - 'default)))) - (setq row-beg (point)) - ;; end of row - (evil-move-to-column end-col) - (when (and (not (eolp)) - (< (current-column) end-col)) - ;; append overlay with virtual spaces if unable to - ;; move directly to the last column - (setq after - (propertize - (make-string - (if (= (point) row-beg) - (- end-col beg-col) - (- end-col (current-column))) - ?\s) 'face 'region)) - ;; place cursor on one of the virtual spaces - (if (= point row-beg) - (put-text-property - 0 (min (length after) 1) - 'cursor t after) - (put-text-property - (max 0 (1- (length after))) (length after) - 'cursor t after))) - (setq row-end (min (point) (line-end-position))) - ;; trim old leading overlays - (while (and old - (setq overlay (car old)) - (< (overlay-start overlay) row-beg) - (/= (overlay-end overlay) row-end)) - (delete-overlay overlay) - (setq old (cdr old))) - ;; reuse an overlay if possible, otherwise create one - (cond - ((and old (setq overlay (car old)) - (or (= (overlay-start overlay) row-beg) - (= (overlay-end overlay) row-end))) - (move-overlay overlay row-beg row-end) - (overlay-put overlay 'before-string before) - (overlay-put overlay 'after-string after) - (setq new (cons overlay new) - old (cdr old))) - (t - (setq overlay (make-overlay row-beg row-end)) - (overlay-put overlay 'before-string before) - (overlay-put overlay 'after-string after) - (setq new (cons overlay new))))) - (forward-line 1)) - ;; display overlays - (dolist (overlay new) - (overlay-put overlay 'face 'region) - (overlay-put overlay 'priority 99)) - ;; trim old overlays - (dolist (overlay old) - (delete-overlay overlay)) - (set overlays (nreverse new))))) - -(defun evil-visual-range () - "Return the Visual selection as a range. -This is a list (BEG END TYPE PROPERTIES...), where BEG is the -beginning of the selection, END is the end of the selection, -TYPE is the selection's type, and PROPERTIES is a property list -of miscellaneous selection attributes." - (apply #'evil-range - evil-visual-beginning evil-visual-end - (evil-visual-type) - :expanded t - evil-visual-properties)) - -(defun evil-visual-direction () - "Return direction of Visual selection. -The direction is -1 if point precedes mark and 1 otherwise. -See also the variable `evil-visual-direction', which holds -the direction of the last selection." - (let* ((point (point)) - (mark (or (mark t) point))) - (if (< point mark) -1 1))) - -(defun evil-visual-type (&optional selection) - "Return the type of the Visual selection. -If SELECTION is specified, return the type of that instead." - (or (and (null selection) (evil-visual-state-p) evil-this-type) - (symbol-value (cdr (assq (or selection evil-visual-selection) - evil-visual-alist))))) - -(defun evil-visual-goto-end () - "Go to the last line of the Visual selection. -This position may differ from `evil-visual-end' depending on -the selection type, and is contained in the selection." - (let ((range (evil-contract-range (evil-visual-range)))) - (goto-char (evil-range-end range)))) - -(defun evil-visual-alist () - "Return an association list from types to selection symbols." - (mapcar #'(lambda (e) - (cons (symbol-value (cdr-safe e)) (cdr-safe e))) - evil-visual-alist)) - -(defun evil-visual-selection-function (selection) - "Return a selection function for TYPE. -Default to `evil-visual-make-region'." - (or (cdr-safe (assq selection evil-visual-alist)) - ;; generic selection function - 'evil-visual-make-region)) - -(defun evil-visual-selection-for-type (type) - "Return a Visual selection for TYPE." - (catch 'done - (dolist (selection evil-visual-alist) - (when (memq (symbol-value (cdr selection)) - (list type (evil-visual-type type))) - (throw 'done (car selection)))))) - -(defun evil-visual-block-corner (&optional corner point mark) - "Block corner corresponding to POINT, with MARK in opposite corner. -Depending on POINT and MARK, the return value is `upper-left', -`upper-right', `lower-left' or `lower-right': - - upper-left +---+ upper-right - | | - lower-left +---+ lower-right - -One-column or one-row blocks are ambiguous. In such cases, -the horizontal or vertical component of CORNER is used. -CORNER defaults to `upper-left'." - (let* ((point (or point (point))) - (mark (or mark (mark t))) - (corner (or corner - (when evil-visual-overlay - (overlay-get evil-visual-overlay :corner)) - 'upper-left)) - (point-col (evil-column point)) - (mark-col (evil-column mark)) - (upperp (if (save-excursion (goto-char (min point mark)) - (search-forward "\n" (max point mark) t)) - (< point mark) - (memq corner '(upper-left upper-right)))) - (leftp (if (= point-col mark-col) - (memq corner '(upper-left lower-left)) - (< point-col mark-col)))) - (if upperp - (if leftp 'upper-left 'upper-right) - (if leftp 'lower-left 'lower-right)))) - -;;; Operator-Pending state - -(evil-define-state operator - "Operator-Pending state." - :tag " " - :cursor evil-half-cursor - :enable (evil-operator-shortcut-map operator motion normal)) - -(evil-define-keymap evil-operator-shortcut-map - "Keymap for Operator-Pending shortcuts like \"dd\" and \"gqq\"." - :local t - (setq evil-operator-shortcut-map (make-sparse-keymap)) - (evil-initialize-local-keymaps)) - -;; the half-height "Operator-Pending cursor" cannot be specified -;; as a static `cursor-type' value, since its height depends on -;; the current font size -(defun evil-half-cursor () - "Change cursor to a half-height box. -\(This is really just a thick horizontal bar.)" - (let ((height (/ (window-pixel-height) (* (window-height) 2)))) - (setq cursor-type (cons 'hbar height)))) - -;;; Replace state - -(evil-define-state replace - "Replace state." - :tag " " - :cursor hbar - :message "-- REPLACE --" - :entry-hook (evil-start-track-last-insertion) - :exit-hook (evil-cleanup-insert-state evil-stop-track-last-insertion) - :input-method t - (cond - ((evil-replace-state-p) - (overwrite-mode 1) - (add-hook 'pre-command-hook #'evil-replace-pre-command nil t) - (add-hook 'pre-command-hook #'evil-insert-repeat-hook) - (unless (eq evil-want-fine-undo t) - (evil-start-undo-step))) - (t - (overwrite-mode -1) - (remove-hook 'pre-command-hook #'evil-replace-pre-command t) - (remove-hook 'pre-command-hook #'evil-insert-repeat-hook) - (setq evil-insert-repeat-info evil-repeat-info) - (evil-set-marker ?^ nil t) - (unless (eq evil-want-fine-undo t) - (evil-end-undo-step)) - (evil-move-cursor-back))) - (setq evil-replace-alist nil)) - -(defun evil-replace-pre-command () - "Remember the character under point." - (when (evil-replace-state-p) - (let ((char (unless (eolp) (char-after))) - (prev (assq (point) evil-replace-alist))) - (if prev - (setcdr prev char) - (push (cons (point) char) evil-replace-alist))))) -(put 'evil-replace-pre-command 'permanent-local-hook t) - -(defun evil-replace-backspace () - "Restore character under cursor." - (interactive) - (backward-char) - (let* ((prev (assq (point) evil-replace-alist)) - (char (cdr prev)) - (this-command #'evil-replace-backspace)) - (when prev - (delete-char 1) - (when char (save-excursion (insert char)))))) - -(defun evil-update-replace-alist (opoint count chars-to-delete &optional offset) - "Add CHARS-TO-DELETE chars to evil-replace-alist, starting at OPOINT. -If COUNT is greater than CHARS-TO-DELETE, pad the alist with nils. -Decrement recorded position by optional offset, or 0." - (when (evil-replace-state-p) - (dotimes (c count) - (let ((pos (+ c opoint))) - (add-to-list 'evil-replace-alist - (cons (- pos (or offset 0)) (when (< c chars-to-delete) - (char-after pos)))))))) - -;;; Motion state - -(evil-define-state motion - "Motion state." - :tag " " - :suppress-keymap t) - -;;; Emacs state - -(evil-define-state emacs - "Emacs state." - :tag " " - :message "-- EMACS --" - :input-method t - :intercept-esc nil) - -(provide 'evil-states) - -;;; evil-states.el ends here diff --git a/.config/emacs/lisp/evil/evil-test-helpers.el b/.config/emacs/lisp/evil/evil-test-helpers.el deleted file mode 100644 index c7eeb71..0000000 --- a/.config/emacs/lisp/evil/evil-test-helpers.el +++ /dev/null @@ -1,416 +0,0 @@ -;;; evil-test-helpers.el --- unit test helpers for Evil -*- coding: utf-8; lexical-binding: t -*- - -;; Author: Vegard Øye -;; Maintainer: Vegard Øye -;; Package-Requires: ((evil "1.15.0")) -;; Version: 1.15.0 - -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -;;; Commentary: - -;; This file contains helper functions for writing tests for -;; evil-mode. These helpers can also be used by other packages which -;; extend evil-mode. - -;; To write a test use `evil-test-buffer': - -;; (require 'evil-test-helpers) -;; -;; (ert-deftest evil-test () -;; :tags '(evil) -;; (evil-test-buffer -;; "[T]his creates a test buffer." ; cursor on "T" -;; ("w") ; key sequence -;; "This [c]reates a test buffer."))) ; cursor moved to "c" -;; -;; The initial state, the cursor syntax, etc., can be changed -;; with keyword arguments. See the documentation string of -;; `evil-test-buffer' for more details. -;; -;; This file is NOT part of Evil itself. - -(require 'elp) -(require 'ert) -(require 'evil) - -;;; Code: - -(when (fboundp 'font-lock-add-keywords) - (font-lock-add-keywords 'emacs-lisp-mode - '(("(\\(evil-test-buffer\\)\\>" - 1 font-lock-keyword-face)))) - -(defvar evil-test-point nil - "Marker for point.") -(make-variable-buffer-local 'evil-test-point) -(defvar evil-test-visual-start nil - "Marker for Visual beginning.") -(make-variable-buffer-local 'evil-test-visual-start) -(defvar evil-test-visual-end nil - "Marker for Visual end.") -(make-variable-buffer-local 'evil-test-visual-end) - -(defvaralias 'evil-test-select-enable-clipboard - (if (boundp 'select-enable-clipboard) - 'select-enable-clipboard - 'x-select-enable-clipboard)) - -(defmacro evil-test-buffer (&rest body) - "Execute FORMS in a temporary buffer. -The following optional keywords specify the buffer's properties: - -:state STATE The initial state, defaults to `normal'. -:visual SELECTION The Visual selection, defaults to `char'. -:point-start STRING String for matching beginning of point, - defaults to \"[\". -:point-end STRING String for matching end of point, - defaults to \"]\". -:visual-start STRING String for matching beginning of - Visual selection, defaults to \"<\". -:visual-end STRING String for matching end of - Visual selection, defaults to \">\". - -Then follows one or more forms. If the first form is a string, -it is taken to be a buffer description as passed to -`evil-test-buffer-from-string', and initializes the buffer. -Subsequent string forms validate the buffer. - -If a form is a list of strings or vectors, it is taken to be a -key sequence and is passed to `execute-kbd-macro'. If the form -is \(file FILENAME CONTENTS), then the test fails unless the -contents of FILENAME equal CONTENTS. If the form is \(error -SYMBOL ...) then the test fails unless an error of type SYMBOL is -raised. Remaining forms are evaluated as-is. - -\(fn [[KEY VALUE]...] FORMS...)" - (declare (indent defun)) - (let ((state 'normal) - arg key point-start point-end string - visual visual-start visual-end) - ;; collect keywords - (while (keywordp (car-safe body)) - (setq key (pop body) - arg (pop body)) - (cond - ((eq key :point-start) - (setq point-start (or arg ""))) - ((eq key :point-end) - (setq point-end (or arg ""))) - ((eq key :state) - (setq state arg)) - ((eq key :visual) - (setq visual arg)) - ((eq key :visual-start) - (setq visual-start (or arg ""))) - ((eq key :visual-end) - (setq visual-end (or arg ""))))) - ;; collect buffer initialization - (when (stringp (car-safe body)) - (setq string (pop body))) - ;; macro expansion - `(let ((buffer (evil-test-buffer-from-string - ,string ',state - ,point-start ,point-end - ',visual ,visual-start ,visual-end)) - (kill-ring kill-ring) - (kill-ring-yank-pointer kill-ring-yank-pointer) - evil-test-select-enable-clipboard - message-log-max) - (unwind-protect - (save-window-excursion - (with-current-buffer buffer - ;; necessary for keyboard macros to work - (switch-to-buffer-other-window (current-buffer)) - (buffer-enable-undo) - ;; parse remaining forms - ,@(mapcar - #'(lambda (form) - (let (error-symbol) - (when (and (listp form) - (eq (car-safe form) 'error)) - (setq error-symbol (car-safe (cdr-safe form)) - form (cdr-safe (cdr-safe form)))) - (let ((result - (cond - ((stringp form) - `(evil-test-buffer-string - ,form - ',point-start ',point-end - ',visual-start ',visual-end)) - ((eq (car-safe form) 'file) - `(evil-test-file-contents ,(cadr form) - ,(car (cddr form)))) - ((or (stringp (car-safe form)) - (vectorp (car-safe form)) - (memq (car-safe (car-safe form)) - '(kbd vconcat))) - ;; we need to execute everything as a single - ;; sequence for command loop hooks to work - `(execute-kbd-macro - (apply #'vconcat - (mapcar #'listify-key-sequence - (list ,@form))))) - ((memq (car-safe form) '(kbd vconcat)) - `(execute-kbd-macro ,form)) - (t form)))) - (if error-symbol - `(should-error ,result :type ',error-symbol) - result)))) - body))) - (when (buffer-name buffer) (kill-buffer buffer)))))) - -(defmacro evil-test-selection (string &optional end-string - before-predicate after-predicate) - "Verify that the Visual selection contains STRING." - (declare (indent defun)) - `(progn - (save-excursion - (goto-char (or evil-visual-beginning (region-beginning))) - (evil-test-text nil (or ,string ,end-string) ,before-predicate)) - (save-excursion - (goto-char (or evil-visual-end (region-end))) - (evil-test-text (or ,end-string ,string) nil nil ,after-predicate)))) - -(defun evil-test-buffer-string (string &optional - point-start point-end - visual-start visual-end) - "Validate the current buffer according to STRING. -If STRING contains an occurrence of POINT-START immediately -followed by POINT-END, that position is compared against point. -If STRING contains an occurrence of VISUAL-START followed by -VISUAL-END, those positions are compared against the Visual selection. -POINT-START and POINT-END default to [ and ]. -VISUAL-START and VISUAL-END default to < and >." - (let ((actual-buffer (current-buffer)) - (marker-buffer (evil-test-marker-buffer-from-string - string - point-start point-end - visual-start visual-end)) - before-point after-point string selection) - (unwind-protect - (with-current-buffer marker-buffer - (setq string (buffer-string)) - (when evil-test-point - (setq before-point (buffer-substring (point-min) evil-test-point) - after-point (buffer-substring evil-test-point (point-max)))) - (when (and evil-test-visual-start evil-test-visual-end) - (setq selection (buffer-substring - evil-test-visual-start evil-test-visual-end))) - (with-current-buffer actual-buffer - (if (or before-point after-point) - (evil-test-text before-point after-point) - ;; if the cursor isn't specified, just test the whole buffer - (save-excursion - (goto-char (point-min)) - (evil-test-text nil string #'bobp #'eobp))) - (when selection - (evil-test-selection selection)))) - (kill-buffer marker-buffer)))) - -(defun evil-test-buffer-from-string (string &optional - state - point-start point-end - visual visual-start visual-end) - "Create a new buffer according to STRING. -If STRING contains an occurrence of POINT-START immediately -followed by POINT-END, then point is moved to that position. -If STRING contains an occurrence of VISUAL-START followed by -VISUAL-END, then a Visual selection is created with those boundaries. -POINT-START and POINT-END default to [ and ]. -VISUAL-START and VISUAL-END default to < and >. -STATE is the initial state; it defaults to `normal'. -VISUAL is the Visual selection: it defaults to `char'." - (let ((type (evil-visual-type (or visual 'char))) - (buffer (evil-test-marker-buffer-from-string - string point-start point-end - visual-start visual-end))) - (with-current-buffer buffer - (prog1 buffer - (evil-change-state state) - ;; let the buffer change its major mode without disabling Evil - (add-hook 'after-change-major-mode-hook #'evil-initialize) - (when (and (markerp evil-test-visual-start) - (markerp evil-test-visual-end)) - (evil-visual-select - evil-test-visual-start evil-test-visual-end type) - (when evil-test-point - (goto-char evil-test-point) - (evil-visual-refresh) - (unless (and (= evil-visual-beginning - evil-test-visual-start) - (= evil-visual-end - evil-test-visual-end)) - (evil-visual-select - evil-test-visual-start evil-test-visual-end type -1) - (goto-char evil-test-point) - (evil-visual-refresh)))) - (when (markerp evil-test-point) - (goto-char evil-test-point)))))) - -(defun evil-test-marker-buffer-from-string (string &optional - point-start point-end - visual-start visual-end) - "Create a new marker buffer according to STRING. -If STRING contains an occurrence of POINT-START immediately -followed by POINT-END, that position is stored in the -buffer-local variable `evil-test-point'. Similarly, -if STRING contains an occurrence of VISUAL-START followed by -VISUAL-END, those positions are stored in the variables -`evil-test-visual-beginning' and `evil-test-visual-end'. -POINT-START and POINT-END default to [ and ]. -VISUAL-START and VISUAL-END default to < and >." - (let ((string (or string "")) - (point-start (regexp-quote - (if (characterp point-start) - (string point-start) - (or point-start "[")))) - (point-end (regexp-quote - (if (characterp point-end) - (string point-end) - (or point-end "]")))) - (visual-start (regexp-quote - (if (characterp visual-start) - (string visual-start) - (or visual-start "<")))) - (visual-end (regexp-quote - (if (characterp visual-end) - (string visual-end) - (or visual-end ">"))))) - (with-current-buffer (generate-new-buffer " *test*") - (prog1 (current-buffer) - (save-excursion - (insert string)) - (save-excursion - (when (> (length point-start) 0) - (if (> (length point-end) 0) - (when (re-search-forward - (format "\\(%s\\)[^%s]?\\(%s\\)" - point-start point-end point-end) nil t) - (goto-char (match-beginning 0)) - (delete-region (match-beginning 2) (match-end 2)) - (delete-region (match-beginning 1) (match-end 1)) - (setq evil-test-point - (move-marker (make-marker) (point)))) - (when (re-search-forward point-start nil t) - (goto-char (match-beginning 0)) - (delete-region (match-beginning 0) (match-end 0)) - (setq evil-test-point - (move-marker (make-marker) (point))))))) - (save-excursion - (when (and (> (length visual-start) 0) - (> (length visual-end) 0)) - (when (re-search-forward visual-start nil t) - (goto-char (match-beginning 0)) - (delete-region (match-beginning 0) (match-end 0)) - (setq evil-test-visual-start - (move-marker (make-marker) (point)))) - (when (re-search-forward visual-end nil t) - (goto-char (match-beginning 0)) - (delete-region (match-beginning 0) (match-end 0)) - (setq evil-test-visual-end - (move-marker (make-marker) (point)))))))))) - -(defun evil-test-text (before after &optional before-predicate after-predicate) - "Verify the text around point. -BEFORE is the expected text before point, and AFTER is -the text after point. BEFORE-PREDICATE is a predicate function -to execute at the beginning of the text, and AFTER-PREDICATE -is executed at the end." - (when before - (if (functionp before) - (setq before-predicate before - before nil) - (should (string= (buffer-substring - (max (point-min) (- (point) (length before))) - (point)) - before)))) - (when after - (if (functionp after) - (setq after-predicate after - after nil) - (should (string= (buffer-substring - (point) - (min (point-max) (+ (point) (length after)))) - after)))) - (when before-predicate - (ert-info ((format "Expect `%s' at the beginning" before-predicate)) - (save-excursion - (backward-char (length before)) - (should (funcall before-predicate))))) - (when after-predicate - (ert-info ((format "Expect `%s' at the end" after-predicate)) - (save-excursion - (forward-char (length after)) - (should (funcall after-predicate)))))) - -(defmacro evil-test-region (string &optional end-string - before-predicate after-predicate) - "Verify that the region contains STRING." - (declare (indent defun)) - `(progn - (save-excursion - (goto-char (region-beginning)) - (evil-test-text nil (or ,string ,end-string) ,before-predicate)) - (save-excursion - (goto-char (region-end)) - (evil-test-text (or ,end-string ,string) nil nil ,after-predicate)))) - -(defmacro evil-test-overlay (overlay string &optional end-string - before-predicate after-predicate) - "Verify that OVERLAY contains STRING." - (declare (indent defun)) - `(progn - (save-excursion - (goto-char (overlay-start ,overlay)) - (evil-test-text nil (or ,string ,end-string) ,before-predicate)) - (save-excursion - (goto-char (overlay-end ,overlay)) - (evil-test-text (or ,end-string ,string) nil nil ,after-predicate)))) - -(defmacro evil-with-temp-file (file-var content &rest body) - "Create a temp file with CONTENT and bind its name to FILE-VAR within BODY. -FILE-VAR must be a symbol which contains the name of the -temporary file within the macro body. CONTENT is either a string -to be used as the content of the temporary file or a form to be -executed with the temporary file's buffer as \(current-buffer), -see `with-temp-file'. BODY contains the forms to be executed -while the temporary file exists. The temporary file is deleted at -the end of the execution of BODY." - (declare (indent 2) - (debug (symbolp form body))) - `(let ((,file-var (make-temp-file "evil-test"))) - (with-temp-file ,file-var - ,(if (stringp content) - `(insert ,content) - content)) - ,@body - (delete-file ,file-var))) - -(defun evil-test-file-contents (name contents) - "Ensure that the contents of file with NAME equal CONTENTS." - (with-temp-buffer - (insert-file-contents name) - (should (string= (buffer-string) - contents)))) - -(provide 'evil-test-helpers) - -;;; evil-test-helpers.el ends here diff --git a/.config/emacs/lisp/evil/evil-tests.el b/.config/emacs/lisp/evil/evil-tests.el deleted file mode 100644 index 01af626..0000000 --- a/.config/emacs/lisp/evil/evil-tests.el +++ /dev/null @@ -1,10130 +0,0 @@ -;; evil-tests.el --- unit tests for Evil -*- coding: utf-8; lexical-binding: t; -*- - -;; Author: Vegard Øye -;; Maintainer: Vegard Øye - -;; Version: 1.15.0 - -;; -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -;;; Commentary: - -;; This file is for developers. It runs some tests on Evil. -;; To load it, run the Makefile target "make test" or add -;; the following lines to .emacs: -;; -;; (setq evil-tests-run nil) ; set to t to run tests immediately -;; (global-set-key [f12] 'evil-tests-run) ; hotkey -;; (require 'evil-tests) -;; -;; Loading this file enables profiling on Evil. The current numbers -;; can be displayed with `elp-results'. The Makefile target -;; "make profiler" shows profiling results in the terminal on the -;; basis of running all tests. -;; -;; To write a test, use `ert-deftest' and specify a :tags value of at -;; least '(evil). The test may inspect the output of functions given -;; certain input, or it may execute a key sequence in a temporary -;; buffer and investigate the results. For the latter approach, the -;; macro `evil-test-buffer' creates a temporary buffer in Normal -;; state. String descriptors initialize and match the contents of -;; the buffer: -;; -;; (ert-deftest evil-test () -;; :tags '(evil) -;; (evil-test-buffer -;; "[T]his creates a test buffer." ; cursor on "T" -;; ("w") ; key sequence -;; "This [c]reates a test buffer."))) ; cursor moved to "c" -;; -;; The initial state, the cursor syntax, etc., can be changed -;; with keyword arguments. See the documentation string of -;; `evil-test-buffer' for more details. -;; -;; This file is NOT part of Evil itself. - -;; FIXME: Merely loading an ELisp file should not change Emacs's config! -(setq load-prefer-newer t) - -(require 'cl-lib) -(require 'elp) -(require 'ert) -;; Load non-compiled `evil-ex'. (It defines `evil-parser' - which is -;; needed by `evil-test-parser' - only inside an `eval-when-compile'.) -(require 'evil-ex "evil-ex.el") -(require 'evil) -(require 'evil-digraphs) -(require 'evil-test-helpers) -(require 'ispell) - -;;; Code: - -(defvar evil-tests-run nil - "*Run Evil tests.") - -(defvar evil-tests-profiler nil - "*Profile Evil tests.") - -(defun evil-tests-initialize (&optional tests profiler interactive) - (setq profiler (or profiler evil-tests-profiler)) - (when (consp profiler) - (setq profiler (car profiler))) - (when profiler - (setq evil-tests-profiler t) - (setq profiler - (cdr (assq profiler - '((call . elp-sort-by-call-count) - (average . elp-sort-by-average-time) - (total . elp-sort-by-total-time))))) - (setq elp-sort-by-function (or profiler 'elp-sort-by-call-count)) - (elp-instrument-package "evil")) - (if interactive - (if (y-or-n-p-with-timeout "Run tests? " 2 t) - (evil-tests-run tests interactive) - (message "You can run the tests at any time with `M-x evil-tests-run'")) - (evil-tests-run tests))) - -(defun evil-tests-run (&optional tests interactive) - "Run Evil tests." - (interactive '(nil t)) - (let ((elp-use-standard-output (not interactive))) - (setq tests - (or (null tests) - `(or ,@(mapcar #'(lambda (test) - (or (null test) - (and (memq test '(evil t)) t) - `(or (tag ,test) - ,(format "^%s$" test)))) - tests)))) - (cond - (interactive - (ert-run-tests-interactively tests) - (when evil-tests-profiler - (elp-results))) - (evil-tests-profiler - (ert-run-tests-batch tests) - (elp-results)) - (t - ;; We would like to use `ert-run-tests-batch-and-exit' - ;; Unfortunately it doesn't work outside of batch mode, and we - ;; can't use batch mode because we have tests that need windows. - ;; Instead, run the tests interactively, copy the results to a - ;; text file, and then exit with an appropriate code. - (setq attempt-stack-overflow-recovery nil - attempt-orderly-shutdown-on-fatal-signal nil) - (unwind-protect - (progn - (ert-run-tests-interactively tests) - (with-current-buffer "*ert*" - (append-to-file (point-min) (point-max) "test-results.txt") - (kill-emacs (if (zerop (ert-stats-completed-unexpected ert--results-stats)) 0 1)))) - (unwind-protect - (progn - (append-to-file "Error running tests\n" nil "test-results.txt") - (append-to-file (backtrace-to-string (backtrace-get-frames 'backtrace)) nil "test-results.txt")) - (kill-emacs 2))))))) - -(defun evil-tests-profiler (&optional force) - "Profile Evil tests." - (when (or evil-tests-profiler force) - (setq evil-tests-profiler t) - (elp-instrument-package "evil"))) - -;;; States - -(defun evil-test-local-mode-enabled () - "Verify that `evil-local-mode' is enabled properly" - (ert-info ("Set the mode variable to t") - (should (eq evil-local-mode t))) - (ert-info ("Refresh `emulation-mode-map-alist'") - (should (memq 'evil-mode-map-alist emulation-mode-map-alists))) - (ert-info ("Create a buffer-local value for `evil-mode-map-alist'") - (should (assq 'evil-mode-map-alist (buffer-local-variables)))) - (ert-info ("Initialize buffer-local keymaps") - (should (assq 'evil-normal-state-local-map (buffer-local-variables))) - (should (keymapp evil-normal-state-local-map)) - (should (assq 'evil-emacs-state-local-map (buffer-local-variables))) - (should (keymapp evil-emacs-state-local-map))) - (ert-info ("Don't add buffer-local entries to the default value") - (should-not (rassq evil-normal-state-local-map - (default-value 'evil-mode-map-alist))) - (should-not (rassq evil-emacs-state-local-map - (default-value 'evil-mode-map-alist))))) - -(defun evil-test-local-mode-disabled () - "Verify that `evil-local-mode' is disabled properly" - (ert-info ("Set the mode variable to nil") - (should-not evil-local-mode)) - (ert-info ("Disable all states") - (evil-test-no-states))) - -(defun evil-test-no-states () - "Verify that all states are disabled" - (ert-info ("Set `evil-state' to nil") - (should-not evil-state)) - (ert-info ("Disable all state keymaps") - (dolist (state (mapcar #'car evil-state-properties) t) - (should-not (evil-state-property state :mode t)) - (should-not (memq (evil-state-property state :keymap t) - (current-active-maps))) - (should-not (evil-state-property state :local t)) - (should-not (memq (evil-state-property state :local-keymap t) - (current-active-maps))) - (dolist (map (evil-state-auxiliary-keymaps state)) - (should-not (memq map (current-active-maps))))))) - -(ert-deftest evil-test-toggle-local-mode () - "Toggle `evil-local-mode'" - :tags '(evil state) - (with-temp-buffer - (ert-info ("Enable `evil-local-mode'") - (evil-local-mode 1) - (evil-test-local-mode-enabled)) - (ert-info ("Disable `evil-local-mode'") - (evil-local-mode -1) - (evil-test-local-mode-disabled)))) - -(defun evil-test-change-state (state) - "Change state to STATE and check keymaps" - (evil-change-state state) - (let ((mode (evil-state-property state :mode)) - ;; (keymap (evil-state-property state :keymap t)) - (local-mode (evil-state-property state :local)) - ;; (local-keymap (evil-state-property state :local-keymap t)) - (tag (evil-state-property state :tag t))) - (when (functionp tag) - (setq tag (funcall tag))) - (ert-info ("Update `evil-state'") - (should (eq evil-state state))) - (ert-info ("Ensure `evil-local-mode' is enabled") - (evil-test-local-mode-enabled)) - (ert-info ("Enable state modes") - (should (symbol-value mode)) - (should (symbol-value local-mode))) - (ert-info ("Push state keymaps to the top") - (evil-test-state-keymaps state)) - (ert-info ("Refresh mode line tag") - (should (equal evil-mode-line-tag tag))))) - -(defun evil-test-state-keymaps (state) - "Verify that STATE's keymaps are pushed to the top" - (let ((actual (evil-state-keymaps state)) - (expected `((,(evil-state-property state :local) - . , (evil-state-property state :local-keymap t)) - (,(evil-state-property state :mode) - . ,(evil-state-property state :keymap t))))) - ;; additional keymaps inherited with :enable - (cond - ((eq state 'operator) - (setq expected - `((evil-operator-shortcut-mode - . ,evil-operator-shortcut-map) - (evil-operator-state-local-minor-mode - . ,evil-operator-state-local-map) - (evil-operator-state-minor-mode - . ,evil-operator-state-map) - (evil-motion-state-local-minor-mode - . ,evil-motion-state-local-map) - (evil-motion-state-minor-mode - . ,evil-motion-state-map) - (evil-normal-state-local-minor-mode - . ,evil-normal-state-local-map) - (evil-normal-state-minor-mode - . ,evil-normal-state-map))))) - (let ((actual (butlast actual (- (length actual) - (length expected))))) - (should (equal actual expected)) - (dolist (map actual) - (setq map (cdr-safe map)) - (should (keymapp map)))))) - -(ert-deftest evil-test-exit-normal-state () - "Enter Normal state and then disable all states" - :tags '(evil state) - (with-temp-buffer - (evil-test-change-state 'normal) - (evil-normal-state -1) - (evil-test-no-states))) - -(ert-deftest evil-test-change-states () - "Change between Normal state, Emacs state and Operator-Pending state" - :tags '(evil state) - (with-temp-buffer - (evil-test-change-state 'normal) - (evil-test-change-state 'emacs) - (evil-test-change-state 'normal) - (evil-test-change-state 'operator) - (evil-test-change-state 'normal) - (evil-test-change-state 'emacs) - (evil-test-change-state 'replace) - (evil-test-change-state 'normal))) - -(ert-deftest evil-test-change-to-previous-state () - "Change to some state and back." - :tags '(evil state) - (with-temp-buffer - (evil-test-change-state 'normal) - (evil-test-change-state 'visual) - (evil-test-change-state 'emacs) - (evil-change-to-previous-state) - (should (eq evil-state 'visual)) - (evil-change-to-previous-state) - (should (eq evil-state 'normal)))) - -(ert-deftest evil-test-enter-normal-state-disabled () - "Enter Normal state even if `evil-local-mode' is disabled" - :tags '(evil state) - (with-temp-buffer - (evil-local-mode -1) - (evil-test-local-mode-disabled) - (evil-test-change-state 'normal))) - -(ert-deftest evil-test-execute-in-normal-state () - "Execute Normal state command in Insert state (`evil-execute-in-normal-state')." - :tags '(evil) - (evil-test-buffer "[a]bcdef\n" - ("I") - (should (evil-insert-state-p)) - ("\C-ox") - (ert-info ("Should return to Insert state") (should (evil-insert-state-p))) - "[b]cdef\n" - ("\C-oA") - (ert-info ("Should return to Insert state after Insert state command") - (should (evil-insert-state-p))) - ("bcdef[]\n")) - (ert-info ("Cursor is placed correctly afterwards") - (evil-test-buffer - :state insert - "abcdefg[]" - ("\C-o~") - "abcdefG[]") - (evil-test-buffer - :state insert - "abcdefg[]" - ("\C-ozz") - "abcdefg[]") - (evil-test-buffer - :state insert - "abc[]defg" - ("\C-o$") - "abcdefg[]") - (evil-test-buffer - :state insert - "abcdefg[]" - ("\C-o^") - "[]abcdefg") - (evil-test-buffer - :state insert - "abcdefg[]" - ("\C-oi") - "abcdef[]g") - (evil-test-buffer - :state insert - "\n[]" - ("\C-ok") - "[]\n") - (evil-test-buffer - "line1\nli[n]e2" - ("ma" "kA" "\C-o`a") - "line1\nli[]ne2")) - (ert-info ("Can enter replace state and stay in it") - (evil-test-buffer - :state insert - "abc[]defg" - ("\C-oRfoo") - "abcfoog")) - (ert-info ("Insert count is ignored") - (evil-test-buffer "[]" - ("2i" "abcdef" "\C-o~" "g" [escape]) - "abcdeF[g]")) - (ert-info ("Can execute evil-repeat in normal state") - (evil-test-buffer - ;; Although this is the same in Vim, text inserted after the temporary - ;; normal command is not recorded for repetition, which is a subtle - ;; (but arguably more useful) difference. - :state insert - "ab[]cfg" - ("\C-o~de\C-o.") - "abCdeF[]g"))) - -(defun evil-test-suppress-keymap (state) - "Verify that `self-insert-command' is suppressed in STATE" - (evil-test-buffer - ";; This buffer is for notes." - (evil-test-change-state state) - ;; TODO: this should be done better - (ert-info ("Disable the state's own keymaps so that the -suppression keymap comes first") - (setq evil-operator-state-minor-mode nil - evil-operator-state-local-minor-mode nil)) - (should (eq (key-binding "£") #'undefined)) - (ert-info ("Don't insert text") - ;; may or may not signal an error, depending on batch mode - (condition-case nil - (execute-kbd-macro "£££") - (error nil)) - (should (string= (buffer-substring 1 4) ";; "))))) - -(ert-deftest evil-test-emacs-state-suppress-keymap () - "`self-insert-command' works in Emacs state" - :tags '(evil state) - (should-error (evil-test-suppress-keymap 'emacs))) - -(ert-deftest evil-test-normal-state-suppress-keymap () - "No `self-insert-command' in Normal state" - :tags '(evil state) - (evil-test-suppress-keymap 'normal)) - -(ert-deftest evil-test-operator-state-suppress-keymap () - "Operator-Pending state should inherit suppression -of `self-insert-command' from Normal state" - :tags '(evil state) - (evil-test-suppress-keymap 'operator)) - -(ert-deftest evil-test-operator-state-shortcut-keymap () - "Enable shortcut keymap in Operator-Pending state" - :tags '(evil state) - (evil-test-buffer - (ert-info ("Activate `evil-operator-shortcut-map' in \ -Operator-Pending state") - (evil-test-change-state 'operator) - (should (rassq evil-operator-shortcut-map - (evil-state-keymaps 'operator))) - (should (keymapp evil-operator-shortcut-map)) - (should evil-operator-shortcut-mode) - (should (memq evil-operator-shortcut-map - (current-active-maps)))) - (ert-info ("Deactivate `evil-operator-shortcut-map' \ -outside Operator-Pending state") - (evil-test-change-state 'emacs) - (should-not evil-operator-shortcut-mode) - (should-not (memq evil-operator-shortcut-map - (current-active-maps)))) - (ert-info ("Reset `evil-operator-shortcut-map' \ -when entering Operator-Pending state") - (define-key evil-operator-shortcut-map "f" 'foo) - (should (eq (lookup-key evil-operator-shortcut-map "f") - 'foo)) - (evil-test-change-state 'operator) - (should-not (eq (lookup-key evil-operator-shortcut-map "f") - 'foo))) - (ert-info ("Reset `evil-operator-shortcut-map' \ -when exiting Operator-Pending state") - (define-key evil-operator-shortcut-map "b" 'bar) - (should (eq (lookup-key evil-operator-shortcut-map "b") - 'bar)) - (evil-test-change-state 'emacs) - (should-not (eq (lookup-key evil-operator-shortcut-map "b") - 'bar)))) - (ert-info ("Compute shortcuts with original keymaps") - (evil-test-buffer "foo" - (define-key evil-normal-state-local-map (kbd "SPC x") #'evil-delete) - ;; evil-forward-char in motion map should not shadow the executed - ;; evil-delete binding above when populating shortcut map. - ((kbd "SPC x x")) - ""))) - -(ert-deftest evil-test-auxiliary-maps () - "Test auxiliary keymaps" - :tags '(evil state) - ;; `evil-define-key' can't be used on a lexically-scoped keymap var. - (defvar evil--map) - (let ((evil--map (make-sparse-keymap)) aux) - (ert-info ("Create a new auxiliary keymap") - (evil-define-key 'normal evil--map "f" 'foo) - (setq aux (evil-get-auxiliary-keymap evil--map 'normal)) - (should (evil-auxiliary-keymap-p aux)) - (should (eq (lookup-key aux "f") 'foo))) - (ert-info ("Add to auxiliary keymap") - (evil-define-key 'normal evil--map "b" 'bar) - (should (eq (lookup-key aux "f") 'foo)) - (should (eq (lookup-key aux "b") 'bar))))) - -(ert-deftest evil-test-global-local-map-binding () - "Test use of `evil-define-key' for binding in global maps." - :tags '(evil state) - (let ((evil-normal-state-map (copy-keymap evil-normal-state-map)) - (evil-normal-state-local-map - (when (keymapp evil-normal-state-local-map) - (copy-keymap evil-normal-state-local-map))) - (global-map (copy-keymap global-map)) - (orig-local-map - (when (keymapp (current-local-map)) - (copy-keymap (current-local-map)))) - (map (or (current-local-map) (make-sparse-keymap)))) - (use-local-map map) - (ert-info ("Bind in a global state map") - (evil-define-key 'normal 'global "f" 'foo) - (should (eq (lookup-key evil-normal-state-map "f") 'foo))) - (ert-info ("Bind in a local state map") - (evil-define-key 'normal 'local "f" 'foo) - (should (eq (lookup-key evil-normal-state-local-map "f") 'foo))) - (ert-info ("Bind in the global map") - (evil-define-key nil 'global "b" 'bar) - (should (eq (lookup-key global-map "b") 'bar))) - (ert-info ("Bind in the local map") - (evil-define-key nil 'local "b" 'bar) - (should (eq (lookup-key (current-local-map) "b") 'bar))) - (use-local-map orig-local-map))) - -;;; Type system - -(ert-deftest evil-test-exclusive-type () - "Expand and contract the `line' type" - :tags '(evil type) - (evil-test-buffer - ";; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (let* ((first-line 1) - (second-line (progn - (forward-line) - (point)))) - (forward-line) - (ert-info ("Return the beginning and end unchanged \ -if they are the same") - (should (equal (evil-normalize 1 1 'exclusive) - (list 1 1 'exclusive)))) - (ert-info ("expand to `inclusive' if the end position \ -is at the beginning of a line") - (should (equal (evil-normalize (1+ first-line) second-line 'exclusive) - (list (1+ first-line) (1- second-line) 'inclusive - :expanded t)))) - (ert-info ("expand to `line' if both the beginning and end \ -are at the beginning of a line") - (should (equal (evil-normalize first-line second-line 'exclusive) - (list first-line second-line 'line - :expanded t)))) - (ert-info ("Measure as the strict difference between the end \ -and the beginning") - (should (string= (evil-describe 1 1 'exclusive) - "0 characters")) - (should (string= (evil-describe 1 2 'exclusive) - "1 character")) - (should (string= (evil-describe 5 2 'exclusive) - "3 characters")))))) - -(ert-deftest evil-test-inclusive-type () - "Expand and contract the `inclusive' type" - :tags '(evil type) - (evil-test-buffer - ";; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (ert-info ("Include the ending character") - (should (equal (evil-expand 1 1 'inclusive) - '(1 2 inclusive :expanded t)))) - (ert-info ("Don't mind if positions are in wrong order") - (should (equal (evil-expand 5 2 'inclusive) - '(2 6 inclusive :expanded t)))) - (ert-info ("Exclude the ending character when contracting") - (should (equal (evil-contract 1 2 'inclusive) - '(1 1 inclusive :expanded nil)))) - (ert-info ("Don't mind positions' order when contracting") - (should (equal (evil-contract 6 2 'inclusive) - '(2 5 inclusive :expanded nil)))) - (ert-info ("Measure as one more than the difference") - (should (string= (evil-describe 1 1 'inclusive) - "1 character")) - (should (string= (evil-describe 5 2 'inclusive) - "4 characters"))))) - -(ert-deftest evil-test-line-type () - "Expand the `line' type" - :tags '(evil type) - (evil-test-buffer - ";; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (let* ((first-line 1) - (second-line (progn - (forward-line) - (point))) - (third-line (progn - (forward-line) - (point)))) - (ert-info ("Expand to the whole first line") - (should (equal (evil-expand first-line first-line 'line) - (list first-line second-line 'line :expanded t))) - (should (string= (evil-describe first-line first-line 'line) - "1 line"))) - (ert-info ("Expand to the two first lines") - (should (equal (evil-expand first-line second-line 'line) - (list first-line third-line 'line :expanded t))) - (should (string= (evil-describe first-line second-line 'line) - "2 lines")))))) - -(ert-deftest evil-test-block-type () - "Expand and contract the `block' type" - :tags '(evil type) - (evil-test-buffer - ";; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (let* ((first-line 1) - (second-line (progn - (forward-line) - (point))) - (third-line (progn - (forward-line) - (point)))) - (ert-info ("Expand to a 1x1 block") - (should (equal (evil-expand 1 1 'block) - (list 1 2 'block :expanded t))) - (should (string= (evil-describe 1 1 'block) - "1 row and 1 column"))) - (ert-info ("Expand to a 2x1 block") - (should (equal (evil-expand first-line second-line 'block) - (list first-line (1+ second-line) 'block :expanded t))) - (should (string= (evil-describe first-line second-line 'block) - "2 rows and 1 column"))) - (ert-info ("Expand to a 3x2 block") - (should (equal (evil-expand first-line (1+ third-line) 'block) - (list first-line (1+ (1+ third-line)) - 'block :expanded t))) - (should (string= (evil-describe first-line (1+ third-line) 'block) - "3 rows and 2 columns"))) - (ert-info ("Contract to a 0x0 rectangle") - (should (equal (evil-contract 1 2 'block) - (list 1 1 'block :expanded nil)))) - (ert-info ("Contract to a 2x0 rectangle") - (should (equal (evil-contract first-line (1+ second-line) 'block) - (list first-line second-line 'block :expanded nil)))) - (ert-info ("Contract to a 3x1 rectangle") - (should (equal (evil-contract first-line (1+ (1+ third-line)) 'block) - (list first-line (1+ third-line) - 'block :expanded nil))))))) - -(ert-deftest evil-test-type-transform () - "Test `evil-transform'" - :tags '(evil type) - (evil-test-buffer - ";; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (ert-info ("Return positions unchanged when passed nil \ -for TYPE or TRANSFORM") - (should (equal (evil-transform nil 1 2 'block) - '(1 2 block))) - (should (equal (evil-transform :expand 1 2 nil) - '(1 2))) - (should (equal (evil-transform nil 1 2 nil) - '(1 2)))) - (ert-info ("Accept markers, but return positions") - (should (equal (evil-transform :expand - (move-marker (make-marker) 1) 1 - 'inclusive) - '(1 2 inclusive :expanded t))) - (should (equal (evil-transform nil (move-marker (make-marker) 1) 2 - nil) - '(1 2)))))) - -(ert-deftest evil-test-type-modifiers () - "Test type modifiers like \"dv}\"" - :tags '(evil type) - (ert-info ("Change `inclusive' motions to `exclusive'") - (evil-test-buffer - "[A]bove some line" - ("dve") - "[e] some line")) - (ert-info ("Change `exclusive' motions to `inclusive'") - (evil-test-buffer - "Above [s]ome line - -Below some empty line" - ("dv}") - "Above[ ] -Below some empty line")) - (ert-info ("Change type to `line'") - (evil-test-buffer - "Above [s]ome line - -Below some empty line" - ("dV}") - "Below [s]ome empty line"))) - -;;; Insertion - -(ert-deftest evil-test-insert () - "Test `evil-insert'" - :tags '(evil insert) - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save" - ("ievil rulz " [escape]) - ";; evil rulz[ ]This buffer is for notes you don't want to save")) - -(ert-deftest evil-test-append () - "Test `evil-append'" - :tags '(evil insert) - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save" - ("aevil rulz " [escape]) - ";; Tevil rulz[ ]his buffer is for notes you don't want to save")) - -(ert-deftest evil-test-visual-insert () - "Test `evil-insert' in Visual state." - :tags '(evil insert) - (ert-info ("Repeat insert over empty lines") - (evil-test-buffer :visual line "<\n\n[]>" - ("IX" [escape]) - "X\nX\nX"))) - -(ert-deftest evil-test-visual-append () - "Test `evil-append' in Visual state." - :tags '(evil insert) - (evil-test-buffer " bar" - ("A_evil rulz " [escape]) - "foo_evil rulz[ ] bar")) - -(ert-deftest evil-test-open-above () - "Test `evil-open-above'" - :tags '(evil insert) - (evil-test-buffer - ";; This buffer is for notes you don't want to save, -\[;]; and for Lisp evaluation." - ("Oabc\ndef" [escape]) - ";; This buffer is for notes you don't want to save, -abc -de[f] -;; and for Lisp evaluation.") - (ert-info ("Open empty line") - (evil-test-buffer - "(let (var)\n [t]est)\n" - (emacs-lisp-mode) - ("O" [escape]) - "(let (var)\n[\n] test)\n")) - (ert-info ("Open non-empty line") - (evil-test-buffer - "(let (var)\n [t]est)\n" - (emacs-lisp-mode) - ("Odo-it" [escape]) - "(let (var)\n do-i[t]\n test)\n"))) - -(ert-deftest evil-test-open-below () - "Test `evil-open-below'" - :tags '(evil insert) - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("oabc\ndef" [escape]) - ";; This buffer is for notes you don't want to save, -abc -de[f] -;; and for Lisp evaluation.") - (ert-info ("Open empty line") - (evil-test-buffer - "[(]let (var)\n test)\n" - (emacs-lisp-mode) - ("o" [escape]) - "(let (var)\n[\n] test)\n")) - (ert-info ("Open non-empty line") - (evil-test-buffer - "[(]let (var)\n test)\n" - (emacs-lisp-mode) - ("odo-it" [escape]) - "(let (var)\n do-i[t]\n test)\n")) - (let ((evil-auto-indent t)) - (ert-info ("With count") - (evil-test-buffer - "[(]and a\n c)\n" - (emacs-lisp-mode) - ("3ob" [escape]) - "(and a\n b\n b\n [b]\n c)\n")))) - -(ert-deftest evil-test-open-below-folded () - "Test `evil-open-below' on folded lines" - :tags '(evil insert) - (evil-test-buffer - "[l]ine1\n\n(let ()\n var)\n\nlast line\n" - (emacs-lisp-mode) - (hs-minor-mode 1) - ("zm2joABC" [escape]) - "line1\n\n(let ()\n var)\nAB[C]\n\nlast line\n")) - -(ert-deftest evil-test-insert-line () - "Test `evil-insert-line'" - :tags '(evil insert) - (evil-test-buffer "foo [b]ar" - ("Ievil rulz " [escape]) - "evil rulz[ ]foo bar") - (ert-info ("With count") - (evil-test-buffer "foo [b]ar" - ("2Ievil rulz " [escape]) - "evil rulz evil rulz[ ]foo bar"))) - -(ert-deftest evil-test-append-line () - "Test `evil-append-line'" - :tags '(evil insert) - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save" - ("Aevil rulz " [escape]) - ";; This buffer is for notes you don't want to saveevil rulz[ ]")) - -(ert-deftest evil-test-insert-digraph () - "Test `evil-insert-digraph'" - :tags '(evil insert) - (ert-info ("Predefined digraph") - (evil-test-buffer - ("i\C-kae") - "æ[]")) - (ert-info ("Custom digraph") - (let ((evil-digraphs-table-user '(((?a ?o) . ?å)))) - (evil-test-buffer - ("i\C-kao") - "å[]"))) - (ert-info ("Digraph in replace state") - (evil-test-buffer - "ab[c]defgh" - ("R\C-kc,") - "abç[d]efgh") - (ert-info ("with count") - (evil-test-buffer - "abc[d]efgh" - ("R\C-u3\C-kd*") - "abcδδδ[g]h")))) - -(ert-deftest evil-test-track-insertion () - "Test that the text of the previous insertion is tracked." - (ert-info ("Moving the cursor starts a new insertion") - (evil-test-buffer - ("iabc" [left] "xxx" [escape] "o\C-a") - "abxxxc\nxxx")) - (ert-info ("Autoindentation should be excluded") - (evil-test-buffer "\(setq x" - (emacs-lisp-mode) - ("o0\)" [escape] "o\C-a") - "(setq x - 0) -0\)"))) - -;;; Repeat system - -(ert-deftest evil-test-normalize-repeat-info () - "Test `evil-normalize-repeat-info'" - :tags '(evil repeat) - (ert-info ("Single array") - (should (equal (evil-normalize-repeat-info - '("abc")) - '([?a ?b ?c]))) - (should (equal (evil-normalize-repeat-info - '("\M-f")) - (list (kbd "M-f"))))) - (ert-info ("Single symbol") - (should (equal (evil-normalize-repeat-info - '(SYM)) - '(SYM)))) - (ert-info ("Arrays only") - (should (equal (evil-normalize-repeat-info - '("abc" [XX YY] "def")) - '([?a ?b ?c XX YY ?d ?e ?f])))) - (ert-info ("Several symbols") - (should (equal (evil-normalize-repeat-info - '(BEG MID END)) - '(BEG MID END)))) - (ert-info ("Arrays with symbol at the beginning") - (should (equal (evil-normalize-repeat-info - '(BEG "abc" [XX YY] "def")) - '(BEG [?a ?b ?c XX YY ?d ?e ?f])))) - (ert-info ("Arrays with symbol at the end") - (should (equal (evil-normalize-repeat-info - '("abc" [XX YY] "def" END)) - '([?a ?b ?c XX YY ?d ?e ?f] END)))) - (ert-info ("Arrays with symbol in the middle") - (should (equal (evil-normalize-repeat-info - '("abc" [XX YY] MID "def" )) - '([?a ?b ?c XX YY] MID [?d ?e ?f])))) - (ert-info ("Concatenate arrays with several symbols") - (should (equal (evil-normalize-repeat-info - '(BEG "abc" [XX YY] MID "def" END)) - '(BEG [?a ?b ?c XX YY] MID [?d ?e ?f] END))))) - -(defun evil-test-repeat-info (keys &optional recorded) - "Execute a sequence of keys and verify that `evil-repeat-ring' -records them correctly. KEYS is the sequence of keys to execute. -RECORDED is the expected sequence of recorded events. -If nil, KEYS is used." - (execute-kbd-macro keys) - (should (equal (evil-normalize-repeat-info (ring-ref evil-repeat-ring 0)) - (list (vconcat (or recorded keys)))))) - -(ert-deftest evil-test-normal-repeat-info-simple-command () - "Save key-sequence after simple editing command in Normal state" - :tags '(evil repeat) - (evil-test-buffer - "[T]his is a test buffer" - (ert-info ("Call simple command without count") - (evil-test-repeat-info "x")) - (ert-info ("Call simple command with count 3") - (evil-test-repeat-info "3x")))) - -(ert-deftest evil-test-normal-repeat-info-char-command () - "Save key-sequence after editing command with character in Normal state" - :tags '(evil repeat) - (evil-test-buffer - "[T]his is a test buffer" - (ert-info ("Call command with character argument without count") - (evil-test-repeat-info "r5")) - (ert-info ("Call command with character argument with count 12") - (evil-test-repeat-info "12rX")))) - -(ert-deftest evil-test-insert-repeat-info () - "Save key-sequence after Insert state" - :tags '(evil repeat) - (evil-test-buffer - (ert-info ("Insert text without count") - (evil-test-repeat-info (vconcat "iABC" [escape]))) - (ert-info ("Insert text with count 42") - (evil-test-repeat-info (vconcat "42iABC" [escape]))))) - -(ert-deftest evil-test-repeat () - "Repeat several editing commands" - :tags '(evil repeat) - (ert-info ("Repeat replace") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save" - ("rX") - "[X]; This buffer is for notes you don't want to save" - ([right right] ".") - "X;[X]This buffer is for notes you don't want to save")) - (ert-info ("Repeat replace with count") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save" - ("2rX") - "X[X] This buffer is for notes you don't want to save" - ([right right] ".") - "XX X[X]is buffer is for notes you don't want to save")) - (ert-info ("Repeat replace without count with a new count") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save" - ("rX") - "[X]; This buffer is for notes you don't want to save" - ([right right] "13.") - "X;XXXXXXXXXXXX[X]is for notes you don't want to save")) - (ert-info ("Repeat replace with count replacing original count") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save" - ("10rX") - "XXXXXXXXX[X]ffer is for notes you don't want to save" - ([right right] "20.") - "XXXXXXXXXXfXXXXXXXXXXXXXXXXXXX[X] don't want to save")) - (ert-info ("Repeat movement in Insert state") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save" - ("i(\M-f)" [escape]) - ";; (This[)] buffer is for notes you don't want to save" - ("w.") - ";; (This) (buffer[)] is for notes you don't want to save")) - (ert-info ("Repeat search motion with offset") - (evil-select-search-module 'evil-search-module 'evil-search) - (evil-test-buffer - "[f]irst, second, third, fourth" - ("d/, /e" [return]) - "[s]econd, third, fourth" - ("2.") - "[f]ourth"))) - -(ert-deftest evil-test-repeat-register () - "Test repeating a register command." - :tags '(evil repeat) - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\nline 4\n" - ("\"addyy\"aP") - "[l]ine 1\nline 2\nline 3\nline 4\n" - (".") - "[l]ine 1\nline 1\nline 2\nline 3\nline 4\n")) - -(ert-deftest evil-test-repeat-numeric-register () - "Test repeating a command with a numeric register." - :tags '(evil repeat) - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\nline 4\nline 5\n" - ("dd...") - "[l]ine 5\n" - ("\"1P") - "[l]ine 4\nline 5\n" - (".") - "[l]ine 3\nline 4\nline 5\n" - (".") - "[l]ine 2\nline 3\nline 4\nline 5\n" - (".") - "[l]ine 1\nline 2\nline 3\nline 4\nline 5\n")) - -(ert-deftest evil-test-cmd-replace-char () - "Calling `evil-replace-char' should replace characters" - :tags '(evil repeat) - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save" - ("r5") - "[5]; This buffer is for notes you don't want to save" - ("3rX") - "XX[X]This buffer is for notes you don't want to save") - (ert-info ("Replace digraph") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save" - ("r e'") - "[é]; This buffer is for notes you don't want to save" - ("3r c*") - "ξξ[ξ]This buffer is for notes you don't want to save") - (ert-info ("Repeat replace digraph") - (evil-test-buffer - "ab[c]defghijkl" - ("r W*") - "ab[Ω]defghijkl" - ("fg" "2.") - "abΩdefΩ[Ω]ijkl"))) - (ert-info ("Replacing \\n should insert only one newline") - (evil-test-buffer - "(setq var xxx [y]yy zzz)\n" - (emacs-lisp-mode) - (setq indent-tabs-mode nil) - ("2r\n") - "(setq var xxx \n [y] zzz)\n"))) - -(ert-deftest evil-test-insert-with-count () - "Test `evil-insert' with repeat count" - :tags '(evil repeat) - (evil-test-buffer - ";; [T]his buffer is for notes" - ("2ievil rulz " [escape]) - ";; evil rulz evil rulz[ ]This buffer is for notes")) - -(ert-deftest evil-test-repeat-insert () - "Test repeating of `evil-insert'" - :tags '(evil repeat) - (ert-info ("Repeat insert") - (evil-test-buffer - "[;]; This buffer is for notes" - ("iABC" [escape]) - "AB[C];; This buffer is for notes" - ("..") - "ABABAB[C]CC;; This buffer is for notes")) - (ert-info ("Repeat insert with count") - (evil-test-buffer - "[;]; This buffer is for notes" - ("2iABC" [escape]) - "ABCAB[C];; This buffer is for notes" - ("..") - "ABCABABCABABCAB[C]CC;; This buffer is for notes")) - (ert-info ("Repeat insert with repeat count") - (evil-test-buffer - "[;]; This buffer is for notes" - ("iABC" [escape]) - "AB[C];; This buffer is for notes" - ("11.") - "ABABCABCABCABCABCABCABCABCABCABCAB[C]C;; This buffer is for notes")) - (ert-info ("Repeat insert with count with repeat with count") - (evil-test-buffer - "[;]; This buffer is for notes" - ("10iABC" [escape]) - "ABCABCABCABCABCABCABCABCABCAB[C];; This buffer is for notes" - ("11.") - "ABCABCABCABCABCABCABCABCABCABABCABCABCABCABCABCABCABCABCABCAB[C]C;; \ -This buffer is for notes"))) - -(ert-deftest evil-test-repeat-error () - "Test whether repeat returns to normal state in case of an error." - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\nline 4" - ("ixxx" [down] [down] [left] [left] [left] "yyy" [escape]) - "xxxline 1\nline 2\nyy[y]line 3\nline 4" - (should-error (execute-kbd-macro "j^.")) - (should (evil-normal-state-p)) - ("^") - "xxxline 1\nline 2\nyyyline 3\n[x]xxline 4")) - -(ert-deftest evil-test-quoted-insert () - "Test evil-quoted-insert in replace state." - (ert-info ("Simple replace C-v") - (evil-test-buffer - "ab[c]defg" - ("R\C-vx") - "abx[d]efg")) - (ert-info ("Control char replace C-v") - (evil-test-buffer - "ab[c]defg" - ("R\C-v\C-g") - "ab[d]efg")) - (ert-info ("C-v with count") - (evil-test-buffer - "ab[c]defg" - ("R\C-u3\C-vx") - "abxxx[f]g")) - (ert-info ("C-v with count near eol") - (evil-test-buffer - "abcde[f]g" - ("R\C-u3\C-vx") - "abcdexxx[]")) - (ert-info ("C-v in replace can be backspaced") - (evil-test-buffer - "ab[c]defg" - ("R\C-u3\C-vx" [backspace]) - "abxx[e]fg"))) - -(ert-deftest evil-test-repeat-quoted-insert () - "Test whether `quoted-insert' can be repeated." - (ert-info ("Insert C-v") - (evil-test-buffer - "lin[e] 1\nline 2\nline 3\n" - ("i\C-v\C-v" [escape]) - "lin[]e 1\nline 2\nline 3\n")) - (ert-info ("Insert ESC") - (evil-test-buffer - "lin[e] 1\nline 2\nline 3\n" - ("i\C-v" [escape escape]) - "lin[]e 1\nline 2\nline 3\n")) - (ert-info ("Block insert C-v") - (evil-test-buffer - "lin[e] 1\nline 2\nline 3\n" - ("gg\C-vGI\C-v\C-v" [escape]) - "[]line 1\nline 2\nline 3\n"))) - -(ert-deftest evil-test-insert-vcount () - "Test `evil-insert' with vertical repeating" - :tags '(evil repeat) - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer. - -;; Below the empty line." - (define-key evil-normal-state-local-map "i" - #'(lambda (count) - (interactive "p") - (evil-insert count 5))) - ("2iABC" [escape]) - "\ -;; ABCAB[C]This buffer is for notes you don't want to save. -;; ABCABCIf you want to create a file, visit that file with C-x C-f, -;; ABCABCthen enter the text in that file's own buffer. - ABCABC -;; ABCABCBelow the empty line.")) - -(ert-deftest evil-test-append-with-count () - "Test `evil-append' with repeat count" - :tags '(evil repeat) - (evil-test-buffer - ";; [T]his buffer is for notes" - ("2aevil rulz " [escape]) - ";; Tevil rulz evil rulz[ ]his buffer is for notes")) - -(ert-deftest evil-test-repeat-append () - "Test repeating of `evil-append'" - :tags '(evil repeat) - (ert-info ("Repeat insert") - (evil-test-buffer - "[;]; This buffer is for notes" - ("aABC" [escape]) - ";AB[C]; This buffer is for notes" - ("..") - ";ABCABCAB[C]; This buffer is for notes")) - (ert-info ("Repeat insert with count") - (evil-test-buffer - "[;]; This buffer is for notes" - ("2aABC" [escape]) - ";ABCAB[C]; This buffer is for notes" - ("..") - ";ABCABCABCABCABCAB[C]; This buffer is for notes")) - (ert-info ("Repeat insert with repeat count") - (evil-test-buffer - "[;]; This buffer is for notes" - ("aABC" [escape]) - ";AB[C]; This buffer is for notes" - ("11.") - ";ABCABCABCABCABCABCABCABCABCABCABCAB[C]; This buffer is for notes")) - (ert-info ("Repeat insert with count with repeat with count") - (evil-test-buffer - "[;]; This buffer is for notes" - ("10aABC" [escape]) - ";ABCABCABCABCABCABCABCABCABCAB[C]; This buffer is for notes" - ("11.") - ";ABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCAB[C]; \ -This buffer is for notes"))) - -(ert-deftest evil-test-append-vcount () - "Test `evil-append' with vertical repeating" - :tags '(evil repeat) - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer. - -;; Below the empty line." - (define-key evil-normal-state-local-map "a" - #'(lambda (count) - (interactive "p") - (evil-append count 5))) - ("2aABC" [escape]) - "\ -;; TABCAB[C]his buffer is for notes you don't want to save. -;; IABCABCf you want to create a file, visit that file with C-x C-f, -;; tABCABChen enter the text in that file's own buffer. - ABCABC -;; BABCABCelow the empty line.")) - -(ert-deftest evil-test-open-above-with-count () - "Test `evil-open-above' with repeat count" - :tags '(evil repeat) - (evil-test-buffer - ";; This buffer is for notes you don't want to save, -\[;]; and for Lisp evaluation." - ("2Oevil\nrulz" [escape]) - ";; This buffer is for notes you don't want to save, -evil\nrulz\nevil\nrul[z] -;; and for Lisp evaluation.")) - -(ert-deftest evil-test-repeat-open-above () - "Test repeating of `evil-open-above'" - :tags '(evil repeat) - (ert-info ("Repeat insert") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save." - ("Oevil\nrulz" [escape]) - "evil\nrul[z] -;; This buffer is for notes you don't want to save." - ("..") - "evil\nevil\nevil\nrul[z]\nrulz\nrulz -;; This buffer is for notes you don't want to save.")) - (ert-info ("Repeat insert with count") - (evil-test-buffer - ";; This buffer is for notes you don't want to save." - ("2Oevil\nrulz" [escape]) - "evil\nrulz\nevil\nrul[z] -;; This buffer is for notes you don't want to save." - ("..") - "evil\nrulz\nevil\nevil\nrulz\nevil\nevil\nrulz\nevil\nrul[z]\nrulz\nrulz -;; This buffer is for notes you don't want to save.")) - (ert-info ("Repeat insert with repeat count") - (evil-test-buffer - ";; This buffer is for notes you don't want to save." - ("Oevil\nrulz" [escape]) - "evil\nrul[z]\n;; This buffer is for notes you don't want to save." - ("2.") - "evil\nevil\nrulz\nevil\nrul[z]\nrulz -;; This buffer is for notes you don't want to save.")) - (ert-info ("Repeat insert with count with repeat with count") - (evil-test-buffer - ";; This buffer is for notes you don't want to save." - ("2Oevil\nrulz" [escape]) - "evil\nrulz\nevil\nrul[z] -;; This buffer is for notes you don't want to save." - ("3.") - "evil\nrulz\nevil\nevil\nrulz\nevil\nrulz\nevil\nrul[z]\nrulz -;; This buffer is for notes you don't want to save."))) - -(ert-deftest evil-test-open-below-with-count () - "Test insertion of `evil-open-below' with repeat count" - :tags '(evil repeat) - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("2oevil\nrulz" [escape]) - ";; This buffer is for notes you don't want to save, -evil\nrulz\nevil\nrul[z] -;; and for Lisp evaluation.")) - -(ert-deftest evil-test-repeat-open-below () - "Test repeating `evil-open-below'" - :tags '(evil repeat) - (ert-info ("Repeat insert") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("oevil\nrulz" [escape]) - ";; This buffer is for notes you don't want to save, -evil\nrul[z]\n;; and for Lisp evaluation." - ("..") - ";; This buffer is for notes you don't want to save, -evil\nrulz\nevil\nrulz\nevil\nrul[z] -;; and for Lisp evaluation.")) - (ert-info ("Repeat insert with count") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("2oevil\nrulz" [escape]) - ";; This buffer is for notes you don't want to save, -evil\nrulz\nevil\nrul[z] -;; and for Lisp evaluation." - ("..") - ";; This buffer is for notes you don't want to save, -evil\nrulz\nevil\nrulz\nevil\nrulz\nevil\nrulz\nevil\nrulz\nevil\nrul[z] -;; and for Lisp evaluation.")) - (ert-info ("Repeat insert with repeat count") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("oevil\nrulz" [escape]) - ";; This buffer is for notes you don't want to save, -evil\nrul[z]\n;; and for Lisp evaluation." - ("2.") - ";; This buffer is for notes you don't want to save, -evil\nrulz\nevil\nrulz\nevil\nrul[z] -;; and for Lisp evaluation.")) - (ert-info ("Repeat insert with count with repeat with count") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("2oevil\nrulz" [escape]) - ";; This buffer is for notes you don't want to save, -evil\nrulz\nevil\nrul[z] -;; and for Lisp evaluation." - ("3.") - ";; This buffer is for notes you don't want to save, -evil\nrulz\nevil\nrulz\nevil\nrulz\nevil\nrulz\nevil\nrul[z] -;; and for Lisp evaluation."))) - -(ert-deftest evil-test-repeat-insert-line () - "Test repeating of `evil-insert-line'" - :tags '(evil repeat) - (ert-info ("Repeat insert") - (evil-test-buffer - ";; This buffer is for note[s]" - ("IABC" [escape]) - "AB[C];; This buffer is for notes" - ("..") - "AB[C]ABCABC;; This buffer is for notes")) - (ert-info ("Repeat insert with count") - (evil-test-buffer - ";; This buffer is for note[s]" - ("2IABC" [escape]) - "ABCAB[C];; This buffer is for notes" - ("..") - "ABCAB[C]ABCABCABCABC;; This buffer is for notes")) - (ert-info ("Repeat insert with repeat count") - (evil-test-buffer - ";; This buffer is for note[s]" - ("IABC" [escape]) - "AB[C];; This buffer is for notes" - ("11.") - "ABCABCABCABCABCABCABCABCABCABCAB[C]ABC;; This buffer is for notes")) - (ert-info ("Repeat insert with count with repeat with count") - (evil-test-buffer - ";; This buffer is for note[s]" - ("10IABC" [escape]) - "ABCABCABCABCABCABCABCABCABCAB[C];; This buffer is for notes" - ("11.") - "ABCABCABCABCABCABCABCABCABCABCAB[C]ABCABCABCABCABCABCABCABCABCABC;; This buffer is for notes"))) - -(ert-deftest evil-test-insert-line-vcount () - "Test `evil-insert-line' with vertical repeating" - :tags '(evil repeat) - (evil-test-buffer - "int[ ]main(int argc, char** argv) -{ - printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -}" - (define-key evil-normal-state-local-map "I" - #'(lambda (count) - (interactive "p") - (evil-insert-line count 4))) - ("2IABC" [escape]) - "ABCABCint main(int argc, char** argv) -ABCABC{ - ABCABCprintf(\"Hello world\\n\"); - ABCABCreturn EXIT_SUCCESS; -}")) - -(ert-deftest evil-test-append-line-with-count () - "Test `evil-append-line' with repeat count" - :tags '(evil repeat) - (evil-test-buffer - ";; [T]his buffer is for notes." - ("2Aevil rulz " [escape]) - ";; This buffer is for notes.evil rulz evil rulz[ ]")) - -(ert-deftest evil-test-repeat-append-line () - "Test repeating of `evil-append-line'" - :tags '(evil repeat) - (ert-info ("Repeat insert") - (evil-test-buffer - ";; [T]his buffer is for notes." - ("AABC" [escape]) - ";; This buffer is for notes.AB[C]" - ("..") - ";; This buffer is for notes.ABCABCAB[C]")) - (ert-info ("Repeat insert with count") - (evil-test-buffer - ";; [T]his buffer is for notes." - ("2AABC" [escape]) - ";; This buffer is for notes.ABCAB[C]" - ("..") - ";; This buffer is for notes.ABCABCABCABCABCAB[C]")) - (ert-info ("Repeat insert with repeat count") - (evil-test-buffer - ";; [T]his buffer is for notes." - ("AABC" [escape]) - ";; This buffer is for notes.ABC" - ("11.") - ";; This buffer is for notes.ABCABCABCABCABCABCABCABCABCABCABCAB[C]")) - (ert-info ("Repeat insert with count with repeat with count") - (evil-test-buffer - ";; [T]his buffer is for notes." - ("10AABC" [escape]) - ";; This buffer is for notes.ABCABCABCABCABCABCABCABCABCAB[C]" - ("11.") - ";; This buffer is for notes.ABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCAB[C]")) - (ert-info ("Repeat append over empty lines") - (evil-test-buffer - "" - ("i" [return] [return] [return] [return] [return] [return] [escape] "gg\C-vGAX" [escape]) - "X\nX\nX\nX\nX\nX\n"))) - -(ert-deftest evil-test-append-line-vcount () - "Test `evil-append-line' with vertical repeating" - :tags '(evil repeat) - (evil-test-buffer - "int[ ]main(int argc, char** argv) -{ - printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -}" - (define-key evil-normal-state-local-map "A" - #'(lambda (count) - (interactive "p") - (evil-append-line count 4))) - ("2AABC" [escape]) - "int main(int argc, char** argv)ABCAB[C] -{ABCABC - printf(\"Hello world\\n\");ABCABC - return EXIT_SUCCESS;ABCABC -}")) - -(ert-deftest evil-test-repeat-by-change () - "Test repeating by tracking changes for completion commands" - :tags '(evil repeat) - (let ((line-move-visual nil) - (change (evil-define-command nil () - :repeat change - (interactive) - (delete-char 5) - (insert "BEGIN\n") - (save-excursion - (insert "\nEND\n"))))) - (evil-test-buffer - ";; [T]his buffer is for notes." - (define-key evil-insert-state-local-map (kbd "C-c C-p") change) - ("iABC " (kbd "C-c C-p") "BODY" [escape]) - ";; ABC BEGIN -BOD[Y] -END -buffer is for notes." - (".") - ";; ABC BEGIN -BODABC BEGIN -BOD[Y] -END - -buffer is for notes."))) - -(ert-deftest evil-test-repeat-kill-buffer () - "Test safe-guard preventing buffers from being deleted -when repeating a command" - :tags '(evil repeat) - (ert-info ("Test killing works for direct calls \ -to `evil-execute-repeat-info'") - (evil-test-buffer - "[;]; This buffer is for notes." - (setq evil-repeat-ring (make-ring 10)) - (ring-insert evil-repeat-ring '((kill-buffer nil))) - (evil-execute-repeat-info (ring-ref evil-repeat-ring 0)) - (should-not (looking-at ";; This")))) - (ert-info ("Verify an error is raised when using \ -the `evil-repeat' command") - (evil-test-buffer - "[;]; This buffer is for notes." - (setq evil-repeat-ring (make-ring 10)) - (ring-insert evil-repeat-ring '((kill-buffer nil))) - (evil-execute-repeat-info (ring-ref evil-repeat-ring 0)) - (should-error (call-interactively #'evil-repeat))))) - -(ert-deftest evil-test-repeat-pop () - "Test `repeat-pop'." - :tags '(evil repeat) - (ert-info ("Test repeat-pop") - (evil-test-buffer - ";; [T]his buffer is for notes." - (setq evil-repeat-ring (make-ring 10)) - ("iABC" [escape] "aXYZ" [escape]) - ";; ABCXY[Z]This buffer is for notes." - (".") - ";; ABCXYZXY[Z]This buffer is for notes.")) - (ert-info ("Test repeat-pop") - (evil-test-buffer - ";; [T]his buffer is for notes." - (setq evil-repeat-ring (make-ring 10)) - ("iABC" [escape] "aXYZ" [escape]) - ";; ABCXY[Z]This buffer is for notes." - ("." (kbd "C-.")) - ";; ABCXYAB[C]ZThis buffer is for notes.")) - (ert-info ("Test repeat-pop-next") - (evil-test-buffer - ";; [T]his buffer is for notes." - (setq evil-repeat-ring (make-ring 10)) - ("iABC" [escape] "aXYZ" [escape]) - ";; ABCXY[Z]This buffer is for notes." - ("." (kbd "C-.") (kbd "M-.")) - ";; ABCXYZXY[Z]This buffer is for notes.")) - (ert-info ("Test repeat-pop after non-change") - (evil-test-buffer - ";; [T]his buffer is for notes." - (setq evil-repeat-ring (make-ring 10)) - ("iABC" [escape] "a" [escape] "aXYZ" [escape]) - ";; ABCXY[Z]This buffer is for notes." - ("." (kbd "C-.") (kbd "C-.")) - ";; ABCXYAB[C]ZThis buffer is for notes."))) - -(ert-deftest evil-test-ESC-repeat-normal-state () - "Test if ESC is not been recorded in normal state." - :tags '(evil repeat) - (ert-info ("Test normal ESC") - (evil-test-buffer - ";;[ ]This buffer is for notes." - (setq evil-repeat-ring (make-ring 10)) - (should (= (ring-length evil-repeat-ring) 0)) - ("aABC" [escape]) - ";; AB[C]This buffer is for notes." - (should (= (ring-length evil-repeat-ring) 1)) - (".") - ";; ABCAB[C]This buffer is for notes." - ([escape]) - (should (= (ring-length evil-repeat-ring) 1)) - (".") - ";; ABCABCAB[C]This buffer is for notes."))) - -(ert-deftest evil-test-abort-operator-repeat () - "Test if ESC in operator-state cancels recording of repeation." - :tags '(evil repeat) - (let ((inhibit-quit t)) - (ert-info ("Test ESC") - (evil-test-buffer - ";;[ ]This buffer is for notes." - (setq evil-repeat-ring (make-ring 10)) - (should (= (ring-length evil-repeat-ring) 0)) - ("aABC" [escape]) - ";; AB[C]This buffer is for notes." - (should (= (ring-length evil-repeat-ring) 1)) - (".") - ";; ABCAB[C]This buffer is for notes." - ("d" [escape]) - (should (= (ring-length evil-repeat-ring) 1)) - (".") - ";; ABCABCAB[C]This buffer is for notes.")))) - -(ert-deftest evil-test-repeat-with-find-char () - "Ensure that repeating find-char commands doesn't change `evil-last-find'" - :tags '(evil repeat) - (evil-test-buffer - "[b]ar baz bat" - ("dfa" "fb") - "r [b]az bat" - (".") - "r [z] bat" - (";") - "r z [b]at")) - -(ert-deftest evil-test-repeat-visual-char () - "Test repeat of character visual mode command." - :tags '(evil repeat) - (ert-info ("Test repeat on same line") - (evil-test-buffer - ";; [T]his buffer is for notes." - ("v3lcABC" [escape]) - ";; AB[C] buffer is for notes." - ("ww.") - ";; ABC buffer AB[C]or notes.")) - (ert-info ("Test repeat on several lines") - (evil-test-buffer - ";; This [b]uffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer. -" - ("vj^eerX") - ";; This XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -XXXX[X] you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer. -" - ("2gg^3w.") - ";; This XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -XXXXX you want XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -XXXX[X]en enter the text in that file's own buffer. -"))) - -(ert-deftest evil-test-repeat-visual-line () - "Test repeat of linewise visual mode command." - :tags '(evil repeat) - (ert-info ("Test repeat on several lines") - (evil-test-buffer - ";; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter th[e] text in that file's own buffer. - -;; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer. -" - ("VkcNew Text" [escape]) - ";; This buffer is for notes you don't want to save. -New Tex[t] - -;; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer. -" - ("jj.") - ";; This buffer is for notes you don't want to save. -New Text - -New Tex[t] -;; then enter the text in that file's own buffer. -"))) - -(ert-deftest evil-test-repeat-visual-block () - "Test repeat of block visual mode command." - :tags '(evil repeat) - (ert-info ("Test repeat on several lines") - (evil-test-buffer - ";; This [b]uffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer. -;; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer. -" - ((kbd "C-v") "3j2lrQ") - ";; This [Q]QQfer is for notes you don't want to save. -;; If yoQQQant to create a file, visit that file with C-x C-f, -;; then QQQer the text in that file's own buffer. -;; This QQQfer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer. -" - ("2j3w.") - ";; This QQQfer is for notes you don't want to save. -;; If yoQQQant to create a file, visit that file with C-x C-f, -;; then QQQer the text [Q]QQthat file's own buffer. -;; This QQQfer is for nQQQs you don't want to save. -;; If you want to creatQQQ file, visit that file with C-x C-f, -;; then enter the text QQQthat file's own buffer. -"))) - -(ert-deftest evil-visual-block-append () - "Test appending in visual block." - :tags '(evil visual insert) - (ert-info ("Simple append") - (evil-test-buffer - "l[i]ne 1\nline 2\nline 3\n" - ((kbd "C-v") "jjllAXXX" [escape]) - "lineXX[X] 1\nlineXXX 2\nlineXXX 3\n")) - (ert-info ("Append after empty lines") - (evil-test-buffer - "line 1l[i]ne 1\nline 2\nline 3line 3\n" - (setq indent-tabs-mode nil) - ((kbd "C-v") "jjllAXXX" [escape]) - "line 1lineXX[X] 1\nline 2 XXX\nline 3lineXXX 3\n")) - (ert-info ("Append after empty first line") - (evil-test-buffer - "l[i]ne 1line 1\nline 2\nline 3line 3line 3\n" - (setq indent-tabs-mode nil) - ((kbd "C-v") "jj3feAXXX" [escape]) - "line 1line 1 XX[X]\nline 2 XXX\nline 3line 3lineXXX 3\n")) - (ert-info ("Append after end of lines") - (evil-test-buffer - "line 1l[i]ne 1line 1\nline 2\nline 3line 3\n" - (setq indent-tabs-mode nil) - ((kbd "C-v") "jj$AXXX" [escape]) - "line 1line 1line 1XX[X]\nline 2XXX\nline 3line 3XXX\n"))) - -(ert-deftest evil-visual-block-insert () - "Test inserting (prepending) in visual block." - :tags '(evil visual insert) - (ert-info ("Prepend and repeat") - (evil-test-buffer - "[a]lpha\nbravo\ncharlie\ndelta\necho\nfoxtrot\ngolf" - ("\C-v" "jj" "I" "zulu" [escape]) - "zul[u]alpha\nzulubravo\nzulucharlie\ndelta\necho\nfoxtrot\ngolf" - ("/delta" [return] ".") - "zulualpha\nzulubravo\nzulucharlie\nzul[u]delta\nzuluecho\nzulufoxtrot\ngolf"))) - -(ert-deftest evil-test-repeat-digraph () - "Test repeat of insertion of a digraph." - :tags '(evil digraph repeat) - (evil-test-buffer - "Line with ['] several apostrophes ', yeah." - ("s" (kbd "C-k") "'9" [escape]) - "Line with [’] several apostrophes ', yeah." - ("f'.") - "Line with ’ several apostrophes [’], yeah.")) - -;;; Operators - -(ert-deftest evil-test-indent () - "Test `evil-indent'" - :tags '(evil visual operator) - (evil-test-buffer - :state visual - "< Line with too much indentation.>" - ("=") - "Line with too much indentation.") - (ert-info ("Can repeat evil-indent without errors") - (evil-test-buffer - "[ ]x\n x" - ("==j.") - "x\nx"))) - -(ert-deftest evil-test-keypress-parser () - "Test `evil-keypress-parser'" - :tags '(evil operator) - (evil-test-buffer - :state operator - (ert-info ("Read from the keyboard unless INPUT is given") - (evil-test-buffer - :state operator - (let ((unread-command-events '(?d))) - (should (equal (evil-keypress-parser) - '(evil-delete nil))) - (should (equal (evil-keypress-parser '(?d)) - '(evil-delete nil)))))) - (ert-info ("Read remainder from the keyboard if INPUT is incomplete") - (let ((unread-command-events '(?d))) - (should (equal (evil-keypress-parser '(?2)) - '(evil-delete 2))))) - (ert-info ("Handle counts not starting with zero") - (should (equal (evil-keypress-parser '(?2 ?d)) - '(evil-delete 2))) - (should (equal (evil-keypress-parser '(?2 ?0 ?d)) - '(evil-delete 20))) - (should (equal (evil-keypress-parser '(?2 ?0 ?2 ?d)) - '(evil-delete 202))) - (should (equal (evil-keypress-parser '(?4 ?0 ?4 ?g ??)) - '(evil-rot13 404)))) - (ert-info ("Treat 0 as a motion") - (should (equal - (evil-keypress-parser '(?0)) - '(evil-beginning-of-line nil)))) - (ert-info ("Handle keyboard macros") - (evil-test-buffer - (define-key evil-motion-state-local-map (kbd "W") (kbd "w")) - (should (equal (evil-keypress-parser '(?W)) - '(evil-forward-word-begin nil))))))) - -(ert-deftest evil-test-invert-char () - "Test `evil-invert-char'" - :tags '(evil operator) - (evil-test-buffer - ";; [T]his buffer is for notes." - ("~") - ";; t[h]is buffer is for notes.") - (evil-test-buffer - ";; <[T]his> buffer is for notes." - ("~") - ";; [t]HIS buffer is for notes.") - (evil-test-buffer - :visual block - ";; <[T]his buffer is for notes, -;; and >for Lisp evaluation." - ("~") - ";; [t]HIS buffer is for notes, -;; AND for Lisp evaluation.")) - -(ert-deftest evil-test-rot13 () - "Test `evil-rot13'" - :tags '(evil operator) - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save." - ("g?" [M-right]) - ";; [G]uvf buffer is for notes you don't want to save.")) - -(ert-deftest evil-test-rot13-with-count () - "Test `evil-rot13' with count argument" - :tags '(evil operator) - (ert-info ("Count before operator") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save." - ("2g?" [M-right]) - ";; [G]uvf ohssre is for notes you don't want to save.")) - (ert-info ("Count before motion") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save." - ("g?2" [M-right]) - ";; [G]uvf ohssre is for notes you don't want to save.")) - (ert-info ("Count before operator and motion") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save." - ("3g?2" [M-right]) - ";; [G]uvf ohssre vf sbe abgrf lbh don't want to save.")) - (ert-info ("Count exceeding buffer boundaries") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save." - ("g?200" [right]) - ";; [G]uvf ohssre vf sbe abgrf lbh qba'g jnag gb fnir."))) - -(ert-deftest evil-test-rot13-repeat () - "Test repeating of `evil-rot13'" - :tags '(evil operator) - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save." - ("g?" [M-right] [M-right]) - ";; Guvf[ ]buffer is for notes you don't want to save." - (".") - ";; Guvf[ ]ohssre is for notes you don't want to save.")) - -(ert-deftest evil-test-rot13-repeat-with-count () - "Test repeating of `evil-rot13' with new count" - :tags '(evil operator) - (ert-info ("Count before operator") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save." - ("2g?" [M-right]) - ";; [G]uvf ohssre is for notes you don't want to save." - ("3.") - ";; [T]his buffer vf for notes you don't want to save.")) - (ert-info ("Count before motion") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save." - ("g?2" [M-right]) - ";; [G]uvf ohssre is for notes you don't want to save." - ("3.") - ";; [T]his buffer vf for notes you don't want to save.")) - (ert-info ("Count before operator and motion") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save." - ("3g?2" [M-right]) - ";; [G]uvf ohssre vf sbe abgrf lbh don't want to save." - ("4.") - ";; [T]his buffer is for abgrf lbh don't want to save."))) - -(ert-deftest evil-test-operator-delete () - "Test deleting text" - :tags '(evil operator) - (ert-info ("Delete characters") - (evil-test-buffer - ";; [T]his buffer is for notes." - ("dl") - ";; [h]is buffer is for notes." - ("d1l") - ";; [i]s buffer is for notes." - ("1dl") - ";; [s] buffer is for notes." - ("1d1l") - ";; [ ]buffer is for notes." - ("d2l") - ";; [u]ffer is for notes." - ("2dl") - ";; [f]er is for notes." - ("d4l") - ";; [i]s for notes." - ("4dl") - ";; [o]r notes." - ("2d2l") - ";; [o]tes.")) - (ert-info ("Delete current line") - (ert-info ("With `evil-start-of-line' `nil'") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("dd") - ";; [a]nd for Lisp evaluation.") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("d1d") - ";; [a]nd for Lisp evaluation.") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("1dd") - ";; [a]nd for Lisp evaluation.") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("1d1d") - ";; [a]nd for Lisp evaluation.")) - (ert-info ("With `evil-start-of-line' `t'") - (let ((evil-start-of-line t)) - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("dd") - "[;]; and for Lisp evaluation.") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("d1d") - "[;]; and for Lisp evaluation.") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("1dd") - "[;]; and for Lisp evaluation.") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("1d1d") - "[;]; and for Lisp evaluation.")))) - (ert-info ("Delete two lines") - (ert-info ("With `evil-start-of-line' `nil'") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("d2d") - ";; [t]hen enter the text in that file's own buffer.") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("2dd") - ";; [t]hen enter the text in that file's own buffer.") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("dj") - ";; [t]hen enter the text in that file's own buffer.") - (evil-test-buffer - ";; This buffer is for notes you don't want to save. -;; [I]f you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("dk") - ";; [t]hen enter the text in that file's own buffer.")) - (ert-info ("With `evil-start-of-line' `t'") - (let ((evil-start-of-line t)) - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("d2d") - "[;]; then enter the text in that file's own buffer.") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("2dd") - "[;]; then enter the text in that file's own buffer.") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("dj") - "[;]; then enter the text in that file's own buffer.") - (evil-test-buffer - ";; This buffer is for notes you don't want to save. -;; [I]f you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("dk") - "[;]; then enter the text in that file's own buffer."))))) - -(evil-define-motion evil-test-square-motion (count) - "Test motion for selecting a square." - :type block - (let ((column (current-column))) - (forward-line (1- count)) - (move-to-column (+ column count -1)))) - -(ert-deftest evil-test-yank () - "Test `evil-yank'" - :tags '(evil operator yank) - (ert-info ("Yank characters") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save." - ("y2e") - (should (string= (current-kill 0) "This buffer")))) - (ert-info ("Yank lines") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("yj") - (should (string= (current-kill 0) - (buffer-substring (point-min) - (1+ (line-end-position 2))))) - (should (eq (car-safe (get-text-property 0 'yank-handler - (current-kill 0))) - 'evil-yank-line-handler))) - (evil-test-buffer - ";; This buffer is for notes you don't want to save. -\[;]; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("y5j") - (should - (string= (current-kill 0) - (concat (buffer-substring (line-beginning-position 1) - (point-max)) - "\n"))) - (should (eq (car-safe (get-text-property 0 'yank-handler - (current-kill 0))) - 'evil-yank-line-handler)))) - (ert-info ("Yank rectangle") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("y3s") - (should (string= (current-kill 0) "Thi\nIf \nthe")) - (should (eq (car-safe (get-text-property 0 'yank-handler - (current-kill 0))) - 'evil-yank-block-handler)))) - (ert-info (":yank, then paste") - (evil-test-buffer - "a\n[b]\nc\nd\n" - (":yank" [return] "p") - "a\nb\nb\nc\nd\n")) - (ert-info (":yank with COUNT") - (evil-test-buffer - "a\n[b]\nc\nd\n" - (":yank 2" [return] "p") - "a\nb\nb\nc\nc\nd\n")) - (ert-info (":yank with COUNT in visual state") - (evil-test-buffer - "a\n\nd\ne\nf\n" - (":yank 3" [return] "p") - "a\nb\nc\nd\ne\nc\nd\ne\nf\n")) - (ert-info (":yank with REGISTER") - (evil-test-buffer - "a\n[b]\nc\nd\n" - (":yank r") ;; yank into the 'r' register - "a\nb\nc\nd\n" - ;; check the 'r' register contains the yanked text - (should (string= (substring-no-properties (evil-get-register ?r)) "b\n")))) - (ert-info (":yank with REGISTER and COUNT") - (evil-test-buffer - "a\n[b]\nc\nd\ne\nf\n" - (":yank r 3") - "a\nb\nc\nd\ne\nf\n" - (should (string= (substring-no-properties (evil-get-register ?r)) "b\nc\nd\n")))) - (ert-info (":yank with range yanks without moving point") - (evil-test-buffer - "[a]\nb\nc\nd\ne\n" - (":4y" [return] "p") - "a\n[d]\nb\nc\nd\ne\n") - (evil-test-buffer - "[a]\nb\nc\nd\ne\n" - (":+4y" [return] "p") - "a\n[e]\nb\nc\nd\ne\n") - (evil-test-buffer - "1\n2\n3\n4\n5\n6\n7\n8\n9\n1[0]" - (":-5,.y") - "1\n2\n3\n4\n5\n6\n7\n8\n9\n1[0]") - (evil-test-buffer - "1\n2\n3\n4\n[5]\n6\n7\n8\n9\n10" - ("my" "G" ":'y,.y") - "1\n2\n3\n4\n5\n6\n7\n8\n9\n[1]0"))) - -(ert-deftest evil-test-yank-line () - "Test `evil-yank-line'" - :tags '(evil operator) - (ert-info ("Yank line with eof being part of visual selection") - (evil-test-buffer - ";; This is line one -;; This is lin[e] two -;; This is line three" - ("v$Yjp") - ";; This is line one -;; This is line two -;; This is line three -[;]; This is line two"))) - -(ert-deftest evil-test-delete () - "Test `evil-delete'" - :tags '(evil operator delete) - (ert-info ("Delete characters") - (evil-test-buffer - ";; This buffer is for notes you don't want to save[.]" - ("x") - ";; This buffer is for notes you don't want to sav[e]" - (goto-char 4) - ";; [T]his buffer is for notes you don't want to save" - ("d2e") - ";; [ ]is for notes you don't want to save" - (should (string= (current-kill 0) "This buffer")) - ("P") - ";; This buffe[r] is for notes you don't want to save")) - (ert-info ("Delete lines") - (ert-info ("With `evil-start-of-line' `nil'") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("2dd") - ";; [t]hen enter the text in that file's own buffer." - ("P") - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer.")) - (ert-info ("With `evil-start-of-line' `t'") - (let ((evil-start-of-line t)) - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("2dd") - "[;]; then enter the text in that file's own buffer." - ("P") - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer.")))) - (ert-info ("Delete last line") - (evil-test-buffer - ";; This buffer is for notes you don't want to save. -;; [I]f you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("2dd") - ";; [T]his buffer is for notes you don't want to save.")) - (ert-info ("Delete last empty line") - (evil-test-buffer - "line 1\nline 2\n\n[]" - ("dd") - "line 1\nline 2\n[]")) - (ert-info ("Delete rectangle") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("d3s") - "[T]his buffer is for notes you don't want to save. -If you want to create a file, visit that file with C-x C-f, -then enter the text in that file's own buffer.")) - (ert-info (":delete") - (evil-test-buffer - "a\n[b]\nc\nd\n" - (":delete") - "a\nc\nd\n")) - (ert-info (":delete with COUNT") - (evil-test-buffer - "a\n[b]\nc\nd\n" - (":delete 2") - "a\nd\n")) - (ert-info (":delete with COUNT in visual state") - (evil-test-buffer - "a\n\nd\ne\nf\n" - (":delete 3") - "a\nb\nf\n")) - (ert-info (":delete with REGISTER") - (evil-test-buffer - "a\n[b]\nc\nd\n" - (":delete r") ;; delete into the 'r' register - "a\nc\nd\n" - ;; check the 'r' register contains the deleted text - (should (string= (substring-no-properties (evil-get-register ?r)) "b\n")))) - (ert-info (":delete with REGISTER and COUNT") - (evil-test-buffer - "a\n[b]\nc\nd\ne\nf\n" - (":delete r 3") - "a\ne\nf\n" - (should (string= (substring-no-properties (evil-get-register ?r)) "b\nc\nd\n")))) - (ert-info ("Charwise multiple whole line delete becomes linewise") - (evil-test-buffer - "1\n[2]\n3\n4" - ("d2w") - "1\n[4]"))) - -(ert-deftest evil-test-delete-line () - "Test `evil-delete-line'" - :tags '(evil operator) - (ert-info ("Delete to end of line") - (evil-test-buffer - ";; This buffer is for notes[ ]you don't want to save." - ("D") - ";; This buffer is for note[s]")) - (ert-info ("Act linewise on character selection") - (evil-test-buffer - ";; This is for notes, -and for Lisp evaluation." - ("D") - "and for Lisp [e]valuation.")) - (ert-info ("Act on each line of block selection") - (evil-test-buffer - :visual block - ";; This buffer is for ." - ("D") - ";; This buffer is for[ ] -;; and for Lisp evalua")) - (ert-info ("Yank full block with block selection") - (evil-test-buffer - :visual block - "line1 le3 line3\n" - ("D") - "line1 [l]\nline2 l\nline3 l\n" - ("0P") - "ine1 line1 line1line1 l -ine2 line2 l -ine3 line3 line3 l\n")) - (ert-info ("Delete additional whole lines with count") - (evil-test-buffer - "a[a]a\nbbb\nc\n" - ("2D") - "a\nc\n")) - (ert-info ("Delete line with eof being part of visual selection") - (evil-test-buffer - ";; This is line one -;; This is lin[e] two -;; This is line three" - ("v$D") - ";; This is line one -;; This is line three")) - (ert-info ("Deletion in normal state leaves point in the right place") - (evil-test-buffer - "alpha b[r]avo charlie\ndelta echo foxtrot\ngolf hotel india" - (should-not evil-start-of-line) - ("D") - "alpha [b]\ndelta echo foxtrot\ngolf hotel india" - ("/echo" [return] "C" "newtext" [escape]) - "alpha b\ndelta newtex[t]\ngolf hotel india") - (let ((evil-start-of-line t)) - (evil-test-buffer - "alpha b[r]avo charlie\ndelta echo foxtrot\ngolf hotel india" - ("D") - "alpha [b]\ndelta echo foxtrot\ngolf hotel india" - ("/echo" [return] "C" "newtext" [escape]) - "alpha b\ndelta newtex[t]\ngolf hotel india"))) - (ert-info ("Line deletion in visual state leaves point in the right place") - (evil-test-buffer - "alpha [b]ravo charlie\ndelta echo foxtrot\ngolf hotel india" - (should-not evil-start-of-line) - ("vD") - "delta [e]cho foxtrot\ngolf hotel india" - ("vX") - "golf h[o]tel india") - (let ((evil-start-of-line t)) - (evil-test-buffer - "alpha [b]ravo charlie\ndelta echo foxtrot\ngolf hotel india" - ("vD") - "[d]elta echo foxtrot\ngolf hotel india" - ("vX") - "[g]olf hotel india")))) - -(ert-deftest evil-test-delete-folded () - "Test `evil-delete' on folded lines." - :tags '(evil operator) - (ert-info ("Delete folded lines") - (evil-test-buffer - "[l]ine1\n\n(let ()\n var)\n\n(let ()\n var2)\n" - (emacs-lisp-mode) - (hs-minor-mode 1) - ("zm2jdd") - "line1\n\n[\n](let ()\n var2)\n")) - (ert-info ("Delete folded lines with count") - (evil-test-buffer - "[l]ine1\n\n(let ()\n var)\n\n(let ()\n var2)\n\nlast line\n" - (emacs-lisp-mode) - (hs-minor-mode 1) - ("zm2j3dd") - "line1\n\n[\n]last line\n"))) - -(ert-deftest evil-test-delete-backward-word () - "Test `evil-delete-backward-word' in insert & replace states, and ex command-line." - :tags '(evil) - (ert-info ("evil-delete-backward-word in insert state") - (let ((evil-backspace-join-lines t)) - (evil-test-buffer - "abc def\n ghi j[k]l\n" - ("i" (kbd "C-w")) - "abc def\n ghi [k]l\n" - ((kbd "C-w")) - "abc def\n [k]l\n" - ((kbd "C-w")) - "abc def\n[k]l\n" - ((kbd "C-w")) - "abc def[k]l\n")) - (let (evil-backspace-join-lines) - (evil-test-buffer - "abc def\n[k]l\n" - (should-error (execute-kbd-macro (concat "i" (kbd "C-w")))) - "abc def\n[k]l\n"))) - (ert-info ("evil-delete-backward-word in replace state") - (evil-test-buffer - "alpha bravo [c]harlie delta" - ("R" "one two") - "alpha bravo one two[ ]delta" - ("\C-w") - "alpha bravo one [l]ie delta" - ("\C-w") - "alpha bravo [c]harlie delta" - ("\C-w") - "alpha [b]ravo charlie delta")) - (ert-info ("evil-delete-backward-word in ex command-line") - (evil-test-buffer - "[ ]" - (":normal i" "one-two" (kbd "C-w") (kbd "C-w") [return]) - "on[e]"))) - -(ert-deftest evil-test-visual-X () - "Test `X' in visual state." - :tags '(evil) - (evil-test-buffer - "This is line one\nThis is lin[e] two\nThis is line three" - ("v$oX") - "This is line one\nThis is lin[e] three")) - -(ert-deftest evil-test-delete-back-to-indentation () - "Test `evil-delete-back-to-indentation' in insert & replace states." - :tags '(evil) - (let ((evil-backspace-join-lines t)) - (evil-test-buffer - "abc def\n ghi j[k]l\n" - ("i" (call-interactively #'evil-delete-back-to-indentation)) - "abc def\n [k]l\n" - (left-char 2) - "abc def\n [ ] kl\n" - (call-interactively #'evil-delete-back-to-indentation) - "abc def\n[ ] kl\n" - (call-interactively #'evil-delete-back-to-indentation) - "abc def[ ] kl\n")) - (let (evil-backspace-join-lines) - (evil-test-buffer - "abc def\n[k]l\n" - (should-error - (progn - (execute-kbd-macro "i") - (call-interactively #'evil-delete-back-to-indentation))) - "abc def\n[k]l\n")) - (ert-info ("Delete back to indentation in replace state") - (evil-test-buffer - " alpha [b]ravo charlie" - ("R" "delta") - " alpha delta[ ]charlie" - (evil-delete-back-to-indentation) - " [a]lpha bravo charlie"))) - -(ert-deftest evil-test-change () - "Test `evil-change'" - :tags '(evil operator) - (ert-info ("Change characters") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save." - ("c2eABC" [escape]) - ";; AB[C] is for notes you don't want to save." - (should (string= (current-kill 0) "This buffer")) - ("p") - ";; ABCThis buffe[r] is for notes you don't want to save.")) - (ert-info ("Change lines") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("2ccABCLINE\nDEFLINE" [escape]) - "ABCLINE -DEFLIN[E] -;; then enter the text in that file's own buffer." - ("p") - "ABCLINE -DEFLINE -\[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer.")) - (ert-info ("Change last line") - (evil-test-buffer - ";; This buffer is for notes you don't want to save. -;; [I]f you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("2ccABC" [escape]) - ";; This buffer is for notes you don't want to save. -AB[C]")) - (ert-info ("C changes whole line in visual characterwise and linewise states") - (evil-test-buffer - "Two lines [s]hould suffice -for this test." - ("veC" "all gone!") - "all gone![] -for this test.") - (evil-test-buffer - "Two lines [w]ill be fine -for this test too." - ("VjC" "all gone!") - "all gone![]")) - (ert-info ("C clears the visual blockwise selection, and all text to the right") - (evil-test-buffer - "Two [l]ines will be fine for -the tests here as well." - ("\C-vjeC") - "Two [] -the ")) - (ert-info ("S clears the whole line in normal mode, and all lines touched by visual selection") - (evil-test-buffer - "Two lines [s]hould suffice -for this test." - ("S" "all gone!") - "all gone![] -for this test.") - (evil-test-buffer - "Two lines [s]hould suffice -for this test." - ("vS" "all gone!") - "all gone![] -for this test.") - (evil-test-buffer - "Two lines [s]hould suffice -for this test." - ("VjS" "all gone!") - "all gone![]") - (evil-test-buffer - "Two lines [s]hould suffice -for this test." - ("\C-VjS" "all gone!") - "all gone![]")) - (ert-info ("R behaves the same as S in visual modes") - (evil-test-buffer - "Two lines [s]hould suffice -for this test." - ("vR" "all gone!") - "all gone![] -for this test.")) - (ert-info ("Change rectangle") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("c3sABC" [escape]) - "AB[C]This buffer is for notes you don't want to save. -ABCIf you want to create a file, visit that file with C-x C-f, -ABCthen enter the text in that file's own buffer."))) - -(ert-deftest evil-maybe-remove-spaces-test () - "Test maybe removing (indentation) spaces after some commands when making a clear line." - :tags '(evil operator) - (ert-info ("changing the line and returning to normal mode removes spaces") - (evil-test-buffer - (emacs-lisp-mode) - ("i(one two" [return] "three" [return] "four" [return] "five" [escape] "?three" [return]) - "(one two - [t]hree - four - five" - ("cc" "new line" [escape] "+") - "(one two - new line - [f]our - five" - ("cc" [escape]) - "(one two - new line -[] - five"))) - -(ert-deftest evil-test-change-line () - "Test `evil-change-line'" - :tags '(evil operator) - (ert-info ("Change line with eof being part of visual selection") - (evil-test-buffer - "This is line one -This is lin[e] two -This is line three" - ("v$C") - "This is line one -[] -This is line three"))) - -(ert-deftest evil-test-change-word () - "Test changing words" - :tags '(evil operator) - (ert-info ("Non-word") - (evil-test-buffer - "[;]; This buffer is for notes." - ("cwABC" [escape]) - "AB[C] This buffer is for notes.")) - (ert-info ("Word") - (evil-test-buffer - ";; [T]his buffer is for notes." - ("cwABC" [escape]) - ";; AB[C] buffer is for notes.")) - (ert-info ("Single character") - (evil-test-buffer - "[;] This buffer is for notes." - ("cwABC" [escape]) - "AB[C] This buffer is for notes.")) - (ert-info ("Whitespace") - (evil-test-buffer - "This[ ]is a test\n" - ("cwABC" [escape]) - "ThisAB[C]is a test\n"))) - -(ert-deftest evil-test-join () - "Test `evil-join'" - :tags '(evil join operator) - (ert-info ("Simple") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f." - ("J") - ";; This buffer is for notes you don't want to save.[ ]\ -;; If you want to create a file, visit that file with C-x C-f.")) - (ert-info ("Visual") - (evil-test-buffer - :visual line - "<;; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f.>" - ("J") - ";; This buffer is for notes you don't want to save.[ ]\ -;; If you want to create a file, visit that file with C-x C-f.")) - (ert-info ("Join with count") - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\nline 4" - (":join 3") - "line 1 line 2 line 3\nline 4")) - (ert-info ("Join with bang and count") - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\nline 4" - (":join! 3") - "line 1line 2line 3\nline 4")) - (ert-info ("Join with bang and count, exceeding end-of-buffer") - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\nline 4" - (":join! 10") - "line 1line 2line 3line 4")) - (ert-info ("Join with count 1 should be the same as without count") - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\nline 4" - (":join 1") - "line 1 line 2\nline 3\nline 4")) - (ert-info ("Join with count 2 should be the same as with count 1") - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\nline 4" - (":join 2") - "line 1 line 2\nline 3\nline 4")) - (ert-info ("Join with count and single line range") - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\nline 4" - (":2join 3") - "line 1\nline 2 line 3 line 4")) - (ert-info ("Join with count and range") - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\nline 4" - (":1,2join 3") - "line 1\nline 2 line 3 line 4")) - (ert-info ("Join with count, range and bang") - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\nline 4" - (":1,2join! 3") - "line 1\nline 2line 3line 4")) - (ert-info ("Join with range") - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\nline 4" - (":1,3join") - "line 1 line 2 line 3\nline 4")) - (ert-info ("Join blank line") - (evil-test-buffer - "(when foo\n[]\n bar)" - (emacs-lisp-mode) - ("J") - "(when foo\n [b]ar)"))) - -(ert-deftest evil-test-substitute () - "Test `evil-substitute'" - :tags '(evil operator) - (ert-info ("Simple") - (evil-test-buffer - ";; [T]his buffer is for notes." - ("5sABC" [escape]) - ";; AB[C]buffer is for notes.")) - (ert-info ("On empty line") - (evil-test-buffer - "Above some line -\[] -Below some empty line" - ("5sABC" [escape]) - "Above some line -AB[C] -Below some empty line"))) - -(ert-deftest evil-test-shift () - "Test `evil-shift-right' and `evil-shift-left'." - :tags '(evil operator) - (let ((evil-shift-width 4) - indent-tabs-mode) - (ert-info ("Shift linewise") - (ert-info ("With `evil-start-of-line' `nil'") - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\n" - ("Vj>") - "[ ] line 1\n line 2\nline 3\n")) - (ert-info ("With `evil-start-of-line' `t'") - (let ((evil-start-of-line t)) - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\n" - ("Vj>") - " [l]ine 1\n line 2\nline 3\n")))) - (ert-info ("Shift char selection on whole line") - (ert-info ("With `evil-start-of-line' `nil'") - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\n" - ("v$>") - " line [1]\nline 2\nline 3\n")) - (ert-info ("With `evil-start-of-line' `t'") - (let ((evil-start-of-line t)) - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\n" - ("v$>") - " [l]ine 1\nline 2\nline 3\n")))) - (ert-info ("Shift visual with count") - (ert-info ("With `evil-start-of-line' `nil'") - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\n" - ("Vj3>") - "[ ] line 1\n line 2\nline 3\n" - ("Vj2<") - "[ ] line 1\n line 2\nline 3\n")) - (ert-info ("With `evil-start-of-line' `t'") - (let ((evil-start-of-line t)) - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\n" - ("Vj3>") - " [l]ine 1\n line 2\nline 3\n" - ("Vj2<") - " [l]ine 1\n line 2\nline 3\n")))) - (ert-info ("Shift in insert state") - (evil-test-buffer - "line 1\nl[i]ne 2\nline 3\n" - ("i\C-t\C-t") - "line 1\n l[i]ne 2\nline 3\n" - ("\C-d") - "line 1\n l[i]ne 2\nline 3\n")) - (ert-info ("Delete all indentation in insert state") - (evil-test-buffer - "line1\n sometext[ ]" - ("a" "somemore" "0\C-d") - "line1\nsometext somemore[]")))) - -(ert-deftest evil-test-operator-set-marks () - "Test `[ and `] are set by operators." - :tags '(evil operator) - (ert-info ("Can go to end of last operated text") - (evil-test-buffer - "alpha br[a]vo charlie" - ("gUiw") - "alpha [B]RAVO charlie" - ("`]") - "alpha BRAV[O] charlie")) - (ert-info ("Can go to end of last operated text") - (evil-test-buffer - "alpha br[a]vo charlie" - ("g?iw$") - "alpha oenib charli[e]" - ("`[") - "alpha [o]enib charlie")) - (ert-info ("Marks are correct after deletion") - (evil-test-buffer - "alpha br[a]vo charlie" - ("daw^") - "[a]lpha charlie" - ("`]") - "alpha [c]harlie" - ("^`[") - "alpha [c]harlie") - (evil-test-buffer - "alpha br[a]vo charlie" - ("D^") - "[a]lpha br" - ("`]") - "alpha b[r]" - ("^`[") - "alpha b[r]"))) - -(ert-deftest evil-test-operator-save-state-for-motion () - "Test that `evil-operator-range' restores state after executing motion." - (evil-test-buffer "abc" - ("dfbix" [escape]) - "xc")) - -;;; Paste - -(ert-deftest evil-test-paste-before () - "Test `evil-paste-before'" - :tags '(evil paste) - (ert-info ("Paste characters") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("y2ej0") - ";; This buffer is for notes you don't want to save, -\[;]; and for Lisp evaluation." - ("P") - ";; This buffer is for notes you don't want to save, -This buffe[r];; and for Lisp evaluation.")) - (ert-info ("Paste characters with count") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("y2ej0") - ";; This buffer is for notes you don't want to save, -\[;]; and for Lisp evaluation." - ("3P") - ";; This buffer is for notes you don't want to save, -This bufferThis bufferThis buffe[r];; and for Lisp evaluation.")) - (ert-info ("Paste characters at end-of-buffer") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("y2eG$") - ";; This buffer is for notes you don't want to save, -;; and for Lisp evaluation[.]" - ("2P") - ";; This buffer is for notes you don't want to save, -;; and for Lisp evaluationThis bufferThis buffe[r].")) - (ert-info ("Paste lines") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("2yyP") - "[;]; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. -;; This buffer is for notes you don't want to save, -;; and for Lisp evaluation.")) - (ert-info ("Paste lines with count") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("2yy2P") - "[;]; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. -;; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. -;; This buffer is for notes you don't want to save, -;; and for Lisp evaluation.")) - (ert-info ("Paste lines at end-of-buffer") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("2yyG$") - ";; This buffer is for notes you don't want to save, -;; and for Lisp evaluation[.]" - ("2P") - ";; This buffer is for notes you don't want to save, -\[;]; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. -;; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. -;; and for Lisp evaluation.")) - (ert-info ("Paste block") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("3ysP") - "[;]; ;; This buffer is for notes you don't want to save. -;; ;; If you want to create a file, visit that file with C-x C-f, -;; ;; then enter the text in that file's own buffer.")) - (ert-info ("Paste block with count") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("3ys2P") - "[;]; ;; ;; This buffer is for notes you don't want to save. -;; ;; ;; If you want to create a file, visit that file with C-x C-f, -;; ;; ;; then enter the text in that file's own buffer.")) - (ert-info ("Paste block with empty line") - (evil-test-buffer - "[;]; Above some line - -;; Below some empty line" - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("3ys2P") - "[;]; ;; ;; Above some line - \n\ -;; ;; ;; Below some empty line")) - (ert-info ("Paste block crossing end of buffer") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("3ysj") - ";; This buffer is for notes you don't want to save. -\[;]; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("P") - ";; This buffer is for notes you don't want to save. -\[;]; ;; If you want to create a file, visit that file with C-x C-f, -;; ;; then enter the text in that file's own buffer. -;;")) - (ert-info ("Paste block at end-of-line") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("3ys$") - ";; This buffer is for notes you don't want to save[.] -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("p") - ";; This buffer is for notes you don't want to save.[;]; -;; If you want to create a file, visit that file wi;; th C-x C-f, -;; then enter the text in that file's own buffer. ;;")) - (ert-info ("Don't mutate register when stripping test props") - (let (indent-tabs-mode) - (evil-test-buffer - "[a]aaaaaaaaaaaa -bbbbbbbb -cccc" - ("\C-vG$yA " "\C-r\"" [escape] "up") - "aaaaaaaaaaaaa[a]aaaaaaaaaaaa -bbbbbbbb bbbbbbbb -cccc cccc")))) - -(ert-deftest evil-test-paste-after () - "Test `evil-paste-after'" - :tags '(evil paste) - (ert-info ("Paste characters") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("y2ej0") - ";; This buffer is for notes you don't want to save, -\[;]; and for Lisp evaluation." - ("p") - ";; This buffer is for notes you don't want to save, -;This buffe[r]; and for Lisp evaluation.")) - (ert-info ("Paste characters with count") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("y2ej0") - ";; This buffer is for notes you don't want to save, -\[;]; and for Lisp evaluation." - ("3p") - ";; This buffer is for notes you don't want to save, -;This bufferThis bufferThis buffe[r]; and for Lisp evaluation.")) - (ert-info ("Paste characters at end-of-buffer") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("y2eG$") - ";; This buffer is for notes you don't want to save, -;; and for Lisp evaluation[.]" - ("2p") - ";; This buffer is for notes you don't want to save, -;; and for Lisp evaluation.This bufferThis buffe[r]")) - (ert-info ("Paste lines") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("2yyp") - ";; This buffer is for notes you don't want to save, -\[;]; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. -;; and for Lisp evaluation.")) - (ert-info ("Paste lines with count") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("2yy2p") - ";; This buffer is for notes you don't want to save, -\[;]; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. -;; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. -;; and for Lisp evaluation.")) - (ert-info ("Paste lines at end-of-buffer") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("2yyG$") - ";; This buffer is for notes you don't want to save, -;; and for Lisp evaluation[.]" - ("2p") - ";; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. -\[;]; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. -;; This buffer is for notes you don't want to save, -;; and for Lisp evaluation.")) - (ert-info ("Paste block") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("3ysp") - ";[;]; ; This buffer is for notes you don't want to save. -;;; ; If you want to create a file, visit that file with C-x C-f, -;;; ; then enter the text in that file's own buffer.")) - (ert-info ("Paste block with count") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("3ys2p") - ";[;]; ;; ; This buffer is for notes you don't want to save. -;;; ;; ; If you want to create a file, visit that file with C-x C-f, -;;; ;; ; then enter the text in that file's own buffer.")) - (ert-info ("Paste block with empty line") - (evil-test-buffer - "[;]; Above some line - -;; Below some empty line" - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("3ys2p") - ";;; ;; ; Above some line - -;;; ;; ; Below some empty line")) - (ert-info ("Paste block crossing end of buffer") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("3ysj") - ";; This buffer is for notes you don't want to save. -\[;]; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("p") - ";; This buffer is for notes you don't want to save. -;;; ; If you want to create a file, visit that file with C-x C-f, -;;; ; then enter the text in that file's own buffer. - ;;")) - (ert-info ("Paste block at end-of-line") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("3ys$") - ";; This buffer is for notes you don't want to save[.] -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("p") - ";; This buffer is for notes you don't want to save.;; -;; If you want to create a file, visit that file wi;; th C-x C-f, -;; then enter the text in that file's own buffer. ;;")) - (ert-info ("Paste preserves preceding text properties") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (put-text-property (point) (line-end-position) 'font-lock-face 'warning) - ("yyp") - ";; This buffer is for notes you don't want to save. -[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (should (equal (get-text-property (point-min) 'font-lock-face) 'warning))))) - -(ert-deftest evil-test-paste-pop-before () - "Test `evil-paste-pop' after `evil-paste-before'" - :tags '(evil paste) - (ert-info ("Paste") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("y2e2yyy3sj") - ";; This buffer is for notes you don't want to save. -\[;]; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("P") - ";; This buffer is for notes you don't want to save. -\[;]; ;; If you want to create a file, visit that file with C-x C-f, -;; ;; then enter the text in that file's own buffer. -;;")) - (ert-info ("Single pop") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("y2e2yyy3sjP\C-p") - ";; This buffer is for notes you don't want to save. -\[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer.")) - (ert-info ("Two pops") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("y2e2yyy3sjP\C-p\C-p") - ";; This buffer is for notes you don't want to save. -;; Thi[s];; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer.")) - (ert-info ("Pop with count") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("y2e2yyy3sjP2\C-p") - ";; This buffer is for notes you don't want to save. -;; Thi[s];; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer.")) - (ert-info ("Single pop-next") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("y2e2yyy3sjP2\C-p\C-n") - ";; This buffer is for notes you don't want to save. -\[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer.")) - (ert-info ("Pop-next with count") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("y2e2yyy3sjP\C-p\C-p2\C-n") - ";; This buffer is for notes you don't want to save. -\[;]; ;; If you want to create a file, visit that file with C-x C-f, -;; ;; then enter the text in that file's own buffer. -;;"))) - -(ert-deftest evil-test-paste-pop-after () - "Test `evil-paste-pop' after `evil-paste-after'" - :tags '(evil paste) - (ert-info ("Paste") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("y2e2yyy3sj") - ";; This buffer is for notes you don't want to save. -\[;]; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("p") - ";; This buffer is for notes you don't want to save. -;[;]; ; If you want to create a file, visit that file with C-x C-f, -;;; ; then enter the text in that file's own buffer. - ;;")) - (ert-info ("Single pop") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("y2e2yyy3sjp\C-p") - ";; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -\[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer.")) - (ert-info ("Two pops") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("y2e2yyy3sjp\C-p\C-p") - ";; This buffer is for notes you don't want to save. -;;; Thi[s]; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer.")) - (ert-info ("Pop with count") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("y2e2yyy3sjp2\C-p") - ";; This buffer is for notes you don't want to save. -;;; Thi[s]; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer.")) - (ert-info ("Single pop-next") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("y2e2yyy3sjp2\C-p\C-n") - ";; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -\[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer.")) - (ert-info ("Pop-next with count") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("y2e2yyy3sjp\C-p\C-p2\C-n") - ";; This buffer is for notes you don't want to save. -;[;]; ; If you want to create a file, visit that file with C-x C-f, -;;; ; then enter the text in that file's own buffer. - ;;"))) - -(ert-deftest evil-test-paste-pop-without-undo () - "Test `evil-paste-pop' with undo disabled" - :tags '(evil paste) - (ert-info ("Pop-next with count without undo") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (setq buffer-undo-list t) - (define-key evil-operator-state-local-map "s" #'evil-test-square-motion) - ("y2e2yyy3sjP\C-p\C-p2\C-n") - ";; This buffer is for notes you don't want to save. -\[;]; ;; If you want to create a file, visit that file with C-x C-f, -;; ;; then enter the text in that file's own buffer. -;;"))) - -(ert-deftest evil-test-visual-paste () - "Test `evil-paste-before' and `evil-paste-after' in Visual state" - :tags '(evil paste) - (evil-test-buffer - ";; This buffer is for notes you don't want to save. -;; [I]f you want to create a file, visit that file with C-x C-f." - ("yyk") - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f." - ("VP") - "[;]; If you want to create a file, visit that file with C-x C-f. -;; If you want to create a file, visit that file with C-x C-f.") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f." - ("yyj") - ";; This buffer is for notes you don't want to save. -;; [I]f you want to create a file, visit that file with C-x C-f." - ("Vp") - ";; This buffer is for notes you don't want to save. -\[;]; This buffer is for notes you don't want to save.") - (ert-info ("Visual-paste from register 3") - ;; This behaviour deviates from vim, which populates registers 1-9 with - ;; deleted text only, not yanked text. This is an aspect of `evil-yank's - ;; use of the emacs kill-ring, so is consistent with non-visual paste. - (evil-test-buffer - "[w]ord1a word1b word1c word1d -word2a word2b word2c word2d" - ("yiwwyiwwyiw") - "word1a word1b [w]ord1c word1d -word2a word2b word2c word2d" - ("+viw\"3p") - "word1a word1b word1c word1d -word1[a] word2b word2c word2d")) - (ert-info ("Visual-paste respects `evil-kill-on-visual-paste'") - (evil-test-buffer - "[w]ord1 word2 word3" - (setq evil-kill-on-visual-paste nil) - ("yewyew") - "word1 word2 [w]ord3" - ("ve\"2p") - "word1 word2 word[1]" - ("o\C-r\"") - "word1 word2 word1 -word2[]") - (evil-test-buffer - "[w]ord1 word2 word3" - (setq evil-kill-on-visual-paste t) - ("yewyew") - "word1 word2 [w]ord3" - ("ve\"2p") - "word1 word2 word[1]" - ("o\C-r\"") - "word1 word2 word1 -word3[]")) - (ert-info ("Visual-paste from `=' register") - (evil-test-buffer - "foo" - ("viw" "\"=p(* 6 7)" [return]) - "4[2]")) - (ert-info ("Blockwise visual paste (of charwise text) with count") - (evil-test-buffer - "[a]bc\n123\n123\n123" - ("ye" "jl" "\C-vG" "2p") - "abc\n1[a]bcabc3\n1abcabc3\n1abcabc3" - ("gv") ;; Test point & mark are stored correctly - "abc\n13")) - (ert-info ("Blockwise visual paste of linewise text") - (evil-test-buffer "[a]bc\n123\n123" - ("yy" "jl" "\C-vj" "p") - "abc\n13\n13\nabc")) - (ert-info ("Blockwise visual paste of blockwise text") - (evil-test-buffer "xy\n[z]\n123\n123" - ("\C-vkly2jl\C-vjp") - "xy\nz\n1xy3\n1z 3"))) - -(ert-deftest evil-test-visual-paste-pop () - "Test `evil-paste-pop' after visual paste." - :tags '(evil paste) - (ert-info ("Visual-char paste, char paste") - (evil-test-buffer - "[w]ord1a word1b word1c\nword2a word2b\nword3a word3b word3c word3d\n" - ("yiwyywyiw^jw") - "word1a word1b word1c\nword2a [w]ord2b\nword3a word3b word3c word3d\n" - ("viwp") - "word1a word1b word1c\nword2a word1[b]\nword3a word3b word3c word3d\n")) - (ert-info ("Visual-char paste, char paste, line pop") - (evil-test-buffer - "[w]ord1a word1b word1c\nword2a word2b\nword3a word3b word3c word3d\n" - ("yiwyywyiw^jw") - "word1a word1b word1c\nword2a [w]ord2b\nword3a word3b word3c word3d\n" - ("viwp\C-p") - "word1a word1b word1c\nword2a \n[w]ord1a word1b word1c\n\nword3a word3b word3c word3d\n")) - (ert-info ("Visual-char paste, char paste, line pop, char pop") - (evil-test-buffer - "[w]ord1a word1b word1c\nword2a word2b\nword3a word3b word3c word3d\n" - ("yiwyywyiw^jw") - "word1a word1b word1c\nword2a [w]ord2b\nword3a word3b word3c word3d\n" - ("viwp\C-p\C-p") - "word1a word1b word1c\nword2a word1[a]\nword3a word3b word3c word3d\n")) - (ert-info ("Visual-line paste, char paste") - (evil-test-buffer - "[w]ord1a word1b word1c\nword2a word2b\nword3a word3b word3c word3d\n" - ("yiwyywyiw^j") - "word1a word1b word1c\n[w]ord2a word2b\nword3a word3b word3c word3d\n" - ("Vp") - "word1a word1b word1c\nword1[b]\nword3a word3b word3c word3d\n")) - (ert-info ("Visual-line paste, char paste, line pop") - (evil-test-buffer - "[w]ord1a word1b word1c\nword2a word2b\nword3a word3b word3c word3d\n" - ("yiwyywyiw^j") - "word1a word1b word1c\n[w]ord2a word2b\nword3a word3b word3c word3d\n" - ("Vp\C-p") - "word1a word1b word1c\n[w]ord1a word1b word1c\nword3a word3b word3c word3d\n")) - (ert-info ("Visual-line paste, char paste, line pop, char pop") - (evil-test-buffer - "[w]ord1a word1b word1c\nword2a word2b\nword3a word3b word3c word3d\n" - ("yiwyywyiw^j") - "word1a word1b word1c\n[w]ord2a word2b\nword3a word3b word3c word3d\n" - ("Vp\C-p\C-p") - "word1a word1b word1c\nword1[a]\nword3a word3b word3c word3d\n"))) - -(ert-deftest evil-test-register () - "Test yanking and pasting to and from register." - :tags '(evil yank paste) - (ert-info ("simple lower case register") - (evil-test-buffer - "[f]oo\n" - ("\"ayw\"aP") - "fo[o]foo\n" - ("\"ayy\"aP") - "[f]oofoo\nfoofoo\n")) - (ert-info ("upper case register") - (evil-test-buffer - "[f]oo\n" - ("\"ayw\"Ayw\"aP") - "foofo[o]foo\n" - ("\"ayy\"Ayy\"aP") - "[f]oofoofoo\nfoofoofoo\nfoofoofoo\n")) - (ert-info ("upper case register and lines") - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\nline 4\n" - ("\"a2Yjj\"A2Y\"aP") - "line 1\nline 2\n[l]ine 1\nline 2\nline 3\nline 4\nline 3\nline 4\n" - ("8G\"ap") - "line 1\nline 2\nline 1\nline 2\nline 3\nline 4\nline 3\nline 4\n[l]ine 1\nline 2\nline 3\nline 4\n")) - (ert-info ("yank with count") - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\n" - ("\"a2yw\"aP") - "line [1]line 1\nline 2\nline 3\n" - ("\"a2yy\"aP") - "[l]ine 1line 1\nline 2\nline 1line 1\nline 2\nline 3\n")) - (dolist (module '(evil-search isearch)) - (evil-select-search-module 'evil-search-module module) - (ert-info ((format "special register / (module: %s)" module)) - (evil-test-buffer - "[f]oo bar\n" - ("/bar" [return] "0i\C-r/") - "bar[f]oo bar\n"))) - (ert-info ("special register :") - (evil-test-buffer - "[f]oo bar\n" - (":noh\ni\C-r:"))) - (ert-info ("Paste from register during change to register") - (evil-test-buffer - "[a]lpha beta" - ("\"ayiw" "w" "\"bciw" "\C-ra") - "alpha alpha[]")) - (ert-info ("Paste from register in replace state") - (evil-test-buffer - "[a]lpha bravo charlie" - ("yiw" "w" "R" "\C-r0") - "alpha alpha[ ]charlie" - ([backspace] [backspace] [backspace]) - "alpha al[a]vo charlie")) - (ert-info ("Normal delete after visual delete doesn't clobber register") - (evil-test-buffer - "[a]lpha bravo charlie delta" - ("vf \"xd" "dw" ";\"xp") - "charlie alpha delta")) - (ert-info ("Choosing register keeps eol anchoring") - (evil-test-buffer - "[a]aaaaa\nbbbbb\ncccc" - ("\C-v" "2j" "$" "\"xy" "G" "o" [escape] "\"xp") - "aaaaaa\nbbbbb\ncccc\n[a]aaaaa\nbbbbb\ncccc"))) - -(ert-deftest evil-test-last-insert-register () - "Test last insertion register." - (evil-test-buffer - "[l]ine 1\n" - ("GiABC" [escape]) - "line 1\nAB[C]" - ("go\".P") - "AB[C]line 1\nABC")) - -(ert-deftest evil-test-zero-register () - "\"0 contains the last text that was yanked without specificying a register." - (evil-test-buffer - "[l]ine 1\nline 2\n" - ("yy\"0p") - "line 1\n[l]ine 1\nline 2\n" - ("j\"ayy\"0p") - "line 1\nline 1\nline 2\n[l]ine 1\n" ; yanked line 2 to "a, so "0 is still line 1 - ("kdd\"0p") - "line 1\nline 1\nline 1\n[l]ine 1\n")) - -(ert-deftest evil-test-=-register () - "\"= is not really a register . It inserts the result of evaluating some elisp" - (ert-info ("Can eval elisp, and can fetch default (last) result") - (evil-test-buffer - :state insert - "8x8= []" - ("\C-r=(* 8 8)" [return]) - "8x8= 64" - ([return] "16x4= \C-r=" [return]) - "8x8= 64 -16x4= 64")) - - (ert-info ("Can eval infix math, and can use register at prompt") - (evil-test-buffer - "[5]0/10 * 100 = " - ("\"nyt=" "A\C-r=" "\C-rn" [return]) - "50/10 * 100 = 500"))) - -(ert-deftest evil-test-gp-gP () - (ert-info ("gp and gP are just like p and P but move the cursor forward") - (evil-test-buffer - "[a]lpha bravo charlie" - ("ye" "2f " "gp") - "alpha bravo alpha[c]harlie" - ("2F " "gP") - "alphaalpha[ ]bravo alphacharlie" - ("l" "ve" "gp") - "alphaalpha alpha[ ]alphacharlie")) - (ert-info ("gp linewise") - (evil-test-buffer - "[a]lpha line\nbravo line\ncharlie line\ndelta line\necho line" - ("2yy" "2j") - "alpha line\nbravo line\n[c]harlie line\ndelta line\necho line" - ("gp") - "alpha line\nbravo line\ncharlie line\nalpha line\nbravo line\n[d]elta line\necho line" - (".") - "alpha line\nbravo line\ncharlie line\nalpha line\nbravo line\ndelta line\nalpha line\nbravo line\necho line"))) - -(ert-deftest evil-test-ex-put () - "evil-ex-put inserts text linewise, regardless of yank-handler" - (ert-info ("Can put linewise text from default register, by line number") - (evil-test-buffer - "[L]orem ipsum dolor sit amet -consectetur adipiscing elit -sed do eiusmod tempor incididunt" - ("yy:2put" [return]) - "Lorem ipsum dolor sit amet -consectetur adipiscing elit -[L]orem ipsum dolor sit amet -sed do eiusmod tempor incididunt")) - - (ert-info ("Can put blockwise text from letter register, backwards") - (evil-test-buffer - "Lorem ipsum [d]olor sit amet -consectetur adipiscing elit -sed do eiusmod tempor incididunt" - ("\C-vje\"xy" "bye" "Vj" ":put! x" [return]) - "Lorem ipsum dolor sit amet -dolor sit -[a]dipiscing -consectetur adipiscing elit -sed do eiusmod tempor incididunt")) - - (ert-info ("Can supply args and put from = register") - (evil-test-buffer - "[L]ine one." - (":put = (* 6 7)" [return]) - "Line one. -[4]2"))) - -(ert-deftest evil-test-align () - "Test `evil-align-left', `evil-align-right' and `evil-align-center'." - :tags '(evil operator) - (evil-without-display - (let ((fill-column 70) - indent-tabs-mode) - (evil-test-buffer - "before\n[l]ine 1\nthis is line number 2\nline number 3\nafter\n" - (":.,+2ri" [return] (kbd "M-x") "untabify" [return]) - "before\n [l]ine 1\n this is line number 2\n line number 3\nafter\n" - (":.,+2ri 60" [return] (kbd "M-x") "untabify" [return]) - "before\n [l]ine 1\n this is line number 2\n line number 3\nafter\n" - (":.,+2le" [return] (kbd "M-x") "untabify" [return]) - "before\n[l]ine 1\nthis is line number 2\nline number 3\nafter\n" - (":.,+2le 10" [return]) - "before\n [l]ine 1\n this is line number 2\n line number 3\nafter\n" - (":.,+2ce" [return] (kbd "M-x") "untabify" [return]) - "before\n [l]ine 1\n this is line number 2\n line number 3\nafter\n" - (":.,+2ce 40" [return] (kbd "M-x") "untabify" [return]) - "before\n [l]ine 1\n this is line number 2\n line number 3\nafter\n")))) - -;;; Motions - -(ert-deftest evil-test-forward-char () - "Test `evil-forward-char' motion" - :tags '(evil motion) - (ert-info ("Simple") - (evil-test-buffer - "[;]; This buffer is for notes." - ("l") - ";[;] This buffer is for notes.")) - (ert-info ("End of line") - (let ((evil-cross-lines t) - (evil-move-beyond-eol nil)) - (evil-test-buffer - ";; This buffer is for notes[,] -;; and for Lisp evaluation." - ("l") - ";; This buffer is for notes, -\[;]; and for Lisp evaluation."))) - (ert-info ("With count") - (evil-test-buffer - "[;]; This buffer is for notes." - ("12l") - ";; This buff[e]r is for notes.")) - (ert-info ("End of line") - (evil-test-buffer - ";; This buffer is for notes[.]" - (error end-of-line "l") - (error end-of-line "10l"))) - (ert-info ("Until end-of-line") - (evil-test-buffer - "[;]; This buffer is for notes." - (error end-of-line "100l") - ";; This buffer is for notes[.]")) - (ert-info ("On empty line") - (evil-test-buffer - "Above some line -\[] -Below some empty line" - (should-error (execute-kbd-macro "l")) - (should-error (execute-kbd-macro "42l"))))) - -(ert-deftest evil-test-backward-char () - "Test `evil-backward-char' motion" - :tags '(evil motion) - (ert-info ("Simple") - (evil-test-buffer - ";; This[ ]buffer is for notes." - ("h") - ";; Thi[s] buffer is for notes.")) - (ert-info ("With count") - (evil-test-buffer - ";; This[ ]buffer is for notes." - ("3h") - ";; T[h]is buffer is for notes.")) - (ert-info ("Beginning of line") - (evil-test-buffer - "[;]; This buffer is for notes." - (should-error (execute-kbd-macro "h")) - (should-error (execute-kbd-macro "10h")))) - (ert-info ("Until beginning-of-line") - (evil-test-buffer - ";; This[ ]buffer is for notes." - (error beginning-of-line "100h") - "[;]; This buffer is for notes.")) - (ert-info ("On empty line") - (evil-test-buffer - "Above some line -\[] -Below some empty line" - (should-error (execute-kbd-macro "h")) - (should-error (execute-kbd-macro "42h"))))) - -(ert-deftest evil-test-previous-line () - "Test `evil-previous-line' motion" - :tags '(evil motion) - (ert-info ("Simple") - (evil-test-buffer - ";; This buffer is for notes you don't want to save, -;; [a]nd for Lisp evaluation." - ("k") - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation.")) - (ert-info ("With count") - (evil-test-buffer - ";; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; [t]hen enter the text in that file's own buffer." - ("2k") - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer.")) - (ert-info ("Until beginning of buffer") - (evil-test-buffer - ";; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; [t]hen enter the text in that file's own buffer." - ("100k") - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer.")) - (ert-info ("At beginning of buffer") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save." - (should-error (execute-kbd-macro "k")) - (should-error (execute-kbd-macro "42k"))))) - -(ert-deftest evil-test-next-line () - "Test `evil-next-line' motion" - :tags '(evil motion) - (ert-info ("Simple") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("j") - ";; This buffer is for notes you don't want to save, -;; [a]nd for Lisp evaluation.")) - (ert-info ("With count") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("2j") - ";; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; [t]hen enter the text in that file's own buffer.")) - (ert-info ("Until end of buffer") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("100j") - ";; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; [t]hen enter the text in that file's own buffer.")) - (ert-info ("At end of buffer") - (evil-test-buffer - ";; This buffer is for notes you don't want to [s]ave." - (should-error (execute-kbd-macro "j")) - (should-error (execute-kbd-macro "42j"))))) - -(ert-deftest evil-test-next+previous-preserve-column () - "Test `evil-previous-line' and `evil-next-line' preserve the column." - :tags '(evil motion) - (ert-info ("Simple") - (evil-test-buffer - "ab[c]\nabcdef\n\nabcd\n" - ("j") - "abc\nab[c]def\n\nabcd\n") - (evil-test-buffer - "ab[c]\nabcdef\n\nabcd\n" - ("jj") - "abc\nabcdef\n[\n]abcd\n") - (evil-test-buffer - "ab[c]\nabcdef\n\nabcd\n" - ("jjj") - "abc\nabcdef\n\nab[c]d\n") - (evil-test-buffer - "ab[c]\nabcdef\n\nabcd\n" - ("jjjk") - "abc\nabcdef\n[\n]abcd\n") - (evil-test-buffer - "ab[c]\nabcdef\n\nabcd\n" - ("jjjkk") - "abc\nab[c]def\n\nabcd\n"))) - -(ert-deftest evil-test-logical-visual-next-line () - "Test alternating between logical and visual next/previous line motions." - :tags '(evil motion) - (skip-unless (and (not noninteractive) (> (window-width) 2))) - (evil-test-buffer "[x]\nyy\n" - (insert (make-string (window-width) ?x)) ; Make first line soft-wrap - (goto-char (point-min)) - ("gjj") - (should (= (current-column) 1)) - ("Gkgk") - (should-not (bolp)))) - -(ert-deftest evil-test-eol-anchoring-with-visual-line-movement () - "Test gj and gk once the cursor is anchored at eol with $." - :tags '(evil motion) - (skip-unless (and (not noninteractive) (> (window-width) 13))) - (evil-test-buffer - "Short [l]ine\nA longer line\nThird line" - ("$gj") - "Short line\nA longer lin[e]\nThird line")) - -(ert-deftest evil-test-other-commands-preserve-column () - "Test other comamnds preserve the column, when appropriate." - :tags '(evil motion) - (ert-info ("evil-goto-line can preserve column") - (let ((evil-start-of-line nil)) - (evil-test-buffer - "Shor[t] line -Average line -The longest line" - ("2G") - "Short line -Aver[a]ge line -The longest line" - ("$G") - "Short line -Average line -The longest lin[e]" - ("hgg") - "Short lin[e] -Average line -The longest line"))) - - (ert-info ("evil-goto-line respects evil-start-of-line") - (let ((evil-start-of-line t)) - (evil-test-buffer - "foo\n[b]ar" - ("$ggj") - "foo\n[b]ar"))) - - (ert-info ("N% (`evil-jump-item' with count) can preserve column") - (let ((evil-start-of-line nil)) - (evil-test-buffer - "Short line -Average line -The lo[n]gest line" - ("5%") - "Short [l]ine -Average line -The longest line" - ("$90%") - "Short line -Average line -The longest lin[e]")))) - -(ert-deftest evil-test-beginning-of-line () - "Test `evil-beginning-of-line' motion" - :tags '(evil motion) - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save." - ("0") - "[;]; This buffer is for notes you don't want to save." - ("0") - "[;]; This buffer is for notes you don't want to save.")) - -(ert-deftest evil-test-end-of-line () - "Test `evil-end-of-line' motion" - :tags '(evil motion) - (ert-info ("Simple") - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save." - ("$") - ";; This buffer is for notes you don't want to save[.]" - ("$") - ";; This buffer is for notes you don't want to save[.]")) - (ert-info ("Don't delete blank lines") - (evil-test-buffer - "Above some line -\[] -Below some empty line" - ("d$") - "Above some line -\[] -Below some empty line")) - (ert-info ("Visual state") - (evil-test-buffer - "f[o]o\nbar" - ("v$") - "fbar") - (let ((evil-v$-excludes-newline t)) - (evil-test-buffer - "f[o]o\nbar" - ("v$") - "f\nbar")))) - -(ert-deftest evil-test-percentage-of-line () - "Test `evil-percentage-of-line' motion" - :tags '(evil motion) - (evil-test-buffer - "[0]123456789" - ("gM") - "01234[5]6789" - ("10gM") - "0[1]23456789" - ("85gM") - "01234567[8]9")) - -(ert-deftest evil-test-first-non-blank () - "Test `evil-first-non-blank' motion" - :tags '(evil motion) - (evil-test-buffer - "\ - printf(\"Hello world\\n\")[;] - return EXIT_SUCCESS;" - ("^") - "\ - [p]rintf(\"Hello world\\n\"); - return EXIT_SUCCESS;" - ("j^") - "\ - printf(\"Hello world\\n\"); - [r]eturn EXIT_SUCCESS;")) - -(ert-deftest evil-test-last-non-blank () - "Test `evil-last-non-blank' motion" - :tags '(evil motion) - (evil-test-buffer - "[i]nt main(int argc, char** argv) \n\ -{ - printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -}" - ("g_") - "int main(int argc, char** argv[)] \n\ -{ - printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -}" - ("jjg_") - "int main(int argc, char** argv) \n\ -{ - printf(\"Hello world\\n\")[;] - return EXIT_SUCCESS; -}")) - -(ert-deftest evil-test-goto-first-line () - "Test `evil-goto-first-line' motion" - :tags '(evil motion) - (ert-info ("With `evil-start-of-line' `nil'") - (evil-test-buffer - "[i]nt main(int argc, char** argv) -{ - printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -}" - ("3gg") - "int main(int argc, char** argv) -{ -[ ] printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -}" - ("gg") - "[i]nt main(int argc, char** argv) -{ - printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -}" - ("100gg") - "int main(int argc, char** argv) -{ - printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -\[}]")) - (ert-info ("With `evil-start-of-line' `nil'") - (let ((evil-start-of-line t)) - (evil-test-buffer - "[i]nt main(int argc, char** argv) -{ - printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -}" - ("3gg") - "int main(int argc, char** argv) -{ - [p]rintf(\"Hello world\\n\"); - return EXIT_SUCCESS; -}" - ("gg") - "[i]nt main(int argc, char** argv) -{ - printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -}" - ("100gg") - "int main(int argc, char** argv) -{ - printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -\[}]")))) - -(ert-deftest evil-test-goto-line () - "Test `evil-goto-line' motion" - :tags '(evil motion) - (ert-info ("With `evil-start-of-line' `t'") - (let ((evil-start-of-line t)) - (evil-test-buffer - "[i]nt main(int argc, char** argv) -{ - printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -}" - ("G") - "int main(int argc, char** argv) -{ - printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -\[}]" - ("3G") - "int main(int argc, char** argv) -{ - [p]rintf(\"Hello world\\n\"); - return EXIT_SUCCESS; -}" - ("100G") - "int main(int argc, char** argv) -{ - printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -\[}]"))) - (ert-info ("With `evil-start-of-line' `nil'") - (evil-test-buffer - "[i]nt main(int argc, char** argv) -{ - printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -}" - ("G") - "int main(int argc, char** argv) -{ - printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -\[}]" - ("3G") - "int main(int argc, char** argv) -{ -[ ] printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -}" - ("100G") - "int main(int argc, char** argv) -{ - printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -\[}]"))) - -(ert-deftest evil-test-goto-char () - "Test `evil-goto-char' motion and ex command." - :tags '(evil motion ex) - (evil-test-buffer - "[W]e only need a short buffer for this test" - (":goto 9") - "We only [n]eed a short buffer for this test" - (":goto") - "[W]e only need a short buffer for this test" - ("16go") - "We only need a [s]hort buffer for this test" - ("go") - "[W]e only need a short buffer for this test" - (evil-goto-char 24) - "We only need a short bu[f]fer for this test" - ("v29go") - "We only need a short buor this test")) - -(ert-deftest evil-test-operator-0 () - "Test motion \"0\" with an operator." - :tags '(evil motion) - (evil-test-buffer - ";; [T]his buffer is for notes." - ("d0") - "[T]his buffer is for notes.")) - -(ert-deftest evil-test-forward-not-word () - "Test `evil-forward-not-thing'" - :tags '(evil motion) - (evil-test-buffer - "[ ] aa,," - (evil-forward-not-thing 'evil-word) - " [a]a,,")) - -;; TODO: test Visual motions and window motions -(ert-deftest evil-test-forward-word-begin () - "Test `evil-forward-word-begin'" - :tags '(evil motion) - (ert-info ("Non-word") - (evil-test-buffer - "[;]; This buffer is for notes." - ("w") - ";; [T]his buffer is for notes.")) - (ert-info ("Simple") - (evil-test-buffer - ";; [T]his buffer is for notes." - ("w") - ";; This [b]uffer is for notes.")) - (ert-info ("With count") - (evil-test-buffer - ";; [T]his buffer is for notes." - ("3w") - ";; This buffer is [f]or notes.")) - (ert-info ("With count on whitespace") - (evil-test-buffer - ";;[ ]This buffer is for notes." - ("3w") - ";; This buffer [i]s for notes.")) - (ert-info ("Empty line") - (evil-test-buffer - "Above some line -\[] -Below some empty line" - ("w") - "Above some line - -\[B]elow some empty line") - (evil-test-buffer - "[A]bove - -Below some empty line" - ("dw") - "[] - -Below some empty line" - ("dw") - "[] -Below some empty line" - ("dw") - "[B]elow some empty line") - (evil-test-buffer - "[A]bove - - Below some empty line with leading whitespace" - ("dw") - "[] - - Below some empty line with leading whitespace" - ("dw") - "[] - Below some empty line with leading whitespace" - ("dw") - " [B]elow some empty line") - (evil-test-buffer - "Some line with trailing whitespace [ ] \n next line\n" - ("dw") - "Some line with trailing whitespace [ ]\n next line\n") - (evil-test-buffer - "[A]\n" - ("dw") - "[]\n")) - (ert-info ("End of buffer") - (evil-test-buffer - ";; [T]his buffer is for notes." - ("100w") - ";; This buffer is for notes[.]" - (should-error (execute-kbd-macro "w")) - (should-error (execute-kbd-macro "10w")))) - (ert-info ("Before last character in buffer") - (evil-test-buffer - "fo[o]." - ("w") - "foo[.]") - (evil-test-buffer - "fo[o] " - ("w") - "foo[ ]") - (evil-test-buffer - "[ ]e" - ("w") - " [e]"))) - -(ert-deftest evil-test-forward-word-end () - "Test `evil-forward-word-end'" - :tags '(evil motion) - (ert-info ("Non-word") - (evil-test-buffer - "[;]; This buffer is for notes." - ("e") - ";[;] This buffer is for notes.")) - (ert-info ("Simple") - (evil-test-buffer - ";; [T]his buffer is for notes." - ("e") - ";; Thi[s] buffer is for notes.")) - (ert-info ("With count") - (evil-test-buffer - ";; [T]his buffer is for notes." - ("3e") - ";; This buffer i[s] for notes.")) - (ert-info ("With count on whitespace") - (evil-test-buffer - ";;[ ]This buffer is for notes." - ("3e") - ";; This buffer i[s] for notes.")) - (ert-info ("Delete") - (evil-test-buffer - ";; This[-]buffer-is-for-notes." - ("de") - ";; This[-]is-for-notes.")) - (ert-info ("Empty line") - (evil-test-buffer - "Above some line -\[] -Below some empty line" - ("e") - "Above some line - -Belo[w] some empty line")) - (ert-info ("End of buffer") - (evil-test-buffer - ";; [T]his buffer is for notes." - ("100e") - ";; This buffer is for notes[.]" - (should-error (execute-kbd-macro "e")) - (should-error (execute-kbd-macro "10e")))) - ;; In Vim, "de" may delete two words rather than one - ;; if the first word is only one letter. In Evil, - ;; "de" always deletes one word. - (ert-info ("Delete a single-letter word") - (evil-test-buffer - "a [b] c" - ("de") - "a [ ]c"))) - -(ert-deftest evil-test-backward-word-begin () - "Test `evil-backward-word-begin'" - :tags '(evil motion) - (ert-info ("Simple") - (evil-test-buffer - ";; This buffer is for notes[.]" - ("b") - ";; This buffer is for [n]otes.")) - (ert-info ("With count") - (evil-test-buffer - ";; This buffer is for notes[.]" - ("2b") - ";; This buffer is [f]or notes.")) - (ert-info ("Empty line") - (evil-test-buffer - "Above some line -\[] -Below some empty line" - ("b") - "Above some [l]ine - -Below some empty line")) - (ert-info ("With count on whitespace") - (evil-test-buffer - ";; This buffer is for[ ]notes." - ("2b") - ";; This buffer [i]s for notes.")) - (ert-info ("Beginning of buffer") - (evil-test-buffer - ";; This buffer is for notes[.]" - ("100b") - "[;]; This buffer is for notes." - (should-error (execute-kbd-macro "b")) - (should-error (execute-kbd-macro "10b"))))) - -(ert-deftest evil-test-backward-word-end () - "Test `evil-backward-word-end'" - :tags '(evil motion) - (ert-info ("Simple") - (evil-test-buffer - ";; This buffer is for notes[.]" - ("ge") - ";; This buffer is for note[s].")) - (ert-info ("With count") - (evil-test-buffer - ";; This buffer is for notes[.]" - ("2ge") - ";; This buffer is fo[r] notes.")) - (ert-info ("Empty line") - (evil-test-buffer - "Above some line -\[] -Below some empty line" - ("ge") - "Above some lin[e] - -Below some empty line")) - (ert-info ("With count on whitespace") - (evil-test-buffer - ";; This buffer is for[ ]notes." - ("2ge") - ";; This buffer i[s] for notes.")) - (ert-info ("Beginning of buffer") - (evil-test-buffer - ";; This buffer is for notes[.]" - ("100ge") - "[;]; This buffer is for notes." - (should-error (execute-kbd-macro "ge")) - (should-error (execute-kbd-macro "10ge"))))) - -(ert-deftest evil-test-forward-word-begin-cjk () - "Test `evil-forward-word-begin' on CJK words" - :tags '(evil motion cjk) - (ert-info ("Latin / numeric") - (evil-test-buffer - "[a]bcd1234" - ("w") - "abcd123[4]")) - (ert-info ("Latin / Kanji") - (evil-test-buffer - "[a]bcd漢字" - ("w") - "abcd[漢]字")) - (ert-info ("Latin / Hiragana") - (evil-test-buffer - "[a]bcdひらがな" - ("w") - "abcd[ひ]らがな")) - (ert-info ("Latin / Katakana") - (evil-test-buffer - "[a]bcdカタカナ" - ("w") - "abcd[カ]タカナ")) - (ert-info ("Latin / half-width Katakana") - (evil-test-buffer - "[a]bcdカタカナ" - ("w") - "abcdカタカ[ナ]")) - (ert-info ("Latin / full-width alphabet") - (evil-test-buffer - "[a]bcdABC" - ("w") - "abcdAB[C]")) - (ert-info ("Latin / full-width numeric") - (evil-test-buffer - "[a]bcd123" - ("w") - "abcd12[3]")) - (ert-info ("Latin / Hangul") - (evil-test-buffer - "[a]bcd한글" - ("w") - "abcd[한]글")) - (ert-info ("numeric / Latin") - (evil-test-buffer - "[1]234abcd" - ("w") - "1234abc[d]")) - (ert-info ("numeric / Kanji") - (evil-test-buffer - "[1]234漢字" - ("w") - "1234[漢]字")) - (ert-info ("numeric / Hiragana") - (evil-test-buffer - "[1]234ひらがな" - ("w") - "1234[ひ]らがな")) - (ert-info ("numeric / Katakana") - (evil-test-buffer - "[1]234カタカナ" - ("w") - "1234[カ]タカナ")) - (ert-info ("numeric / half-width Katakana") - (evil-test-buffer - "[1]234カタカナ" - ("w") - "1234カタカ[ナ]")) - (ert-info ("numeric / full-width alphabet") - (evil-test-buffer - "[1]234ABC" - ("w") - "1234AB[C]")) - (ert-info ("numeric / full-width numeric") - (evil-test-buffer - "[1]234123" - ("w") - "123412[3]")) - (ert-info ("numeric / Hangul") - (evil-test-buffer - "[1]234한글" - ("w") - "1234[한]글")) - (ert-info ("Kanji / Latin") - (evil-test-buffer - "[漢]字abcd" - ("w") - "漢字[a]bcd")) - (ert-info ("Kanji / numeric") - (evil-test-buffer - "[漢]字1234" - ("w") - "漢字[1]234")) - (ert-info ("Kanji / Hiragana") - (evil-test-buffer - "[漢]字ひらがな" - ("w") - "漢字[ひ]らがな")) - (ert-info ("Kanji / Katakana") - (evil-test-buffer - "[漢]字カタカナ" - ("w") - "漢字[カ]タカナ")) - (ert-info ("Kanji / half-width Katakana") - (evil-test-buffer - "[漢]字カタカナ" - ("w") - "漢字[カ]タカナ")) - (ert-info ("Kanji / full-width alphabet") - (evil-test-buffer - "[漢]字ABC" - ("w") - "漢字[A]BC")) - (ert-info ("Kanji / full-width numeric") - (evil-test-buffer - "[漢]字123" - ("w") - "漢字[1]23")) - (ert-info ("Kanji / Hangul") - (evil-test-buffer - "[漢]字한글" - ("w") - "漢字[한]글")) - (ert-info ("Hiragana / Latin") - (evil-test-buffer - "[ひ]らがなabcd" - ("w") - "ひらがな[a]bcd")) - (ert-info ("Hiragana / numeric") - (evil-test-buffer - "[ひ]らがな1234" - ("w") - "ひらがな[1]234")) - (ert-info ("Hiragana / Kanji") - (evil-test-buffer - "[ひ]らがな漢字" - ("w") - "ひらがな[漢]字")) - (ert-info ("Hiragana / Katakana") - (evil-test-buffer - "[ひ]らがなカタカナ" - ("w") - "ひらがな[カ]タカナ")) - (ert-info ("Hiragana / half-width Katakana") - (evil-test-buffer - "[ひ]らがなカタカナ" - ("w") - "ひらがな[カ]タカナ")) - (ert-info ("Hiragana / full-width alphabet") - (evil-test-buffer - "[ひ]らがなABC" - ("w") - "ひらがな[A]BC")) - (ert-info ("Hiragana / full-width numeric") - (evil-test-buffer - "[ひ]らがな123" - ("w") - "ひらがな[1]23")) - (ert-info ("Hiragana / Hangul") - (evil-test-buffer - "[ひ]らがな한글" - ("w") - "ひらがな[한]글")) - (ert-info ("Katakana / Latin") - (evil-test-buffer - "[カ]タカナabcd" - ("w") - "カタカナ[a]bcd")) - (ert-info ("Katakana / numeric") - (evil-test-buffer - "[カ]タカナ1234" - ("w") - "カタカナ[1]234")) - (ert-info ("Katakana / Kanji") - (evil-test-buffer - "[カ]タカナ漢字" - ("w") - "カタカナ[漢]字")) - (ert-info ("Katakana / Hiragana") - (evil-test-buffer - "[カ]タカナひらがな" - ("w") - "カタカナ[ひ]らがな")) - (ert-info ("Katakana / half-width Katakana") - (evil-test-buffer - "[カ]タカナカタカナ" - ("w") - "カタカナ[カ]タカナ")) - (ert-info ("Katakana / full-width alphabet") - (evil-test-buffer - "[カ]タカナABC" - ("w") - "カタカナ[A]BC")) - (ert-info ("Katakana / full-width numeric") - (evil-test-buffer - "[カ]タカナ123" - ("w") - "カタカナ[1]23")) - (ert-info ("Katakana / Hangul") - (evil-test-buffer - "[カ]タカナ한글" - ("w") - "カタカナ[한]글")) - (ert-info ("half-width Katakana / Latin") - (evil-test-buffer - "[カ]タカナabcd" - ("w") - "カタカナabc[d]")) - (ert-info ("half-width Katakana / numeric") - (evil-test-buffer - "[カ]タカナ1234" - ("w") - "カタカナ123[4]")) - (ert-info ("half-width Katakana / Kanji") - (evil-test-buffer - "[カ]タカナ漢字" - ("w") - "カタカナ[漢]字")) - (ert-info ("half-width Katakana / Hiragana") - (evil-test-buffer - "[カ]タカナひらがな" - ("w") - "カタカナ[ひ]らがな")) - (ert-info ("half-width Katakana / Katakana") - (evil-test-buffer - "[カ]タカナカタカナ" - ("w") - "カタカナ[カ]タカナ")) - (ert-info ("half-width Katakana / full-width alphabet") - (evil-test-buffer - "[カ]タカナABC" - ("w") - "カタカナAB[C]")) - (ert-info ("half-width Katakana / full-width numeric") - (evil-test-buffer - "[カ]タカナ123" - ("w") - "カタカナ12[3]")) - (ert-info ("half-width Katakana / Hangul") - (evil-test-buffer - "[カ]タカナ한글" - ("w") - "カタカナ[한]글")) - (ert-info ("full-width alphabet / Latin") - (evil-test-buffer - "[A]BCabcd" - ("w") - "ABCabc[d]")) - (ert-info ("full-width alphabet / numeric") - (evil-test-buffer - "[A]BC1234" - ("w") - "ABC123[4]")) - (ert-info ("full-width alphabet / Kanji") - (evil-test-buffer - "[A]BC漢字" - ("w") - "ABC[漢]字")) - (ert-info ("full-width alphabet / Hiragana") - (evil-test-buffer - "[A]BCひらがな" - ("w") - "ABC[ひ]らがな")) - (ert-info ("full-width alphabet / Katakana") - (evil-test-buffer - "[A]BCカタカナ" - ("w") - "ABC[カ]タカナ")) - (ert-info ("full-width alphabet / half-width Katakana") - (evil-test-buffer - "[A]BCカタカナ" - ("w") - "ABCカタカ[ナ]")) - (ert-info ("full-width alphabet / full-width numeric") - (evil-test-buffer - "[A]BC123" - ("w") - "ABC12[3]")) - (ert-info ("full-width alphabet / Hangul") - (evil-test-buffer - "[A]BC한글" - ("w") - "ABC[한]글")) - (ert-info ("full-width numeric / Latin") - (evil-test-buffer - "[1]23abcd" - ("w") - "123abc[d]")) - (ert-info ("full-width numeric / numeric") - (evil-test-buffer - "[1]231234" - ("w") - "123123[4]")) - (ert-info ("full-width numeric / Kanji") - (evil-test-buffer - "[1]23漢字" - ("w") - "123[漢]字")) - (ert-info ("full-width numeric / Hiragana") - (evil-test-buffer - "[1]23ひらがな" - ("w") - "123[ひ]らがな")) - (ert-info ("full-width numeric / Katakana") - (evil-test-buffer - "[1]23カタカナ" - ("w") - "123[カ]タカナ")) - (ert-info ("full-width numeric / half-width Katakana") - (evil-test-buffer - "[1]23カタカナ" - ("w") - "123カタカ[ナ]")) - (ert-info ("full-width numeric / full-width alphabet") - (evil-test-buffer - "[1]23ABC" - ("w") - "123AB[C]")) - (ert-info ("full-width numeric / Hangul") - (evil-test-buffer - "[1]23한글" - ("w") - "123[한]글")) - (ert-info ("Hangul / Latin") - (evil-test-buffer - "[한]글abcd" - ("w") - "한글[a]bcd")) - (ert-info ("Hangul / numeric") - (evil-test-buffer - "[한]글1234" - ("w") - "한글[1]234")) - (ert-info ("Hangul / Kanji") - (evil-test-buffer - "[한]글漢字" - ("w") - "한글[漢]字")) - (ert-info ("Hangul / Hiragana") - (evil-test-buffer - "[한]글ひらがな" - ("w") - "한글[ひ]らがな")) - (ert-info ("Hangul / Katakana") - (evil-test-buffer - "[한]글カタカナ" - ("w") - "한글[カ]タカナ")) - (ert-info ("Hangul / half-width Katakana") - (evil-test-buffer - "[한]글カタカナ" - ("w") - "한글[カ]タカナ")) - (ert-info ("Hangul / full-width alphabet") - (evil-test-buffer - "[한]글ABC" - ("w") - "한글[A]BC")) - (ert-info ("Hangul / full-width numeric") - (evil-test-buffer - "[한]글123" - ("w") - "한글[1]23"))) - -(ert-deftest evil-test-forward-word-end-cjk () - "Test `evil-forward-word-end' on CJK words" - :tags '(evil motion cjk) - (ert-info ("Latin / numeric") - (evil-test-buffer - "[a]bcd1234" - ("e") - "abcd123[4]")) - (ert-info ("Latin / Kanji") - (evil-test-buffer - "[a]bcd漢字" - ("e") - "abc[d]漢字")) - (ert-info ("Latin / Hiragana") - (evil-test-buffer - "[a]bcdひらがな" - ("e") - "abc[d]ひらがな")) - (ert-info ("Latin / Katakana") - (evil-test-buffer - "[a]bcdカタカナ" - ("e") - "abc[d]カタカナ")) - (ert-info ("Latin / half-width Katakana") - (evil-test-buffer - "[a]bcdカタカナ" - ("e") - "abcdカタカ[ナ]")) - (ert-info ("Latin / full-width alphabet") - (evil-test-buffer - "[a]bcdABC" - ("e") - "abcdAB[C]")) - (ert-info ("Latin / full-width numeric") - (evil-test-buffer - "[a]bcd123" - ("e") - "abcd12[3]")) - (ert-info ("Latin / Hangul") - (evil-test-buffer - "[a]bcd한글" - ("e") - "abc[d]한글")) - (ert-info ("numeric / Latin") - (evil-test-buffer - "[1]234abcd" - ("e") - "1234abc[d]")) - (ert-info ("numeric / Kanji") - (evil-test-buffer - "[1]234漢字" - ("e") - "123[4]漢字")) - (ert-info ("numeric / Hiragana") - (evil-test-buffer - "[1]234ひらがな" - ("e") - "123[4]ひらがな")) - (ert-info ("numeric / Katakana") - (evil-test-buffer - "[1]234カタカナ" - ("e") - "123[4]カタカナ")) - (ert-info ("numeric / half-width Katakana") - (evil-test-buffer - "[1]234カタカナ" - ("e") - "1234カタカ[ナ]")) - (ert-info ("numeric / full-width alphabet") - (evil-test-buffer - "[1]234ABC" - ("e") - "1234AB[C]")) - (ert-info ("numeric / full-width numeric") - (evil-test-buffer - "[1]234123" - ("e") - "123412[3]")) - (ert-info ("numeric / Hangul") - (evil-test-buffer - "[1]234한글" - ("e") - "123[4]한글")) - (ert-info ("Kanji / Latin") - (evil-test-buffer - "[漢]字abcd" - ("e") - "漢[字]abcd")) - (ert-info ("Kanji / numeric") - (evil-test-buffer - "[漢]字1234" - ("e") - "漢[字]1234")) - (ert-info ("Kanji / Hiragana") - (evil-test-buffer - "[漢]字ひらがな" - ("e") - "漢[字]ひらがな")) - (ert-info ("Kanji / Katakana") - (evil-test-buffer - "[漢]字カタカナ" - ("e") - "漢[字]カタカナ")) - (ert-info ("Kanji / half-width Katakana") - (evil-test-buffer - "[漢]字カタカナ" - ("e") - "漢[字]カタカナ")) - (ert-info ("Kanji / full-width alphabet") - (evil-test-buffer - "[漢]字ABC" - ("e") - "漢[字]ABC")) - (ert-info ("Kanji / full-width numeric") - (evil-test-buffer - "[漢]字123" - ("e") - "漢[字]123")) - (ert-info ("Kanji / Hangul") - (evil-test-buffer - "[漢]字한글" - ("e") - "漢[字]한글")) - (ert-info ("Hiragana / Latin") - (evil-test-buffer - "[ひ]らがなabcd" - ("e") - "ひらが[な]abcd")) - (ert-info ("Hiragana / numeric") - (evil-test-buffer - "[ひ]らがな1234" - ("e") - "ひらが[な]1234")) - (ert-info ("Hiragana / Kanji") - (evil-test-buffer - "[ひ]らがな漢字" - ("e") - "ひらが[な]漢字")) - (ert-info ("Hiragana / Katakana") - (evil-test-buffer - "[ひ]らがなカタカナ" - ("e") - "ひらが[な]カタカナ")) - (ert-info ("Hiragana / half-width Katakana") - (evil-test-buffer - "[ひ]らがなカタカナ" - ("e") - "ひらが[な]カタカナ")) - (ert-info ("Hiragana / full-width alphabet") - (evil-test-buffer - "[ひ]らがなABC" - ("e") - "ひらが[な]ABC")) - (ert-info ("Hiragana / full-width numeric") - (evil-test-buffer - "[ひ]らがな123" - ("e") - "ひらが[な]123")) - (ert-info ("Hiragana / Hangul") - (evil-test-buffer - "[ひ]らがな한글" - ("e") - "ひらが[な]한글")) - (ert-info ("Katakana / Latin") - (evil-test-buffer - "[カ]タカナabcd" - ("e") - "カタカ[ナ]abcd")) - (ert-info ("Katakana / numeric") - (evil-test-buffer - "[カ]タカナ1234" - ("e") - "カタカ[ナ]1234")) - (ert-info ("Katakana / Kanji") - (evil-test-buffer - "[カ]タカナ漢字" - ("e") - "カタカ[ナ]漢字")) - (ert-info ("Katakana / Hiragana") - (evil-test-buffer - "[カ]タカナひらがな" - ("e") - "カタカ[ナ]ひらがな")) - (ert-info ("Katakana / half-width Katakana") - (evil-test-buffer - "[カ]タカナカタカナ" - ("e") - "カタカ[ナ]カタカナ")) - (ert-info ("Katakana / full-width alphabet") - (evil-test-buffer - "[カ]タカナABC" - ("e") - "カタカ[ナ]ABC")) - (ert-info ("Katakana / full-width numeric") - (evil-test-buffer - "[カ]タカナ123" - ("e") - "カタカ[ナ]123")) - (ert-info ("Katakana / Hangul") - (evil-test-buffer - "[カ]タカナ한글" - ("e") - "カタカ[ナ]한글")) - (ert-info ("half-width Katakana / Latin") - (evil-test-buffer - "[カ]タカナabcd" - ("e") - "カタカナabc[d]")) - (ert-info ("half-width Katakana / numeric") - (evil-test-buffer - "[カ]タカナ1234" - ("e") - "カタカナ123[4]")) - (ert-info ("half-width Katakana / Kanji") - (evil-test-buffer - "[カ]タカナ漢字" - ("e") - "カタカ[ナ]漢字")) - (ert-info ("half-width Katakana / Hiragana") - (evil-test-buffer - "[カ]タカナひらがな" - ("e") - "カタカ[ナ]ひらがな")) - (ert-info ("half-width Katakana / Katakana") - (evil-test-buffer - "[カ]タカナカタカナ" - ("e") - "カタカ[ナ]カタカナ")) - (ert-info ("half-width Katakana / full-width alphabet") - (evil-test-buffer - "[カ]タカナABC" - ("e") - "カタカナAB[C]")) - (ert-info ("half-width Katakana / full-width numeric") - (evil-test-buffer - "[カ]タカナ123" - ("e") - "カタカナ12[3]")) - (ert-info ("half-width Katakana / Hangul") - (evil-test-buffer - "[カ]タカナ한글" - ("e") - "カタカ[ナ]한글")) - (ert-info ("full-width alphabet / Latin") - (evil-test-buffer - "[A]BCabcd" - ("e") - "ABCabc[d]")) - (ert-info ("full-width alphabet / numeric") - (evil-test-buffer - "[A]BC1234" - ("e") - "ABC123[4]")) - (ert-info ("full-width alphabet / Kanji") - (evil-test-buffer - "[A]BC漢字" - ("e") - "AB[C]漢字")) - (ert-info ("full-width alphabet / Hiragana") - (evil-test-buffer - "[A]BCひらがな" - ("e") - "AB[C]ひらがな")) - (ert-info ("full-width alphabet / Katakana") - (evil-test-buffer - "[A]BCカタカナ" - ("e") - "AB[C]カタカナ")) - (ert-info ("full-width alphabet / half-width Katakana") - (evil-test-buffer - "[A]BCカタカナ" - ("e") - "ABCカタカ[ナ]")) - (ert-info ("full-width alphabet / full-width numeric") - (evil-test-buffer - "[A]BC123" - ("e") - "ABC12[3]")) - (ert-info ("full-width alphabet / Hangul") - (evil-test-buffer - "[A]BC한글" - ("e") - "AB[C]한글")) - (ert-info ("full-width numeric / Latin") - (evil-test-buffer - "[1]23abcd" - ("e") - "123abc[d]")) - (ert-info ("full-width numeric / numeric") - (evil-test-buffer - "[1]231234" - ("e") - "123123[4]")) - (ert-info ("full-width numeric / Kanji") - (evil-test-buffer - "[1]23漢字" - ("e") - "12[3]漢字")) - (ert-info ("full-width numeric / Hiragana") - (evil-test-buffer - "[1]23ひらがな" - ("e") - "12[3]ひらがな")) - (ert-info ("full-width numeric / Katakana") - (evil-test-buffer - "[1]23カタカナ" - ("e") - "12[3]カタカナ")) - (ert-info ("full-width numeric / half-width Katakana") - (evil-test-buffer - "[1]23カタカナ" - ("e") - "123カタカ[ナ]")) - (ert-info ("full-width numeric / full-width alphabet") - (evil-test-buffer - "[1]23ABC" - ("e") - "123AB[C]")) - (ert-info ("full-width numeric / Hangul") - (evil-test-buffer - "[1]23한글" - ("e") - "12[3]한글")) - (ert-info ("Hangul / Latin") - (evil-test-buffer - "[한]글abcd" - ("e") - "한[글]abcd")) - (ert-info ("Hangul / numeric") - (evil-test-buffer - "[한]글1234" - ("e") - "한[글]1234")) - (ert-info ("Hangul / Kanji") - (evil-test-buffer - "[한]글漢字" - ("e") - "한[글]漢字")) - (ert-info ("Hangul / Hiragana") - (evil-test-buffer - "[한]글ひらがな" - ("e") - "한[글]ひらがな")) - (ert-info ("Hangul / Katakana") - (evil-test-buffer - "[한]글カタカナ" - ("e") - "한[글]カタカナ")) - (ert-info ("Hangul / half-width Katakana") - (evil-test-buffer - "[한]글カタカナ" - ("e") - "한[글]カタカナ")) - (ert-info ("Hangul / full-width alphabet") - (evil-test-buffer - "[한]글ABC" - ("e") - "한[글]ABC")) - (ert-info ("Hangul / full-width numeric") - (evil-test-buffer - "[한]글123" - ("e") - "한[글]123"))) - -(ert-deftest evil-test-backword-word-begin-cjk () - "Test `evil-backward-word-begin' on CJK words" - :tags '(evil motion cjk) - (ert-info ("Latin / numeric") - (evil-test-buffer - "abcd123[4]" - ("b") - "[a]bcd1234")) - (ert-info ("Latin / Kanji") - (evil-test-buffer - "abcd漢[字]" - ("b") - "abcd[漢]字")) - (ert-info ("Latin / Hiragana") - (evil-test-buffer - "abcdひらが[な]" - ("b") - "abcd[ひ]らがな")) - (ert-info ("Latin / Katakana") - (evil-test-buffer - "abcdカタカ[ナ]" - ("b") - "abcd[カ]タカナ")) - (ert-info ("Latin / half-width Katakana") - (evil-test-buffer - "abcdカタカ[ナ]" - ("b") - "[a]bcdカタカナ")) - (ert-info ("Latin / full-width alphabet") - (evil-test-buffer - "abcdAB[C]" - ("b") - "[a]bcdABC")) - (ert-info ("Latin / full-width numeric") - (evil-test-buffer - "abcd12[3]" - ("b") - "[a]bcd123")) - (ert-info ("Latin / Hangul") - (evil-test-buffer - "abcd한[글]" - ("b") - "abcd[한]글")) - (ert-info ("numeric / Latin") - (evil-test-buffer - "1234abc[d]" - ("b") - "[1]234abcd")) - (ert-info ("numeric / Kanji") - (evil-test-buffer - "1234漢[字]" - ("b") - "1234[漢]字")) - (ert-info ("numeric / Hiragana") - (evil-test-buffer - "1234ひらが[な]" - ("b") - "1234[ひ]らがな")) - (ert-info ("numeric / Katakana") - (evil-test-buffer - "1234カタカ[ナ]" - ("b") - "1234[カ]タカナ")) - (ert-info ("numeric / half-width Katakana") - (evil-test-buffer - "1234カタカ[ナ]" - ("b") - "[1]234カタカナ")) - (ert-info ("numeric / full-width alphabet") - (evil-test-buffer - "1234AB[C]" - ("b") - "[1]234ABC")) - (ert-info ("numeric / full-width numeric") - (evil-test-buffer - "123412[3]" - ("b") - "[1]234123")) - (ert-info ("numeric / Hangul") - (evil-test-buffer - "1234한[글]" - ("b") - "1234[한]글")) - (ert-info ("Kanji / Latin") - (evil-test-buffer - "漢字abc[d]" - ("b") - "漢字[a]bcd")) - (ert-info ("Kanji / numeric") - (evil-test-buffer - "漢字123[4]" - ("b") - "漢字[1]234")) - (ert-info ("Kanji / Hiragana") - (evil-test-buffer - "漢字ひらが[な]" - ("b") - "漢字[ひ]らがな")) - (ert-info ("Kanji / Katakana") - (evil-test-buffer - "漢字カタカ[ナ]" - ("b") - "漢字[カ]タカナ")) - (ert-info ("Kanji / half-width Katakana") - (evil-test-buffer - "漢字カタカ[ナ]" - ("b") - "漢字[カ]タカナ")) - (ert-info ("Kanji / full-width alphabet") - (evil-test-buffer - "漢字AB[C]" - ("b") - "漢字[A]BC")) - (ert-info ("Kanji / full-width numeric") - (evil-test-buffer - "漢字12[3]" - ("b") - "漢字[1]23")) - (ert-info ("Kanji / Hangul") - (evil-test-buffer - "漢字한[글]" - ("b") - "漢字[한]글")) - (ert-info ("Hiragana / Latin") - (evil-test-buffer - "ひらがなabc[d]" - ("b") - "ひらがな[a]bcd")) - (ert-info ("Hiragana / numeric") - (evil-test-buffer - "ひらがな123[4]" - ("b") - "ひらがな[1]234")) - (ert-info ("Hiragana / Kanji") - (evil-test-buffer - "ひらがな漢[字]" - ("b") - "ひらがな[漢]字")) - (ert-info ("Hiragana / Katakana") - (evil-test-buffer - "ひらがなカタカ[ナ]" - ("b") - "ひらがな[カ]タカナ")) - (ert-info ("Hiragana / half-width Katakana") - (evil-test-buffer - "ひらがなカタカ[ナ]" - ("b") - "ひらがな[カ]タカナ")) - (ert-info ("Hiragana / full-width alphabet") - (evil-test-buffer - "ひらがなAB[C]" - ("b") - "ひらがな[A]BC")) - (ert-info ("Hiragana / full-width numeric") - (evil-test-buffer - "ひらがな12[3]" - ("b") - "ひらがな[1]23")) - (ert-info ("Hiragana / Hangul") - (evil-test-buffer - "ひらがな한[글]" - ("b") - "ひらがな[한]글")) - (ert-info ("Katakana / Latin") - (evil-test-buffer - "カタカナabc[d]" - ("b") - "カタカナ[a]bcd")) - (ert-info ("Katakana / numeric") - (evil-test-buffer - "カタカナ123[4]" - ("b") - "カタカナ[1]234")) - (ert-info ("Katakana / Kanji") - (evil-test-buffer - "カタカナ漢[字]" - ("b") - "カタカナ[漢]字")) - (ert-info ("Katakana / Hiragana") - (evil-test-buffer - "カタカナひらが[な]" - ("b") - "カタカナ[ひ]らがな")) - (ert-info ("Katakana / half-width Katakana") - (evil-test-buffer - "カタカナカタカ[ナ]" - ("b") - "カタカナ[カ]タカナ")) - (ert-info ("Katakana / full-width alphabet") - (evil-test-buffer - "カタカナAB[C]" - ("b") - "カタカナ[A]BC")) - (ert-info ("Katakana / full-width numeric") - (evil-test-buffer - "カタカナ12[3]" - ("b") - "カタカナ[1]23")) - (ert-info ("Katakana / Hangul") - (evil-test-buffer - "カタカナ한[글]" - ("b") - "カタカナ[한]글")) - (ert-info ("half-width Katakana / Latin") - (evil-test-buffer - "カタカナabc[d]" - ("b") - "[カ]タカナabcd")) - (ert-info ("half-width Katakana / numeric") - (evil-test-buffer - "カタカナ123[4]" - ("b") - "[カ]タカナ1234")) - (ert-info ("half-width Katakana / Kanji") - (evil-test-buffer - "カタカナ漢[字]" - ("b") - "カタカナ[漢]字")) - (ert-info ("half-width Katakana / Hiragana") - (evil-test-buffer - "カタカナひらが[な]" - ("b") - "カタカナ[ひ]らがな")) - (ert-info ("half-width Katakana / Katakana") - (evil-test-buffer - "カタカナカタカ[ナ]" - ("b") - "カタカナ[カ]タカナ")) - (ert-info ("half-width Katakana / full-width alphabet") - (evil-test-buffer - "カタカナAB[C]" - ("b") - "[カ]タカナABC")) - (ert-info ("half-width Katakana / full-width numeric") - (evil-test-buffer - "カタカナ12[3]" - ("b") - "[カ]タカナ123")) - (ert-info ("half-width Katakana / Hangul") - (evil-test-buffer - "カタカナ한[글]" - ("b") - "カタカナ[한]글")) - (ert-info ("full-width alphabet / Latin") - (evil-test-buffer - "ABCabc[d]" - ("b") - "[A]BCabcd")) - (ert-info ("full-width alphabet / numeric") - (evil-test-buffer - "ABC123[4]" - ("b") - "[A]BC1234")) - (ert-info ("full-width alphabet / Kanji") - (evil-test-buffer - "ABC漢[字]" - ("b") - "ABC[漢]字")) - (ert-info ("full-width alphabet / Hiragana") - (evil-test-buffer - "ABCひらが[な]" - ("b") - "ABC[ひ]らがな")) - (ert-info ("full-width alphabet / Katakana") - (evil-test-buffer - "ABCカタカ[ナ]" - ("b") - "ABC[カ]タカナ")) - (ert-info ("full-width alphabet / half-width Katakana") - (evil-test-buffer - "ABCカタカ[ナ]" - ("b") - "[A]BCカタカナ")) - (ert-info ("full-width alphabet / full-width numeric") - (evil-test-buffer - "ABC12[3]" - ("b") - "[A]BC123")) - (ert-info ("full-width alphabet / Hangul") - (evil-test-buffer - "ABC한[글]" - ("b") - "ABC[한]글")) - (ert-info ("full-width numeric / Latin") - (evil-test-buffer - "123abc[d]" - ("b") - "[1]23abcd")) - (ert-info ("full-width numeric / numeric") - (evil-test-buffer - "123123[4]" - ("b") - "[1]231234")) - (ert-info ("full-width numeric / Kanji") - (evil-test-buffer - "123漢[字]" - ("b") - "123[漢]字")) - (ert-info ("full-width numeric / Hiragana") - (evil-test-buffer - "123ひらが[な]" - ("b") - "123[ひ]らがな")) - (ert-info ("full-width numeric / Katakana") - (evil-test-buffer - "123カタカ[ナ]" - ("b") - "123[カ]タカナ")) - (ert-info ("full-width numeric / half-width Katakana") - (evil-test-buffer - "123カタカ[ナ]" - ("b") - "[1]23カタカナ")) - (ert-info ("full-width numeric / full-width alphabet") - (evil-test-buffer - "123AB[C]" - ("b") - "[1]23ABC")) - (ert-info ("full-width numeric / Hangul") - (evil-test-buffer - "123한[글]" - ("b") - "123[한]글")) - (ert-info ("Hangul / Latin") - (evil-test-buffer - "한글abc[d]" - ("b") - "한글[a]bcd")) - (ert-info ("Hangul / numeric") - (evil-test-buffer - "한글123[4]" - ("b") - "한글[1]234")) - (ert-info ("Hangul / Kanji") - (evil-test-buffer - "한글漢[字]" - ("b") - "한글[漢]字")) - (ert-info ("Hangul / Hiragana") - (evil-test-buffer - "한글ひらが[な]" - ("b") - "한글[ひ]らがな")) - (ert-info ("Hangul / Katakana") - (evil-test-buffer - "한글カタカ[ナ]" - ("b") - "한글[カ]タカナ")) - (ert-info ("Hangul / half-width Katakana") - (evil-test-buffer - "한글カタカ[ナ]" - ("b") - "한글[カ]タカナ")) - (ert-info ("Hangul / full-width alphabet") - (evil-test-buffer - "한글AB[C]" - ("b") - "한글[A]BC")) - (ert-info ("Hangul / full-width numeric") - (evil-test-buffer - "한글12[3]" - ("b") - "한글[1]23"))) - -(ert-deftest evil-test-backword-word-end-cjk () - "Test `evil-backward-word-end' on CJK words" - :tags '(evil motion cjk) - (ert-info ("Latin / numeric") - (evil-test-buffer - "abcd123[4]" - ("ge") - "[a]bcd1234")) - (ert-info ("Latin / Kanji") - (evil-test-buffer - "abcd漢[字]" - ("ge") - "abc[d]漢字")) - (ert-info ("Latin / Hiragana") - (evil-test-buffer - "abcdひらが[な]" - ("ge") - "abc[d]ひらがな")) - (ert-info ("Latin / Katakana") - (evil-test-buffer - "abcdカタカ[ナ]" - ("ge") - "abc[d]カタカナ")) - (ert-info ("Latin / half-width Katakana") - (evil-test-buffer - "abcdカタカ[ナ]" - ("ge") - "[a]bcdカタカナ")) - (ert-info ("Latin / full-width alphabet") - (evil-test-buffer - "abcdAB[C]" - ("ge") - "[a]bcdABC")) - (ert-info ("Latin / full-width numeric") - (evil-test-buffer - "abcd12[3]" - ("ge") - "[a]bcd123")) - (ert-info ("Latin / Hangul") - (evil-test-buffer - "abcd한[글]" - ("ge") - "abc[d]한글")) - (ert-info ("numeric / Latin") - (evil-test-buffer - "1234abc[d]" - ("ge") - "[1]234abcd")) - (ert-info ("numeric / Kanji") - (evil-test-buffer - "1234漢[字]" - ("ge") - "123[4]漢字")) - (ert-info ("numeric / Hiragana") - (evil-test-buffer - "1234ひらが[な]" - ("ge") - "123[4]ひらがな")) - (ert-info ("numeric / Katakana") - (evil-test-buffer - "1234カタカ[ナ]" - ("ge") - "123[4]カタカナ")) - (ert-info ("numeric / half-width Katakana") - (evil-test-buffer - "1234カタカ[ナ]" - ("ge") - "[1]234カタカナ")) - (ert-info ("numeric / full-width alphabet") - (evil-test-buffer - "1234AB[C]" - ("ge") - "[1]234ABC")) - (ert-info ("numeric / full-width numeric") - (evil-test-buffer - "123412[3]" - ("ge") - "[1]234123")) - (ert-info ("numeric / Hangul") - (evil-test-buffer - "1234한[글]" - ("ge") - "123[4]한글")) - (ert-info ("Kanji / Latin") - (evil-test-buffer - "漢字abc[d]" - ("ge") - "漢[字]abcd")) - (ert-info ("Kanji / numeric") - (evil-test-buffer - "漢字123[4]" - ("ge") - "漢[字]1234")) - (ert-info ("Kanji / Hiragana") - (evil-test-buffer - "漢字ひらが[な]" - ("ge") - "漢[字]ひらがな")) - (ert-info ("Kanji / Katakana") - (evil-test-buffer - "漢字カタカ[ナ]" - ("ge") - "漢[字]カタカナ")) - (ert-info ("Kanji / half-width Katakana") - (evil-test-buffer - "漢字カタカ[ナ]" - ("ge") - "漢[字]カタカナ")) - (ert-info ("Kanji / full-width alphabet") - (evil-test-buffer - "漢字AB[C]" - ("ge") - "漢[字]ABC")) - (ert-info ("Kanji / full-width numeric") - (evil-test-buffer - "漢字12[3]" - ("ge") - "漢[字]123")) - (ert-info ("Kanji / Hangul") - (evil-test-buffer - "漢字한[글]" - ("ge") - "漢[字]한글")) - (ert-info ("Hiragana / Latin") - (evil-test-buffer - "ひらがなabc[d]" - ("ge") - "ひらが[な]abcd")) - (ert-info ("Hiragana / numeric") - (evil-test-buffer - "ひらがな123[4]" - ("ge") - "ひらが[な]1234")) - (ert-info ("Hiragana / Kanji") - (evil-test-buffer - "ひらがな漢[字]" - ("ge") - "ひらが[な]漢字")) - (ert-info ("Hiragana / Katakana") - (evil-test-buffer - "ひらがなカタカ[ナ]" - ("ge") - "ひらが[な]カタカナ")) - (ert-info ("Hiragana / half-width Katakana") - (evil-test-buffer - "ひらがなカタカ[ナ]" - ("ge") - "ひらが[な]カタカナ")) - (ert-info ("Hiragana / full-width alphabet") - (evil-test-buffer - "ひらがなAB[C]" - ("ge") - "ひらが[な]ABC")) - (ert-info ("Hiragana / full-width numeric") - (evil-test-buffer - "ひらがな12[3]" - ("ge") - "ひらが[な]123")) - (ert-info ("Hiragana / Hangul") - (evil-test-buffer - "ひらがな한[글]" - ("ge") - "ひらが[な]한글")) - (ert-info ("Katakana / Latin") - (evil-test-buffer - "カタカナabc[d]" - ("ge") - "カタカ[ナ]abcd")) - (ert-info ("Katakana / numeric") - (evil-test-buffer - "カタカナ123[4]" - ("ge") - "カタカ[ナ]1234")) - (ert-info ("Katakana / Kanji") - (evil-test-buffer - "カタカナ漢[字]" - ("ge") - "カタカ[ナ]漢字")) - (ert-info ("Katakana / Hiragana") - (evil-test-buffer - "カタカナひらが[な]" - ("ge") - "カタカ[ナ]ひらがな")) - (ert-info ("Katakana / half-width Katakana") - (evil-test-buffer - "カタカナカタカ[ナ]" - ("ge") - "カタカ[ナ]カタカナ")) - (ert-info ("Katakana / full-width alphabet") - (evil-test-buffer - "カタカナAB[C]" - ("ge") - "カタカ[ナ]ABC")) - (ert-info ("Katakana / full-width numeric") - (evil-test-buffer - "カタカナ12[3]" - ("ge") - "カタカ[ナ]123")) - (ert-info ("Katakana / Hangul") - (evil-test-buffer - "カタカナ한[글]" - ("ge") - "カタカ[ナ]한글")) - (ert-info ("half-width Katakana / Latin") - (evil-test-buffer - "カタカナabc[d]" - ("ge") - "[カ]タカナabcd")) - (ert-info ("half-width Katakana / numeric") - (evil-test-buffer - "カタカナ123[4]" - ("ge") - "[カ]タカナ1234")) - (ert-info ("half-width Katakana / Kanji") - (evil-test-buffer - "カタカナ漢[字]" - ("ge") - "カタカ[ナ]漢字")) - (ert-info ("half-width Katakana / Hiragana") - (evil-test-buffer - "カタカナひらが[な]" - ("ge") - "カタカ[ナ]ひらがな")) - (ert-info ("half-width Katakana / Katakana") - (evil-test-buffer - "カタカナカタカ[ナ]" - ("ge") - "カタカ[ナ]カタカナ")) - (ert-info ("half-width Katakana / full-width alphabet") - (evil-test-buffer - "カタカナAB[C]" - ("ge") - "[カ]タカナABC")) - (ert-info ("half-width Katakana / full-width numeric") - (evil-test-buffer - "カタカナ12[3]" - ("ge") - "[カ]タカナ123")) - (ert-info ("half-width Katakana / Hangul") - (evil-test-buffer - "カタカナ한[글]" - ("ge") - "カタカ[ナ]한글")) - (ert-info ("full-width alphabet / Latin") - (evil-test-buffer - "ABCabc[d]" - ("ge") - "[A]BCabcd")) - (ert-info ("full-width alphabet / numeric") - (evil-test-buffer - "ABC123[4]" - ("ge") - "[A]BC1234")) - (ert-info ("full-width alphabet / Kanji") - (evil-test-buffer - "ABC漢[字]" - ("ge") - "AB[C]漢字")) - (ert-info ("full-width alphabet / Hiragana") - (evil-test-buffer - "ABCひらが[な]" - ("ge") - "AB[C]ひらがな")) - (ert-info ("full-width alphabet / Katakana") - (evil-test-buffer - "ABCカタカ[ナ]" - ("ge") - "AB[C]カタカナ")) - (ert-info ("full-width alphabet / half-width Katakana") - (evil-test-buffer - "ABCカタカ[ナ]" - ("ge") - "[A]BCカタカナ")) - (ert-info ("full-width alphabet / full-width numeric") - (evil-test-buffer - "ABC12[3]" - ("ge") - "[A]BC123")) - (ert-info ("full-width alphabet / Hangul") - (evil-test-buffer - "ABC한[글]" - ("ge") - "AB[C]한글")) - (ert-info ("full-width numeric / Latin") - (evil-test-buffer - "123abc[d]" - ("ge") - "[1]23abcd")) - (ert-info ("full-width numeric / numeric") - (evil-test-buffer - "123123[4]" - ("ge") - "[1]231234")) - (ert-info ("full-width numeric / Kanji") - (evil-test-buffer - "123漢[字]" - ("ge") - "12[3]漢字")) - (ert-info ("full-width numeric / Hiragana") - (evil-test-buffer - "123ひらが[な]" - ("ge") - "12[3]ひらがな")) - (ert-info ("full-width numeric / Katakana") - (evil-test-buffer - "123カタカ[ナ]" - ("ge") - "12[3]カタカナ")) - (ert-info ("full-width numeric / half-width Katakana") - (evil-test-buffer - "123カタカ[ナ]" - ("ge") - "[1]23カタカナ")) - (ert-info ("full-width numeric / full-width alphabet") - (evil-test-buffer - "123AB[C]" - ("ge") - "[1]23ABC")) - (ert-info ("full-width numeric / Hangul") - (evil-test-buffer - "123한[글]" - ("ge") - "12[3]한글")) - (ert-info ("Hangul / Latin") - (evil-test-buffer - "한글abc[d]" - ("ge") - "한[글]abcd")) - (ert-info ("Hangul / numeric") - (evil-test-buffer - "한글123[4]" - ("ge") - "한[글]1234")) - (ert-info ("Hangul / Kanji") - (evil-test-buffer - "한글漢[字]" - ("ge") - "한[글]漢字")) - (ert-info ("Hangul / Hiragana") - (evil-test-buffer - "한글ひらが[な]" - ("ge") - "한[글]ひらがな")) - (ert-info ("Hangul / Katakana") - (evil-test-buffer - "한글カタカ[ナ]" - ("ge") - "한[글]カタカナ")) - (ert-info ("Hangul / half-width Katakana") - (evil-test-buffer - "한글カタカ[ナ]" - ("ge") - "한[글]カタカナ")) - (ert-info ("Hangul / full-width alphabet") - (evil-test-buffer - "한글AB[C]" - ("ge") - "한[글]ABC")) - (ert-info ("Hangul / full-width numeric") - (evil-test-buffer - "한글12[3]" - ("ge") - "한[글]123"))) - -(ert-deftest evil-test-forward-paragraph () - "Test `evil-forward-paragraph'" - :tags '(evil motion) - (ert-info ("Simple") - (evil-test-buffer - "[A]bove some line - -Below some empty line" - ("}") - "Above some line -\[] -Below some empty line")) - (ert-info ("With count") - (evil-test-buffer - "[A]bove some line - -Below some empty line" - ("2}") - "Above some line - -Below some empty lin[e]")) - (ert-info ("End of buffer") - (evil-test-buffer - "[B]elow some empty line" - ("100}") - "Below some empty lin[e]" - (should-error (execute-kbd-macro "}")) - (should-error (execute-kbd-macro "42}")))) - (ert-info ("End of buffer with newline") - (evil-test-buffer - "[B]elow some empty line\n\n" - ("100}") - "Below some empty line\n\n[]" - (should-error (execute-kbd-macro "}")) - (should-error (execute-kbd-macro "42}"))))) - -(ert-deftest evil-test-backward-paragraph () - "Test `evil-backward-paragraph'" - :tags '(evil motion) - (ert-info ("Simple") - (evil-test-buffer - "Above some line - -Below some empty lin[e]" - ("{") - "Above some line -\[] -Below some empty line")) - (ert-info ("With count") - (evil-test-buffer - "Above some line - -Below some empty lin[e]" - ("2{") - "[A]bove some line - -Below some empty line")) - (ert-info ("Beginning of buffer") - (evil-test-buffer - "Above some line - -Below some empty lin[e]" - ("100{") - "[A]bove some line - -Below some empty line" - (should-error (execute-kbd-macro "{")) - (should-error (execute-kbd-macro "42{")))) - (ert-info ("Beginning of buffer with newlines") - (evil-test-buffer - "\n\nAbove some line - -Below some empty lin[e]" - ("100{") - "[]\n\nAbove some line - -Below some empty line" - (should-error (execute-kbd-macro "{")) - (should-error (execute-kbd-macro "42{"))))) - -(ert-deftest evil-test-forward-sentence () - "Test `evil-forward-sentence'" - :tags '(evil motion) - (ert-info ("Simple") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. If you want to create a file, -;; visit that file with C-x C-f. - -Below some empty line." - (")") - ";; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. [I]f you want to create a file, -;; visit that file with C-x C-f. - -Below some empty line." - (")") - ";; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. If you want to create a file, -;; visit that file with C-x C-f. -\[] -Below some empty line." - (")") - ";; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. If you want to create a file, -;; visit that file with C-x C-f. - -\[B]elow some empty line.")) - (ert-info ("With count") - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. If you want to create a file, -;; visit that file with C-x C-f. - -Below some empty line." - ("2)") - ";; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. If you want to create a file, -;; visit that file with C-x C-f. -\[] -Below some empty line." - ("2)") - ";; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. If you want to create a file, -;; visit that file with C-x C-f. - -Below some empty line[.]")) - (ert-info ("End of buffer") - (evil-test-buffer - "[B]elow some empty line." - ("100)") - "Below some empty line[.]" - (should-error (execute-kbd-macro ")")) - (should-error (execute-kbd-macro "42)")))) - (ert-info ("End of buffer with newline") - (evil-test-buffer - "[B]elow some empty line.\n\n" - (")") - "Below some empty line.\n[\n]" - (")") - "Below some empty line.\n\n[]" - (should-error (execute-kbd-macro ")")) - (should-error (execute-kbd-macro "42)"))))) - -(ert-deftest evil-test-backward-sentence () - "Test `evil-backward-sentence'" - :tags '(evil motion) - (ert-info ("Simple") - (evil-test-buffer - ";; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. If you want to create a file, -;; visit that file with C-x C-f. - -Below some empty line[.]" - ("(") - ";; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. If you want to create a file, -;; visit that file with C-x C-f. - -\[B]elow some empty line." - ("(") - ";; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. If you want to create a file, -;; visit that file with C-x C-f. -\[] -Below some empty line." - ("(") - ";; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. [I]f you want to create a file, -;; visit that file with C-x C-f. - -Below some empty line." - ("(") - "[;]; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. If you want to create a file, -;; visit that file with C-x C-f. - -Below some empty line.")) - (ert-info ("With count") - (evil-test-buffer - ";; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. If you want to create a file, -;; visit that file with C-x C-f. - -Below some empty line[.]" - ("2(") - ";; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. If you want to create a file, -;; visit that file with C-x C-f. -\[] -Below some empty line." - ("2(") - "[;]; This buffer is for notes you don't want to save, -;; and for Lisp evaluation. If you want to create a file, -;; visit that file with C-x C-f. - -Below some empty line.")) - (ert-info ("Beginning of buffer") - (evil-test-buffer - ";; This buffer is for notes you don't want to save[.]" - ("100(") - "[;]; This buffer is for notes you don't want to save." - (should-error (execute-kbd-macro "(")) - (should-error (execute-kbd-macro "42(")))) - (ert-info ("Beginning of buffer with newlines") - (evil-test-buffer - "\n\n;; This buffer is for notes you don't want to save[.]" - ("100(") - "[]\n\n;; This buffer is for notes you don't want to save." - (should-error (execute-kbd-macro "(")) - (should-error (execute-kbd-macro "42("))))) - -(ert-deftest evil-test-find-char () - "Test `evil-find-char'" - :tags '(evil motion) - (ert-info ("Simple") - (evil-test-buffer - "[;]; This buffer is for notes." - ("fT") - ";; [T]his buffer is for notes.")) - (ert-info ("With count") - (evil-test-buffer - "[;]; This buffer is for notes." - ("2fe") - ";; This buffer is for not[e]s.")) - (ert-info ("Repeat") - (evil-test-buffer - "[;]; This buffer is for notes." - ("fe;") - ";; This buffer is for not[e]s.")) - (ert-info ("Repeat backward") - (evil-test-buffer - "[;]; This buffer is for notes." - ("2fe,") - ";; This buff[e]r is for notes.")) - (ert-info ("No match") - (evil-test-buffer - "[;]; This buffer is for notes." - (should-error (execute-kbd-macro "fL")))) - (ert-info ("End of line") - (let ((evil-cross-lines t)) - (evil-test-buffer - "[;]; This buffer is for notes, -;; and for Lisp evaluation." - ("fL") - ";; This buffer is for notes, -;; and for [L]isp evaluation."))) - (ert-info ("Empty line") - (evil-test-buffer - "[] -This buffer is for notes." - (should-error (execute-kbd-macro "fT"))))) - -(ert-deftest evil-test-find-char-backward () - "Test `evil-find-char-backward'" - :tags '(evil motion) - (ert-info ("Simple") - (evil-test-buffer - ";; This buffer is for notes[.]" - ("FT") - ";; [T]his buffer is for notes.")) - (ert-info ("With count") - (evil-test-buffer - ";; This buffer is for notes[.]" - ("2Fe") - ";; This buff[e]r is for notes.")) - (ert-info ("Repeat") - (evil-test-buffer - ";; This buffer is for notes[.]" - ("Fe;") - ";; This buff[e]r is for notes.")) - (ert-info ("Repeat backward") - (evil-test-buffer - ";; This buffer is for notes[.]" - ("2Fe,") - ";; This buffer is for not[e]s.")) - (ert-info ("No match") - (evil-test-buffer - ";; This buffer is for notes[.]" - (should-error (execute-kbd-macro "FL")))) - (ert-info ("End of line") - (let ((evil-cross-lines t)) - (evil-test-buffer - ";; This buffer is for notes, -;; and for Lisp evaluation[.]" - ("FT") - ";; [T]his buffer is for notes, -;; and for Lisp evaluation.")))) - -(ert-deftest evil-test-find-digraph-char () - "Test evil-read-digraph-char while finding char." - :tags '(evil motion) - (ert-info ("Find digraph char") - (evil-test-buffer - "a[b]cde∀g" - ("f\C-kFA") - "abcde[∀]g"))) - -(ert-deftest evil-test-find-char-to () - "Test `evil-find-char-to'" - :tags '(evil motion) - (ert-info ("Simple") - (evil-test-buffer - "[;]; This buffer is for notes." - ("tT") - ";;[ ]This buffer is for notes.")) - (ert-info ("With count") - (evil-test-buffer - "[;]; This buffer is for notes." - ("2te") - ";; This buffer is for no[t]es.")) - (ert-info ("Repeat") - (evil-test-buffer - "[;]; This buffer is for notes." - ("tel;") - ";; This buffer is for no[t]es.")) - (ert-info ("Repeat backward") - (evil-test-buffer - "[;]; This buffer is for notes." - ("2te,") - ";; This buffe[r] is for notes.")) - (ert-info ("Repeat should skip adjacent character") - (let ((evil-repeat-find-to-skip-next t)) - (evil-test-buffer - "[a]aaxaaaxaaaxaaa" - ("tx;") - "aaaxaa[a]xaaaxaaa" - (";") - "aaaxaaaxaa[a]xaaa" - (",") - "aaaxaaax[a]aaxaaa" - (",") - "aaax[a]aaxaaaxaaa"))) - (ert-info ("Repeat should NOT skip adjacent character") - (let ((evil-repeat-find-to-skip-next nil)) - (evil-test-buffer - "[a]aaxaaaxaaaxaaa" - ("tx;") - "aa[a]xaaaxaaaxaaa"))) - (ert-info ("No match") - (evil-test-buffer - "[;]; This buffer is for notes." - (should-error (execute-kbd-macro "tL")))) - (ert-info ("End of line") - (let ((evil-cross-lines t)) - (evil-test-buffer - "[;]; This buffer is for notes, -;; and for Lisp evaluation." - ("tL") - ";; This buffer is for notes, -;; and for[ ]Lisp evaluation.")))) - -(ert-deftest evil-test-find-char-to-backward () - "Test `evil-find-char-to-backward'" - :tags '(evil motion) - (ert-info ("Simple") - (evil-test-buffer - ";; This buffer is for notes[.]" - ("TT") - ";; T[h]is buffer is for notes.")) - (ert-info ("With count") - (evil-test-buffer - ";; This buffer is for notes[.]" - ("2Te") - ";; This buffe[r] is for notes.")) - (ert-info ("Repeat") - (evil-test-buffer - ";; This buffer is for notes[.]" - ("Teh;") - ";; This buffe[r] is for notes.")) - (ert-info ("Repeat backward") - (evil-test-buffer - ";; This buffer is for notes[.]" - ("2Te,") - ";; This buffer is for no[t]es.")) - (ert-info ("Repeat should skip adjacent character") - (let ((evil-repeat-find-to-skip-next t)) - (evil-test-buffer - "aaaxaaaxaaaxaa[a]" - ("Tx;") - "aaaxaaax[a]aaxaaa" - (";") - "aaax[a]aaxaaaxaaa" - (",") - "aaaxaa[a]xaaaxaaa" - (",") - "aaaxaaaxaa[a]xaaa"))) - (ert-info ("Repeat should NOT skip adjacent character") - (let ((evil-repeat-find-to-skip-next nil)) - (evil-test-buffer - "aaaxaaaxaaaxaa[a]" - ("Tx;") - "aaaxaaaxaaax[a]aa"))) - (ert-info ("No match") - (evil-test-buffer - ";; This buffer is for notes[.]" - (should-error (execute-kbd-macro "TL")))) - (ert-info ("End of line") - (let ((evil-cross-lines t)) - (evil-test-buffer - ";; This buffer is for notes, -;; and for Lisp evaluation[.]" - ("TT") - ";; T[h]is buffer is for notes, -;; and for Lisp evaluation.")))) - -(ert-deftest evil-test-jump-item () - "Test `evil-jump-item'" - :tags '(evil motion) - (ert-info ("Simple") - (evil-test-buffer - "int main[(]int argc, char** argv)" - ("%") - "int main(int argc, char** argv[)]" - ("%") - "int main[(]int argc, char** argv)")) - (ert-info ("Before parenthesis") - (evil-test-buffer - "[i]nt main(int argc, char** argv)" - ("%") - "int main(int argc, char** argv[)]" - ("5h") - "int main(int argc, char**[ ]argv)" - ("%") - "int main[(]int argc, char** argv)")) - (ert-info ("Over several lines") - (evil-test-buffer - "int main(int argc, char** argv) -\[{] - printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -}" - ("%") - "int main(int argc, char** argv) -{ - printf(\"Hello world\\n\"); - return EXIT_SUCCESS; -\[}]")) - (ert-info ("On line without parenthesis") - (evil-test-buffer - "[#]include " - (should-error (execute-kbd-macro "%")))) - (ert-info ("Before unmatched opening parenthesies") - (evil-test-buffer - "x[x]xx ( yyyyy () zzzz" - (should-error (execute-kbd-macro "%")) - "x[x]xx ( yyyyy () zzzz")) - (ert-info ("Before unmatched closing parenthesies") - (evil-test-buffer - "x[x]xx ) yyyyy () zzzz" - (should-error (execute-kbd-macro "%")) - "x[x]xx ) yyyyy () zzzz")) - - (ert-info ("At the end of the line") - (evil-test-buffer - "[p]ublic void foo(String bar) {\n blabla;\n}\n" - ("v$%") - "public void foo(String bar) {\n blabla;\n[}]\n"))) - -(ert-deftest evil-test-unmatched-paren () - "Test `evil-previous-open-paren' and `evil-next-close-paren'" - :tags '(evil motion) - (ert-info ("Simple") - (evil-test-buffer - "foo ( { ( [b]ar ) baz } )" - ("[(") - "foo ( { [(] bar ) baz } )" - ("])") - "foo ( { ( bar [)] baz } )" - ("[(") - "foo ( { [(] bar ) baz } )" - ("[(") - "foo [(] { ( bar ) baz } )" - ("f)])") - "foo ( { ( bar ) baz } [)]")) - (ert-info ("With count") - (evil-test-buffer - "foo ( { ( [b]ar ) baz } )" - ("2[(") - "foo [(] { ( bar ) baz } )") - (evil-test-buffer - "foo ( { ( [b]ar ) baz } )" - ("2])") - "foo ( { ( bar ) baz } [)]"))) - -(ert-deftest evil-test-paren-jump-from-string () - "Test jump to next/prev paren from a string" - :tags '(evil motion) - (evil-test-buffer - "{ - fun(a, \"T[]est\", test()); -} -" - ("[(") - "{ - fun[(]a, \"Test\", test()); -} -" - ("])") - "{ - fun(a, \"Test\", test()[)]; -} -") - (evil-test-buffer - "{ - fun(a, \"T[]est\", test()); -} -" - ("])") - "{ - fun(a, \"Test\", test()[)]; -} -" - ("[(") - "{ - fun[(]a, \"Test\", test()); -} -") - (evil-test-buffer - "{ - fun(a, \"T[]est\", test()); -} -" - ("[{") - "[{] - fun(a, \"Test\", test()); -} -") - (evil-test-buffer - "{ - fun(a, \"T[]est\", test()); -} -" - ("]}") - "{ - fun(a, \"Test\", test()); -[}] -")) - -(ert-deftest evil-test-paren-jump-inside-string-from-string () - "Test jump to next/prev paren inside string from a string" - :tags '(evil motion) - (evil-test-buffer - "{ (\"Test with paren (inside multi (l[e]vel))\", test()); } " - ("[(") - "{ (\"Test with paren (inside multi [(]level))\", test()); } " - ("[(") - "{ (\"Test with paren [(]inside multi (level))\", test()); } ") - (evil-test-buffer - "{ (\"Test with paren (inside multi (l[e]vel))\", test()); } " - ("])") - "{ (\"Test with paren (inside multi (level[)])\", test()); } " - ("])") - "{ (\"Test with paren (inside multi (level)[)]\", test()); } ") - (evil-test-buffer - "{ (\"Test with paren {inside multi {l[e]vel}}\", test()); } " - ("[{") - "{ (\"Test with paren {inside multi [{]level}}\", test()); } " - ("[{") - "{ (\"Test with paren [{]inside multi {level}}\", test()); } ") - (evil-test-buffer - "{ (\"Test with paren {inside multi {l[e]vel}}\", test()); } " - ("]}") - "{ (\"Test with paren {inside multi {level[}]}\", test()); } " - ("]}") - "{ (\"Test with paren {inside multi {level}[}]\", test()); } ")) - -(ert-deftest evil-test-insert-resume () - "Test `evil-insert-resume'" - :tags '(evil motion) - (ert-info ("Can move to last insert location and take a count") - (evil-test-buffer - "alpha bravo [ ]delta echo" - ("i" "charlie" [escape] "^") - "[a]lpha bravo charlie delta echo" - ("2gi" " zulu" [escape]) - "alpha bravo charlie zulu zul[u] delta echo")) - (ert-info ("Can move to `^' marker in visual line state") - (evil-test-buffer - "alpha [b]ravo\ncharlie delta\necho foxtrot" - ("i" [escape] "/foxtrot" [return]) - "alpha bravo\ncharlie delta\necho [f]oxtrot" - ("Vk") - "alpha bravo\ncharl[i]e delta\necho foxtrot" - ("gi") - "alpha [b]ravo\ncharlie delta\necho foxtrot" - ("vd") - "alpha [o]xtrot"))) - -(ert-deftest evil-test-next-mark () - "Test `evil-next-mark', `evil-previous-mark'" - :tags '(evil motion) - (ert-info ("Can move to next mark, next mark line, -previous mark and previous mark line") - (evil-test-buffer - "[a]lpha bravo -charlie delta echo -foxtrot golf hotel -india juliet" - ("ma" "w" "mb" "w" - "mc" "w" "md" "w" "me" "w" - "mf" "w" "mg" "w" "mh" "w" - "mi" "w" "mj") - "alpha bravo -charlie delta echo -foxtrot golf hotel -india [j]uliet" - ("3]`") - "alpha bravo -[c]harlie delta echo -foxtrot golf hotel -india juliet" - ("]'") - "alpha bravo -charlie delta echo -[f]oxtrot golf hotel -india juliet" - ("[`") - "alpha bravo -charlie delta [e]cho -foxtrot golf hotel -india juliet" - ("2['") - "alpha bravo -charlie delta echo -foxtrot golf hotel -[i]ndia juliet"))) - -(ert-deftest evil-set-col-0-mark-test () - "Test `evil-set-col-0-mark' ex command" - :tags '(evil ex) - (evil-test-buffer - "Lin[e] 1 -Line 2" - (":mark k" [return] "G" "`k") - "[L]ine 1 -Line 2")) - -(ert-deftest evil-delete-marks-test () - "Test `evil-delete-marks' ex command" - :tags '(evil ex) - (ert-info ("Can delete marks") - (evil-test-buffer - "[O]ne line is enough if we use backtick to navigate" - ("mO" "w" "ml" "w" "mi" "$b" "m4") - "One line is enough if we use backtick to [n]avigate" - ("`O") - "[O]ne line is enough if we use backtick to navigate" - (":delm O" [return] "`i") - "One line [i]s enough if we use backtick to navigate" - (error user-error "`O") - "One line [i]s enough if we use backtick to navigate" - ("`4") - "One line is enough if we use backtick to [n]avigate" - (":delm h-m" [return]) - (error user-error "`i") - "One line is enough if we use backtick to [n]avigate"))) - -(ert-deftest evil-automatic-marks-test () - "Test that certain commands automatically set mark(er)s" - :tags '(evil) - (ert-info ("Visual selection sets angle-bracket marks") - (evil-test-buffer - "alpha br[a]vo charlie" - ("viw" [escape] "$") - "alpha bravo charli[e]" - ("`>") - "alpha brav[o] charlie" - ("`<") - "alpha [b]ravo charlie"))) - -(ert-deftest evil-test-flyspell-motions () - "Test flyspell motions" - :tags '(evil motion) - (skip-unless (condition-case _ (progn (ispell-check-version) t) (error))) - (ert-info ("Simple") - (evil-test-buffer - "[I] cannt tpye for lyfe" - (flyspell-mode) - (flyspell-buffer) - ("]s") - "I [c]annt tpye for lyfe" - ("]s") - "I cannt [t]pye for lyfe" - ("]s") - "I cannt tpye for [l]yfe" - ("]s") - "I [c]annt tpye for lyfe" - ("[s") - "I cannt tpye for [l]yfe" - ("[s") - "I cannt [t]pye for lyfe") - (evil-test-buffer - "[o]en otw thre" - (flyspell-mode) - (flyspell-buffer) - ("]s") - "oen [o]tw thre" - ("]s") - "oen otw [t]hre" - ("]s") - "[o]en otw thre")) - (ert-info ("With count") - (evil-test-buffer - "[I] cannt tpye for lyfe" - (flyspell-mode) - (flyspell-buffer) - ("2]s") - "I cannt [t]pye for lyfe" - ("2]s") - "I [c]annt tpye for lyfe" - ("2[s") - "I cannt [t]pye for lyfe" - ("2[s") - "I cannt tpye for [l]yfe")) - (ert-info ("With evil-search-wrap disabled") - (let (evil-search-wrap) - (evil-test-buffer - "[I] cannt tpye for lyfe" - (flyspell-mode) - (flyspell-buffer) - ("]s") - "I [c]annt tpye for lyfe" - ("]s") - "I cannt [t]pye for lyfe" - ("]s") - "I cannt tpye for [l]yfe" - (error search-failed "]s")))) - (ert-info ("One mistake") - (evil-test-buffer - "[I]'m almst there..." - (flyspell-mode) - (flyspell-buffer) - ("]s") - "I'm [a]lmst there..." - ("]s") - "I'm [a]lmst there...")) - (ert-info ("No mistakes") - (evil-test-buffer - "[I]'ve learned to type!" - (flyspell-mode) - (flyspell-buffer) - (error search-failed "]s") - (error search-failed "[s")))) - -;;; Text objects - -(ert-deftest evil-test-text-object () - "Test `evil-define-text-object'" - :tags '(evil text-object) - (let ((object (evil-define-text-object nil (count &optional beg end _type) - (let ((sel (and beg end (evil-range beg end)))) - (when (and sel (> count 0)) (forward-char 1)) - (let ((range (if (< count 0) - (list (- (point) 3) (point)) - (list (point) (+ (point) 3))))) - (if sel - (evil-range-union range sel) - range)))))) - (ert-info ("Select three characters after point") - (evil-test-buffer - :state operator - ";; [T]his buffer is for notes." - (should (equal (funcall object 1) '(4 7 inclusive))))) - (ert-info ("Select three characters before point") - (evil-test-buffer - :state operator - ";; [T]his buffer is for notes." - (should (equal (funcall object -1) '(1 4 inclusive))))) - (ert-info ("Select three characters after selection") - (evil-test-buffer - ";; buffer is for notes." - (call-interactively object) - ";; ffer is for notes.")) - (ert-info ("Select three characters before selection") - (evil-test-buffer - ";; <[T]his> buffer is for notes." - (call-interactively object) - "<[;]; This> buffer is for notes.")) - (ert-info ("Delete three characters after point") - (evil-test-buffer - "[;]; This buffer is for notes." - (define-key evil-operator-state-local-map "io" object) - ("dio") - "[T]his buffer is for notes.")))) - -(ert-deftest evil-test-word-objects () - "Test `evil-inner-word' and `evil-a-word'" - :tags '(evil text-object) - (ert-info ("Select a word") - (evil-test-buffer - ";; [T]his buffer is for notes." - ("viw") - ";; buffer is for notes.") - (evil-test-buffer - ";; [T]his buffer is for notes." - ("vaw") - ";; buffer is for notes.") - (evil-test-buffer - ";; Thi[s] buffer is for notes." - ("viw") - ";; buffer is for notes.") - (evil-test-buffer - ";; Thi[s] buffer is for notes." - ("vaw") - ";; buffer is for notes.")) - (ert-info ("Select two words") - (ert-info ("Include whitespace on this side") - (evil-test-buffer - ";;< Thi[s]> buffer is for notes." - ("aw") - ";;< This buffe[r]> is for notes.") - (evil-test-buffer - ";; This <[b]uffer >is for notes." - ("aw") - ";; <[T]his buffer >is for notes.")) - (ert-info ("Include whitespace on the other side") - (evil-test-buffer - ";; buffer is for notes." - ("aw") - ";; is for notes.") - (evil-test-buffer - ";; This<[ ]buffer> is for notes." - ("aw") - ";;<[ ]This buffer> is for notes."))) - (ert-info ("select first visual word") - (evil-test-buffer - "([a])" - ("viw") - "(<[a]>)")) - (ert-info ("Deleting whitespace is confined to the line") - (evil-test-buffer - "foo\n [ ] bar" - ("diw") - "foo\n[b]ar") - (evil-test-buffer - "foo\n [ ] bar" - ("diW") - "foo\n[b]ar") - (evil-test-buffer - "fo[o]\nbar" - ("diW") - "[\n]bar") - (evil-test-buffer - "foo\n [ ] bar" - ("daw") - "foo\n[]") - (evil-test-buffer - "foo\n [ ] bar" - ("daW") - "foo\n[]")) - (ert-info ("Deleting the only word on a line doesn't delete indentation") - (evil-test-buffer - " [b]ar" - ("daw") - " [ ]") - (evil-test-buffer - " [b]ar" - ("daW") - " [ ]") - (ert-info ("But deleting the final word of many behaves as normal") - (evil-test-buffer - " foo [b]ar" - ("daw") - " fo[o]"))) - (ert-info ("Deleting whitespace on whitepsace only line") - (evil-test-buffer - "foo\n[ ]\nbar" - ("diw") - "foo\n[]\nbar") - (evil-test-buffer - "foo\n[ ]\nbar" - ("daw") - "foo\n[]\nbar"))) - -(ert-deftest evil-test-word-objects-cjk () - "Test `evil-inner-word' and `evil-a-word' on CJK words" - :tags '(evil text-object cjk) - (ert-info ("Select a word") - (evil-test-buffer - "[a]bcd1234" - ("viw") - "") - (evil-test-buffer - "[a]bcd1234" - ("vaw") - "") - (evil-test-buffer - "[a]bcd漢字" - ("viw") - "漢字") - (evil-test-buffer - "[a]bcd漢字" - ("vaw") - "漢字") - (evil-test-buffer - "[a]bcdひらがな" - ("viw") - "ひらがな") - (evil-test-buffer - "[a]bcdひらがな" - ("vaw") - "ひらがな") - (evil-test-buffer - "[a]bcdカタカナ" - ("viw") - "カタカナ") - (evil-test-buffer - "[a]bcdカタカナ" - ("vaw") - "カタカナ") - (evil-test-buffer - "[a]bcdカタカナ" - ("viw") - "") - (evil-test-buffer - "[a]bcdカタカナ" - ("vaw") - "") - (evil-test-buffer - "[a]bcdABC" - ("viw") - "") - (evil-test-buffer - "[a]bcdABC" - ("vaw") - "") - (evil-test-buffer - "[a]bcd123" - ("viw") - "") - (evil-test-buffer - "[a]bcd123" - ("vaw") - "") - (evil-test-buffer - "[a]bcd한글" - ("viw") - "한글") - (evil-test-buffer - "[a]bcd한글" - ("vaw") - "한글") - (evil-test-buffer - "[1]234abcd" - ("viw") - "<1234abc[d]>") - (evil-test-buffer - "[1]234abcd" - ("vaw") - "<1234abc[d]>") - (evil-test-buffer - "[1]234漢字" - ("viw") - "<123[4]>漢字") - (evil-test-buffer - "[1]234漢字" - ("vaw") - "<123[4]>漢字") - (evil-test-buffer - "[1]234ひらがな" - ("viw") - "<123[4]>ひらがな") - (evil-test-buffer - "[1]234ひらがな" - ("vaw") - "<123[4]>ひらがな") - (evil-test-buffer - "[1]234カタカナ" - ("viw") - "<123[4]>カタカナ") - (evil-test-buffer - "[1]234カタカナ" - ("vaw") - "<123[4]>カタカナ") - (evil-test-buffer - "[1]234カタカナ" - ("viw") - "<1234カタカ[ナ]>") - (evil-test-buffer - "[1]234カタカナ" - ("vaw") - "<1234カタカ[ナ]>") - (evil-test-buffer - "[1]234ABC" - ("viw") - "<1234AB[C]>") - (evil-test-buffer - "[1]234ABC" - ("vaw") - "<1234AB[C]>") - (evil-test-buffer - "[1]234123" - ("viw") - "<123412[3]>") - (evil-test-buffer - "[1]234123" - ("vaw") - "<123412[3]>") - (evil-test-buffer - "[1]234한글" - ("viw") - "<123[4]>한글") - (evil-test-buffer - "[1]234한글" - ("vaw") - "<123[4]>한글") - (evil-test-buffer - "[漢]字abcd" - ("viw") - "<漢[字]>abcd") - (evil-test-buffer - "[漢]字abcd" - ("vaw") - "<漢[字]>abcd") - (evil-test-buffer - "[漢]字1234" - ("viw") - "<漢[字]>1234") - (evil-test-buffer - "[漢]字1234" - ("vaw") - "<漢[字]>1234") - (evil-test-buffer - "[漢]字ひらがな" - ("viw") - "<漢[字]>ひらがな") - (evil-test-buffer - "[漢]字ひらがな" - ("vaw") - "<漢[字]>ひらがな") - (evil-test-buffer - "[漢]字カタカナ" - ("viw") - "<漢[字]>カタカナ") - (evil-test-buffer - "[漢]字カタカナ" - ("vaw") - "<漢[字]>カタカナ") - (evil-test-buffer - "[漢]字カタカナ" - ("viw") - "<漢[字]>カタカナ") - (evil-test-buffer - "[漢]字カタカナ" - ("vaw") - "<漢[字]>カタカナ") - (evil-test-buffer - "[漢]字ABC" - ("viw") - "<漢[字]>ABC") - (evil-test-buffer - "[漢]字ABC" - ("vaw") - "<漢[字]>ABC") - (evil-test-buffer - "[漢]字123" - ("viw") - "<漢[字]>123") - (evil-test-buffer - "[漢]字123" - ("vaw") - "<漢[字]>123") - (evil-test-buffer - "[漢]字한글" - ("viw") - "<漢[字]>한글") - (evil-test-buffer - "[漢]字한글" - ("vaw") - "<漢[字]>한글") - (evil-test-buffer - "[ひ]らがなabcd" - ("viw") - "<ひらが[な]>abcd") - (evil-test-buffer - "[ひ]らがなabcd" - ("vaw") - "<ひらが[な]>abcd") - (evil-test-buffer - "[ひ]らがな1234" - ("viw") - "<ひらが[な]>1234") - (evil-test-buffer - "[ひ]らがな1234" - ("vaw") - "<ひらが[な]>1234") - (evil-test-buffer - "[ひ]らがな漢字" - ("viw") - "<ひらが[な]>漢字") - (evil-test-buffer - "[ひ]らがな漢字" - ("vaw") - "<ひらが[な]>漢字") - (evil-test-buffer - "[ひ]らがなカタカナ" - ("viw") - "<ひらが[な]>カタカナ") - (evil-test-buffer - "[ひ]らがなカタカナ" - ("vaw") - "<ひらが[な]>カタカナ") - (evil-test-buffer - "[ひ]らがなカタカナ" - ("viw") - "<ひらが[な]>カタカナ") - (evil-test-buffer - "[ひ]らがなカタカナ" - ("vaw") - "<ひらが[な]>カタカナ") - (evil-test-buffer - "[ひ]らがなABC" - ("viw") - "<ひらが[な]>ABC") - (evil-test-buffer - "[ひ]らがなABC" - ("vaw") - "<ひらが[な]>ABC") - (evil-test-buffer - "[ひ]らがな123" - ("viw") - "<ひらが[な]>123") - (evil-test-buffer - "[ひ]らがな123" - ("vaw") - "<ひらが[な]>123") - (evil-test-buffer - "[ひ]らがな한글" - ("viw") - "<ひらが[な]>한글") - (evil-test-buffer - "[ひ]らがな한글" - ("vaw") - "<ひらが[な]>한글") - (evil-test-buffer - "[カ]タカナabcd" - ("viw") - "<カタカ[ナ]>abcd") - (evil-test-buffer - "[カ]タカナabcd" - ("vaw") - "<カタカ[ナ]>abcd") - (evil-test-buffer - "[カ]タカナ1234" - ("viw") - "<カタカ[ナ]>1234") - (evil-test-buffer - "[カ]タカナ1234" - ("vaw") - "<カタカ[ナ]>1234") - (evil-test-buffer - "[カ]タカナ漢字" - ("viw") - "<カタカ[ナ]>漢字") - (evil-test-buffer - "[カ]タカナ漢字" - ("vaw") - "<カタカ[ナ]>漢字") - (evil-test-buffer - "[カ]タカナひらがな" - ("viw") - "<カタカ[ナ]>ひらがな") - (evil-test-buffer - "[カ]タカナひらがな" - ("vaw") - "<カタカ[ナ]>ひらがな") - (evil-test-buffer - "[カ]タカナカタカナ" - ("viw") - "<カタカ[ナ]>カタカナ") - (evil-test-buffer - "[カ]タカナカタカナ" - ("vaw") - "<カタカ[ナ]>カタカナ") - (evil-test-buffer - "[カ]タカナABC" - ("viw") - "<カタカ[ナ]>ABC") - (evil-test-buffer - "[カ]タカナABC" - ("vaw") - "<カタカ[ナ]>ABC") - (evil-test-buffer - "[カ]タカナ123" - ("viw") - "<カタカ[ナ]>123") - (evil-test-buffer - "[カ]タカナ123" - ("vaw") - "<カタカ[ナ]>123") - (evil-test-buffer - "[カ]タカナ한글" - ("viw") - "<カタカ[ナ]>한글") - (evil-test-buffer - "[カ]タカナ한글" - ("vaw") - "<カタカ[ナ]>한글") - (evil-test-buffer - "[カ]タカナabcd" - ("viw") - "<カタカナabc[d]>") - (evil-test-buffer - "[カ]タカナabcd" - ("vaw") - "<カタカナabc[d]>") - (evil-test-buffer - "[カ]タカナ1234" - ("viw") - "<カタカナ123[4]>") - (evil-test-buffer - "[カ]タカナ1234" - ("vaw") - "<カタカナ123[4]>") - (evil-test-buffer - "[カ]タカナ漢字" - ("viw") - "<カタカ[ナ]>漢字") - (evil-test-buffer - "[カ]タカナ漢字" - ("vaw") - "<カタカ[ナ]>漢字") - (evil-test-buffer - "[カ]タカナひらがな" - ("viw") - "<カタカ[ナ]>ひらがな") - (evil-test-buffer - "[カ]タカナひらがな" - ("vaw") - "<カタカ[ナ]>ひらがな") - (evil-test-buffer - "[カ]タカナカタカナ" - ("viw") - "<カタカ[ナ]>カタカナ") - (evil-test-buffer - "[カ]タカナカタカナ" - ("vaw") - "<カタカ[ナ]>カタカナ") - (evil-test-buffer - "[カ]タカナABC" - ("viw") - "<カタカナAB[C]>") - (evil-test-buffer - "[カ]タカナABC" - ("vaw") - "<カタカナAB[C]>") - (evil-test-buffer - "[カ]タカナ123" - ("viw") - "<カタカナ12[3]>") - (evil-test-buffer - "[カ]タカナ123" - ("vaw") - "<カタカナ12[3]>") - (evil-test-buffer - "[カ]タカナ한글" - ("viw") - "<カタカ[ナ]>한글") - (evil-test-buffer - "[カ]タカナ한글" - ("vaw") - "<カタカ[ナ]>한글") - (evil-test-buffer - "[A]BCabcd" - ("viw") - "<ABCabc[d]>") - (evil-test-buffer - "[A]BCabcd" - ("vaw") - "<ABCabc[d]>") - (evil-test-buffer - "[A]BC1234" - ("viw") - "<ABC123[4]>") - (evil-test-buffer - "[A]BC1234" - ("vaw") - "<ABC123[4]>") - (evil-test-buffer - "[A]BC漢字" - ("viw") - "<AB[C]>漢字") - (evil-test-buffer - "[A]BC漢字" - ("vaw") - "<AB[C]>漢字") - (evil-test-buffer - "[A]BCひらがな" - ("viw") - "<AB[C]>ひらがな") - (evil-test-buffer - "[A]BCひらがな" - ("vaw") - "<AB[C]>ひらがな") - (evil-test-buffer - "[A]BCカタカナ" - ("viw") - "<AB[C]>カタカナ") - (evil-test-buffer - "[A]BCカタカナ" - ("vaw") - "<AB[C]>カタカナ") - (evil-test-buffer - "[A]BCカタカナ" - ("viw") - "<ABCカタカ[ナ]>") - (evil-test-buffer - "[A]BCカタカナ" - ("vaw") - "<ABCカタカ[ナ]>") - (evil-test-buffer - "[A]BC123" - ("viw") - "<ABC12[3]>") - (evil-test-buffer - "[A]BC123" - ("vaw") - "<ABC12[3]>") - (evil-test-buffer - "[A]BC한글" - ("viw") - "<AB[C]>한글") - (evil-test-buffer - "[A]BC한글" - ("vaw") - "<AB[C]>한글") - (evil-test-buffer - "[1]23abcd" - ("viw") - "<123abc[d]>") - (evil-test-buffer - "[1]23abcd" - ("vaw") - "<123abc[d]>") - (evil-test-buffer - "[1]231234" - ("viw") - "<123123[4]>") - (evil-test-buffer - "[1]231234" - ("vaw") - "<123123[4]>") - (evil-test-buffer - "[1]23漢字" - ("viw") - "<12[3]>漢字") - (evil-test-buffer - "[1]23漢字" - ("vaw") - "<12[3]>漢字") - (evil-test-buffer - "[1]23ひらがな" - ("viw") - "<12[3]>ひらがな") - (evil-test-buffer - "[1]23ひらがな" - ("vaw") - "<12[3]>ひらがな") - (evil-test-buffer - "[1]23カタカナ" - ("viw") - "<12[3]>カタカナ") - (evil-test-buffer - "[1]23カタカナ" - ("vaw") - "<12[3]>カタカナ") - (evil-test-buffer - "[1]23カタカナ" - ("viw") - "<123カタカ[ナ]>") - (evil-test-buffer - "[1]23カタカナ" - ("vaw") - "<123カタカ[ナ]>") - (evil-test-buffer - "[1]23ABC" - ("viw") - "<123AB[C]>") - (evil-test-buffer - "[1]23ABC" - ("vaw") - "<123AB[C]>") - (evil-test-buffer - "[1]23한글" - ("viw") - "<12[3]>한글") - (evil-test-buffer - "[1]23한글" - ("vaw") - "<12[3]>한글") - (evil-test-buffer - "[한]글abcd" - ("viw") - "<한[글]>abcd") - (evil-test-buffer - "[한]글abcd" - ("vaw") - "<한[글]>abcd") - (evil-test-buffer - "[한]글1234" - ("viw") - "<한[글]>1234") - (evil-test-buffer - "[한]글1234" - ("vaw") - "<한[글]>1234") - (evil-test-buffer - "[한]글漢字" - ("viw") - "<한[글]>漢字") - (evil-test-buffer - "[한]글漢字" - ("vaw") - "<한[글]>漢字") - (evil-test-buffer - "[한]글ひらがな" - ("viw") - "<한[글]>ひらがな") - (evil-test-buffer - "[한]글ひらがな" - ("vaw") - "<한[글]>ひらがな") - (evil-test-buffer - "[한]글カタカナ" - ("viw") - "<한[글]>カタカナ") - (evil-test-buffer - "[한]글カタカナ" - ("vaw") - "<한[글]>カタカナ") - (evil-test-buffer - "[한]글カタカナ" - ("viw") - "<한[글]>カタカナ") - (evil-test-buffer - "[한]글カタカナ" - ("vaw") - "<한[글]>カタカナ") - (evil-test-buffer - "[한]글ABC" - ("viw") - "<한[글]>ABC") - (evil-test-buffer - "[한]글ABC" - ("vaw") - "<한[글]>ABC") - (evil-test-buffer - "[한]글123" - ("viw") - "<한[글]>123") - (evil-test-buffer - "[한]글123" - ("vaw") - "<한[글]>123"))) - -(ert-deftest evil-test-paragraph-objects () - "Test `evil-inner-paragraph' and `evil-a-paragraph'" - :tags '(evil text-object) - (ert-info ("Select a paragraph with point at beginning") - (evil-test-buffer - "[;]; This buffer is for notes, -;; and for Lisp evaluation. - -;; This buffer is for notes, -;; and for Lisp evaluation." - ("vap") - "<;; This buffer is for notes, -;; and for Lisp evaluation. -\[]\n>\ -;; This buffer is for notes, -;; and for Lisp evaluation.")) - (ert-info ("Select a paragraph with point at last line") - (evil-test-buffer - ";; This buffer is for notes, -\[;]; and for Lisp evaluation. - -;; This buffer is for notes, -;; and for Lisp evaluation." - ("vap") - "<;; This buffer is for notes, -;; and for Lisp evaluation. -\[]\n>\ -;; This buffer is for notes, -;; and for Lisp evaluation.")) - (ert-info ("Select a paragraph with point after paragraph") - (evil-test-buffer - ";; This buffer is for notes, -;; and for Lisp evaluation. -\[] -;; This buffer is for notes, -;; and for Lisp evaluation." - ("vap") - ";; This buffer is for notes, -;; and for Lisp evaluation. -< -;; This buffer is for notes, -;; and for Lisp evaluation[.]>")) - (ert-info ("Select inner paragraph") - (evil-test-buffer - "[;]; This buffer is for notes, -;; and for Lisp evaluation. - -;; This buffer is for notes, -;; and for Lisp evaluation." - ("vip") - "<;; This buffer is for notes, -;; and for Lisp evaluation.[] -> -;; This buffer is for notes, -;; and for Lisp evaluation.") - (evil-test-buffer - ";; This buffer is for notes, -\[;]; and for Lisp evaluation. - -;; This buffer is for notes, -;; and for Lisp evaluation." - ("vip") - "<;; This buffer is for notes, -;; and for Lisp evaluation.[] -> -;; This buffer is for notes, -;; and for Lisp evaluation.") - (evil-test-buffer - ";; This buffer is for notes, -;; and for Lisp evaluation. -\[] -;; This buffer is for notes, -;; and for Lisp evaluation." - ("vip") - ";; This buffer is for notes, -;; and for Lisp evaluation. -< -;; This buffer is for notes, -;; and for Lisp evaluation[.]>"))) - -(ert-deftest evil-test-quote-objects () - "Test `evil-inner-single-quote' and `evil-a-single-quote'" - :tags '(evil text-object) - (ert-info ("Select text inside of '...'") - (evil-test-buffer - "This is 'a [t]est' for quote objects." - ("vi'") - "This is '' for quote objects.") - (evil-test-buffer - "This is \"a '[t]est'\" for quote objects." - ("vi'") - "This is \"a ''\" for quote objects.")) - (ert-info ("Select text including enclosing quotes") - (evil-test-buffer - "This is 'a [t]est' for quote objects." - ("v2i'") - "This is <'a test[']> for quote objects.")) - (ert-info ("Select text including enclosing quotes and following space") - (evil-test-buffer - "This is 'a [t]est' for quote objects." - ("va'") - "This is <'a test'[ ]>for quote objects.")) - (ert-info ("Select text including enclosing quotes and previous space") - (evil-test-buffer - "This is 'a [t]est'. For quote objects." - ("va'") - "This is< 'a test[']>. For quote objects.")) - (ert-info ("Select text on opening quote") - (evil-test-buffer - "This is [\"]a test\". For \"quote\" objects." - (emacs-lisp-mode) - ("va\"") - "This is< \"a test[\"]>. For \"quote\" objects.")) - (ert-info ("Select text on closing quote") - (evil-test-buffer - "This is \"a test[\"]. For \"quote\" objects." - (emacs-lisp-mode) - ("va\"") - "This is< \"a test[\"]>. For \"quote\" objects.")) - (ert-info ("Delete text from outside") - (evil-test-buffer - "Th[i]s is \"a test\". For \"quote\" objects." - (emacs-lisp-mode) - ("da\"") - "This is[.] For \"quote\" objects.")) - (ert-info ("Operator on empty quotes") - (evil-test-buffer - "This is [a]n \"\" empty quote" - (emacs-lisp-mode) - ("ci\"XXX" [escape]) - "This is an \"XX[X]\" empty quote"))) - -(ert-deftest evil-test-paren-objects () - "Test `evil-inner-paren', etc." - :tags '(evil text-object) - (ert-info ("Select inner text") - (evil-test-buffer - "[(]aaa)" - (emacs-lisp-mode) ; syntax - ("vi(") - "()") - (evil-test-buffer - "(aaa[)]" - (emacs-lisp-mode) - ("vi(") - "()") - (ert-info ("Next to outer delimiter") - (evil-test-buffer - "([(]aaa))" - (emacs-lisp-mode) - ("vi(") - "(())") - (evil-test-buffer - "((aaa[)])" - (emacs-lisp-mode) - ("vi(") - "(())"))) - (ert-info ("Select double inner parentheses") - (evil-test-buffer - "([(]word))" - ("dib") - "(())") - (evil-test-buffer - "[(](word))" - ("dib") - "()") - (evil-test-buffer - "((word[)])" - ("dib") - "(())") - (evil-test-buffer - "((word)[)]" - ("dib") - "()")) - (ert-info ("Select double outer parentheses") - (evil-test-buffer - "a([(]word))b" - ("dab") - "a()b") - (evil-test-buffer - "a[(](word))b" - ("dab") - "ab") - (evil-test-buffer - "a((word[)])b" - ("dab") - "a()b") - (evil-test-buffer - "a((word)[)]b" - ("dab") - "ab")) - (ert-info ("Select parentheses inside strings") - (evil-test-buffer - "(aaa \"b(b[b]b)\" aa)" - (emacs-lisp-mode) - ("va(") - "(aaa \"b<(bbb[)]>\" aa)")) - (ert-info ("Break out of empty strings") - (evil-test-buffer - "(aaa \"bb[b]b\" aa)" - (emacs-lisp-mode) - ("va(") - "<(aaa \"bbbb\" aa[)]>")) - (ert-info ("Select inner parentheses around strings") - (evil-test-buffer - "((\"t[e]st\"))\n" - (emacs-lisp-mode) - ("vib") - "((<\"test[\"]>))\n" - ("ib") - "(<(\"test\"[)]>)\n") - (evil-test-buffer - "( ( \"t[e]st\" ) )\n" - (emacs-lisp-mode) - ("vib") - "( (< \"test\"[ ]>) )\n" - ("ib") - "(< ( \"test\" )[ ]>)\n") - (evil-test-buffer - "((\"t[e]st\"))\n" - (emacs-lisp-mode) - ("vhhib") - "((<[\"]test\">))\n" - ("ib") - "(<[(]\"test\")>)\n") - (evil-test-buffer - "( ( \"t[e]st\" ) )\n" - (emacs-lisp-mode) - ("vhhib") - "( (<[ ]\"test\" >) )\n" - ("ib") - "(<[ ]( \"test\" ) >)\n")) - (ert-info ("Select outer parentheses around strings") - (evil-test-buffer - "((\"t[e]st\"))\n" - (emacs-lisp-mode) - ("vab") - "(<(\"test\"[)]>)\n" - ("ab") - "<((\"test\")[)]>\n") - (evil-test-buffer - "( ( \"t[e]st\" ) )\n" - (emacs-lisp-mode) - ("vab") - "( <( \"test\" [)]> )\n" - ("ab") - "<( ( \"test\" ) [)]>\n") - (evil-test-buffer - "((\"t[e]st\"))\n" - (emacs-lisp-mode) - ("vhhab") - "(<[(]\"test\")>)\n" - ("ab") - "<[(](\"test\"))>\n") - (evil-test-buffer - "( ( \"t[e]st\" ) )\n" - (emacs-lisp-mode) - ("vhhab") - "( <[(] \"test\" )> )\n" - ("ab") - "<[(] ( \"test\" ) )>\n") - (evil-test-buffer - "(([\"]\"))\n" - ("dab") - "([)]\n")) - (ert-info ("Select inner paren on different lines") - (evil-test-buffer - "for (auto i : vector) { - if (cond) { - do_[s]omething(); - } -}" - ("vi}") - "for (auto i : vector) { - if (cond) { -< do_something();[\n]> }\n}" - ("i}") - "for (auto i : vector) { -< if (cond) { - do_something(); - }[\n]>}")) - (ert-info ("Enlarge to smallest complete surrounding") - (evil-test-buffer - "for (auto i : vector) { - if (comething(); - } -}" - ("i}") - "for (auto i : vector) { -< if (cond) { - do_something(); - }[\n]>}")) - (ert-info ("yank on blocks is turned linewise") - (evil-test-buffer - "{\n [f]oo();\n}\n" - ("yiBp") - "{\n foo();\n [f]oo();\n}\n")) - (ert-info ("exclusive like if ending at bol") - (evil-test-buffer - "(defun foo ()\n[ ] (insert \"bar\")\n )\n" - ("cibx" [escape]) - "([x]\n )\n")) - (ert-info ("Operator on empty parentheses") - (evil-test-buffer - "a([(]))b" - ("cibx" [escape]) - "a(([x]))b") - (evil-test-buffer - "a(([)])b" - ("cibx" [escape]) - "a(([x]))b"))) - -(ert-deftest evil-test-forces-linewise-text-objects () - "Test `evil-text-object-change-visual-type' option." - :tags '(evil text-object) - (let ((evil-text-object-change-visual-type t)) - (ert-info ("Change visual type") - (evil-test-buffer - " function(opts) { - this.var1 = something(); - [t]his.var2 = something_else(); - return something_nasty(); - } -" - ("Vi}") - " function(opts) { -< this.var1 = something(); - this.var2 = something_else(); - return something_nasty();[ -]> } -" - (should (eq (evil-visual-type) 'inclusive))))) - (let ((evil-text-object-change-visual-type nil)) - (ert-info ("Change visual type keeping linewise") - (evil-test-buffer - " function(opts) { - this.var1 = something(); - [t]his.var2 = something_else(); - return something_nasty(); - } -" - ("Vi}") - " function(opts) { -< this.var1 = something(); - this.var2 = something_else(); - return something_nasty();\n> } -" - (should (eq (evil-visual-type) 'line))))) - (let ((evil-text-object-change-visual-type nil)) - (ert-info ("Linewise outer block") - (evil-test-buffer - " function(opts) { - this.var1 = something(); - [t]his.var2 = something_else(); - return something_nasty(); - } -" - ("Va}") - "< function(opts) { - this.var1 = something(); - this.var2 = something_else(); - return something_nasty(); - } ->" - (should (eq (evil-visual-type) 'line))))) - (ert-info ("Forced motion type should change text object type") - (evil-test-buffer - "for (int i=0; i<10; i++) { - if ([c]ond) { - do_something(); - } -}" - ("dVi}") - "for (int i=0; i<10; i++) { -\[}]"))) - -(ert-deftest evil-test-tag-objects () - "Test `evil-inner-tag', etc." - :tags '(evil text-object) - (ert-info ("Handle nested tags") - (evil-test-buffer - :visual-start "{" - :visual-end "}" - "

f[o]o bar

" - ("vit") - "

{fo[o]} bar

")) - (ert-info ("Break out of tags") - (evil-test-buffer - :visual-start "{" - :visual-end "}" - "bbbb" - ("vit") - "{bbb[b]}") - (evil-test-buffer - :visual-start "{" - :visual-end "}" - "bbbb" - ("vat") - "{bbbb]}")) - (ert-info ("Handle quoted strings tags") - (evil-test-buffer - :visual-start "{" - :visual-end "}" - " - -
-\[ ] -

-UPDATE -

-

-test hello Creative Commons -

-
- - -" - ("vit") - " - -
{\n \n

-UPDATE -

-

-test hello Creative Commons -

[\n]}
- - -")) - (ert-info ("Handle js arrow fns") - (evil-test-buffer - :visual-start "«" - :visual-end "»" - "" - ("vit") - "")) - (ert-info ("Inner tag is selected, even when empty") - (evil-test-buffer - :visual-start "«" - :visual-end "»" - "

fooqux

" - ("cit" "bar") - "

foobarqux

"))) - -;;; Visual state - -(defun evil-test-visual-select (selection &optional mark point) - "Verify that TYPE is selected correctly" - (let ((type (evil-visual-type selection))) - (evil-visual-make-selection mark point type) - (ert-info ("Activate region unless SELECTION is `block'") - (cond - ((eq selection 'block) - (should (mark t)) - (should-not (region-active-p)) - (should-not transient-mark-mode)) - (t - (should (mark)) - (should (region-active-p))))) - (ert-info ("Refresh Visual markers") - (should (= (evil-range-beginning (evil-expand (point) (mark) type)) - evil-visual-beginning)) - (should (= (evil-range-end (evil-expand (point) (mark) type)) - evil-visual-end)) - (should (eq (evil-visual-type) type)) - (should (eq evil-visual-direction - (if (< (point) (mark)) -1 1)))))) - -(ert-deftest evil-test-visual-refresh () - "Test `evil-visual-refresh'" - :tags '(evil visual) - (evil-test-buffer - ";; [T]his buffer is for notes." - (evil-visual-refresh nil nil 'inclusive) - (should (= evil-visual-beginning 4)) - (should (= evil-visual-end 5))) - (evil-test-buffer - ";; [T]his buffer is for notes." - (let ((evil-visual-region-expanded t)) - (evil-visual-refresh nil nil 'inclusive) - (should (= evil-visual-beginning 4)) - (should (= evil-visual-end 4))))) - -(ert-deftest evil-test-non-transient-visual-selection () - "Ensure visual charwise selection can be made when transient mark mode is nil." - :tags '(evil visual) - (evil-test-buffer - "Alpha [b]ravo charlie" - (setq-local transient-mark-mode nil) - ("ve") - "Alpha charlie")) - -(ert-deftest evil-test-visual-exchange () - "Test `exchange-point-and-mark' in Visual character selection" - :tags '(evil visual) - (evil-test-buffer - ";; <[T]his> buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("o") - (should (region-active-p)) - ";; buffer is for notes you don't want to save, -;; and for Lisp evaluation.")) - -(ert-deftest evil-test-visual-char () - "Test Visual character selection" - :tags '(evil visual) - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - (evil-test-visual-select 'char) - ";; <[T]>his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("e") - ";; buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("o") - ";; <[T]his> buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("d") - ";; [ ]buffer is for notes you don't want to save, -;; and for Lisp evaluation." - ("vV") - "<;; [ ]buffer is for notes you don't want to save,\n>\ -;; and for Lisp evaluation.")) - -(ert-deftest evil-test-visual-line () - "Test Visual line selection" - :tags '(evil visual) - (evil-test-buffer - ";; [T]his buffer is for notes you don't want to save, -;; and for Lisp evaluation." - (evil-test-visual-select 'line) - "<;; [T]his buffer is for notes you don't want to save,\n>\ -;; and for Lisp evaluation." - ("e") - "<;; Thi[s] buffer is for notes you don't want to save,\n>\ -;; and for Lisp evaluation." - ("o") - "<;; [T]his buffer is for notes you don't want to save,\n>\ -;; and for Lisp evaluation." - ("d") - ";; [a]nd for Lisp evaluation.")) - -(ert-deftest evil-test-visual-block () - "Test Visual block selection" - :tags '(evil visual) - (evil-test-buffer - "[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - (evil-test-visual-select 'block) - "<[;]>; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; then enter the text in that file's own buffer." - ("jjll") - "<;; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;;[ ]>then enter the text in that file's own buffer." - ("O") - ";; [;]; then enter the text in that file's own buffer." - ("o") - ";;[ ];; then enter the text in that file's own buffer." - ("O") - "<[;]; This buffer is for notes you don't want to save. -;; If you want to create a file, visit that file with C-x C-f, -;; >then enter the text in that file's own buffer." - ("d") - "This buffer is for notes you don't want to save. -If you want to create a file, visit that file with C-x C-f, -then enter the text in that file's own buffer.") - (ert-info ("Visual block can select over lines of different length") - (evil-test-buffer - "Short [l]ine -A much longer line -A medium line -Tiny ln" - ("\C-v$jd") - "Short[ ] -A much -A medium line -Tiny ln" - ("jj\C-v" [end] "jd") - "Short -A much -A me[d] -Tiny ")) - (ert-info ("Visual block does not extend up to curswant unless tracking EOL") - (evil-test-buffer - "[a]bc -" - ("\C-vfcjd") - "[b]c -")) - (ert-info ("Pasting visual block") - (evil-test-buffer - "alpha [b]ravo charlie -delta echo foxtrot -golf hotel india -juliet kilo mike" - ("\C-v" "jje" "y" "$" "p") - "alpha bravo charlie[b]rav -delta echo foxtrot echo -golf hotel india otel -juliet kilo mike" - ("G" "o" [escape] "p") - "alpha bravo charliebrav -delta echo foxtrot echo -golf hotel india otel -juliet kilo mike -[b]rav -echo -otel"))) - -(ert-deftest evil-test-visual-restore () - "Test restoring a previous selection" - :tags '(evil visual) - (ert-info ("Restore characterwise selection") - (evil-test-buffer - ";; <[T]his> buffer is for notes." - ([escape] "gv") - ";; <[T]his> buffer is for notes.")) - (ert-info ("Restore linewise selection") - (evil-test-buffer - :visual line - "<;; [T]his buffer is for notes.>" - ([escape] "gv") - "<;; [T]his buffer is for notes.>")) - (ert-info ("Restore blockwise selection") - (evil-test-buffer - :visual block - "<;; This buffer is for notes, -;;[ ]>and for Lisp evaluation." - ([escape] "gv") - "<;; This buffer is for notes, -;;[ ]>and for Lisp evaluation.") - (ert-info ("After paste shifts initially selected text") - (evil-test-buffer - :visual block - "<1\n2\n[3]>" - ("yP") - "[1]1\n22\n33" - ("gvr*") - "[*]1\n*2\n*3"))) - (ert-info ("Restore linewise visually-pasted selection") - (evil-test-buffer - "[a]lpha bravo\ncharlie delta -echo foxtrot\ngolf hotel" - ("2yy" "++" "Vp" "gv") - "alpha bravo\ncharlie delta -golf hotel")) - ;; 4 repetitions appears necessary, from manual testing - (ert-info ("Restore previous linewise selection from linewise selection") - (evil-test-buffer - "alpha bravo\nch[a]rlie delta\necho foxtrot\ngolf hotel" - ("V" [escape] "jV") - "alpha bravo\ncharlie delta\ngolf hotel" - ("gv") - "alpha bravo\necho foxtrot\ngolf hotel" - ("gv") - "alpha bravo\ncharlie delta\ngolf hotel" - ("gv") - "alpha bravo\necho foxtrot\ngolf hotel" - ("gv") - "alpha bravo\ncharlie delta\ngolf hotel")) - (ert-info ("Restore between previous charwise selection and linewise selection") - (evil-test-buffer - "alpha bravo\nch[a]rlie delta\necho foxtrot\ngolf hotel" - ("viw" [escape] "jV") - "alpha bravo\ncharlie delta\ngolf hotel" - ("gv") - "alpha bravo\n delta\necho foxtrot\ngolf hotel" - ("gv") - "alpha bravo\ncharlie delta\ngolf hotel" - ("gv") - "alpha bravo\n delta\necho foxtrot\ngolf hotel" - ("gv") - "alpha bravo\ncharlie delta\ngolf hotel"))) - -(ert-deftest evil-test-visual-redefine () - "Test redefining a previous selection" - :tags '(evil visual) - (ert-info ("Redefine characterwise selection") - (evil-test-buffer - ";; <[T]his> buffer is for notes." - ([escape] "gv") - ";; <[T]his> buffer is for notes." - ([escape] "2lm<2wm>gv") - ";; Ths for notes.")) - (ert-info ("Redefine linewise selection") - (evil-test-buffer - :visual line - "<[a]lpha bravo ->charlie delta -echo foxtrot -golf hotel" - ([escape] "gv") - "<[a]lpha bravo ->charlie delta -echo foxtrot -golf hotel" - ([escape] "2jm>gv") - "golf hotel" - ([escape] "kmgolf hotel")) - (ert-info ("Redefine blockwise selection") - (evil-test-buffer - :visual block - " delta -echo foxtrot -golf hotel" - ([escape] "gv") - " delta -echo foxtrot -golf hotel" - ([escape] "2jm>gv") - "tel" - ([escape] "k0mtel"))) - -(ert-deftest evil-test-visual-separate-from-operator-marks () - "Test that visual selection is kept separate from the '[ and '] marks (#1744)." - (evil-test-buffer "x\ny" - ("ylvpjxgv") - "[x]\n")) - -;;; Replace state - -(ert-deftest evil-test-replacement () - "Test replacing consecutive characters" - :tags '(evil replace) - (ert-info ("Replace and restore consecutive characters") - (evil-test-buffer - ";; [T]his buffer is for notes" - ("Rfoo") - ";; foo[s] buffer is for notes" - ([backspace backspace backspace]) - ";; [T]his buffer is for notes")) - (ert-info ("Replace and restore consecutive characters beyond eol") - (evil-test-buffer - ";; [T]his buffer is for notes" - ("wwwwRxxxxxxx") - ";; This buffer is for xxxxxxx[]" - ([backspace backspace backspace backspace backspace backspace backspace]) - ";; This buffer is for [n]otes")) - (ert-info ("Replace from line below and restore") - (define-key evil-replace-state-map (kbd "C-e") #'evil-copy-from-below) - (evil-test-buffer - ";; [f]oo bar\n;; qux quux" - ("R\C-e\C-e\C-e") - ";; qux[ ]bar\n;; qux quux" - ([backspace backspace backspace]) - ";; [f]oo bar\n;; qux quux") - (define-key evil-replace-state-map (kbd "C-e") nil)) - (ert-info ("Replace from line above and restore") - (define-key evil-replace-state-map (kbd "C-y") #'evil-copy-from-above) - (evil-test-buffer - ";; foo bar\n;; [q]ux quux" - ("R\C-y\C-y\C-y") - ";; foo bar\n;; foo[ ]quux" - ([backspace backspace backspace]) - ";; foo bar\n;; [q]ux quux") - (define-key evil-replace-state-map (kbd "C-y") nil)) - (ert-info ("Replace character twice and restore") - (evil-test-buffer "[a]" - ("Rb" [left] "c" [backspace]) - "b")) - (ert-info ("Can give Replace-state a count repeat it") - (evil-test-buffer - "a[l]pha bravo" - ("3Rx" [escape]) - "axx[x]a bravo" - ("wi\C-a") - "axxxa x[]bravo")) - (ert-info ("Replace deletion keeps consistent . register") - (evil-test-buffer - "a[l]pha bravo" - ("Rfop" [backspace] "o" [escape]) - "afo[o]a bravo" - ("A \C-@") - "afooa bravo fo[o]")) - (ert-info ("Replace-state sets ^ mark") - (evil-test-buffer - "a[l]pha bravo" - ("Rxx" [escape] "$") - "axxha brav[o]" - ("`^") - "axx[h]a bravo"))) - -;;; Ex - -(ert-deftest evil-test-ex-parse () - "Test `evil-ex-parse'" - :tags '(evil ex) - (should (equal (evil-ex-parse "5cmd arg") - '(evil-ex-call-command (string-to-number "5") "cmd" "arg"))) - (should (equal (evil-ex-parse "5cmd !arg") - '(evil-ex-call-command (string-to-number "5") "cmd" "!arg"))) - (should (equal (evil-ex-parse "5 arg") - '(evil-ex-call-command (string-to-number "5") "arg" nil))) - (should (equal (evil-ex-parse "+1,+2t-1") - '(evil-ex-call-command - (let ((l1 (evil-ex-line - nil - (+ (evil-ex-signed-number - (intern "+") - (string-to-number "1")))))) - (save-excursion - (and l1 (string= "," ";") (goto-line l1)) - (evil-ex-range - l1 (evil-ex-line - nil - (+ (evil-ex-signed-number - (intern "+") - (string-to-number "2"))))))) - "t" - "-1")))) - -(ert-deftest evil-test-ex-parse-ranges () - "Test parsing of ranges" - :tags '(evil ex) - (cl-flet - ((mk-range - (a b &optional relative) - `(let ((l1 ,(when a `(evil-ex-line ,@a)))) - (save-excursion - (and l1 (string= ,(if relative ";" ",") ";") (goto-line l1)) - (evil-ex-range l1 ,(when b `(evil-ex-line ,@b))))))) - (should (equal (evil-ex-parse "%" nil 'range) - '(evil-ex-full-range))) - (should (equal (evil-ex-parse "*" nil 'range) - '(evil-ex-last-visual-range))) - (should (equal (evil-ex-parse "5,27" nil 'range) - (mk-range '((string-to-number "5") nil) - '((string-to-number "27") nil)))) - (should (equal (evil-ex-parse "5,$" nil 'range) - (mk-range '((string-to-number "5") nil) - '((evil-ex-last-line) nil)))) - (should (equal (evil-ex-parse "5,'x" nil 'range) - (mk-range '((string-to-number "5") nil) - '((evil-ex-marker "x") nil)))) - (should (equal (evil-ex-parse "`x,`y" nil 'range) - '(evil-ex-char-marker-range "x" "y"))) - (should (equal (evil-ex-parse "`[,`]" nil 'range) - '(evil-ex-char-marker-range "[" "]"))) - (should (equal (evil-ex-parse "5,+" nil 'range) - (mk-range '((string-to-number "5") nil) - '(nil (+ (evil-ex-signed-number (intern "+") nil)))))) - (should (equal (evil-ex-parse "5,-" nil 'range) - (mk-range '((string-to-number "5") nil) - '(nil (+ (evil-ex-signed-number (intern "-") nil)))))) - (should (equal (evil-ex-parse "5,4+2-7-3+10-" nil 'range) - (mk-range - '((string-to-number "5") nil) - '((string-to-number "4") - (+ (evil-ex-signed-number - (intern "+") (string-to-number "2")) - (evil-ex-signed-number - (intern "-") (string-to-number "7")) - (evil-ex-signed-number - (intern "-") (string-to-number "3")) - (evil-ex-signed-number - (intern "+") (string-to-number "10")) - (evil-ex-signed-number (intern "-") nil)))))) - (should (equal (evil-ex-parse ".-2,4+2-7-3+10-" nil 'range) - (mk-range - '((evil-ex-current-line) - (+ (evil-ex-signed-number - (intern "-") (string-to-number "2")))) - '((string-to-number "4") - (+ (evil-ex-signed-number - (intern "+") (string-to-number "2")) - (evil-ex-signed-number - (intern "-") (string-to-number "7")) - (evil-ex-signed-number - (intern "-") (string-to-number "3")) - (evil-ex-signed-number - (intern "+") (string-to-number "10")) - (evil-ex-signed-number - (intern "-") nil)))))) - (should (equal (evil-ex-parse "'a-2,$-10" nil 'range) - (mk-range - '((evil-ex-marker "a") - (+ (evil-ex-signed-number - (intern "-") (string-to-number "2")))) - '((evil-ex-last-line) - (+ (evil-ex-signed-number - (intern "-") (string-to-number "10"))))))) - (should (equal (evil-ex-parse "'[,']" nil 'range) - (mk-range '((evil-ex-marker "[") nil) - '((evil-ex-marker "]") nil)))) - (should (equal (evil-ex-parse "'{,'}" nil 'range) - (mk-range '((evil-ex-marker "{") nil) - '((evil-ex-marker "}") nil)))) - (should (equal (evil-ex-parse "'(,')" nil 'range) - (mk-range '((evil-ex-marker "(") nil) - '((evil-ex-marker ")") nil)))) - (should (equal (evil-ex-parse ",']" nil 'range) - (mk-range nil '((evil-ex-marker "]") nil)))) - (should (equal (evil-ex-parse ";']" nil 'range) - (mk-range nil '((evil-ex-marker "]") nil) t))) - (should (equal (evil-ex-parse ".+42" nil 'range) - '(evil-ex-range - (evil-ex-line - (evil-ex-current-line) - (+ (evil-ex-signed-number - (intern "+") (string-to-number "42"))))))))) - -(ert-deftest evil-test-ex-parse-emacs-commands () - "Test parsing of Emacs commands" - :tags '(evil ex) - (should (equal (evil-ex-parse "ido-mode") - '(evil-ex-call-command nil "ido-mode" nil))) - (should (equal (evil-ex-parse "yas/reload-all") - '(evil-ex-call-command nil "yas/reload-all" nil))) - (should (equal (evil-ex-parse "mu4e") - '(evil-ex-call-command nil "mu4e" nil))) - (should (equal (evil-ex-parse "make-frame") - '(evil-ex-call-command nil "make-frame" nil)))) - -(ert-deftest evil-text-ex-search-offset () - "Test for addresses like /base//pattern/" - :tags '(evil ex) - (ert-info ("without base") - (evil-test-buffer - "[l]ine 1\naaa\nbbb\naaa\nccc\nddd" - (":/aaa/d") - "line 1\nbbb\naaa\nccc\nddd")) - (ert-info ("with base") - (evil-test-buffer - "[l]ine 1\naaa\nbbb\naaa\nccc\nddd" - (":/bbb//aaa/d") - "line 1\naaa\nbbb\nccc\nddd")) - (ert-info ("range without base") - (evil-test-buffer - "[l]ine 1\naaa\nbbb\naaa\nccc\nddd\nccc\neee\n" - (":/aaa/;/ccc/d") - "line 1\nddd\nccc\neee\n")) - (ert-info ("range with base") - (evil-test-buffer - "[l]ine 1\naaa\nbbb\naaa\nccc\nddd\nccc\neee\n" - (":/bbb//aaa/;/ddd//ccc/d") - "line 1\naaa\nbbb\neee\n"))) - -(ert-deftest evil-test-ex-goto-line () - "Test if :number moves point to a certain line" - :tags '(evil ex) - (ert-info ("Move to line") - (let ((evil-start-of-line t)) - (evil-test-buffer - :visual line - "1\n 2\n [ ]3\n 4\n 5\n" - (":4" [return]) - "1\n 2\n 3\n [4]\n 5\n" - (":2" [return]) - "1\n [2]\n 3\n 4\n 5\n")))) - -(ert-deftest evil-test-ex-repeat () - "Test :@: command." - :tags '(evil ex) - (evil-without-display - (ert-info ("Repeat in current line") - (evil-test-buffer - "[a]bcdef\nabcdef\nabcdef" - (":s/[be]/X/g" [return]) - "[a]XcdXf\nabcdef\nabcdef" - ("jj:@:" [return]) - "aXcdXf\nabcdef\n[a]XcdXf")) - (ert-info ("Repeat in specified line") - (evil-test-buffer - "[a]bcdef\nabcdef\nabcdef" - (":s/[be]/X/g" [return]) - "[a]XcdXf\nabcdef\nabcdef" - (":3@:" [return]) - "aXcdXf\nabcdef\n[a]XcdXf")) - (ert-info ("Double repeat, first without then with specified line") - (evil-test-buffer - "[a]bcdef\nabcdef\nabcdef" - (":s/[be]/X/" [return]) - "[a]Xcdef\nabcdef\nabcdef" - ("jj:@:" [return] ":1@:" [return]) - "[a]XcdXf\nabcdef\naXcdef")))) - -(ert-deftest evil-test-ex-repeat2 () - "Test @: command." - :tags '(evil ex) - (evil-without-display - (ert-info ("Repeat in current line") - (evil-test-buffer - "[a]bcdef\nabcdef\nabcdef" - (":s/[be]/X" [return]) - "[a]Xcdef\nabcdef\nabcdef" - ("jj@:") - "aXcdef\nabcdef\n[a]Xcdef")) - (ert-info ("Repeat with count in current line") - (evil-test-buffer - "[a]bcdef\nabcdef\nabcdef" - (":s/[be]/X" [return]) - "[a]Xcdef\nabcdef\nabcdef" - ("jj2@:") - "aXcdef\nabcdef\n[a]XcdXf")) - (ert-info ("Do not record dot repeat") - (evil-test-buffer - "" - ("OAAAAAA" [escape] "^") - "[A]AAAAA\n" - (":s/A/X" [return]) - "[X]AAAAA\n" - ("@:") - "[X]XAAAA\n" - (".") - "AAAAAA\nXXAAAA\n")))) - -(ert-deftest evil-test-ex-visual-char-range () - "Test visual character ranges in ex state." - :tags '(evil ex visual) - (evil-without-display - (ert-info ("No character range, inclusive") - (let ((evil-visual-char 'inclusive) - evil-ex-visual-char-range) - (evil-test-buffer - "li[n]e 1\nline 2\nline 3\nline 4\n" - ("vjll:d" [return]) - "line 3\nline 4\n"))) - (ert-info ("No character range, exclusive") - (let ((evil-visual-char 'inclusive) - evil-ex-visual-char-range) - (evil-test-buffer - "li[n]e 1\nline 2\nline 3\nline 4\n" - ("vjll:d" [return]) - "line 3\nline 4\n"))) - (ert-info ("Character range, inclusive") - (let ((evil-visual-char 'inclusive) - (evil-ex-visual-char-range t)) - (evil-test-buffer - "li[n]e 1\nline 2\nline 3\nline 4\n" - ("vjll:d" [return]) - "li2\nline 3\nline 4\n"))) - (ert-info ("Character range, exclusive") - (let ((evil-visual-char 'exclusive) - (evil-ex-visual-char-range t)) - (evil-test-buffer - "li[n]e 1\nline 2\nline 3\nline 4\n" - ("vjll:d" [return]) - "li 2\nline 3\nline 4\n"))))) - -(ert-deftest evil-test-ex-substitute-replacement () - "Test `evil-ex-substitute' with special replacements." - :tags '(evil ex search) - (ert-info ("Substitute upper first on first match in line") - (evil-test-buffer - "[x]xx foo bar foo bar foo bar" - (":s/\\(foo\\|bar\\)/\\u\\1" [return]) - "[x]xx Foo bar foo bar foo bar")) - (ert-info ("Substitute upper first on first match in line with confirm") - (evil-test-buffer - "[x]xx foo bar foo bar foo bar" - (":s/\\(foo\\|bar\\)/\\u\\1/c" [return] "y") - "[x]xx Foo bar foo bar foo bar")) - (ert-info ("Substitute upper first on whole line") - (evil-test-buffer - "[x]xx foo bar foo bar foo bar" - (":s/\\(foo\\|bar\\)/\\u\\1/g" [return]) - "[x]xx Foo Bar Foo Bar Foo Bar")) - (ert-info ("Substitute upper first on whole line") - (evil-test-buffer - "[x]xx foo bar foo bar foo bar" - (":s/\\(foo\\|bar\\)/\\u\\1/gc" [return] "yynyyn") - "[x]xx Foo Bar foo Bar Foo bar")) - (ert-info ("Substitute upper/lower on first match in line") - (evil-test-buffer - "[x]xx foo BAR foo BAR foo BAR" - (":s/\\(f[[:alpha:]]*\\>\\)\\s-*\\(b[[:alpha:]]*\\>\\)/\\L\\2_\\e\\U\\1" [return]) - "[x]xx bar_FOO foo BAR foo BAR")) - (ert-info ("Substitute upper/lower on first match in line with confirm") - (evil-test-buffer - "[x]xx foo BAR foo BAR foo BAR" - (":s/\\(f[[:alpha:]]*\\>\\)\\s-*\\(b[[:alpha:]]*\\>\\)/\\L\\2_\\e\\U\\1/c" [return] "y") - "[x]xx bar_FOO foo BAR foo BAR")) - (ert-info ("Substitute upper/lower on whole line") - (evil-test-buffer - "[x]xx foo BAR foo BAR foo BAR" - (":s/\\(f[[:alpha:]]*\\>\\)\\s-*\\(b[[:alpha:]]*\\>\\)/\\L\\2_\\e\\U\\1/g" [return]) - "[x]xx bar_FOO bar_FOO bar_FOO")) - (ert-info ("Substitute upper/lower on whole line") - (evil-test-buffer - "[x]xx foo BAR foo BAR foo BAR" - (":s/\\(f[[:alpha:]]*\\>\\)\\s-*\\(b[[:alpha:]]*\\>\\)/\\L\\2_\\e\\U\\1/gc" [return] "yny") - "[x]xx bar_FOO foo BAR bar_FOO")) - (ert-info ("Substitute with escaped characters in replacement") - (evil-test-buffer - "[a]bcXdefXghiXjkl\n" - (":s/X/\\|\\/\\|/g" [return]) - "[a]bc|/|def|/|ghi|/|jkl\n")) - (ert-info ("Substitute with register") - (evil-test-buffer - "[a]bc\niiiXiiiXiiiXiii\n" - ("\"ayiwj:s/X/\\=@a/g" [return]) - "abc\n[i]iiabciiiabciiiabciii\n")) - (ert-info ("Substitute newlines") - (evil-test-buffer - "[a]bc\ndef\nghi\n" - (":%s/\n/z/" [return]) - "[a]bczdefzghiz")) - (ert-info ("Substitute newlines with g flag") - (evil-test-buffer - "[a]bc\ndef\nghi\n" - (":%s/\n/z/g" [return]) - "[a]bczdefzghiz")) - (ert-info ("Substitute newlines without newline in regexp") - (evil-test-buffer - "[A]BC\nDEF\nGHI\n" - (":%s/[^]]*/z/" [return]) - "Z")) - (ert-info ("Substitute n flag does not replace") - (evil-test-buffer - "[a]bc\naef\nahi\n" - (":%s/a//n" [return]) - "[a]bc\naef\nahi\n")) - (ert-info ("Substitute n flag does not replace with g flag") - (evil-test-buffer - "[a]bc\naef\nahi\n" - (":%s/a//gn" [return]) - "[a]bc\naef\nahi\n")) - (ert-info ("Substitute $ does not loop infinitely") - (evil-test-buffer - "[a]bc\ndef\nghi" - (":%s/$/ END/g" [return]) - "abc END\ndef END\n[g]hi END")) - (ert-info ("Substitute the zero-length beginning of line character") - (evil-test-buffer - "[a]bc\ndef\nghi" - (":s/^/ #/" [return]) - " [#]abc\ndef\nghi")) - (ert-info ("Substitute the zero-length beginning of line character with g flag") - (evil-test-buffer - "[a]bc\ndef\nghi" - (":s/^/ #/g" [return]) - " [#]abc\ndef\nghi")) - (ert-info ("Use Substitute to delete individual characters") - (evil-test-buffer - "[x]xyxxz" - (":%s/x//g" [return]) - "[y]z")) - (ert-info ("Substitute doesn't match final empty line") - (evil-test-buffer - "abc\n[d]ef\n\nghi" - (":s/$/4" [return]) - "abc\n[d]ef4\n\nghi") - (evil-test-buffer - "abc\n[d]ef\n\nghi" - (":s/f\\w*/4" [return]) - "abc\n[d]e4\n\nghi")) - (ert-info ("Substitute doesn't move point if 0 matches") - (evil-test-buffer - "abc\nd[e]f\nghi" - (":%s/nothere/foo" [return]) - "abc\nd[e]f\nghi")) - (ert-info ("Substitute up to EOB works") - (evil-test-buffer "[f]oo" - (":s/foo") - "")) - (ert-info ("Substitute with multi-line replacement") - (evil-test-buffer "x" - (":s/./foo\\nbar") - "foo\n[b]ar")) - (ert-info ("Use replace count in substitution") - (evil-test-buffer "xx" - (":s/./\\#/g") - "01")) - (ert-info ("Substitute with `calc' Lisp expression") - (evil-test-buffer "1 + 2" - (":s/.*/\\,(calc-eval \\0)") - "3"))) - -(ert-deftest evil-test-ex-repeat-substitute-replacement () - "Test `evil-ex-substitute' with repeating of previous substitutions." - :tags '(evil ex search) - (ert-info ("Repeat previous pattern") - (evil-select-search-module 'evil-search-module 'evil-search) - (evil-test-buffer - "[x]xx foo bar foo bar foo bar" - (":s/foo/AAA" [return]) - "[x]xx AAA bar foo bar foo bar" - (":s//BBB" [return]) - "[x]xx AAA bar BBB bar foo bar" - ("/bar" [return] ":s//CCC" [return]) - "[x]xx AAA CCC BBB bar foo bar" - (":s/ar/XX" [return]) - "[x]xx AAA CCC BBB bXX foo bar" - (":s//YY" [return]) - "[x]xx AAA CCC BBB bXX foo bYY")) - (ert-info ("Repeat previous replacement") - (evil-test-buffer - "[x]xx foo bar foo bar foo bar" - (":s/foo/AAA" [return]) - "[x]xx AAA bar foo bar foo bar" - (":s/bar/~" [return]) - "[x]xx AAA AAA foo bar foo bar")) - (ert-info ("Repeat with previous flags") - (evil-test-buffer - "[x]xx foo bar foo bar foo bar" - (":s/foo/AAA/g" [return]) - "[x]xx AAA bar AAA bar AAA bar" - (":s/bar/BBB/&" [return]) - "[x]xx AAA BBB AAA BBB AAA BBB")) - (ert-info ("Repeat previous substitute without flags") - (evil-select-search-module 'evil-search-module 'evil-search) - (evil-test-buffer - "[x]xx foo bar foo bar foo bar\nxxx foo bar foo bar foo bar" - (":s/foo/AAA/g" [return]) - "[x]xx AAA bar AAA bar AAA bar\nxxx foo bar foo bar foo bar" - ("j:s" [return]) - "xxx AAA bar AAA bar AAA bar\n[x]xx AAA bar foo bar foo bar" - ("/bar" [return] ":s" [return]) - "xxx AAA bar AAA bar AAA bar\n[x]xx AAA bar AAA bar foo bar") - (evil-test-buffer - "[x]xx foo bar foo bar foo bar\nxxx foo bar foo bar foo bar" - (":s/foo/AAA/g" [return]) - "[x]xx AAA bar AAA bar AAA bar\nxxx foo bar foo bar foo bar" - ("j&") - "xxx AAA bar AAA bar AAA bar\n[x]xx AAA bar foo bar foo bar") - (evil-test-buffer - "[x]xx foo bar foo bar foo bar\nxxx foo bar foo bar foo bar" - (":s/foo/AAA/g" [return]) - "[x]xx AAA bar AAA bar AAA bar\nxxx foo bar foo bar foo bar" - ("j:&" [return]) - "xxx AAA bar AAA bar AAA bar\n[x]xx AAA bar foo bar foo bar")) - (ert-info ("Repeat previous substitute with the same flags") - (evil-test-buffer - "[x]xx foo bar foo bar foo bar\nxxx foo bar foo bar foo bar" - (":s/foo/AAA/g" [return]) - "[x]xx AAA bar AAA bar AAA bar\nxxx foo bar foo bar foo bar" - ("j:s//~/&" [return]) - "xxx AAA bar AAA bar AAA bar\n[x]xx AAA bar AAA bar AAA bar") - (evil-test-buffer - "[x]xx foo bar foo bar foo bar\nxxx foo bar foo bar foo bar" - (":s/foo/AAA/g" [return]) - "[x]xx AAA bar AAA bar AAA bar\nxxx foo bar foo bar foo bar" - ("j:&&" [return]) - "xxx AAA bar AAA bar AAA bar\n[x]xx AAA bar AAA bar AAA bar")) - (ert-info ("Repeat previous substitute with new flags") - (evil-test-buffer - "[x]xx foo bar foo bar foo bar\nxxx foo bar foo bar foo bar" - (":s/foo/AAA" [return]) - "[x]xx AAA bar foo bar foo bar\nxxx foo bar foo bar foo bar" - ("j:s g" [return]) - "xxx AAA bar foo bar foo bar\n[x]xx AAA bar AAA bar AAA bar") - (evil-test-buffer - "[x]xx foo bar foo bar foo bar\nxxx foo bar foo bar foo bar" - (":s/foo/AAA" [return]) - "[x]xx AAA bar foo bar foo bar\nxxx foo bar foo bar foo bar" - ("j:& g" [return]) - "xxx AAA bar foo bar foo bar\n[x]xx AAA bar AAA bar AAA bar")) - (ert-info ("Repeat with previous search pattern") - (evil-select-search-module 'evil-search-module 'evil-search) - (evil-test-buffer - "[x]xx foo bar foo bar foo bar\nxxx foo bar foo bar foo bar" - (":s/foo/AAA" [return]) - "[x]xx AAA bar foo bar foo bar\nxxx foo bar foo bar foo bar" - ("/bar" [return]) - "xxx AAA [b]ar foo bar foo bar\nxxx foo bar foo bar foo bar" - (":2s rg" [return]) - "xxx AAA bar foo bar foo bar\n[x]xx foo AAA foo AAA foo AAA") - (evil-test-buffer - "[x]xx foo bar foo bar foo bar\nxxx foo bar foo bar foo bar" - (":s/foo/AAA" [return]) - "[x]xx AAA bar foo bar foo bar\nxxx foo bar foo bar foo bar" - ("/bar" [return]) - "xxx AAA [b]ar foo bar foo bar\nxxx foo bar foo bar foo bar" - (":2~ g" [return]) - "xxx AAA bar foo bar foo bar\n[x]xx foo AAA foo AAA foo AAA")) - (ert-info ("Repeat previous substitute globally") - (evil-test-buffer - "[x]xx foo bar foo bar foo bar\nxxx foo bar foo bar foo bar" - (":s/foo/AAA/g" [return]) - "[x]xx AAA bar AAA bar AAA bar\nxxx foo bar foo bar foo bar" - ("g&") - "xxx AAA bar AAA bar AAA bar\n[x]xx AAA bar AAA bar AAA bar")) - (ert-info ("Substitute with last search, maintaining case sensitivty") - (evil-select-search-module 'evil-search-module 'evil-search) - (evil-test-buffer - "[a]lpha\nbravo\nbravo\ncharlie\nBravo\ndelta" - ("/\\Cbravo" [return]) - "alpha\n[b]ravo\nbravo\ncharlie\nBravo\ndelta" - (":%s//zulu" [return]) - "alpha\nzulu\n[z]ulu\ncharlie\nBravo\ndelta")) - (ert-info ("Repeat magic multiple times") - (let ((evil-magic 'very-magic) - (evil-ex-search-vim-style-regexp t)) - (evil-test-buffer - "[b]ravo, alpha\ndelta, charlie\nfoxtrot, echo\nhotel, golf" - (":s/(.*), (.*)/\\2 \\1" [return]) - "alpha bravo\ndelta, charlie\nfoxtrot, echo\nhotel, golf" - ("j&") - "alpha bravo\ncharlie delta\nfoxtrot, echo\nhotel, golf" - ("j&") - "alpha bravo\ncharlie delta\necho foxtrot\nhotel, golf" - ("j&") - "alpha bravo\ncharlie delta\necho foxtrot\ngolf hotel")))) - -(ert-deftest evil-test-ex-regex-without-case () - "Test `evil-ex-regex-without-case'" - :tags '(evil ex search) - (should (equal (evil-ex-regex-without-case "cdeCDE") - "cdeCDE")) - (should (equal (evil-ex-regex-without-case "\\ccde\\CCDE") - "cdeCDE")) - (should (equal (evil-ex-regex-without-case "\\\\ccde\\\\CCDE") - "\\\\ccde\\\\CCDE")) - (should (equal (evil-ex-regex-without-case "\\\\\\ccde\\\\\\CCDE") - "\\\\cde\\\\CDE"))) - -(ert-deftest evil-test-ex-regex-case () - "Test `evil-ex-regex-case'" - :tags '(evil ex search) - (should (equal (evil-ex-regex-case "cde" 'smart) 'insensitive)) - (should (equal (evil-ex-regex-case "cDe" 'smart) 'sensitive)) - (should (equal (evil-ex-regex-case "cde" 'sensitive) 'sensitive)) - (should (equal (evil-ex-regex-case "cde" 'insensitive) 'insensitive)) - (should (equal (evil-ex-regex-case "\\ccde" 'smart) 'insensitive)) - (should (equal (evil-ex-regex-case "\\cCde" 'smart) 'insensitive)) - (should (equal (evil-ex-regex-case "\\Ccde" 'smart) 'sensitive)) - (should (equal (evil-ex-regex-case "\\CCde" 'smart) 'sensitive)) - (should (equal (evil-ex-regex-case "\\ccd\\Ce" 'smart) 'insensitive)) - (should (equal (evil-ex-regex-case "\\cCd\\Ce" 'smart) 'insensitive)) - (should (equal (evil-ex-regex-case "\\Ccd\\ce" 'smart) 'sensitive)) - (should (equal (evil-ex-regex-case "\\CCd\\ce" 'smart) 'sensitive))) - -(ert-deftest evil-test-ex-search () - "Test evil internal search." - :tags '(evil ex search) - (evil-without-display - (evil-select-search-module 'evil-search-module 'evil-search) - (ert-info ("Test smart case insensitive") - (evil-test-buffer - "[s]tart you YOU You you YOU You" - ("/you" [return]) - "start [y]ou YOU You you YOU You" - ("n") - "start you [Y]OU You you YOU You" - ("n") - "start you YOU [Y]ou you YOU You" - ("n") - "start you YOU You [y]ou YOU You")) - (ert-info ("Test smart case sensitive") - (evil-test-buffer - "[s]tart you YOU You you YOU You" - ("/You" [return]) - "start you YOU [Y]ou you YOU You" - ("n") - "start you YOU You you YOU [Y]ou")) - (ert-info ("Test insensitive") - (evil-test-buffer - "[s]tart you YOU You you YOU You" - ("/\\cyou" [return]) - "start [y]ou YOU You you YOU You" - ("n") - "start you [Y]OU You you YOU You" - ("n") - "start you YOU [Y]ou you YOU You" - ("n") - "start you YOU You [y]ou YOU You")) - (ert-info ("Test sensitive") - (evil-test-buffer - "[s]tart you YOU You you YOU You" - ("/\\Cyou" [return]) - "start [y]ou YOU You you YOU You" - ("n") - "start you YOU You [y]ou YOU You")) - (ert-info ("Test failing search does not move point") - (evil-test-buffer - "foo [f]oo foo\nbar bar2 bar\nbaz baz baz\n" - (error search-failed "/foofoo" [return]) - "foo [f]oo foo\nbar bar2 bar\nbaz baz baz\n" - ("/bar2" [return]) - "foo foo foo\nbar [b]ar2 bar\nbaz baz baz\n" - ("dw") - "foo foo foo\nbar [b]ar\nbaz baz baz\n" - (error search-failed "n") - "foo foo foo\nbar [b]ar\nbaz baz baz\n" - (error search-failed "N") - "foo foo foo\nbar [b]ar\nbaz baz baz\n")) - (ert-info ("Test search for newline") - (evil-test-buffer - "[s]tart\nline 2\nline 3\n\n" - ("/\\n" [return]) - "star[t]\nline 2\nline 3\n\n" - ("n") - "start\nline [2]\nline 3\n\n" - ("n") - "start\nline 2\nline [3]\n\n" - ("n") - "start\nline 2\nline 3\n[]\n")) - (ert-info ("Can search for start/end of symbol") - (let ((evil-magic 'very-magic)) - (evil-test-buffer - "[a]lpha bravo bra charlie" - ("/bra\\_>" [return]) - "alpha bravo [b]ra charlie"))) - (ert-info ("Can search for literal < and >") - (let ((evil-magic 'very-magic)) - (evil-test-buffer - :visual-start "«" - :visual-end "»" - "[a]lpha bravo charlie" - ("/" [return]) - "alpha bravo [<]bravo> charlie"))) - (ert-info ("Can paste from register in ex-search") - (evil-test-buffer - "Alpha [b]ravo charlie alpha bravo delta bravo delta" - ("\"bye" "w") - "Alpha bravo [c]harlie alpha bravo delta bravo delta" - ("/\C-rb" [return]) - "Alpha bravo charlie alpha [b]ravo delta bravo delta" - ("w/\C-r\C-o" [return]) - "Alpha bravo charlie alpha bravo delta bravo [d]elta")) - (ert-info ("Can use C-w yank-word functionality") - (let ((old-val evil-want-C-w-delete)) - (custom-set-variables '(evil-want-C-w-delete nil)) - (evil-test-buffer - "alpha [b]ravo charlie delta bravo echo" - ("/\C-w" [return]) - "alpha bravo charlie delta [b]ravo echo") - (custom-set-variables `(evil-want-C-w-delete ,old-val)))) - (ert-info ("Can use backreferences with vim-style regexp") - (let ((evil-ex-search-vim-style-regexp t)) - (evil-test-buffer - "[a]bacababcacabccadefghij" - ;; Very magic - ("/\\v(.)(.)(.)\\3\\1/e" [return]) - "abacababcacabcc[a]defghij") - (evil-test-buffer - "[a]bacababcacabccadefghij" - ;; Default magic - ("/\\(.\\)\\(.\\)\\(.\\)\\3\\1/e" [return]) - "abacababcacabcc[a]defghij") - (evil-test-buffer - "[a]bacababcac1abcca1defghij" - ;; With literal numbers - ("/\\(.\\)\\(.\\)\\(.\\)\\3\\11/e" [return]) - "abacababcac1abcca[1]defghij"))))) - -(ert-deftest evil-test-ex-search-offset () - "Test search offsets." - :tags '(evil ex search) - (evil-without-display - (evil-select-search-module 'evil-search-module 'evil-search) - (ert-info ("Test line offsets") - (evil-test-buffer - "[f]oo foo\nbar bar\nbaz baz\nAnother line\nAnd yet another line" - ("/bar/2") - "foo foo\nbar bar\nbaz baz\n[A]nother line\nAnd yet another line" - ("?bar?-") - "[f]oo foo\nbar bar\nbaz baz\nAnother line\nAnd yet another line" - ("/r bar/") - "foo foo\nba[r] bar\nbaz baz\nAnother line\nAnd yet another line")) - (ert-info ("Test end offsets") - (evil-test-buffer - "[f]oo foo\nbar bar\nbaz baz\nAnother line\nAnd yet another line" - ("/bar/e") - "foo foo\nba[r] bar\nbaz baz\nAnother line\nAnd yet another line" - ("/baz/e+2") - "foo foo\nbar bar\nbaz [b]az\nAnother line\nAnd yet another line" - ("/line/e-1") - "foo foo\nbar bar\nbaz baz\nAnother li[n]e\nAnd yet another line")) - (ert-info ("Test begin offsets") - (evil-test-buffer - "[f]oo foo\nbar bar\nbaz baz\nAnother line\nAnd yet another line" - ("/bar/b") - "foo foo\n[b]ar bar\nbaz baz\nAnother line\nAnd yet another line" - ("/baz/b+2") - "foo foo\nbar bar\nba[z] baz\nAnother line\nAnd yet another line" - ("/line/b-") - "foo foo\nbar bar\nbaz baz\nAnother[ ]line\nAnd yet another line")) - (ert-info ("Test search-next with offset") - (evil-test-buffer - "[f]oo foo\nbar bar\nbaz baz\nAnother line\nAnd yet another line" - ("/ ba/+1" [return]) - "foo foo\nbar bar\n[b]az baz\nAnother line\nAnd yet another line" - ("n") - "foo foo\nbar bar\nbaz baz\n[A]nother line\nAnd yet another line")) - (ert-info ("Test search next after /$") - (evil-test-buffer - "[l]ine 1\nline 2\n\n\line 4\n" - ("/$" [return]) - "line [1]\nline 2\n\n\line 4\n" - ("n") - "line 1\nline [2]\n\n\line 4\n" - ("n") - "line 1\nline 2\n[\n]\line 4\n" - ("n") - "line 1\nline 2\n\n\line [4]\n")))) - -(ert-deftest evil-test-ex-search-pattern-offset () - "Test pattern offsets." - :tags '(evil ex search) - (evil-without-display - (evil-select-search-module 'evil-search-module 'evil-search) - (ert-info ("Test simple pattern offsets") - (evil-test-buffer - "[f]oo foo\nbar bar\nfoo foo\nbaz baz\nAnother line\nAnd yet another line" - ("/bar/;/foo" [return]) - "foo foo\nbar bar\n[f]oo foo\nbaz baz\nAnother line\nAnd yet another line")) - (ert-info ("Test simple pattern offsets in backward direction") - (evil-test-buffer - "[f]oo foo\nbar bar\nfoo foo\nbaz baz\nAnother line\nAnd yet another line" - ("/bar/;?foo" [return]) - "foo [f]oo\nbar bar\nfoo foo\nbaz baz\nAnother line\nAnd yet another line")) - (ert-info ("Ensure second pattern is used for search repeat") - (evil-test-buffer - "[f]oo foo\nbar bar\nfoo foo\nbaz baz\nAnother line\nAnd yet another line" - ("/bar/;?foo" [return] "n") - "foo foo\nbar bar\n[f]oo foo\nbaz baz\nAnother line\nAnd yet another line")))) - -(ert-deftest evil-test-ex-search-repeat () - "Test repeat of search." - :tags '(evil ex search) - (evil-without-display - (evil-select-search-module 'evil-search-module 'evil-search) - (ert-info ("Test repeat of simple pattern") - (evil-test-buffer - "[f]oo foo\nbar bar\nbaz baz\nAnother line\nAnd yet another line" - ("/bar" [return] "/" [return]) - "foo foo\nbar [b]ar\nbaz baz\nAnother line\nAnd yet another line")) - (ert-info ("Test repeat of simple pattern with new offset") - (evil-test-buffer - "[f]oo foo\nbar bar\nbaz baz\nAnother line\nAnd yet another line" - ("/bar" [return] "//e" [return]) - "foo foo\nbar ba[r]\nbaz baz\nAnother line\nAnd yet another line")) - (ert-info ("Test repeat of pattern with offset") - (evil-test-buffer - "[f]oo foo\nbar bar\nbaz baz\nAnother line\nAnd yet another line" - ("/bar/e" [return] "/" [return]) - "foo foo\nbar ba[r]\nbaz baz\nAnother line\nAnd yet another line")) - (ert-info ("Test repeat of pattern with offset without offset") - (evil-test-buffer - "[f]oo foo\nbar bar\nbaz baz\nAnother line\nAnd yet another line" - ("/bar/e" [return] "//" [return]) - "foo foo\nbar [b]ar\nbaz baz\nAnother line\nAnd yet another line")) - (ert-info ("Test repeat of pattern with offset with new offset") - (evil-test-buffer - "[f]oo foo\nbar bar\nbaz baz\nAnother line\nAnd yet another line" - ("/bar/e" [return] "//b+1" [return]) - "foo foo\nbar b[a]r\nbaz baz\nAnother line\nAnd yet another line")) - (ert-info ("Test repeat of pattern in the same search") - (evil-test-buffer - "[a]lpha bravo charlie delta charlie alpha bravo alpha" - ("/charlie/;/") - "alpha bravo charlie delta [c]harlie alpha bravo alpha" - ("/alpha/;//") - "alpha bravo charlie delta charlie alpha bravo [a]lpha" - ("?charlie?;?") - "alpha bravo [c]harlie delta charlie alpha bravo alpha") - (ert-info ("including when switching direction") - (evil-test-buffer - "[a]lpha bravo charlie delta charlie alpha bravo alpha" - ("/bravo/;?") - "alpha bravo charlie delta charlie alpha [b]ravo alpha" - ("?alpha?;//") - "alpha bravo charlie delta charlie alpha bravo [a]lpha"))))) - -(ert-deftest evil-test-ex-search-word () - "Test search for word under point." - :tags '(evil ex search) - (evil-without-display - (evil-select-search-module 'evil-search-module 'evil-search) - (setq evil-ex-search-history nil) - (evil-test-buffer - "so[m]e text with a strange word -and here some other stuff -maybe we need one line more with some text\n" - (setq evil-symbol-word-search nil) - ("*") - "some text with a strange word -and here [s]ome other stuff -maybe we need one line more with some text\n" - ("n") - "some text with a strange word -and here some other stuff -maybe we need one line more with [s]ome text\n" - (ert-info ("Search history") - (should (equal evil-ex-search-history '("\\")))) - ("*") - "[s]ome text with a strange word -and here some other stuff -maybe we need one line more with some text\n" - (ert-info ("Search history with double pattern") - (should (equal evil-ex-search-history '("\\"))))) - (ert-info ("Test unbounded search") - (evil-select-search-module 'evil-search-module 'evil-search) - (setq evil-ex-search-history nil) - (evil-test-buffer - "[s]ymbol\n(defun my-symbolfunc ())\n(defvar my-symbolvar)\nanother symbol\n" - ("*") - (setq evil-symbol-word-search nil) - "symbol\n(defun my-symbolfunc ())\n(defvar my-symbolvar)\nanother [s]ymbol\n" - ("ggg*") - "symbol\n(defun my-[s]ymbolfunc ())\n(defvar my-symbolvar)\nanother symbol\n" - (should (equal evil-ex-search-history '("symbol" "\\"))) - ("n") - "symbol\n(defun my-symbolfunc ())\n(defvar my-[s]ymbolvar)\nanother symbol\n")) - (ert-info ("Test symbol search") - (evil-select-search-module 'evil-search-module 'evil-search) - (evil-test-buffer - "(defun my-s[y]mbol-func ())\n(defvar my-symbol-var)\n(my-symbol-func)\n(setq my-symbol-func2 (my-symbol-func))\n" - (setq evil-symbol-word-search t) - ("*") - "(defun my-symbol-func ())\n(defvar my-symbol-var)\n([m]y-symbol-func)\n(setq my-symbol-func2 (my-symbol-func))\n" - ("n") - "(defun my-symbol-func ())\n(defvar my-symbol-var)\n(my-symbol-func)\n(setq my-symbol-func2 ([m]y-symbol-func))\n")) - (ert-info ("Test with non-nil `evil-ex-search-vim-style-regexp'") - (evil-select-search-module 'evil-search-module 'evil-search) - (let ((evil-ex-search-vim-style-regexp t) - (evil-magic 'very-magic)) - (evil-test-buffer - "[a]lpha bravo alpha charlie alpha" - ("*") - "alpha bravo [a]lpha charlie alpha" - ("/" [return]) - "alpha bravo alpha charlie [a]lpha"))))) - -(ert-deftest evil-test-ex-search-motion () - "Test that Ex forward search, as a motion, can be repeated." - :tags '(evil ex search) - (evil-without-display - (evil-select-search-module 'evil-search-module 'evil-search) - (evil-test-buffer "alpha [b]ravo charlie delta golf hotel charlie india" - ("c/charlie" [return] "replacement " [escape] "4w.") - "alpha replacement charlie delta golf replacement[ ]charlie india"))) - -(ert-deftest evil-test-ex-search-next+previous-match () - :tags '(evil ex search) - (evil-without-display - (evil-select-search-module 'evil-search-module 'evil-search) - (ert-info ("evil-next-match in normal state") - (evil-test-buffer - "[b]ravo charlie delta charlie alpha charlie bravo" - ("/charlie" [return] "e") - "bravo charli[e] delta charlie alpha charlie bravo" - ("gn") - "bravo delta charlie alpha charlie bravo" - ([escape] "b") - "bravo [c]harlie delta charlie alpha charlie bravo" - ("gn") - "bravo delta charlie alpha charlie bravo" - ([escape] "w") - "bravo charlie [d]elta charlie alpha charlie bravo" - ("gn") - "bravo charlie delta alpha charlie bravo" - ([escape] "^") - "[b]ravo charlie delta charlie alpha charlie bravo" - ("3gn") - "bravo charlie delta charlie alpha bravo")) - (ert-info ("evil-previous-match in normal state") - (evil-test-buffer - "[b]ravo charlie delta charlie alpha charlie bravo" - ("/charlie" [return] "e") - "bravo charli[e] delta charlie alpha charlie bravo" - ("$gN") - "bravo charlie delta charlie alpha <[c]harlie> bravo" - ([escape] "gN") - "bravo charlie delta charlie alpha <[c]harlie> bravo" - ([escape] "e" "2gN") - "bravo charlie delta <[c]harlie> alpha charlie bravo")) - (ert-info ("evil-next-match in visual state") - (evil-test-buffer - "[b]ravo charlie delta charlie alpha charlie bravo" - ("/charlie" [return] "e") - "bravo charli[e] delta charlie alpha charlie bravo" - ("gn") - "bravo delta charlie alpha charlie bravo" - ("gn") - "bravo alpha charlie bravo" - ("o") - "bravo <[c]harlie delta charlie> alpha charlie bravo" - ("gn") - "bravo charli<[e] delta charlie> alpha charlie bravo" - ([escape] "^v2gn") - " alpha charlie bravo")) - (ert-info ("evil-previous-match in visual state") - (evil-test-buffer - "bravo charlie delta charlie alpha charlie brav[o]" - ("?charlie" [return]) - "bravo charlie delta charlie alpha [c]harlie bravo" - ("gN") - "bravo charlie delta charlie alpha <[c]harlie> bravo" - ("gN") - "bravo charlie delta <[c]harlie alpha charlie> bravo" - ("o") - "bravo charlie delta bravo" - ("gN") - "bravo charlie delta harlie bravo" - ([escape] "$v2gN") - "bravo charlie delta <[c]harlie alpha charlie bravo>")) - (ert-info ("evil-match in operator state") - (evil-test-buffer - "[b]ravo charlie delta charlie alpha charlie bravo" - ("/charlie" [return]) - "bravo [c]harlie delta charlie alpha charlie bravo" - ("cgn" "foo" [escape]) - "bravo fo[o] delta charlie alpha charlie bravo" - (".") - "bravo foo delta fo[o] alpha charlie bravo" - ("$cgN" "bar" [escape]) - "bravo foo delta foo alpha ba[r] bravo")) - (ert-info ("Unfound evil ex next match doesn't move cursor") - (evil-test-buffer - "[a]lpha bravo" - (should-error (execute-kbd-macro "/zulu")) - "[a]lpha bravo" - (should-error (execute-kbd-macro "gn")) - "[a]lpha bravo")))) - -(ert-deftest evil-test-isearch-word () - "Test isearch for word under point." - :tags '(evil isearch) - (evil-without-display - (evil-select-search-module 'evil-search-module 'isearch) - (evil-test-buffer - "so[m]e text with a strange word -and here some other stuff -maybe we need one line more with some text\n" - (setq evil-symbol-word-search nil) - ("*") - "some text with a strange word -and here [s]ome other stuff -maybe we need one line more with some text\n" - ("n") - "some text with a strange word -and here some other stuff -maybe we need one line more with [s]ome text\n" - ("*") - "[s]ome text with a strange word -and here some other stuff -maybe we need one line more with some text\n") - (ert-info ("Test unbounded search") - (evil-select-search-module 'evil-search-module 'isearch) - (evil-test-buffer - "[s]ymbol\n(defun my-symbolfunc ())\n(defvar my-symbolvar)\nanother symbol\n" - (setq evil-symbol-word-search nil) - ("*") - "symbol\n(defun my-symbolfunc ())\n(defvar my-symbolvar)\nanother [s]ymbol\n" - ("ggg*") - "symbol\n(defun my-[s]ymbolfunc ())\n(defvar my-symbolvar)\nanother symbol\n" - ("n") - "symbol\n(defun my-symbolfunc ())\n(defvar my-[s]ymbolvar)\nanother symbol\n")) - (ert-info ("Test symbol search") - (evil-select-search-module 'evil-search-module 'isearch) - (evil-test-buffer - "(defun my-s[y]mbol-func ())\n(defvar my-symbol-var)\n(my-symbol-func)\n(setq my-symbol-func2 (my-symbol-func))\n" - (setq evil-symbol-word-search t) - ("*") - "(defun my-symbol-func ())\n(defvar my-symbol-var)\n([m]y-symbol-func)\n(setq my-symbol-func2 (my-symbol-func))\n" - ("n") - "(defun my-symbol-func ())\n(defvar my-symbol-var)\n(my-symbol-func)\n(setq my-symbol-func2 ([m]y-symbol-func))\n")))) - -(ert-deftest evil-test-read () - "Test of `evil-read'" - :tags '(evil ex) - (evil-without-display - (ert-info ("Test insertion of file with trailing newline") - (evil-with-temp-file name - "temp file 1\ntemp file 2\n" - (ert-info ("At first line") - (evil-test-buffer - "[l]ine 1\nline 2" - ((vconcat ":read " name [return])) - "line 1\n[t]emp file 1\ntemp file 2\nline 2")) - (ert-info ("At last line") - (evil-test-buffer - "line 1\n[l]ine 2" - ((vconcat ":read " name [return])) - "line 1\nline 2\n[t]emp file 1\ntemp file 2\n")) - (ert-info ("After specified line number") - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\nline 4\line 5" - ((vconcat ":3read " name [return])) - "line 1\nline 2\nline 3\n[t]emp file 1\ntemp file 2\nline 4\line 5")) - (ert-info ("After specified line 0") - (evil-test-buffer - "line 1\nline [2]\nline 3\nline 4\line 5" - ((vconcat ":0read " name [return])) - "[t]emp file 1\ntemp file 2\nline 1\nline 2\nline 3\nline 4\line 5")))) - (ert-info ("Test insertion of file without trailing newline") - (evil-with-temp-file name - "temp file 1\ntemp file 2" - (evil-test-buffer - "[l]ine 1\nline 2" - ((vconcat ":read " name [return])) - "line 1\n[t]emp file 1\ntemp file 2\nline 2"))) - (ert-info ("Test insertion of shell command") - (ert-info ("with space") - (evil-test-buffer - "[l]line 1\nline 2" - (":read !echo cmd line 1" [return]) - "line 1\n[c]md line 1\nline 2")) - (ert-info ("without space") - (evil-test-buffer - "[l]line 1\nline 2" - (":read!echo cmd line 1" [return]) - "line 1\n[c]md line 1\nline 2"))) - (ert-info ("Test substitution of % in shell commands") - (evil-with-temp-file name - "3\n2\n1\n" - (evil-test-buffer - (":e " name [return]) - "[3]\n2\n1\n" - (":read !echo %" [return] ":w" [return]) - (file name (concat "3\n" - (buffer-file-name) "\n" - "2\n" - "1\n"))))) - (ert-info ("Ensure that point ends up at the last line of shell output, if any") - (evil-with-temp-file name - "3\n2\n1\n" - (evil-test-buffer - "[l]ine 1\nline 2" - ((vconcat ":read !cat " name [return])) - "line 1\n3\n2\n[1]\nline 2"))) - (ert-info ("Test insertion of shell command without trailing newline") - (ert-info ("with space") - (evil-test-buffer - "[l]line 1\nline 2" - (":read !echo -n cmd line 1" [return]) - "line 1\n[c]md line 1\nline 2")) - (ert-info ("without space") - (evil-test-buffer - "[l]line 1\nline 2" - (":read!echo -n cmd line 1" [return]) - "line 1\n[c]md line 1\nline 2"))))) - -(ert-deftest evil-test-shell-command () - "Test `evil-shell-command'." - (ert-info ("ex shell command") - (evil-test-buffer - "[l]ine 5\nline 4\nline 3\nline 2\nline 1\n" - (":2,3!sort" [return]) - "line 5\n[l]ine 3\nline 4\nline 2\nline 1\n")) - (ert-info ("shell command operator with count") - (evil-test-buffer - "line 5\n[l]ine 4\nline 3\nline 2\nline 1\n" - ("2!!sort" [return]) - "line 5\n[l]ine 3\nline 4\nline 2\nline 1\n")) - (ert-info ("shell command operator with motion") - (evil-test-buffer - "line 5\n[l]ine 4\nline 3\nline 2\nline 1\n" - ("!jsort" [return]) - "line 5\n[l]ine 3\nline 4\nline 2\nline 1\n")) - (ert-info ("shell command operator with backward motion") - (evil-test-buffer - "line 5\nline 4\n[l]ine 3\nline 2\nline 1\n" - ("!ksort" [return]) - "line 5\n[l]ine 3\nline 4\nline 2\nline 1\n")) - (ert-info ("shell command operator with visual selection") - (evil-test-buffer - "line 5\n[l]ine 4\nline 3\nline 2\nline 1\n" - ("vj!sort" [return]) - "line 5\n[l]ine 3\nline 4\nline 2\nline 1\n"))) - -(defmacro evil-with-both-search-modules (&rest body) - `(mapc (lambda (search-module) - (setq evil-search-forward-history nil - evil-search-backward-history nil - evil-ex-search-history nil) - (evil-select-search-module 'evil-search-module search-module) - ,@body) - '(isearch evil-search))) - -(ert-deftest evil-test-global () - "Test `evil-ex-global'." - :tags '(evil ex global) - (ert-info ("global delete") - (evil-test-buffer - "[n]o 1\nno 2\nno 3\nyes 4\nno 5\nno 6\nno 7\n" - (":g/yes/d" [return]) - "no 1\nno 2\nno 3\n[n]o 5\nno 6\nno 7\n")) - (ert-info ("global delete, specifying case sensitivty") - (evil-test-buffer - "[a]lpha bravo charlie\nalpha Bravo charlie\nalpha BRAVO charlie\nalpha delta charlie" - (":g/\\CBravo/d" [return]) - "alpha bravo charlie\n[a]lpha BRAVO charlie\nalpha delta charlie" - (":g/\\cBravo/d" [return]) - "alpha delta charlie")) - (ert-info ("global delete with arg") - (evil-test-buffer - "[n]o 1\nno 2\nno 3\nyes 4\nno 5\nno 6\nno 7\n" - (":g/yes/d2" [return]) - "no 1\nno 2\nno 3\n[n]o 6\nno 7\n")) - (ert-info ("global delete with range") - (evil-test-buffer - "alpha\nbravo\ncharlie\ndelta\ncharlie\necho\ngolf\ncharlie\nhotel" - (":g/charlie/-1d") - "alpha\ncharlie\ncharlie\necho\ncharlie\nhotel")) - (ert-info ("global substitute") - (evil-test-buffer - "[n]o 1\nno 2\nno 3\nyes 4\nno 5\nno 6\nno 7\n" - (":g/no/s/[3-6]/x" [return]) - "no 1\nno 2\nno x\nyes 4\nno x\nno x\n[n]o 7\n" - ("u") - "no 1\nno 2\nno [3]\nyes 4\nno 5\nno 6\nno 7\n")) - (ert-info ("global substitute with trailing slash") - (evil-test-buffer - "[n]o 1\nno 2\nno 3\nyes 4\nno 5\nno 6\nno 7\n" - (":g/no/s/[3-6]/x/" [return]) - "no 1\nno 2\nno x\nyes 4\nno x\nno x\n[n]o 7\n" - ("u") - "no 1\nno 2\nno [3]\nyes 4\nno 5\nno 6\nno 7\n")) - (evil-select-search-module 'evil-search-module 'evil-search) - (ert-info ("global use last match if none given, with evil-search") - (evil-test-buffer - "[n]o 1\nno 2\nno 3\nyes 4\nno 5\nno 6\nno 7\n" - ("/yes" [return]) - "no 1\nno 2\nno 3\nyes 4\nno 5\nno 6\nno 7\n" - (":g//d" [return]) - "no 1\nno 2\nno 3\n[n]o 5\nno 6\nno 7\n" - (":v//d" [return]) - "")) - (evil-select-search-module 'evil-search-module 'isearch) - (ert-info ("global use last match if none given, with isearch") - (evil-test-buffer - "[n]o 1\nno 2\nno 3\nisearch 4\nno 5\nno 6\nno 7\n" - ("/isearch" [return]) - "no 1\nno 2\nno 3\nisearch 4\nno 5\nno 6\nno 7\n" - (":g//d" [return]) - "no 1\nno 2\nno 3\n[n]o 5\nno 6\nno 7\n" - (":v//d" [return]) - "")) - (ert-info (":global should take into account evil-ex-search-case") - (evil-with-both-search-modules - (let ((evil-ex-search-case 'sensitive)) - (evil-test-buffer - "this\nThis\n" - (":g/this/d" [return]) - "This\n")) - (let ((evil-ex-search-case 'insensitive)) - (evil-test-buffer - "this\nThis\n" - (":g/this/d" [return]) - "")) - (let ((evil-ex-search-case 'smart)) - (evil-test-buffer - "this\nThis\n" - (":g/this/d" [return]) - "") - (evil-test-buffer - "this\nThis\n" - (":g/This/d" [return]) - "this\n")))) - (ert-info (":global should transform vim-style regexp when appropriate") - (let ((evil-ex-search-vim-style-regexp t)) - (evil-test-buffer - "a\n1\nb\n2\nc\n3\n" - (":g/\\d/>") - "a\n 1\nb\n 2\nc\n 3\n")))) - -(ert-deftest evil-test-normal () - "Test `evil-ex-normal'." - :tags '(evil ex) - (let (evil-want-fine-undo) - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\nline 4\nline 5\n" - (":normal lxIABC" [escape] "AXYZ" [return]) - "ABClne 1XY[Z]\nline 2\nline 3\nline 4\nline 5\n" - (":3,4normal lxIABC" [escape] "AXYZ" [return]) - "ABClne 1XYZ\nline 2\nABClne 3XYZ\nABClne 4XY[Z]\nline 5\n" - ("u") - "ABClne 1XYZ\nline 2\nl[i]ne 3\nline 4\nline 5\n"))) - -(ert-deftest evil-test-copy () - :tags '(evil ex) - "Test `evil-copy'." - (ert-info ("Copy to last line") - (evil-test-buffer - "[l]ine1\nline2\nline3\nline4\nline5\n" - (":2,3copy$") - "line1\nline2\nline3\nline4\nline5\nline2\n[l]ine3\n")) - (ert-info ("Copy to last incomplete line") - (evil-test-buffer - "[l]ine1\nline2\nline3\nline4\nline5" - (":2,3copy$") - "line1\nline2\nline3\nline4\nline5\nline2\n[l]ine3\n")) - (ert-info ("Copy incomplete line to last incomplete line") - (evil-test-buffer - "[l]ine1\nline2\nline3\nline4\nline5" - (":4,5copy$") - "line1\nline2\nline3\nline4\nline5\nline4\n[l]ine5\n")) - (ert-info ("Copy to first line") - (evil-test-buffer - "[l]ine1\nline2\nline3\nline4\nline5\n" - (":2,3copy0") - "line2\n[l]ine3\nline1\nline2\nline3\nline4\nline5\n")) - (ert-info ("Copy to intermediate line") - (evil-test-buffer - "[l]ine1\nline2\nline3\nline4\nline5\n" - (":2,4copy2") - "line1\nline2\nline2\nline3\n[l]ine4\nline3\nline4\nline5\n")) - (ert-info ("Copy to current line") - (evil-test-buffer - "line1\nline2\nline3\nli[n]e4\nline5\n" - (":2,4copy.") - "line1\nline2\nline3\nline4\nline2\nline3\n[l]ine4\nline5\n"))) - -(ert-deftest evil-test-move () - :tags '(evil ex) - "Test `evil-move'." - (ert-info ("Move to last line") - (evil-test-buffer - "[l]ine1\nline2\nline3\nline4\nline5\n" - (":2,3move$") - "line1\nline4\nline5\nline2\n[l]ine3\n")) - (ert-info ("Move to last incomplete line") - (evil-test-buffer - "[l]ine1\nline2\nline3\nline4\nline5" - (":2,3move$") - "line1\nline4\nline5\nline2\n[l]ine3\n")) - (ert-info ("Move incomplete line to last incomplete line") - (evil-test-buffer - "[l]ine1\nline2\nline3\nline4\nline5" - (":4,5move$") - "line1\nline2\nline3\nline4\n[l]ine5\n")) - (ert-info ("Move to first line") - (evil-test-buffer - "[l]ine1\nline2\nline3\nline4\nline5\n" - (":2,3move0") - "line2\n[l]ine3\nline1\nline4\nline5\n")) - (ert-info ("Move to intermediate line") - (evil-test-buffer - "[l]ine1\nline2\nline3\nline4\nline5\n" - (":2,4move2") - "line1\nline2\nline3\n[l]ine4\nline5\n")) - (ert-info ("Move to other line") - (evil-test-buffer - "[l]ine1\nline2\nline3\nline4\nline5\n" - (":2,3move4") - "line1\nline4\nline2\n[l]ine3\nline5\n")) - (ert-info ("Move to current line") - (evil-test-buffer - "line1\nline2\nline3\nli[n]e4\nline5\n" - (":2,4move.") - "line1\nline2\nline3\n[l]ine4\nline5\n")) - (ert-info ("Move to backwards line, searching forwards (wrapping around)") - (evil-test-buffer - " -Target -Other line -[S]ource -" - (":move/Target/") - " -Target -[S]ource -Other line -")) - (ert-info ("Move to forwards line, searching backwards (wrapping around)") - (evil-test-buffer - " -Target -[O]ther line -Source -" - (":move?Source?") - " -Target -Source -[O]ther line -")) - (ert-info ("Move with global (classic line reversal)") - (evil-test-buffer - "5\n4\n3\n2\n1\n" - (":g/^/m0") - "1\n2\n3\n4\n5\n") - (ert-info ("... and visual selection") - (evil-test-buffer - "<5\n4\n3\n2\n[1]>\n" - (":g/^/m0") - "1\n2\n3\n4\n5\n")) - (ert-info ("... and no last blank line") - (evil-test-buffer - "5\n4\n3\n2\n1" - (":g/^/m0") - "1\n2\n3\n4\n5")))) - -(ert-deftest evil-test-write () - :tags '(evil ex) - "Test `evil-write'." - (ert-info ("Write open file") - (evil-with-temp-file filename "line1\nline2\nline3\n" - (evil-test-buffer - ((vconcat ":e " filename [return])) - "[l]ine1\nline2\nline3\n" - ("Galine4\nline5\n" [escape]) - "line1\nline2\nline3\nline4\nline5\n" - (":w") - (file filename "line1\nline2\nline3\nline4\nline5\n")))) - (ert-info ("Write current buffer to new file") - (let ((filename (make-temp-file "evil-test-write"))) - (evil-test-buffer - "[l]ine1\nline2\nline3\nline4\nline5\n" - (delete-file filename) - ((vconcat ":w " filename [return])) - (file filename "line1\nline2\nline3\nline4\nline5\n") - (delete-file filename)))) - (ert-info ("Write part of a buffer") - (let ((filename (make-temp-file "evil-test-write"))) - (evil-test-buffer - "[l]ine1\nline2\nline3\nline4\nline5\n" - (delete-file filename) - ((vconcat ":2,3w " filename [return])) - (file filename "line2\nline3\n") - (delete-file filename)))) - (ert-info ("Appending a file") - (let ((filename (make-temp-file "evil-test-write"))) - (evil-test-buffer - "[l]ine1\nline2\nline3\nline4\nline5\n" - (delete-file filename) - ((vconcat ":4w " filename [return])) - (file filename "line4\n") - ((vconcat ":1,2w >>" filename [return])) - (file filename "line4\nline1\nline2\n") - ((vconcat ":w >> " filename [return])) - (file filename - "line4\nline1\nline2\nline1\nline2\nline3\nline4\nline5\n") - (delete-file filename))))) - -(ert-deftest evil-test-ex-sort () - :tags '(evil ex) - "Text Ex command \":sort\" (`evil-ex-sort')." - (ert-info ("Plain sort") - (evil-test-buffer - "[z]zyy\ntest\ntEst\ntesT\nTEST\ntest\n" - (":sort") - "[T]EST\ntEst\ntesT\ntest\ntest\nzzyy\n")) - (ert-info ("Reverse sort") - (evil-test-buffer - "[z]zyy\ntest\ntEst\ntesT\nTEST\ntest\n" - (":sort!") - "[z]zyy\ntest\ntest\ntesT\ntEst\nTEST\n")) - (ert-info ("case insensitive") - (evil-test-buffer - "[z]zyy\ntest\ntEst\ntesT\nTEST\ntest\n" - (":sort i") - "[t]est\ntEst\ntesT\nTEST\ntest\nzzyy\n")) - (ert-info ("unique") - (evil-test-buffer - "[z]zyy\ntest\ntEst\ntesT\nTEST\ntest\n" - (":sort u") - "[T]EST\ntEst\ntesT\ntest\nzzyy\n")) - (ert-info ("case insensitive and unique") - (evil-test-buffer - "[z]zyy\ntest\ntEst\ntesT\nTEST\ntest\n" - (":sort iu") - "[t]est\nzzyy\n")) - (ert-info ("pattern sort") - (evil-test-buffer - "[t]e|z|t\nzz|a|y\n" - (":sort /|[a-z]|/ r") - ("zz|a|y\nte|z|t\n")) - (evil-test-buffer - "[a],b\nb,a\n" - (":sort /[^,]*,/") - "b,a\na,b\n") - (evil-test-buffer - "[a],b\nb,a\n" - ("/," [return] ":sort //") - "b,a\na,b\n")) - (ert-info ("numeric sort") - (ert-info ("decimal") - (evil-test-buffer - "27\n027\n2\na\n1\n" - (":sort n") - "a\n1\n2\n27\n027\n")) - (ert-info ("octal") - (evil-test-buffer - "9\n8\n" - (":sort o") - "9\n8\n") - (evil-test-buffer - "777\n776\n7239\n" - (":sort o") - "7239\n776\n777\n")) - (ert-info ("hexadecimal") - (evil-test-buffer - "0xae\n0xb\nae\nad\n" - (":sort x") - "0xb\nad\n0xae\nae\n")))) - -;;; Command line window - -(ert-deftest evil-test-command-window-ex () - "Test command line window for Ex commands." - (let ((evil-ex-history (list "s/foo/baz" "s/foo/bar"))) - (evil-test-buffer "[b]ar baz foo" - ("q:") - "s/foo/bar\ns/foo/baz\n[]\n" - ("kk:s/bar/quz" [return]) - "[s]/foo/quz\ns/foo/baz\n" - ("fzrx" [return]) - "[b]ar baz qux" - (should (equal (car evil-ex-history) "s/foo/qux"))))) - -(ert-deftest evil-test-command-window-noop () - "Test that executing a blank command does nothing." - (evil-test-buffer "[f]oo foo foo" - ("q:") - "[]\n" - ([return]) - "[f]oo foo foo")) - -(ert-deftest evil-test-command-window-search-history () - "Test command window with forward and backward search history." - (let ((evil-search-module 'isearch) - (evil-search-forward-history (list "four" "three" "qux")) - (evil-search-backward-history (list "baz" "bar"))) - (evil-test-buffer "foo bar [b]az qux one two three four" - ("q/") - "qux\nthree\nfour\n[]\n" - ("k" [return]) - "foo bar baz qux one two three [f]our" - ("0N") - "foo bar baz qux one two three [f]our" - ("q?") - "bar\nbaz\n[]\n" - ("k$rr" [return]) - "foo [b]ar baz qux one two three four" - (error 'user-error "q/iNOT THERE" [return]) - "foo [b]ar baz qux one two three four"))) - -(ert-deftest evil-test-command-window-search-word () - "Test command window history when searching for word under cursor." - (let ((evil-search-module 'isearch)) - (evil-test-buffer - "[f]oo bar foo bar foo" - ("**") - "foo bar foo bar [f]oo" - ("B#") - "foo [b]ar foo bar foo" - ("q/k" [return]) - "foo bar [f]oo bar foo" - ("q?k" [return]) - "foo [b]ar foo bar foo"))) - -;;; Window motions - -(ert-deftest evil-test-window-next-and-prev-respect-window-parameters () - "Test that `evil-window-next' and `evil-window-prev' respect window parameters. -E.g. they do not move to windows that have the `no-other-window' -parameter set." - (save-window-excursion - ;; Make sure there is a single original window and open a second - ;; other window with `no-other-window' set. - (delete-other-windows) - (let* ((this-window (selected-window)) - (other-window (split-window))) - (set-window-parameter other-window 'no-other-window t) - ;; `evil-window-next'/`evil-window-prev' should not switch to - ;; the window with `no-other-window' parameter set. - (evil-window-next nil) - (should (eq (selected-window) this-window)) - (evil-window-prev nil) - (should (eq (selected-window) this-window))))) - -;;; Utilities - -(ert-deftest evil-test-parser () - "Test `evil-parser'" - (with-temp-buffer - (cl-flet - ((parse - (s &rest args) - (erase-buffer) - (insert s) - (goto-char (point-min)) - (apply - (evil-parser - '((number "[0-9]+" #'string-to-number) - (plus "\\+" #'intern) - (minus "-" #'intern) - (operator - plus - minus) - (sign (\? operator)) - (signed-number (sign number)) - (expr - ("foo" (& "bar")) - ("xxx" (! "yyy")) - (number operator number)) - (epsilon nil)) - expr operator plus signed-number number epsilon) - args))) - (ert-info ("Nothing") - (should (equal (parse "1+2" 'epsilon) '(nil)))) - (ert-info ("Symbols") - (should (equal (parse "+" 'plus) '((intern "+")))) - (should (equal (parse "+" 'operator) '((intern "+"))))) - (ert-info ("Leading whitespace") - (should (equal (parse " 1" 'number) '((string-to-number "1"))))) - (ert-info ("Syntax tree") - (should (equal (parse "1" 'signed-number t) - '((signed-number (sign . 1) (number . 2)))))) - (ert-info ("Lookahead") - (should (equal (parse "foobar" 'expr) '((list "foo")))) - (should (null (parse "foobaz" 'expr))) - (should (null (parse "xxxyyy" 'expr))) - (should (equal (parse "xxxzzz" 'expr) '((list "xxx"))))) - (ert-info ("Semantic actions") - (should (equal (parse "1+1" 'expr) - '((list - (string-to-number "1") - (intern "+") - (string-to-number "1"))))))))) - -(ert-deftest evil-test-delimited-arguments () - "Test `evil-delimited-arguments'" - :tags '(evil util) - (ert-info ("Any number of arguments") - (should (equal (evil-delimited-arguments "/a/b/c/") - '("a" "b" "c"))) - (should (equal (evil-delimited-arguments "/a/b/c") - '("a" "b" "c"))) - (should (equal (evil-delimited-arguments "/a/b//") - '("a" "b" ""))) - (should (equal (evil-delimited-arguments "/a///") - '("a" "" ""))) - (should (equal (evil-delimited-arguments "/a/ ") - '("a" " "))) - (should (equal (evil-delimited-arguments "/a/") - '("a"))) - (should (equal (evil-delimited-arguments "//b//") - '("" "b" ""))) - (should (equal (evil-delimited-arguments "/a//c") - '("a" "" "c"))) - (should (equal (evil-delimited-arguments "////") - '("" "" ""))) - (should (equal (evil-delimited-arguments "/") - nil)) - (should (equal (evil-delimited-arguments " ") - nil)) - (should (equal (evil-delimited-arguments "") - nil))) - (ert-info ("Two arguments") - (should (equal (evil-delimited-arguments "/a/b/c" 2) - '("a" "b/c"))) - (should (equal (evil-delimited-arguments "/a/b/" 2) - '("a" "b"))) - (should (equal (evil-delimited-arguments "/a/b" 2) - '("a" "b"))) - (should (equal (evil-delimited-arguments "/a//" 2) - '("a" ""))) - (should (equal (evil-delimited-arguments "/a/ " 2) - '("a" " "))) - (should (equal (evil-delimited-arguments "/a/" 2) - '("a" nil))) - (should (equal (evil-delimited-arguments "/a" 2) - '("a" nil))) - (should (equal (evil-delimited-arguments " " 2) - '(nil nil))) - (should (equal (evil-delimited-arguments "" 2) - '(nil nil)))) - (ert-info ("One argument") - (should (equal (evil-delimited-arguments "/a/b/c" 1) - '("a/b/c"))) - (should (equal (evil-delimited-arguments "/a/ " 1) - '("a"))) - (should (equal (evil-delimited-arguments "/a/" 1) - '("a"))) - (should (equal (evil-delimited-arguments "/a" 1) - '("a"))) - (should (equal (evil-delimited-arguments "/" 1) - '(nil))) - (should (equal (evil-delimited-arguments " " 1) - '(nil))) - (should (equal (evil-delimited-arguments "" 1) - '(nil)))) - (ert-info ("Zero arguments") - (should (equal (evil-delimited-arguments "/a" 0) - nil)) - (should (equal (evil-delimited-arguments "/" 0) - nil)) - (should (equal (evil-delimited-arguments " " 0) - nil)) - (should (equal (evil-delimited-arguments "" 0) - nil)))) - -(ert-deftest evil-test-concat-charsets () - "Test `evil-concat-charsets'" - :tags '(evil util) - (ert-info ("Bracket") - (should (equal (evil-concat-charsets "abc" "]def") - "]abcdef"))) - (ert-info ("Complement") - (should (equal (evil-concat-charsets "^abc" "def") - "^abcdef")) - (should (equal (evil-concat-charsets "^abc" "^def") - "^abcdef"))) - (ert-info ("Hyphen") - (should (equal (evil-concat-charsets "abc" "-def") - "-abcdef")) - (should (equal (evil-concat-charsets "^abc" "-def") - "^-abcdef"))) - (ert-info ("Newline") - (should (equal (evil-concat-charsets "^ \t\r\n" "[:word:]_") - "^ \t\r\n[:word:]_")))) - -(ert-deftest evil-test-properties () - "Test `evil-get-property' and `evil-put-property'" - :tags '(evil util) - (defvar evil--alist) - (let (evil--alist) - (ert-info ("Set properties") - (evil-put-property 'evil--alist 'wibble :foo t) - (should (equal evil--alist '((wibble . (:foo t))))) - (evil-put-property 'evil--alist 'wibble :bar nil) - (should (equal evil--alist '((wibble . (:foo t :bar nil))))) - (evil-put-property 'evil--alist 'wobble :foo nil :bar nil :baz t) - (should (equal evil--alist '((wobble . (:foo nil :bar nil :baz t)) - (wibble . (:foo t :bar nil)))))) - (ert-info ("Get properties") - (should (evil-get-property evil--alist 'wibble :foo)) - (should-not (evil-get-property evil--alist 'wibble :bar)) - (should-not (evil-get-property evil--alist 'wobble :foo)) - (should-not (evil-get-property evil--alist 'wibble :baz)) - (should (equal (evil-get-property evil--alist t :foo) - '((wibble . t) (wobble . nil)))) - (should (equal (evil-get-property evil--alist t :bar) - '((wibble . nil) (wobble . nil)))) - (should (equal (evil-get-property evil--alist t :baz) - '((wobble . t))))))) - -(ert-deftest evil-test-filter-list () - "Test `evil-filter-list'" - :tags '(evil util) - (ert-info ("Return filtered list") - (should (null (evil-filter-list #'null '(nil)))) - (should (equal (evil-filter-list #'null '(nil 1)) '(1))) - (should (equal (evil-filter-list #'null '(nil 1 2 nil)) '(1 2))) - (should (equal (evil-filter-list #'null '(nil nil 1)) '(1))) - (should (equal (evil-filter-list #'null '(nil 1 nil 2 nil 3)) - '(1 2 3)))) - (ert-info ("Remove matches by side-effect when possible") - (let (list) - (setq list '(1 nil)) - (evil-filter-list #'null list) - (should (equal list '(1))) - - (setq list '(1 nil nil)) - (evil-filter-list #'null list) - (should (equal list '(1))) - - (setq list '(1 nil nil 2)) - (evil-filter-list #'null list) - (should (equal list '(1 2))) - - (setq list '(1 nil 2 nil 3)) - (evil-filter-list #'null list) - (should (equal list '(1 2 3)))))) - -(ert-deftest evil-test-concat-lists () - "Test `evil-concat-lists' and `evil-concat-alists'" - :tags '(evil util) - (ert-info ("Remove duplicates across lists") - (should (equal (evil-concat-lists - nil '(a b) '(b c)) - '(a b c)))) - (ert-info ("Remove duplicates inside lists") - (should (equal (evil-concat-lists - '(a a b) nil '(b c) nil) - '(a b c)))) - (ert-info ("Remove duplicate associations") - (should (equal (evil-concat-alists - '((a . b)) '((a . c))) - '((a . c)))) - (should-not (equal (evil-concat-lists - '((a . b)) '((a . c))) - '((a . b)))))) - -(ert-deftest evil-test-sort () - "Test `evil-sort'." - :tags '(evil util) - (ert-info ("Two elements") - (let ((a 2) (b 1)) - (evil-sort a b) - (should (= a 1)) - (should (= b 2)))) - (ert-info ("Three elements") - (let ((a 3) (b 1) (c 2)) - (evil-sort a b c) - (should (= a 1)) - (should (= b 2)) - (should (= c 3)))) - (ert-info ("Four elements") - (let ((a 4) (b 3) (c 2) (d 1)) - (evil-sort a b c d) - (should (= a 1)) - (should (= b 2)) - (should (= c 3)) - (should (= d 4))))) - -(ert-deftest evil-test-read-key () - "Test `evil-read-key'" - :tags '(evil util) - (let ((unread-command-events '(?A))) - (ert-info ("Prevent downcasing in `this-command-keys'") - (should (eq (evil-read-key) ?A)) - (should (equal (this-command-keys) "A"))))) - -(ert-deftest evil-test-extract-count () - "Test `evil-extract-count'" - :tags '(evil util) - (evil-test-buffer - (ert-info ("Exact without count") - (should (equal (evil-extract-count "x") - (list nil 'evil-delete-char "x" nil))) - (should (equal (evil-extract-count "g0") - (list nil 'evil-beginning-of-visual-line "g0" nil)))) - - (ert-info ("Exact with count") - (should (equal (evil-extract-count "420x") - (list 420 'evil-delete-char "x" nil))) - (should (equal (evil-extract-count (vconcat "420" [M-right])) - (list 420 (key-binding [M-right]) (vconcat [M-right]) nil))) - (should (equal (evil-extract-count "2301g0") - (list 2301 'evil-beginning-of-visual-line "g0" nil)))) - - (ert-info ("Extra elements without count") - (should (equal (evil-extract-count "xAB") - (list nil 'evil-delete-char "x" "AB"))) - (should (equal (evil-extract-count "g0CD") - (list nil 'evil-beginning-of-visual-line "g0" "CD")))) - - (ert-info ("Extra elements with count") - (should (equal (evil-extract-count "420xAB") - (list 420 'evil-delete-char "x" "AB"))) - (should (equal (evil-extract-count "2301g0CD") - (list 2301 'evil-beginning-of-visual-line "g0" "CD")))) - - (ert-info ("Exact \"0\" count") - (should (equal (evil-extract-count "0") - (list nil 'evil-beginning-of-line - "0" nil)))) - - (ert-info ("Extra elements and \"0\"") - (should (equal (evil-extract-count "0XY") - (list nil 'evil-beginning-of-line - "0" "XY")))) - - (ert-info ("Count only") - (should-error (evil-extract-count "1230"))) - - (ert-info ("Unknown command") - (should-error (evil-extract-count "°")) - (should-error (evil-extract-count "12°"))))) - -(ert-deftest evil-transform-vim-style-regexp () - "Test `evil-transform-vim-style-regexp'" - (dolist (repl '((?s . "[[:space:]]") - (?S . "[^[:space:]]") - (?d . "[[:digit:]]") - (?D . "[^[:digit:]]") - (?x . "[[:xdigit:]]") - (?X . "[^[:xdigit:]]") - (?o . "[0-7]") - (?O . "[^0-7]") - (?a . "[[:alpha:]]") - (?A . "[^[:alpha:]]") - (?l . "[a-z]") - (?L . "[^a-z]") - (?u . "[A-Z]") - (?U . "[^A-Z]") - (?y . "\\s") - (?Y . "\\S") - (?w . "\\w") - (?W . "\\W"))) - (ert-info ((format "Test transform from '\\%c' to '%s'" - (car repl) (cdr repl))) - (should (equal (evil-transform-vim-style-regexp - (concat "xxx\\" - (char-to-string (car repl)) - "\\" - (char-to-string (car repl)) - "\\\\" - (char-to-string (car repl)) - "\\\\\\" - (char-to-string (car repl)) - "yyy")) - (concat "xxx" - (cdr repl) - (cdr repl) - "\\\\" - (char-to-string (car repl)) - "\\\\" - (cdr repl) - "yyy")))))) - -;;; Advice - -(ert-deftest evil-test-eval-last-sexp () - "Test advised `evil-last-sexp'" - :tags '(evil advice) - (ert-info ("Normal state") - (evil-test-buffer - "(+ 1 (+ 2 3[)])" - ("1" (kbd "C-x C-e")) - "(+ 1 (+ 2 35[)])")) - (ert-info ("Insert state") - (evil-test-buffer - "(+ 1 (+ 2 3[)])" - ("i" (kbd "C-u") (kbd "C-x C-e") [escape]) - "(+ 1 (+ 2 3[3]))")) - (ert-info ("Emacs state") - (evil-test-buffer - "(+ 1 (+ 2 3[)])" - ((kbd "C-z") (kbd "C-u") (kbd "C-x C-e")) - "(+ 1 (+ 2 33[)])"))) - -;;; ESC - -(ert-deftest evil-test-esc-count () - "Test if prefix-argument is transferred for key sequences with meta-key" - :tags '(evil esc) - (unless noninteractive - (ert-info ("Test M-") - (evil-test-buffer - "[A]BC DEF GHI JKL MNO" - ("3" (kbd "ESC ")) - "ABC DEF GHI[ ]JKL MNO")) - (ert-info ("Test shell-command") - (evil-test-buffer - "[A]BC DEF GHI JKL MNO" - ("1" (kbd "ESC !") "echo TEST" [return]) - "[T]EST\nABC DEF GHI JKL MNO")))) - -(when (or evil-tests-profiler evil-tests-run) - (evil-tests-initialize)) - -(ert-deftest evil-test-black-hole-register () - :tags '(evil) - (ert-info ("Test \"_ on delete word") - (evil-test-buffer - "[E]vil evil is awesome." - ("dw\"_dwP") - "Evil[ ]is awesome.")) - (ert-info ("Test \"_ on delete line") - (evil-test-buffer - "[T]his line is a keeper!\nThis line is not." - ("dd\"_ddP") - "[T]his line is a keeper!")) - (ert-info ("Test \"_ on delete region") - (evil-test-buffer - "!\nThis line is not." - ("d\gg\"_dGP") - "This region is a keepe[r]"))) - -(ert-deftest evil-test-pasteable-macros () - "Test if we can yank and paste macros containing - " - :tags '(evil) - (ert-info ("Execute yanked macro") - (evil-test-buffer - "[i]foo\e" - ("\"qD@q\"qp" - "fooifoo\e"))) - (ert-info ("Paste recorded marco") - (evil-test-buffer - (evil-set-register ?q (vconcat "ifoo" [escape])) - ("@q\"qp") - "fooifoo\e"))) - -(ert-deftest evil-test-forward-symbol () - :tags '(evil) - (ert-info ("Test symbol deletion") - (evil-test-buffer - "(test [t]his (hello there) with dao)" - ("dao") - "(test [(]hello there) with dao)")) - (ert-info ("Test symbol motion") - (evil-test-buffer - "(test[ ](hello there) with dao)" - (should (eq 0 (forward-evil-symbol 1))) - "(test ([h]ello there) with dao)" - (should (eq 0 (forward-evil-symbol 1))) - "(test (hello[ ]there) with dao)")) - (ert-info ("Test dio on whitespace") - (evil-test-buffer - "(test[ ]dio with whitespace)" - ("dio") - "(test[d]io with whitespace)")) - (ert-info ("Test dao/dio with empty lines") - (evil-test-buffer - "there are two lines in this file\n[\n]and some whitespace between them" - ("dao") - "there are two lines in this file\n[a]nd some whitespace between them") - (evil-test-buffer - "here are another two lines\n[\n]with a blank line between them" - ("dio") - "here are another two lines\n[w]ith a blank line between them")) - (ert-info ("Test dao/dio with empty lines and punctuation") - (evil-test-buffer - "These two lines \n[\n]!have punctuation on them" - ("dao") - "These two lines \n[!]have punctuation on them"))) - -(ert-deftest evil-test-jump () - :tags '(evil jumps) - (let ((evil--jumps-buffer-targets "\\*\\(new\\|scratch\\|test\\)\\*")) - (ert-info ("Test jumping backward and forward in a single buffer") - (evil-test-buffer - "[z] z z z z z z z z z" - ("/z" [return]) - "z [z] z z z z z z z z" - ("nnnn") - "z z z z z [z] z z z z" - ("\C-o") - "z z z z [z] z z z z z" - ("\C-o") - "z z z [z] z z z z z z" - ("\C-i\C-i") - "z z z z z [z] z z z z")) - (ert-info ("Test jumping backward and forward with counts") - (evil-test-buffer - "[z] z z z z z z z z z" - ("/z" [return] "nnnn") - "z z z z z [z] z z z z" - ("3\C-o") - "z z [z] z z z z z z z" - ("2\C-i") - "z z z z [z] z z z z z" - )) - (ert-info ("Jump list branches off when new jump is set") - (evil-test-buffer - "[z] z z z z z z z" - ("/z" [return] "nnnn4\C-o") ;; adds a bunch of jumps after the 2nd z - "z [z] z z z z z z" - ("/z" [return]) ;; sets a new jump, list should be reset - "z z [z] z z z z z" - ("\C-o") - "z [z] z z z z z z" - ("3\C-i") ;; even after jumping forward 3 times it can't get past the 3rd z - "z z [z] z z z z z")) - (ert-info ("Jump across files") - (let ((temp-file (make-temp-file "evil-test-"))) - (unwind-protect - (evil-test-buffer - "[z] z z z z z z" - ("\M-x" "find-file" [return] temp-file [return] "inew buffer" [escape]) - "new buffe[r]" - ("\C-o") - "[z] z z z z z z" - ("\C-i") - "new buffe[r]") - (delete-file temp-file) - (let ((buf (file-name-nondirectory temp-file))) - (when (get-buffer buf) - (with-current-buffer buf (set-buffer-modified-p nil)) - (kill-buffer buf)))))) - (ert-info ("Jump multiple times between files") - (let ((a (make-temp-file "evil-aa-" nil nil "evil-bb\n\nthis is a")) - (b (make-temp-file "evil-bb-" nil nil "evil-cc\n\nthis is b")) - (c (make-temp-file "evil-cc-" nil nil "this is c"))) - (unwind-protect - (evil-test-buffer - (find-file a) - ("gf" [return]) - "evil-cc\n\nthis is b" - ("gf" [return]) - "this is c" - ("\C-o" "\C-o") - "evil-bb\n\nthis is a" - ("\C-i" "\C-i") - "this is c") - (dolist (f (list a b c)) - (let ((buf (file-name-nondirectory f))) - (when (get-buffer buf) - (with-current-buffer buf (set-buffer-modified-p nil)) - (kill-buffer buf))) - (delete-file f))))))) - -(ert-deftest evil-test-find-file () - :tags '(evil jumps) - (when (memq system-type '(cygwin windows-nt ms-dos)) - (ert-skip "[INFO] GitHub Actions has different userprofile name.")) - (ert-info ("Find file at point (normal state)") - (evil-with-temp-file file-name "" - (evil-test-buffer - (vconcat "i" file-name [escape]) - (should-not (equal file-name (buffer-file-name))) - ("gf") - (should (equal file-name (buffer-file-name)))))) - (ert-info ("Find file at point (visual state)") - (evil-with-temp-file file-name "" - (evil-test-buffer - (vconcat "iuser@localhost:" file-name "$" [escape]) - (should-not (equal file-name (buffer-file-name))) - ("0f:lvt$gf") - (should (equal file-name (buffer-file-name)))))) - (ert-info ("Find file at point with line number") - (let* ((line-number 3) - (file-content (make-string (* 2 line-number) ?\n))) - (evil-with-temp-file file-name (insert file-content) - (evil-test-buffer - (vconcat "i" file-name (format ":%d" line-number) [escape]) - (should (and (not (equal file-name (buffer-file-name))) - (not (equal line-number (line-number-at-pos))))) - ("gF") - (should (and (equal file-name (buffer-file-name)) - (equal line-number (line-number-at-pos)))))))) - (ert-info ("Find file at point with line and column numbers") - (let* ((line-number 3) - (column-number 5) - (file-content (mapconcat #'identity - (make-list (* 2 line-number) - (make-string (* 2 column-number) ?\s)) - "\n"))) - (evil-with-temp-file file-name (insert file-content) - (evil-test-buffer - (vconcat "i" file-name (format ":%d:%d" line-number column-number) [escape]) - (should (and (not (equal file-name (buffer-file-name))) - (not (equal line-number (line-number-at-pos))) - (not (equal column-number (current-column))))) - ("gF") - (should (and (equal file-name (buffer-file-name)) - (equal line-number (line-number-at-pos)) - (equal column-number (1+ (current-column)))))))))) - -(ert-deftest evil-test-jump-buffers () - :tags '(evil jumps) - (skip-unless nil) - (ert-info ("Test jumping backward and forward across buffers") - (evil-test-buffer - "[z] z z z z z z z z z" - (":new" [return] "inew buffer" [escape]) - "new buffe[r]" - ("\C-o") - "[z] z z z z z z z z z" - ("\C-i") - "new buffe[r]"))) - -(ert-deftest evil-test-abbrev-expand () - :tags '(evil abbrev) - (ert-info ("Test abbrev expansion on insert state exit") - (define-abbrev-table 'global-abbrev-table - '(("undef" "undefined"))) ; add global abbrev - (evil-test-buffer - "foo unde[f] bar" - (abbrev-mode) - ("a" [escape]) - "foo undefine[d] bar") ; 'undef' should be expanded - (evil-test-buffer - "foo unde[f] bar" - ("a" [escape]) - "foo unde[f] bar") ; 'undef' shouldn't be expanded, - ; abbrev-mode is not enabled - (evil-test-buffer - "fo[o] undef bar" - (abbrev-mode) - ("a" [escape]) - "fo[o] undef bar") ; 'foo' shouldn't be expanded, - ; it's not an abbrev - (kill-all-abbrevs) ; remove all abbrevs - (evil-test-buffer - "foo unde[f] bar" - (abbrev-mode) - ("a" [escape]) - "foo unde[f] bar") ; 'undef' shouldn't be expanded, - ; it's not an abbrev - (setq abbrevs-changed nil))) - -(ert-deftest evil-test-text-object-macro () - :tags '(evil abbrev) - (ert-info ("Test pipe character and other delimiters as object delimiters") - ;; This is the macro that broke after pull #747. - (defmacro evil-test-define-and-bind-text-object (name key start-regex end-regex) - (let ((inner-name (make-symbol (concat "evil-inner-" name))) - (outer-name (make-symbol (concat "evil-a-" name)))) - `(progn - (evil-define-text-object ,inner-name (count &optional beg end _type) - (evil-select-paren ,start-regex ,end-regex beg end type count nil)) - (evil-define-text-object ,outer-name (count &optional beg end _type) - (evil-select-paren ,start-regex ,end-regex beg end type count t)) - (define-key evil-inner-text-objects-map ,key #',inner-name) - (define-key evil-outer-text-objects-map ,key #',outer-name)))) - (evil-test-define-and-bind-text-object "pipe" "|" "|" "|") - (evil-test-define-and-bind-text-object "rackety" "#" "#|" "|#") - - (evil-test-buffer - "#|this i[s] a test #|with rackety|# multiline - and nestable comments|#" - ("vi#") - "#||#") - (evil-test-buffer - "| foo | aoe[u] | bar |" - ("vi|") - "| foo |< aoeu >| bar |" - ("a|") - "| foo <| aoeu |> bar |" - ("a|") - "<| foo | aoeu | bar |>") - (evil-test-buffer - "| foo | aoe[u] | bar |" - ("ci|testing" [escape]) - "| foo |testing| bar |"))) - -(ert-deftest evil-test-kbd-macro () - "Test recording and replaying of macros." - :tags '(evil kbd-macro) - (ert-info ("Execute macro an infinite number of times") - (evil-test-buffer "xxx" - (evil-set-register ?q "ryl") - (error 'end-of-line "\C-u@q") - "yyy"))) - -(ert-deftest evil-test-undo-kbd-macro () - "Test if evil can undo the changes made by a keyboard macro -when an error stops the execution of the macro" - :tags '(evil undo kbd-macro) - (ert-info ("When kbd-macro goes to the end of buffer") - (evil-test-buffer - "[l]ine 1\nline 2\nline 3\nline 4" - (evil-set-register ?q "jdd") - ("jdd") - (should-error (execute-kbd-macro "2@q")) - ("uu") - "line 1\n[l]ine 2\nline 3\nline 4")) - (ert-info ("When kbd-macro goes to the end of line") - (evil-test-buffer - "[f]ofof" - (evil-set-register ?q "lx") - ("lx") - (should-error (execute-kbd-macro "2@q")) - ("uu") - "f[o]fof")) - (ert-info ("When kbd-macro goes to the beginning of buffer") - (evil-test-buffer - "line 1\nline 2\n[l]ine 3" - (evil-set-register ?q "kx") - ("kx") - (should-error (execute-kbd-macro "2@q")) - ("uu") - "line 1\n[l]ine 2\nline 3"))) - -(ert-deftest evil-test-undo-jump () - "Test that undo adds to the jump list." - :tags '(evil) - (let ((evil--jumps-buffer-targets "\\*\\(new\\|scratch\\|test\\)\\*")) - (ert-info ("Undo adds to the jump list") - (evil-test-buffer - "alpha [b]ravo charlie delta" - ("dw" "w") - "alpha charlie [d]elta" - ("u") - "alpha [b]ravo charlie delta" - ("``") - "alpha bravo charlie [d]elta")))) - -(ert-deftest evil-test-insert-state-undo () - "Test that undo isn't lost when done from insert state." - :tags '(evil) - (skip-unless (version<= "28" emacs-version)) - (let (evil-want-fine-undo) - (customize-set-variable 'evil-undo-system 'undo-redo) - (evil-test-buffer - "alpha [ ]delta" - (evil-define-key* 'insert 'local [f8] 'evil-undo) - ("icharlie" [f8] [escape]) - "alpha[ ] delta" - ("\C-r") - "alpha [c]harlie delta"))) - -(ert-deftest evil-test-visual-update-x-selection () - "Test `evil-visual-update-x-selection'." - :tags '(evil) - (ert-info ("Buffer argument isn't a live buffer") - ;; create buffer in normal mode, so we don't try to actually copy anything to - ;; the X selection. - (let ((buf (evil-test-buffer-from-string "foobar"))) - (kill-buffer buf) - ;; should not raise an "Selecting deleted buffer" error - (evil-visual-update-x-selection buf)))) - -(ert-deftest evil-test-append-to-kbd-macro () - "Test if evil can append to a keyboard macro." - :tags '(evil append to kbd-macro) - (ert-info ("When kbd-macro ends in ") - (evil-test-buffer - (evil-set-register ?a (vconcat "ainserted text" [escape])) - (evil-set-register ?A (vconcat "a appended text" [escape])) - ("@a") - "inserted text appended tex[t]"))) - -(ert-deftest evil-test-paren-jumping () - :tags '(evil paren) - (ert-info ("Test doing motions on parens that you aren't in") - (evil-test-buffer - "[m]ain(argc, argv) char **argv; {" - ("dib" [escape]) - "main([)] char **argv; {") - (evil-test-buffer - "[a]lpha (bravo) charlie " - ("yi(") - "alpha ([b]ravo) charlie " - ("$p") - "alpha (bravo) charlie brav[o]") - (evil-test-buffer - "[a]lpha (bravo (charlie))" - ("2di(") - "alpha (bravo ([)]") - (evil-test-buffer - :point-start "(" - :point-end ")" - "(a)lpha [bravo [charlie]] [bravo]" - ("3di[") - "alpha [bravo [charlie]] [(])") - (evil-test-buffer -"[#]include \"stdlib.h\" -main(argc, argv) char **argv; { - while (1) malloc(0); -}" - ("ci{ return 0;" [escape]) -"#include \"stdlib.h\" -main(argc, argv) char **argv; { - return 0[;] -}"))) - -;;; Core - -(ert-deftest evil-test-initial-state () - "Test `evil-initial-state'" - :tags '(evil core) - ;; FIXME: These have a global effect, so better move them out and give them - ;; a proper namespace prefix. - (define-derived-mode test-1-mode prog-mode "Test1") - (define-derived-mode test-2-mode test-1-mode "Test2") - (evil-set-initial-state 'test-1-mode 'insert) - (ert-info ("Check default state") - (should (eq (evil-initial-state 'prog-mode 'normal) 'normal))) - (ert-info ("Basic functionality 1") - (should (eq (evil-initial-state 'test-1-mode) 'insert))) - (ert-info ("Basic functionality 2") - (evil-test-buffer - "abc\ndef\n" - (test-1-mode) - (should (eq evil-state 'insert)))) - (ert-info ("Inherit initial state from a parent") - (evil-test-buffer - "abc\ndef\n" - (test-2-mode) - (should (eq evil-state 'insert)))) - (evil-set-initial-state 'test-1-mode nil) - (ert-info ("Check for inheritance loops") - (evil-test-buffer - "abc\ndef\n" - (unwind-protect - (let ((major-mode 'test-2-mode)) - (put 'test-1-mode 'derived-mode-parent 'test-2-mode) - ;; avoid triggering all of the hooks here, some of which might get - ;; caught in loops depending on the environment. settings major-mode - ;; is sufficient for `evil-initial-state-for-buffer' to work. - (should-error (evil-initial-state-for-buffer))) - (put 'test-1-mode 'derived-mode-parent 'prog-mode)))) - ;; FIXME: Same as above. - (defalias 'test-1-alias-mode #'test-1-mode) - (define-derived-mode test-3-mode test-1-alias-mode "Test3") - (evil-set-initial-state 'test-1-mode 'insert) - (ert-info ("Check inheritance from major mode aliases") - "abc\ndef\n" - (test-3-mode) - (should (eq evil-state 'insert)))) - -(ert-deftest evil-test-keep-input-method () - "Test that the input method is preserved when changing the major mode." - :tags '(evil core input-method) - (cl-flet ((use-german-input-method () (set-input-method "german-prefix"))) - (unwind-protect - (progn - (add-hook 'text-mode-hook #'use-german-input-method) - (evil-test-buffer - "[]" - (should (null evil-input-method)) - ("a\"a" [escape]) - "\"[a]" - (text-mode) - (should (equal evil-input-method "german-prefix")) - ("a\"a" [escape]) - "\"a[ä]" - (emacs-lisp-mode) - (should (equal evil-input-method "german-prefix")))) - (remove-hook 'text-mode-hook #'use-german-input-method)))) - -(ert-deftest evil-retab () - "Test the :retab command" - :tags '(evil) - (ert-info ("From tabs to spaces") - (evil-test-buffer - "def foo():\n\twhile True:\n\t\treturn\n" - (setq indent-tabs-mode nil) - (setq tab-width 4) - (":retab" [return]) - "def foo():\n while True:\n return\n")) - (ert-info ("From spaces to tabs") - (evil-test-buffer - "def foo():\n while True:\n return\n" - (setq indent-tabs-mode t) - (setq tab-width 4) - (":retab" [return]) - "def foo():\n\twhile True:\n\t\treturn\n")) - (ert-info ("Specify tab width as an argument") - (evil-test-buffer - "def foo():\n\twhile True:\n\t\treturn\n" - (setq indent-tabs-mode nil) - (setq tab-width 4) - (":retab 2" [return]) - "def foo():\n while True:\n return\n")) - (ert-info ("Invalid argument") - (evil-test-buffer - "def foo():\n\twhile True:\n\t\treturn\n" - (should-error (execute-kbd-macro ":retab foo" [return]))))) - -(ert-deftest evil-retab-visual () - "Test the :retab command on visual line selection. -This test fails in the batch mode (and therefore in the GitHub CI) -but it works fine in `M-x ert-run-tests-interactively'." - :tags '(evil visual) - (skip-unless (not noninteractive)) - (ert-info ("Retab only selected lines") - (evil-test-buffer - "def foo():\n\twhile True:\n\t\treturn\n" - (setq indent-tabs-mode nil) - (setq tab-width 4) - ("Vj" ":retab" [return]) - "def foo():\n while True:\n\t\treturn\n"))) - -(provide 'evil-tests) - -;;; evil-tests.el ends here diff --git a/.config/emacs/lisp/evil/evil-types.el b/.config/emacs/lisp/evil/evil-types.el deleted file mode 100644 index 360316a..0000000 --- a/.config/emacs/lisp/evil/evil-types.el +++ /dev/null @@ -1,465 +0,0 @@ -;;; evil-types.el --- Type system -*- lexical-binding: t -*- - -;; Author: Vegard Øye -;; Maintainer: Vegard Øye - -;; Version: 1.15.0 - -;; -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -;;; Commentary: - -;; A type defines a transformation on a pair of buffer positions. -;; Types are used by Visual state (character/line/block selection) -;; and Operator-Pending state (character/line/block motions). -;; -;; The basic transformation is "expansion". For example, the `line' -;; type "expands" a pair of positions to whole lines by moving the -;; first position to the beginning of the line and the last position -;; to the end of the line. That expanded selection is what the rest -;; of Emacs sees and acts on. -;; -;; An optional transformation is "contraction", which is the opposite -;; of expansion. If the transformation is one-to-one, expansion -;; followed by contraction always returns the original range. -;; (The `line' type is not one-to-one, as it may expand multiple -;; positions to the same lines.) -;; -;; Another optional transformation is "normalization", which takes -;; two unexpanded positions and adjusts them before expansion. -;; This is useful for cleaning up "invalid" positions. -;; -;; Types are defined at the end of this file using the macro -;; `evil-define-type'. - -(require 'evil-common) -(require 'evil-macros) - -;;; Code: - -;;; Type definitions - -(evil-define-type exclusive - "Return the positions unchanged, with some exceptions. -If the end position is at the beginning of a line, then: - -* If the beginning position is at or before the first non-blank - character on the line, return `line' (expanded). - -* Otherwise, move the end position to the end of the previous - line and return `inclusive' (expanded)." - :normalize (lambda (beg end) - (cond - ((progn - (goto-char end) - (and (/= beg end) (bolp))) - (setq end (max beg (1- end))) - (cond - ((progn - (goto-char beg) - (looking-back "^[ \f\t\v]*" (line-beginning-position))) - (evil-expand beg end 'line)) - (t - (unless evil-cross-lines - (setq end (max beg (1- end)))) - (evil-expand beg end 'inclusive)))) - (t - (evil-range beg end)))) - :string (lambda (beg end) - (let ((width (- end beg))) - (format "%s character%s" width - (if (= width 1) "" "s"))))) - -(evil-define-type inclusive - "Include the character under point. -Handling for `evil-want-visual-char-semi-exclusive' is deprecated, -and will be removed in a future version." - :expand (lambda (beg end) - (if (and (with-no-warnings evil-want-visual-char-semi-exclusive) - (evil-visual-state-p) - (< beg end) - (save-excursion - (goto-char end) - (or (bolp) (eolp)))) - (evil-range beg end 'exclusive) - (evil-range beg (1+ end)))) - :contract (lambda (beg end) - (evil-range beg (max beg (1- end)))) - :normalize (lambda (beg end) - (evil-range beg (if (eq (char-after end) ?\n) - (max beg (1- end)) end))) - :string (lambda (beg end) - (let ((width (- end beg))) - (format "%s character%s" width - (if (= width 1) "" "s"))))) - -(evil-define-type line - "Include whole lines." - :one-to-one nil - :expand (lambda (beg end) - (evil-range - (progn - (goto-char beg) - ;; move to beginning of line as displayed - (evil-move-beginning-of-line) - (point)) - (progn - (goto-char end) - ;; move to the end of line as displayed - (evil-move-end-of-line) - (line-beginning-position 2)))) - :contract (lambda (beg end) - (evil-range beg (max beg (1- end)))) - :string (lambda (beg end) - (let ((height (count-lines beg end))) - (format "%s line%s" height - (if (= height 1) "" "s"))))) - -(evil-define-type screen-line - "Include whole lines, being aware of `visual-line-mode' -when `evil-respect-visual-line-mode' is non-nil." - :one-to-one nil - :expand (lambda (beg end) - (if (not (and evil-respect-visual-line-mode visual-line-mode)) - (evil-line-expand beg end) - (evil-range - (progn - (goto-char beg) - (save-excursion - (beginning-of-visual-line))) - (progn - (goto-char end) - (save-excursion - ;; `beginning-of-visual-line' reverts to the beginning of the - ;; last visual line if the end of the last line is the end of - ;; the buffer. This would prevent selecting the last screen - ;; line. - (if (= (line-beginning-position 2) (point-max)) - (point-max) - (beginning-of-visual-line 2))))))) - :contract (lambda (beg end) - (evil-range beg (max beg (1- end)))) - :string (lambda (beg end) - (let ((height (count-screen-lines beg end))) - (format "%s screen line%s" height - (if (= height 1) "" "s"))))) - -(evil-define-type block - "Like `inclusive', but for rectangles: -the last column is included." - :expand (lambda (beg end &rest properties) - (let ((beg-col (evil-column beg)) - (end-col (evil-column end)) - (corner (plist-get properties :corner))) - ;; Since blocks are implemented as a pair of buffer - ;; positions, expansion is restricted to what the buffer - ;; allows. In the case of a one-column block, there are - ;; two ways to expand it (either move the upper corner - ;; beyond the lower corner, or the lower beyond the - ;; upper), so try out both possibilities when - ;; encountering the end of the line. - (cond - ((= beg-col end-col) - (goto-char end) - (cond - ((eolp) - (goto-char beg) - (if (eolp) - (evil-range beg end) - (evil-range (1+ beg) end))) - ((memq corner '(lower-right upper-right right)) - (evil-range (1+ beg) end)) - (t - (evil-range beg (1+ end))))) - ((< beg-col end-col) - (goto-char end) - (if (eolp) - (evil-range beg end) - (evil-range beg (1+ end)))) - (t - (goto-char beg) - (if (eolp) - (evil-range beg end) - (evil-range (1+ beg) end)))))) - :contract (lambda (beg end) - (let ((beg-col (evil-column beg)) - (end-col (evil-column end))) - (if (> beg-col end-col) - (evil-range (1- beg) end) - (evil-range beg (max beg (1- end)))))) - :string (lambda (beg end) - (let ((height (count-lines - beg - (progn - (goto-char end) - (if (and (bolp) (not (eobp))) - (1+ end) - end)))) - (width (abs (- (evil-column beg) - (evil-column end))))) - (format "%s row%s and %s column%s" - height - (if (= height 1) "" "s") - width - (if (= width 1) "" "s")))) - :rotate (lambda (beg end &rest properties) - "Rotate block according to :corner property. -:corner can be one of `upper-left',``upper-right', `lower-left' -and `lower-right'." - (let ((left (evil-column beg)) - (right (evil-column end)) - (corner (or (plist-get properties :corner) - 'upper-left))) - (evil-sort left right) - (goto-char beg) - (if (memq corner '(upper-right lower-left)) - (move-to-column right) - (move-to-column left)) - (setq beg (point)) - (goto-char end) - (if (memq corner '(upper-right lower-left)) - (move-to-column left) - (move-to-column right)) - (setq end (point)) - (setq properties (plist-put properties - :corner corner)) - (apply #'evil-range beg end properties)))) - -(evil-define-type rectangle - "Like `exclusive', but for rectangles: -the last column is excluded." - :expand (lambda (beg end) - ;; select at least one column - (if (= (evil-column beg) (evil-column end)) - (evil-expand beg end 'block) - (evil-range beg end 'block)))) - -;;; Standard interactive codes - -(evil-define-interactive-code "*" - "Signal error if the buffer is read-only." - (when buffer-read-only - (signal 'buffer-read-only nil))) - -(evil-define-interactive-code "b" (prompt) - "Name of existing buffer." - (list (read-buffer prompt (current-buffer) t))) - -(evil-define-interactive-code "c" - "Read character." - (list (read-char))) - -(evil-define-interactive-code "p" - "Prefix argument converted to number." - (list (prefix-numeric-value current-prefix-arg))) - -(evil-define-interactive-code "P" - "Prefix argument in raw form." - (list current-prefix-arg)) - -;;; Custom interactive codes - -(evil-define-interactive-code "" - "Prefix argument converted to number, possibly multiplied by evil--window-digit." - (let ((prefix-num (prefix-numeric-value current-prefix-arg))) - (if evil--window-digit - (list (* evil--window-digit prefix-num)) - (list prefix-num)))) - -(evil-define-interactive-code "" - "Count." - (list (when current-prefix-arg - (prefix-numeric-value current-prefix-arg)))) - -(evil-define-interactive-code "" - "Count, but only in visual state. -This should be used by an operator taking a count. In normal -state the count should not be handled by the operator but by the -motion that defines the operator's range. In visual state the -range is specified by the visual region and the count is not used -at all. Thus in the case the operator may use the count -directly." - (list (when (and (evil-visual-state-p) current-prefix-arg) - (prefix-numeric-value - current-prefix-arg)))) - -(evil-define-interactive-code "" - "Prefix argument converted to number, or nil possibly multiplied by -evil--window-digit." - (let ((prefix-num (prefix-numeric-value current-prefix-arg))) - (list - (cond (evil--window-digit (* evil--window-digit prefix-num)) - (current-prefix-arg prefix-num))))) - -(evil-define-interactive-code "" - "Character read through `evil-read-key'." - (list - (if (evil-operator-state-p) - (evil-without-restriction (evil-read-key)) - (evil-read-key)))) - -(evil-define-interactive-code "" - "Untyped motion range (BEG END)." - (evil-operator-range)) - -(evil-define-interactive-code "" - "Typed motion range (BEG END TYPE)." - (evil-operator-range t)) - -(evil-define-interactive-code "" - "Typed motion range of visual range (BEG END TYPE). -If visual state is inactive then those values are nil." - (if (evil-visual-state-p) - (let ((range (evil-visual-range))) - (list (car range) - (cadr range) - (evil-type range))) - (list nil nil nil))) - -(evil-define-interactive-code "" - "Current register." - (list evil-this-register)) - -(evil-define-interactive-code "" - "Current yank-handler." - (list (evil-yank-handler))) - -(evil-define-interactive-code "" - "Ex argument." - :ex-arg t - (list (when evil-called-from-ex-p evil-ex-argument))) - -(evil-define-interactive-code "" () - "Prefix argument or ex-arg, converted to number" - (list (cond - (current-prefix-arg (prefix-numeric-value current-prefix-arg)) - (evil-ex-argument (string-to-number evil-ex-argument)) - (evil-called-from-ex-p nil) - (t 1)))) - -(evil-define-interactive-code "" - "Ex file argument." - :ex-arg file - (list (when evil-called-from-ex-p (evil-ex-file-arg)))) - -(evil-define-interactive-code "" - "Ex buffer argument." - :ex-arg buffer - (list evil-ex-argument)) - -(evil-define-interactive-code "" - "Ex shell command argument." - :ex-arg shell - (list evil-ex-argument)) - -(evil-define-interactive-code "" - "Ex file or shell command argument." - :ex-arg file-or-shell - (list evil-ex-argument)) - -(evil-define-interactive-code "" - "Ex symbolic argument." - :ex-arg sym - (list (and evil-ex-argument (intern evil-ex-argument)))) - -(evil-define-interactive-code "" - "Ex line number." - (list - (when evil-called-from-ex-p - (let ((expr (evil-ex-parse (or evil-ex-argument "")))) - (if (eq (car expr) 'evil-goto-line) - (save-excursion (goto-char evil-ex-point) - (eval (cadr expr) t)) - (user-error "Invalid address")))))) - -(evil-define-interactive-code "" - "Ex bang argument." - :ex-bang t - (list evil-ex-bang)) - -(evil-define-interactive-code "" - "Ex delimited argument." - (when evil-called-from-ex-p - (evil-delimited-arguments (or evil-ex-argument "")))) - -(evil-define-interactive-code "" - "Ex global argument." - (when evil-called-from-ex-p - (evil-ex-parse-global (or evil-ex-argument "")))) - -(evil-define-interactive-code "" - "Ex substitution argument." - :ex-arg substitution - (when evil-called-from-ex-p - (evil-ex-get-substitute-info (or evil-ex-argument "") t))) - -(evil-define-interactive-code "" - "Ex register and count argument, both optional. -Can be used for commands such as :delete [REGISTER] [COUNT] where the -command can be called with either zero, one or two arguments. With one -argument, if it is numeric, it is treated as a COUNT, otherwise, as a -REGISTER." - (when evil-called-from-ex-p - (evil-ex-get-optional-register-and-count evil-ex-argument))) - -(defun evil-ex-get-optional-register-and-count (string) - "Parse STRING as an ex arg with both optional REGISTER and COUNT. -Return a list (REGISTER COUNT)." - (let* ((split-args (split-string (or string ""))) - (arg-count (length split-args)) - (arg0 (car split-args)) - (arg1 (cadr split-args)) - (number-regex "^-?[1-9][0-9]*$") - (register nil) - (count nil)) - (cond - ;; :command REGISTER or :command COUNT - ((= arg-count 1) - (if (string-match-p number-regex arg0) - (setq count arg0) - (setq register arg0))) - ;; :command REGISTER COUNT - ((eq arg-count 2) - (setq register arg0 - count arg1)) - ;; more than 2 args aren't allowed - ((> arg-count 2) - (user-error "Invalid use"))) - - ;; if register is given, check it's valid - (when register - (unless (= (length register) 1) - (user-error "Invalid register")) - (setq register (string-to-char register))) - - ;; if count is given, check it's valid - (when count - (unless (string-match-p number-regex count) - (user-error "Invalid count")) - (setq count (string-to-number count)) - (unless (> count 0) - (user-error "Invalid count"))) - - (list register count))) - -(provide 'evil-types) - -;;; evil-types.el ends here diff --git a/.config/emacs/lisp/evil/evil-vars.el b/.config/emacs/lisp/evil/evil-vars.el deleted file mode 100644 index 291a91a..0000000 --- a/.config/emacs/lisp/evil/evil-vars.el +++ /dev/null @@ -1,2121 +0,0 @@ -;;; evil-vars.el --- Settings and variables -*- lexical-binding: t -*- - -;; Author: Vegard Øye -;; Maintainer: Vegard Øye - -;; Version: 1.15.0 - -;; -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -;;; Code: - -(declare-function evil-add-command-properties "evil-common" - (command &rest properties)) -(declare-function evil-update-insert-state-bindings "evil-maps" - (&optional _option-name remove force)) - -;;; Hooks - -(defvar evil-after-load-hook nil - "Functions to be run when loading of Evil is finished. -This hook can be used to execute some initialization routines -when Evil is completely loaded.") - -(defvar evil-after-global-hook nil - "Functions to be run after :global and :vglobal.") - -(defcustom evil-goto-definition-functions - '(evil-goto-definition-imenu - evil-goto-definition-semantic - evil-goto-definition-xref - evil-goto-definition-search) - "List of functions run until success by `evil-goto-definition'." - :type 'hook - :group 'evil) - -;;; Initialization - -(defvar evil-pending-custom-initialize nil - "A list of pending initializations for custom variables. -Each element is a triple (FUNC VAR VALUE). When Evil is -completely loaded then the functions (funcall FUNC VAR VALUE) is -called for each element. FUNC should be a function suitable for -the :initialize property of `defcustom'.") - -(defun evil-custom-initialize-pending-reset (var value) - "Add a pending customization with `custom-initialize-reset'." - (push (list 'custom-initialize-reset var value) - evil-pending-custom-initialize)) - -(defun evil-run-pending-custom-initialize () - "Execute the pending initializations. -See `evil-pending-custom-initialize'." - (dolist (init evil-pending-custom-initialize) - (apply (car init) (cdr init))) - (remove-hook 'evil-after-load-hook #'evil-run-pending-custom-initialize)) -(add-hook 'evil-after-load-hook #'evil-run-pending-custom-initialize) - -;;; Setters - -(defun evil-set-toggle-key (key) - "Set `evil-toggle-key' to KEY. -KEY must be readable by `read-kbd-macro'." - (let ((old-key (read-kbd-macro - (if (boundp 'evil-toggle-key) - evil-toggle-key - "C-z"))) - (key (read-kbd-macro key))) - (with-no-warnings - (dolist (pair '((evil-motion-state-map evil-emacs-state) - (evil-insert-state-map evil-emacs-state) - (evil-emacs-state-map evil-exit-emacs-state))) - (when (boundp (car pair)) - (let ((map (symbol-value (car pair))) - (fun (cadr pair))) - (when (keymapp map) - (define-key map key fun) - (define-key map old-key nil)))))))) - -(defun evil-set-custom-state-maps (var pending-var key _make newlist) - "Change the list of special keymaps. -VAR is the variable containing the list of keymaps. -PENDING-VAR is the variable containing the list of the currently pending - keymaps. -KEY the special symbol to be stored in the keymaps. -MAKE the creation function of the special keymaps. -NEWLIST the list of new special keymaps." - (set-default pending-var newlist) - (when (default-boundp var) - (dolist (map (default-value var)) - (when (and (boundp (car map)) - (keymapp (default-value (car map)))) - (define-key (default-value (car map)) (vector key) nil)))) - (set-default var newlist) - (evil-update-pending-maps)) - -(defun evil-update-pending-maps (&optional _file) - "Try to set pending special keymaps. -This function should be called from an `after-load-functions' -hook." - (let ((maps '((evil-make-overriding-map . evil-pending-overriding-maps) - (evil-make-intercept-map . evil-pending-intercept-maps)))) - (while maps - (let* ((map (pop maps)) - (make (car map)) - (pending-var (cdr map)) - (pending (symbol-value pending-var)) - newlist) - (while pending - (let* ((map (pop pending)) - (kmap (and (boundp (car map)) - (keymapp (symbol-value (car map))) - (symbol-value (car map)))) - (state (cdr map))) - (if kmap - (funcall make kmap state) - (push map newlist)))) - (set-default pending-var newlist))))) - -(defun evil-set-visual-newline-commands (var value) - "Set the value of `evil-visual-newline-commands'. -Setting this variable changes the properties of the appropriate -commands." - (with-no-warnings - (when (default-boundp var) - (dolist (cmd (default-value var)) - (evil-set-command-property cmd :exclude-newline nil))) - (set-default var value) - (dolist (cmd (default-value var)) - (evil-set-command-property cmd :exclude-newline t)))) - -(defun evil-set-custom-motions (var values) - "Set the list of motion commands." - (with-no-warnings - (when (default-boundp var) - (dolist (motion (default-value var)) - (evil-add-command-properties motion :keep-visual nil :repeat nil))) - (set-default var values) - (mapc #'evil-declare-motion (default-value var)))) - -;;; Customization group - -(defgroup evil nil - "Extensible vi layer." - :group 'emulations - :prefix 'evil-) - -(defcustom evil-auto-indent t - "\\ -Whether to auto-indent when opening lines with \\[evil-open-below] \ -and \\[evil-open-above]." - :type 'boolean - :group 'evil) - -(defcustom evil-shift-width 4 - "\\ -The number of columns by which a line is shifted. -This applies to the shifting operators \\[evil-shift-right] and \ -\\[evil-shift-left]." - :type 'integer - :safe #'integerp - :group 'evil) - -(defcustom evil-shift-round t - "\\ -Whether shifting rounds to the nearest multiple. -If non-nil, \\[evil-shift-right] and \\[evil-shift-left] adjust line -indentation to the nearest multiple of `evil-shift-width'." - :type 'boolean - :group 'evil) - -(defcustom evil-indent-convert-tabs t - "\\ -If non-nil, the \\[evil-indent] operator converts between leading tabs and spaces. -Whether tabs are converted to spaces or vice versa depends on the -value of `indent-tabs-mode'." - :type 'boolean - :group 'evil) - -(defcustom evil-default-cursor t - "The default cursor. -May be a cursor type as per `cursor-type', a color string as passed -to `set-cursor-color', a zero-argument function for changing the -cursor, or a list of the above. - -nil is interpreted as t; if you want the nil `cursor-type' (i.e., -you want to disable the cursor), set this variable to (list nil)." - :type '(set symbol (cons symbol symbol) string function) - :group 'evil) - -(defvar evil-force-cursor nil - "Overwrite the current states default cursor.") - -(defcustom evil-start-of-line nil - "Analogue of vim's `startofline'. -If nil, preserve column when making relevant movements of the cursor. -Otherwise, move the cursor to the start of the line." - :type 'boolean - :group 'evil) - -(defcustom evil-repeat-move-cursor t - "\\ -Whether repeating commands with \\[evil-repeat] may move the cursor. -If nil, the original cursor position is preserved, even if the command -normally would have moved the cursor." - :type 'boolean - :group 'evil) - -(defcustom evil-cross-lines nil - "\\ -Whether horizontal motions may move to other lines. If non-nil, -certain motions that conventionally operate in a single line may move -the cursor to other lines. Otherwise, they are restricted to the -current line. This applies to \\[evil-backward-char], \ -\\[evil-forward-char], \\[evil-find-char], \ -\\[evil-find-char-backward], \\[evil-find-char-to], \ -\\[evil-find-char-to-backward], \ -\\\\[evil-invert-char]." - :type 'boolean - :group 'evil) - -(defcustom evil-backspace-join-lines t - "Whether backward delete in insert state may join lines." - :type 'boolean - :group 'evil) - -(defcustom evil-move-cursor-back t - "Whether the cursor is moved backwards when exiting insert state. -If non-nil, the cursor moves \"backwards\" when exiting insert state, -so that it ends up on the character to the left. Otherwise it remains -in place, on the character to the right. - -See also `evil-move-beyond-eol'." - :type 'boolean - :group 'evil) - -(defcustom evil-move-beyond-eol nil - "Whether the cursor can move past the end of the line. -If non-nil, the cursor is allowed to move one character past the -end of the line, as in Emacs." - :type 'boolean - :group 'evil) - -(defcustom evil-respect-visual-line-mode nil - "\\ -Whether movement commands respect `visual-line-mode'. -If non-nil, `visual-line-mode' is generally respected when it is -on. In this case, motions such as \\[evil-next-line] and -\\[evil-previous-line] navigate by visual lines (on the screen) rather -than \"physical\" lines (defined by newline characters). If nil, -the setting of `visual-line-mode' is ignored. - -This variable must be set before Evil is loaded." - :type 'boolean - :group 'evil) - -(defcustom evil-repeat-find-to-skip-next t - "Whether a repeat of t or T should skip an adjacent character." - :type 'boolean - :group 'evil) - -(defcustom evil-kbd-macro-suppress-motion-error nil - "\\ -Whether left/right motions signal errors in keyboard macros. -This variable only affects beginning-of-line or end-of-line errors -regarding the motions \\[evil-backward-char] and \\[evil-forward-char] -respectively. This may be desired since such errors cause macro -definition or execution to be terminated. There are four -possibilities: - -- `record': errors are suppressed when recording macros, but not when - replaying them. -- `replay': errors are suppressed when replaying macros, but not when - recording them. -- `t': errors are suppressed in both cases. -- `nil': errors are never suppressed." - :type '(radio (const :tag "No" :value nil) - (const :tag "Record" :value record) - (const :tag "Replay" :value replay) - (const :tag "Both" :value t)) - :group 'evil) - -(defcustom evil-track-eol t - "\\ -Whether \\[evil-end-of-line] \"sticks\" the cursor to the end of the line. -If non-nil, vertical motions after \\[evil-end-of-line] maintain the cursor at the -end of the line, even if the target line is longer. This is analogous -to `track-eol', but respects Evil's interpretation of end-of-line." - :type 'boolean - :group 'evil) - -(defcustom evil-mode-line-format 'before - "The position of the state tag in the mode line. -If set to `before' or `after', the tag is placed at the beginning -or the end of the mode-line, respectively. If nil, there is no -tag. Otherwise it should be a cons cell (WHERE . WHICH), where -WHERE is either `before' or `after', and WHICH is a symbol in -`mode-line-format'. The tag is then placed before or after that -symbol, respectively." - :type '(radio :value 'before - (const :tag "No tag" nil) - (const before) - (const after) - (cons :tag "Next to symbol" - (choice :value after - (const before) - (const after)) - symbol)) - :group 'evil) - -(defcustom evil-mouse-word 'evil-word - "The thing-at-point symbol for double click selection. -The double-click starts visual state in a special word selection -mode. This symbol is used to determine the words to be -selected. Possible values are `evil-word' or `evil-WORD'." - :type 'symbol - :group 'evil) - -(defcustom evil-bigword "^ \t\r\n" - "The set of characters to be interpreted as WORD boundaries. -This is enclosed with square brackets and used as a regular -expression. By default, whitespace characters are considered -WORD boundaries." - :type 'string - :group 'evil) - -(defcustom evil-want-fine-undo nil - "Whether actions are undone in several steps. -There are two possible choices: nil (\"no\") means that all -changes made during insert state, including a possible delete -after a change operation, are collected in a single undo step. -Non-nil (\"yes\") means that undo steps are determined according -to Emacs heuristics, and no attempt is made to aggregate changes. - -For backward compatibility purposes, the value `fine' is -interpreted as `nil'. This option was removed because it did not -work consistently." - :type '(radio (const :tag "No" :value nil) - (const :tag "Fine (obsolete)" :value fine) - (const :tag "Yes" :value t)) - :group 'evil) - -(defcustom evil-regexp-search t - "\\ -Whether to use regular expressions for searching in \ -\\[evil-search-forward] and \\[evil-search-backward]." - :type 'boolean - :group 'evil) - -(defcustom evil-search-wrap t - "\\ -Whether search with \\[evil-search-forward] and \ -\\[evil-search-backward] wraps around the buffer. -If this is non-nil, search stops at the buffer boundaries." - :type 'boolean - :group 'evil) - -(defcustom evil-flash-delay 2 - "\\ -Time in seconds to flash search matches after \\[evil-search-next] and \ -\\[evil-search-previous]." - :type 'number - :group 'evil) - -(defcustom evil-auto-balance-windows t - "If non-nil window creation and deletion trigger rebalancing." - :type 'boolean - :group 'evil) - -(defcustom evil-split-window-below nil - "If non-nil split windows are created below." - :type 'boolean - :group 'evil) - -(defcustom evil-vsplit-window-right nil - "If non-nil vertically split windows with are created to the right." - :type 'boolean - :group 'evil) - -(defcustom evil-esc-delay 0.01 - "The time, in seconds, to wait for another key after escape. -If no further event arrives during this time, the event is -translated to `ESC'. Otherwise, it is translated according to -`input-decode-map'. This does not apply in Emacs state, and may -also be inhibited by setting `evil-inhibit-esc'." - :type 'number - :group 'evil) - -(defvar evil-esc-mode nil - "Non-nil if `evil-esc-mode' is enabled.") - -(defvar evil-esc-map nil - "Original ESC prefix map in `input-decode-map'. -Used by `evil-esc-mode'.") - -(defvar evil-inhibit-esc nil - "If non-nil, the \"\\e\" event will never be translated to `escape'.") - -(defcustom evil-intercept-esc 'always - "Whether Evil should intercept the escape key. -In the terminal, escape and a meta key sequence both generate the -same event. In order to distingush these, Evil uses -`input-decode-map'. It is not necessary to do this in a graphical -Emacs session. However, if you prefer to use \"C-[\" as escape (which -is identical to the terminal escape key code), this interception must -also happen in graphical Emacs sessions. Set this variable to -`always', t (only in the terminal) or nil (never intercept)." - :type '(radio (const :tag "Never" :value nil) - (const :tag "In terminal only" :value t) - (const :tag "Always" :value always)) - :group 'evil) - -(defcustom evil-show-paren-range 0 - "The maximum distance between point and a parenthesis -which causes the parenthesis to be highlighted." - :type 'integer - :group 'evil) - -(defcustom evil-ex-hl-update-delay 0.02 - "Time in seconds of idle before updating search highlighting. -Setting this to a period shorter than that of keyboard's repeat -rate allows highlights to update while scrolling." - :type 'number - :group 'evil) - -(defcustom evil-highlight-closing-paren-at-point-states - '(not emacs insert replace) - "The states in which the closing parenthesis at point should be highlighted. -All states listed here highlight the closing parenthesis at -point (which is Vim's default behavior). All others highlight the -parenthesis before point (which is Emacs default behavior). If -this list contains the symbol `not' then its meaning is inverted, -i.e. all states listed here highlight the closing parenthesis -before point." - :type '(repeat symbol) - :group 'evil) - -(defcustom evil-kill-on-visual-paste t - "Whether pasting in visual state adds the replaced text to the -kill ring, making it the default for the next paste. The default -replicates the default Vim behavior for `p'. This value is flipped by -`evil-paste-before' (\\[evil-paste-before])." - :type 'boolean - :group 'evil) - -(defcustom evil-want-C-i-jump t - "Whether `C-i' jumps forward in the jump list (like Vim). -Otherwise, `C-i' inserts a tab character." - :type 'boolean - :group 'evil - :set #'(lambda (sym value) - (set-default sym value) - (when (boundp 'evil-motion-state-map) - (cond - ((and (not value) - (eq (lookup-key evil-motion-state-map (kbd "C-i")) - 'evil-jump-forward)) - (define-key evil-motion-state-map (kbd "C-i") nil)) - ((and value - (not (lookup-key evil-motion-state-map (kbd "C-i")))) - (define-key evil-motion-state-map (kbd "C-i") - 'evil-jump-forward)))))) - -(defcustom evil-want-C-u-scroll nil - "Whether `C-u' scrolls up (like Vim). -Otherwise, `C-u' applies a prefix argument. The binding of -`C-u' mirrors Emacs behaviour by default due to the relative -ubiquity of prefix arguments." - :type 'boolean - :group 'evil - :set #'(lambda (sym value) - (set-default sym value) - (when (boundp 'evil-motion-state-map) - (cond - ((and (not value) - (eq (lookup-key evil-motion-state-map (kbd "C-u")) - 'evil-scroll-up)) - (define-key evil-motion-state-map (kbd "C-u") nil)) - ((and value - (not (lookup-key evil-motion-state-map (kbd "C-u")))) - (define-key evil-motion-state-map (kbd "C-u") - 'evil-scroll-up)))))) - -(defcustom evil-want-C-d-scroll t - "Whether `C-d' scrolls down (like Vim)." - :type 'boolean - :group 'evil - :set #'(lambda (sym value) - (set-default sym value) - (when (boundp 'evil-motion-state-map) - (cond - ((and (not value) - (eq (lookup-key evil-motion-state-map (kbd "C-d")) - 'evil-scroll-down)) - (define-key evil-motion-state-map (kbd "C-d") nil)) - ((and value - (not (lookup-key evil-motion-state-map (kbd "C-d")))) - (define-key evil-motion-state-map (kbd "C-d") - 'evil-scroll-down)))))) - -(defcustom evil-want-C-u-delete nil - "Whether `C-u' deletes back to indentation in insert state. -Otherwise, `C-u' applies a prefix argument. The binding of -`C-u' mirrors Emacs behaviour by default due to the relative -ubiquity of prefix arguments." - :type 'boolean - :group 'evil - :set #'(lambda (sym value) - (set-default sym value) - (when (and (boundp 'evil-insert-state-map) - (boundp 'evil-replace-state-map)) - (cond - ((and (not value) - (eq (lookup-key evil-insert-state-map (kbd "C-u")) - 'evil-delete-back-to-indentation)) - (define-key evil-insert-state-map (kbd "C-u") nil) - (define-key evil-replace-state-map (kbd "C-u") nil)) - ((and value - (not (lookup-key evil-insert-state-map (kbd "C-u")))) - (define-key evil-insert-state-map (kbd "C-u") - 'evil-delete-back-to-indentation) - (define-key evil-replace-state-map (kbd "C-u") - 'evil-delete-back-to-indentation)))))) - -(defcustom evil-want-C-w-delete t - "Whether `C-w' deletes a word in Insert/Ex/Search state." - :type 'boolean - :group 'evil - :set (lambda (sym value) - (set-default sym value) - (when (and (boundp 'evil-insert-state-map) - (boundp 'evil-replace-state-map)) - (cond - ((and (not value) - (eq (lookup-key evil-insert-state-map (kbd "C-w")) - 'evil-delete-backward-word)) - (define-key evil-insert-state-map (kbd "C-w") 'evil-window-map) - (define-key evil-replace-state-map (kbd "C-w") 'evil-window-map)) - ((and value - (eq (lookup-key evil-insert-state-map (kbd "C-w")) - 'evil-window-map)) - (define-key evil-insert-state-map (kbd "C-w") 'evil-delete-backward-word) - (define-key evil-replace-state-map (kbd "C-w") 'evil-delete-backward-word)))) - (when (boundp 'evil-command-line-map) - (cond - ((and (not value) - (eq (lookup-key evil-command-line-map (kbd "C-w")) - 'evil-delete-backward-word)) - (define-key evil-command-line-map (kbd "C-w") nil)) - ((and value - (null (lookup-key evil-command-line-map (kbd "C-w")))) - (define-key evil-command-line-map (kbd "C-w") 'evil-delete-backward-word)))) - (when (boundp 'evil-ex-search-keymap) - (cond - ((and (not value) - (null (lookup-key evil-ex-search-keymap (kbd "C-w")))) - (define-key evil-ex-search-keymap (kbd "C-w") 'evil-search-yank-word)) - ((and value - (eq (lookup-key evil-ex-search-keymap (kbd "C-w")) - 'evil-search-yank-word)) - (define-key evil-ex-search-keymap (kbd "C-w") nil)))))) - -(defcustom evil-want-C-h-delete nil - "Whether `C-h' deletes a char in Insert state." - :type 'boolean - :group 'evil - :set #'(lambda (sym value) - (set-default sym value) - (when (and (boundp 'evil-insert-state-map) - (boundp 'evil-replace-state-map)) - (cond - ((and (not value) - (eq (lookup-key evil-insert-state-map (kbd "C-h")) - 'evil-delete-backward-char-and-join)) - (define-key evil-insert-state-map (kbd "C-h") nil) - (define-key evil-replace-state-map (kbd "C-h") nil)) - ((and value - (not (lookup-key evil-insert-state-map (kbd "C-h")))) - (define-key evil-insert-state-map (kbd "C-h") - 'evil-delete-backward-char-and-join) - (define-key evil-replace-state-map (kbd "C-h") - 'evil-replace-backspace)))))) - -(defcustom evil-want-C-g-bindings nil - "Whether `C-g' postfix can be used in bindings." - :type 'boolean - :group 'evil) - -(defcustom evil-want-C-w-in-emacs-state nil - "Whether `C-w' prefixes windows commands in Emacs state." - :type 'boolean - :group 'evil - :set #'(lambda (sym value) - (set-default sym value) - (when (boundp 'evil-emacs-state-map) - (cond - ((and (not value) - (eq (lookup-key evil-emacs-state-map (kbd "C-w")) - 'evil-window-map)) - (define-key evil-emacs-state-map (kbd "C-w") nil)) - ((and value - (not (lookup-key evil-emacs-state-map (kbd "C-w")))) - (define-key evil-emacs-state-map (kbd "C-w") 'evil-window-map)))))) - -(defcustom evil-want-change-word-to-end t - "Whether `cw' behaves like `ce'." - :type 'boolean - :group 'evil) - -(defcustom evil-want-Y-yank-to-eol nil - "Whether `Y' yanks to the end of the line. -The default behavior is to yank the whole line, like Vim." - :group 'evil - :type 'boolean - :initialize #'evil-custom-initialize-pending-reset - :set #'(lambda (sym value) - (set-default sym value) - (evil-add-command-properties - 'evil-yank-line - :motion (if value - 'evil-end-of-line-or-visual-line - 'evil-line-or-visual-line)))) - -(defcustom evil-disable-insert-state-bindings nil - "Whether insert state bindings should be used. -Bindings for escape, delete and `evil-toggle-key' are always -available. If this is non-nil, default Emacs bindings are by and -large accessible in insert state." - :group 'evil - :type 'boolean - :initialize #'evil-custom-initialize-pending-reset - :set #'(lambda (sym value) - (set-default sym value) - (evil-update-insert-state-bindings sym value))) - -(defcustom evil-echo-state t - "Whether to signal the current state in the echo area." - :type 'boolean - :group 'evil) - -(defcustom evil-complete-all-buffers t - "\\ -Whether completion looks for matches in all buffers. -This applies to \\[evil-complete-next] and \\[evil-complete-previous] \ -in insert state." - :type 'boolean - :group 'evil) - -(defcustom evil-search-wrap-ring-bell nil - "Whether to ring the bell when search wraps around the buffer." - :type 'boolean - :group 'evil) - -(defvar dabbrev-search-these-buffers-only) -(defvar dabbrev-case-distinction) -(defcustom evil-complete-next-func - #'(lambda (arg) - (require 'dabbrev) - (let ((dabbrev-search-these-buffers-only - (unless evil-complete-all-buffers - (list (current-buffer)))) - dabbrev-case-distinction) - (condition-case nil - (if (eq last-command this-command) - (dabbrev-expand nil) - (dabbrev-expand (- (abs (or arg 1))))) - (error (dabbrev-expand nil))))) - "Completion function used by \ -\\\\[evil-complete-next]." - :type 'function - :group 'evil) - -(defcustom evil-complete-previous-func - #'(lambda (arg) - (require 'dabbrev) - (let ((dabbrev-search-these-buffers-only - (unless evil-complete-all-buffers - (list (current-buffer)))) - dabbrev-case-distinction) - (dabbrev-expand arg))) - "Completion function used by \ -\\\\[evil-complete-previous]." - :type 'function - :group 'evil) - -(defcustom evil-complete-next-minibuffer-func 'minibuffer-complete - "Minibuffer completion function used by \ -\\\\[evil-complete-next]." - :type 'function - :group 'evil) - -(defcustom evil-complete-previous-minibuffer-func 'minibuffer-complete - "Minibuffer completion function used by \ -\\\\[evil-complete-previous]." - :type 'function - :group 'evil) - -(defcustom evil-complete-next-line-func - #'(lambda (arg) - (let ((hippie-expand-try-functions-list - '(try-expand-line - try-expand-line-all-buffers))) - (hippie-expand arg))) - "Minibuffer completion function used by \ -\\\\[evil-complete-next-line]." - :type 'function - :group 'evil) - -(defcustom evil-complete-previous-line-func - evil-complete-next-line-func - "Minibuffer completion function used by \ -\\\\[evil-complete-previous-line]." - :type 'function - :group 'evil) - -(defcustom evil-lookup-func #'woman - "Lookup function used by \ -\"\\\\[evil-lookup]\"." - :type 'function - :group 'evil) - -(defcustom evil-toggle-key "C-z" - "The key used to change to and from Emacs state. -Must be readable by `read-kbd-macro'. For example: \"C-z\"." - :type 'string - :group 'evil - :set #'(lambda (sym value) - (evil-set-toggle-key value) - (set-default sym value))) - -(defcustom evil-default-state 'normal - "The default Evil state. -This is the state a buffer starts in when it is not otherwise -configured (see `evil-set-initial-state' and -`evil-buffer-regexps'). The value may be one of `normal', -`insert', `visual', `replace', `operator', `motion' and `emacs'." - :type 'symbol - :group 'evil) - -(defcustom evil-buffer-regexps - '(("^ \\*load\\*" . nil)) - "Regular expressions determining the initial state for a buffer. -Entries have the form (REGEXP . STATE), where REGEXP is a regular -expression matching the buffer's name and STATE is one of `normal', -`insert', `visual', `replace', `operator', `motion', `emacs' and -`nil'. If STATE is `nil', Evil is disabled in the buffer." - :type '(alist :key-type string :value-type symbol) - :group 'evil) - -(defcustom evil-emacs-state-modes - '(5x5-mode - archive-mode - bbdb-mode - biblio-selection-mode - blackbox-mode - bookmark-bmenu-mode - bookmark-edit-annotation-mode - browse-kill-ring-mode - bs-mode - bubbles-mode - bzr-annotate-mode - calc-mode - cfw:calendar-mode - completion-list-mode - Custom-mode - custom-theme-choose-mode - debugger-mode - delicious-search-mode - desktop-menu-blist-mode - desktop-menu-mode - doc-view-mode - dun-mode - dvc-bookmarks-mode - dvc-diff-mode - dvc-info-buffer-mode - dvc-log-buffer-mode - dvc-revlist-mode - dvc-revlog-mode - dvc-status-mode - dvc-tips-mode - ediff-mode - ediff-meta-mode - efs-mode - Electric-buffer-menu-mode - emms-browser-mode - emms-mark-mode - emms-metaplaylist-mode - emms-playlist-mode - ess-help-mode - etags-select-mode - fj-mode - gc-issues-mode - gdb-breakpoints-mode - gdb-disassembly-mode - gdb-frames-mode - gdb-locals-mode - gdb-memory-mode - gdb-registers-mode - gdb-threads-mode - gist-list-mode - git-rebase-mode - gnus-article-mode - gnus-browse-mode - gnus-group-mode - gnus-server-mode - gnus-summary-mode - gomoku-mode - google-maps-static-mode - ibuffer-mode - jde-javadoc-checker-report-mode - magit-cherry-mode - magit-diff-mode - magit-log-mode - magit-log-select-mode - magit-popup-mode - magit-popup-sequence-mode - magit-process-mode - magit-reflog-mode - magit-refs-mode - magit-revision-mode - magit-stash-mode - magit-stashes-mode - magit-status-mode - mh-folder-mode - monky-mode - mpuz-mode - mu4e-main-mode - mu4e-headers-mode - mu4e-view-mode - notmuch-hello-mode - notmuch-search-mode - notmuch-show-mode - notmuch-tree-mode - occur-mode - org-agenda-mode - package-menu-mode - pdf-outline-buffer-mode - pdf-view-mode - proced-mode - rcirc-mode - rebase-mode - recentf-dialog-mode - reftex-select-bib-mode - reftex-select-label-mode - reftex-toc-mode - sldb-mode - slime-inspector-mode - slime-thread-control-mode - slime-xref-mode - snake-mode - solitaire-mode - sr-buttons-mode - sr-mode - sr-tree-mode - sr-virtual-mode - tar-mode - tetris-mode - tla-annotate-mode - tla-archive-list-mode - tla-bconfig-mode - tla-bookmarks-mode - tla-branch-list-mode - tla-browse-mode - tla-category-list-mode - tla-changelog-mode - tla-follow-symlinks-mode - tla-inventory-file-mode - tla-inventory-mode - tla-lint-mode - tla-logs-mode - tla-revision-list-mode - tla-revlog-mode - tla-tree-lint-mode - tla-version-list-mode - twittering-mode - urlview-mode - vc-annotate-mode - vc-dir-mode - vc-git-log-view-mode - vc-hg-log-view-mode - vc-svn-log-view-mode - vm-mode - vm-summary-mode - w3m-mode - wab-compilation-mode - xgit-annotate-mode - xgit-changelog-mode - xgit-diff-mode - xgit-revlog-mode - xhg-annotate-mode - xhg-log-mode - xhg-mode - xhg-mq-mode - xhg-mq-sub-mode - xhg-status-extra-mode) - "Modes that should come up in Emacs state." - :type '(repeat symbol) - :group 'evil) - -(defcustom evil-insert-state-modes - '(comint-mode - erc-mode - eshell-mode - geiser-repl-mode - gud-mode - inferior-apl-mode - inferior-caml-mode - inferior-emacs-lisp-mode - inferior-j-mode - inferior-python-mode - inferior-scheme-mode - inferior-sml-mode - internal-ange-ftp-mode - haskell-interactive-mode - prolog-inferior-mode - racket-repl-mode - reb-mode - shell-mode - slime-repl-mode - term-mode - utop-mode - wdired-mode) - "Modes that should come up in Insert state." - :type '(repeat symbol) - :group 'evil) - -(defcustom evil-motion-state-modes - '(apropos-mode - Buffer-menu-mode - calendar-mode - color-theme-mode - command-history-mode - compilation-mode - dictionary-mode - ert-results-mode - help-mode - Info-mode - Man-mode - speedbar-mode - undo-tree-visualizer-mode - woman-mode) - "Modes that should come up in Motion state." - :type '(repeat symbol) - :group 'evil) - -(defvar evil-pending-overriding-maps nil - "An alist of pending overriding maps.") - -(defvar evil-pending-intercept-maps nil - "An alist of pending intercept maps.") - -(defcustom evil-overriding-maps '() - "Keymaps that should override Evil maps. -Entries have the form (MAP-VAR . STATE), where MAP-VAR is -a keymap variable and STATE is the state whose bindings -should be overridden. If STATE is nil, all states are -overridden." - :type '(alist :key-type symbol :value-type symbol) - :group 'evil - :set #'(lambda (var values) - (set-default var values) - (evil-set-custom-state-maps 'evil-overriding-maps - 'evil-pending-overriding-maps - 'override-state - 'evil-make-overriding-map - values)) - :initialize #'evil-custom-initialize-pending-reset) - -(add-hook 'after-load-functions #'evil-update-pending-maps) - -(defcustom evil-intercept-maps - '((edebug-mode-map . nil)) - "Keymaps that should intercept Evil maps. -Entries have the form (MAP-VAR . STATE), where MAP-VAR is -a keymap variable and STATE is the state whose bindings -should be intercepted. If STATE is nil, all states are -intercepted." - :type '(alist :key-type symbol :value-type symbol) - :group 'evil - :set #'(lambda (var values) - (set-default var values) - (evil-set-custom-state-maps 'evil-intercept-maps - 'evil-pending-intercept-maps - 'intercept-state - 'evil-make-intercept-map - values)) - :initialize #'evil-custom-initialize-pending-reset) - -(defcustom evil-motions - '(back-to-indentation - backward-char - backward-list - backward-paragraph - backward-sentence - backward-sexp - backward-up-list - backward-word - beginning-of-buffer - beginning-of-defun - beginning-of-line - beginning-of-visual-line - c-beginning-of-defun - c-end-of-defun - diff-file-next - diff-file-prev - diff-hunk-next - diff-hunk-prev - down-list - end-of-buffer - end-of-defun - end-of-line - end-of-visual-line - exchange-point-and-mark - forward-char - forward-list - forward-paragraph - forward-sentence - forward-sexp - forward-word - goto-char - goto-last-change - ibuffer-backward-line - ibuffer-forward-line - isearch-abort - isearch-cancel - isearch-complete - isearch-del-char - isearch-delete-char - isearch-edit-string - isearch-exit - isearch-highlight-regexp - isearch-occur - isearch-other-control-char - isearch-other-meta-char - isearch-printing-char - isearch-query-replace - isearch-query-replace-regexp - isearch-quote-char - isearch-repeat-backward - isearch-repeat-forward - isearch-ring-advance - isearch-ring-retreat - isearch-toggle-case-fold - isearch-toggle-input-method - isearch-toggle-regexp - isearch-toggle-specified-input-method - isearch-toggle-word - isearch-yank-char - isearch-yank-kill - isearch-yank-line - isearch-yank-word-or-char - keyboard-quit - left-char - left-word - mouse-drag-region - mouse-save-then-kill - mouse-set-point - mouse-set-region - mwheel-scroll - move-beginning-of-line - move-end-of-line - next-error - next-line - paredit-backward - paredit-backward-down - paredit-backward-up - paredit-forward - paredit-forward-down - paredit-forward-up - pop-global-mark - pop-tag-mark - pop-to-mark-command - previous-error - previous-line - right-char - right-word - scroll-down - scroll-down-command - scroll-up - scroll-up-command - sgml-skip-tag-backward - sgml-skip-tag-forward - up-list) - "Non-Evil commands to initialize to motions." - :type '(repeat symbol) - :group 'evil - :set #'evil-set-custom-motions - :initialize #'evil-custom-initialize-pending-reset) - -(defcustom evil-visual-newline-commands - '(LaTeX-section - TeX-font) - "Commands excluding the trailing newline of a Visual Line selection. -These commands work better without this newline." - :type '(repeat symbol) - :group 'evil - :set #'evil-set-visual-newline-commands - :initialize #'evil-custom-initialize-pending-reset) - -(defcustom evil-want-visual-char-semi-exclusive nil - "DEPRECATED. Will be removed in a future version. -Prefer to set `evil-v$-excludes-newline' to non-nil. - -Visual character selection to beginning/end of line is exclusive. -If non nil then an inclusive visual character selection which -ends at the beginning or end of a line is turned into an -exclusive selection. Thus if the selected (inclusive) range ends -at the beginning of a line it is changed to not include the first -character of that line, and if the selected range ends at the end -of a line it is changed to not include the newline character of -that line." - :type 'boolean - :group 'evil) -(make-obsolete-variable - 'evil-want-visual-char-semi-exclusive - "Semi-exclusivity prevents selecting text + 1st char of next line, -without having to introduce new niche functionality. -Prefer to set `evil-v$-excludes-newline' to non-nil." - "1.15.0") - -(defcustom evil-v$-excludes-newline nil - "If non-nil, `evil-end-of-line' does not move as far as to include -the `\n' char at eol. This makes `v$' consistent with `$' used as a -motion (e.g. `v$y' is consistent with `y$' in normal state)." - :type 'boolean - :group 'evil) - -(defcustom evil-text-object-change-visual-type t - "Text objects change the current visual state type. -If non-nil then a text-object changes the type of the visual state to -its default selection type (e.g. a word object always changes to -charwise visual state). Otherwise the current visual state type is -preserved." - :type 'boolean - :group 'evil) - -(defgroup evil-cjk nil - "CJK support" - :prefix "evil-cjk-" - :group 'evil) - -(defcustom evil-cjk-emacs-word-boundary nil - "Determine word boundary exactly the same way as Emacs does." - :type 'boolean - :group 'evil-cjk) - -(defcustom evil-cjk-word-separating-categories - '(;; Kanji - (?C . ?H) (?C . ?K) (?C . ?k) (?C . ?A) (?C . ?G) - ;; Hiragana - (?H . ?C) (?H . ?K) (?H . ?k) (?H . ?A) (?H . ?G) - ;; Katakana - (?K . ?C) (?K . ?H) (?K . ?k) (?K . ?A) (?K . ?G) - ;; half-width Katakana - (?k . ?C) (?k . ?H) (?k . ?K) ; (?k . ?A) (?k . ?G) - ;; full-width alphanumeric - (?A . ?C) (?A . ?H) (?A . ?K) ; (?A . ?k) (?A . ?G) - ;; full-width Greek - (?G . ?C) (?G . ?H) (?G . ?K) ; (?G . ?k) (?G . ?A) - ) - "List of pair (cons) of categories to determine word boundary -used in `evil-cjk-word-boundary-p'. See the documentation of -`word-separating-categories'. Use `describe-categories' to see -the list of categories." - :type '(alist :key-type (choice character (const nil)) - :value-type (choice character (const nil))) - :group 'evil-cjk) - -(defcustom evil-cjk-word-combining-categories - '(;; default value in word-combining-categories - (nil . ?^) (?^ . nil) - ;; Roman - (?r . ?k) (?r . ?A) (?r . ?G) - ;; half-width Katakana - (?k . ?r) (?k . ?A) (?k . ?G) - ;; full-width alphanumeric - (?A . ?r) (?A . ?k) (?A . ?G) - ;; full-width Greek - (?G . ?r) (?G . ?k) (?G . ?A) - ) - "List of pair (cons) of categories to determine word boundary -used in `evil-cjk-word-boundary-p'. See the documentation of -`word-combining-categories'. Use `describe-categories' to see the -list of categories." - :type '(alist :key-type (choice character (const nil)) - :value-type (choice character (const nil))) - :group 'evil-cjk) - -(defcustom evil-ex-complete-emacs-commands 'in-turn - "TAB-completion for Emacs commands in ex command line. -This variable determines when Emacs commands are considered for -completion, always, never, or only if no Evil ex command is -available for completion." - :group 'evil - :type '(radio (const :tag "Only if no ex-command." :value in-turn) - (const :tag "Never" :value nil) - (const :tag "Always" :value t))) - -(defface evil-ex-commands '(( nil - :underline t - :slant italic)) - "Face for the Evil command in completion in ex mode." - :group 'evil) - -(defface evil-ex-info '(( ((supports :slant)) - :slant italic - :foreground "red")) - "Face for the info message in ex mode." - :group 'evil) - -(defcustom evil-ex-visual-char-range nil - "Type of default ex range in visual char state. -If non-nil the default range when starting an ex command from -character visual state is `<,`> otherwise it is '<,'>. In the -first case the ex command will be passed a region covering only -the visual selection. In the second case the passed region will -be extended to contain full lines." - :group 'evil - :type 'boolean) - -(defvar evil--ex-global-active-p nil - "If the :global command is running. -Used to change the behaviour of certain commands like :print.") - -(defvar evil--ex-print-accumulator "" - "Used by :print etc. to accumulate a string when invoked by :global etc.") - -;; Searching -(defcustom evil-symbol-word-search nil - "If nil then * and # search for words otherwise for symbols." - :group 'evil - :type 'boolean) - -(defcustom evil-magic t - "Meaning which characters in a pattern are magic. -The meaning of those values is the same as in Vim. Note that it -only has influence if the Evil search module is chosen in -`evil-search-module'." - :group 'evil - :type '(radio (const :tag "Very magic." :value very-magic) - (const :tag "Magic" :value t) - (const :tag "Nomagic" :value nil) - (const :tag "Very nomagic" :value very-nomagic))) - -(defcustom evil-ex-search-vim-style-regexp nil - "If non-nil Vim-style backslash codes are supported in search patterns. -See `evil-transform-vim-style-regexp' for the supported backslash -codes. Note that this only affects the search command if -`evil-search-module' is set to `evil-search'. The isearch module -always uses plain Emacs regular expressions." - :type 'boolean - :group 'evil) - -(defcustom evil-ex-interactive-search-highlight 'all-windows - "Determine in which windows the interactive highlighting should be shown." - :type '(radio (const :tag "All windows." all-windows) - (const :tag "Selected window." selected-window) - (const :tag "Disable highlighting." nil)) - :group 'evil) - -(defcustom evil-ex-search-persistent-highlight t - "If non-nil matches remain highlighted when the search ends." - :type 'boolean - :group 'evil) - -(defcustom evil-ex-search-case 'smart - "The case behaviour of the search command. -Smart case means that the pattern is case sensitive if and only -if it contains an upper case letter, otherwise it is case -insensitive." - :type '(radio (const :tag "Case sensitive." sensitive) - (const :tag "Case insensitive." insensitive) - (const :tag "Smart case." smart)) - :group 'evil) - -(defcustom evil-ex-substitute-case nil - "The case behaviour of the search command. -Smart case means that the pattern is case sensitive if and only -if it contains an upper case letter, otherwise it is case -insensitive. If nil then the setting of `evil-ex-search-case' is -used." - :type '(radio (const :tag "Same as interactive search." nil) - (const :tag "Case sensitive." sensitive) - (const :tag "Case insensitive." insensitive) - (const :tag "Smart case." smart)) - :group 'evil) - -(defcustom evil-ex-search-interactive t - "If t search is interactive." - :type 'boolean - :group 'evil) - -(defcustom evil-ex-search-incremental t - "If t, use incremental search. Note that this only affects the -search command if `evil-search-module' is set to `evil-search'." - :type 'boolean - :group 'evil) - -(defcustom evil-ex-search-highlight-all t - "If t and interactive search is enabled, all matches are -highlighted." - :type 'boolean - :group 'evil) - -(defcustom evil-ex-substitute-highlight-all t - "If t all matches for the substitute pattern are highlighted." - :type 'boolean - :group 'evil) - -(defcustom evil-ex-substitute-interactive-replace t - "If t and substitute patterns are highlighted, -the replacement is shown interactively." - :type 'boolean - :group 'evil) - -(defcustom evil-ex-substitute-global nil - "If non-nil substitute patterns are global by default. -Standardly (if this variable is nil) a substitution works only on the -first match of the pattern in a line unless the \"g\" flag is -given, in which case the substitution happens on all matches in the -line. If this option is non-nil, this behavior is reversed." - :type 'boolean - :group 'evil) - -(defface evil-ex-search '((t :inherit isearch)) - "Face for interactive search." - :group 'evil) - -(defface evil-ex-lazy-highlight '((t :inherit lazy-highlight)) - "Face for highlighting all matches in interactive search." - :group 'evil) - -(defface evil-ex-substitute-matches '((t :inherit lazy-highlight)) - "Face for interactive substitute matches." - :group 'evil) - -(defface evil-ex-substitute-replacement '((((supports :underline)) - :underline t - :foreground "red")) - "Face for interactive replacement text." - :group 'evil) - -(defcustom evil-command-window-height 7 - "Height (in lines) of the command line window. -Set to 0 to use the default height for `split-window'." - :type 'integer - :group 'evil) - -(defcustom evil-display-shell-error-in-message nil - "Show error output of a shell command in the error buffer. -If this variable is non-nil the error output of a shell command -goes to the messages buffer instead of being mixed with the -regular output. This happens only if the exit status of the -command is non-zero." - :type 'boolean - :group 'evil) - -(defcustom evil-want-abbrev-expand-on-insert-exit t - "If non-nil abbrevs will be expanded when leaving insert state -like in Vim, if `abbrev-mode' is on." - :type 'boolean - :group 'evil) - -;;; Variables - -(defmacro evil-define-local-var (symbol &optional initvalue docstring) - "Define SYMBOL as permanent buffer local variable, and return SYMBOL. -The parameters are the same as for `defvar', but the variable -SYMBOL is made permanent buffer local." - (declare (indent defun) - (doc-string 3) - (debug (symbolp &optional form stringp))) - `(progn - (defvar ,symbol ,initvalue ,docstring) - (make-variable-buffer-local ',symbol) - (put ',symbol 'permanent-local t))) - -(evil-define-local-var evil-scroll-count 0 - "Hold last used prefix for `evil-scroll-up' -and `evil-scroll-down'. -Determine how many lines should be scrolled. -Default value is 0 - scroll half the screen.") - -(evil-define-local-var evil-state nil - "The current Evil state. -To change the state, use `evil-change-state' -or call the state function (e.g., `evil-normal-state').") - -;; these may be used inside `evil-define-state' -(evil-define-local-var evil-next-state nil - "The Evil state being switched to.") - -(evil-define-local-var evil-previous-state-alist nil - "For Each evil state the Evil state being switched from.") - -(evil-define-local-var evil-previous-state nil - "The Evil state being switched from.") - -(defvar evil-execute-in-emacs-state-buffer nil - "The buffer of the latest `evil-execute-in-emacs-state'. -When this command is being executed the current buffer is stored -in this variable. This is necessary in case the Emacs-command to -be called changes the current buffer.") - -(evil-define-local-var evil-mode-line-tag nil - "Mode-Line indicator for the current state.") -(put 'evil-mode-line-tag 'risky-local-variable t) - -(defvar evil-global-keymaps-alist nil - "Association list of keymap variables. -Entries have the form (MODE . KEYMAP), where KEYMAP -is the variable containing the keymap for MODE.") - -(defvar evil-local-keymaps-alist nil - "Association list of keymap variables that must be -reinitialized in each buffer. Entries have the form -\(MODE . KEYMAP), where KEYMAP is the variable containing -the keymap for MODE.") - -(defvar evil-minor-mode-keymaps-alist nil - "Association list of Evil states to minor-mode keymap alists. -Entries have the form (STATE . MODE-MAP-ALIST), where -MODE-MAP-ALIST is an alist taking the form of -`minor-mode-map-alist'.") - -(defvar evil-state-properties nil - "Specifications made by `evil-define-state'. -Entries have the form (STATE . PLIST), where PLIST is a property -list specifying various aspects of the state. To access a property, -use `evil-state-property'.") - -(evil-define-local-var evil-mode-map-alist nil - "Association list of keymaps to use for Evil modes. -Elements have the form (MODE . KEYMAP), with the first keymaps -having higher priority.") - -(defvar evil-change-commands '(evil-change) - "Commands that wrap or replace `evil-change'. -This list exists to apply an inconsistency with vim's change command -to commands that wrap or redefine it. See emacs-evil/evil#916.") - -(defvar evil-transient-vars '(cua-mode transient-mark-mode select-active-regions) - "List of variables pertaining to Transient Mark mode.") - -(defvar evil-transient-vals nil - "Association list of old values for Transient Mark mode variables. -Entries have the form (VARIABLE VALUE LOCAL), where LOCAL is -whether the variable was previously buffer-local.") - -(defvar evil-no-display nil - "If non-nil, various Evil displays are inhibited. -Use the macro `evil-without-display' to set this variable.") - -(defvar evil-type-properties nil - "Specifications made by `evil-define-type'. -Entries have the form (TYPE . PLIST), where PLIST is a property -list specifying functions for handling the type: expanding it, -describing it, etc.") - -(defvar evil-interactive-alist nil - "Association list of Evil-specific interactive codes.") - -(evil-define-local-var evil-motion-marker nil - "Marker for storing the starting position of a motion.") - -(evil-define-local-var evil-this-type nil - "Current motion type.") - -(evil-define-local-var evil-this-type-modified nil - "Non-nil iff current motion type has been modified by the user. -If the type has been modified, this variable contains the new -type.") - -(evil-define-local-var evil-this-register nil - "Current register.") - -(defvar evil-last-=-register-input nil - "Most recent input from the `=' register. A string.") - -(defvar evil-this-macro nil - "Current macro register.") - -(evil-define-local-var evil-this-operator nil - "Current operator.") - -(evil-define-local-var evil-this-motion nil - "Current motion.") - -(evil-define-local-var evil-this-motion-count nil - "Current motion count.") - -;; In light of `evil-last-recorded-register' this should probably -;; be renamed to `evil-last-executed-register' but that may break configs -(defvar evil-last-register nil - "The last executed register.") - -(defvar evil-last-recorded-register nil - "The last recorded register.") - -(defvar evil-inhibit-operator nil - "Inhibit current operator. -If an operator calls a motion and the motion sets this variable -to t, the operator code is not executed.") - -(defvar evil-inhibit-operator-value nil - "This variable is used to transfer the value -of `evil-inhibit-operator' from one local scope to another.") - -;; used by `evil-define-operator' -(defvar evil-operator-range-beginning nil - "Beginning of `evil-operator-range'.") - -(defvar evil-operator-range-end nil - "End of `evil-operator-range'.") - -(defvar evil-operator-range-type nil - "Type of `evil-operator-range'.") - -(defvar evil-operator-range-motion nil - "Motion of `evil-operator-range'.") - -(defvar evil-operator-start-col nil - "Used to restore column (where possible) after an operator has moved it.") - -(defvar evil-restriction-stack nil - "List of previous restrictions. -Using `evil-with-restriction' stores the previous values of -`point-min' and `point-max' as a pair in this list.") - -(evil-define-local-var evil-markers-alist - '((?\( . evil-backward-sentence-begin) - (?\) . evil-forward-sentence-begin) - (?{ . evil-backward-paragraph) - (?} . evil-forward-paragraph) - (?' . evil-jump-backward-swap) - (?` . evil-jump-backward-swap) - (?< . evil-visual-beginning) - (?> . evil-visual-goto-end) - (?. . (lambda () - (let (last-command) - (goto-last-change nil))))) - "Association list for markers. -Entries have the form (CHAR . DATA), where CHAR is the marker's -name and DATA is either a marker object as returned by `make-marker', -a variable, a movement function, or a cons cell (STRING NUMBER), -where STRING is a file path and NUMBER is a buffer position. -The global value of this variable holds markers available from -every buffer, while the buffer-local value holds markers available -only in the current buffer.") - -(defconst evil-suppress-map (make-keymap) - "Full keymap disabling default bindings to `self-insert-command'.") -(suppress-keymap evil-suppress-map t) - -(defvar evil-read-key-map (make-sparse-keymap) - "Keymap active during `evil-read-key'. -This keymap can be used to bind some commands during the -execution of `evil-read-key' which is usually used to read a -character argument for some commands, e.g. `evil-replace'.") - -;; TODO: customize size of ring -(defvar evil-repeat-ring (make-ring 10) - "A ring of repeat-informations to repeat the last command.") - -(defvar evil-recording-repeat nil - "Whether we are recording a repeat.") - -(defvar evil-recording-current-command nil - "Whether we are recording the current command for repeat.") - -(defvar evil-repeat-changes nil - "Accumulated buffer changes in reverse order for change-tracking commands.") - -(defvar evil-repeat-info nil - "Information accumulated during current repeat.") - -(defvar evil-repeat-buffer nil - "The buffer in which the repeat started. -If the buffer is changed, the repeat is cancelled.") - -(defvar evil-repeat-pos nil - "The point position at the start of a change-tracking command.") - -(defvar evil-repeat-keys nil - "The keys that invoked the current command.") - -(defvar evil-last-repeat nil - "Information about the latest repeat command. -This is a list of three elements (POINT COUNT UNDO-POINTER), -where POINT is the position of point before the latest repeat, -COUNT the count-argument of the latest repeat command and -UNDO-POINTER the head of the undo-list before the last command -has been repeated.") - -(defvar evil-repeat-count nil - "The explicit count when repeating a command.") - -(defvar evil-maybe-remove-spaces nil - "Flag to determine if newly inserted spaces should be removed. -See the function `evil-maybe-remove-spaces'.") - -(evil-define-local-var evil-insert-count nil - "The explicit count passed to a command starting Insert or Replace state.") - -(evil-define-local-var evil-insert-vcount nil - "The information about the number of following lines the -insertion should be repeated. This is list (LINE COLUMN COUNT) -where LINE is the line-number where the original insertion -started and COLUMN is either a number or function determining the -column where the repeated insertions should take place. COUNT is -number of repeats (including the original insertion).") - -(defvar evil-insert-skip-empty-lines nil - "Non-nil of the current insertion should not take place on - lines at which the insertion point is behind the end of the - line.") - -(evil-define-local-var evil-insert-lines nil - "Non-nil if the current insertion command is a line-insertion -command o or O.") - -(evil-define-local-var evil-insert-repeat-info nil - "Repeat information accumulated during an insertion.") - -(evil-define-local-var evil-replace-alist nil - "Association list of characters overwritten in Replace state. -The format is (POS . CHAR).") - -(evil-define-local-var evil-echo-area-message nil - "Previous value of `current-message'.") - -(defvar evil-write-echo-area nil - "If set to t inside `evil-save-echo-area', then the echo area -is not restored.") - -(defvar evil-last-find nil - "A pair (FUNCTION . CHAR) describing the lastest character - search command.") - -(defvar evil-last-paste nil - "Information about the latest paste. -This should be a list (CMD COUNT POINT BEG END FIRSTVISUAL) where -CMD is the last paste-command (`evil-paste-before', -`evil-paste-after' or `evil-visual-paste'), COUNT is the repeat -count of the paste, POINT is the position of point before the -paste, BEG end END are the region of the inserted -text. FIRSTVISUAL is t if and only if the previous command was -the first visual paste (i.e. before any paste-pop).") - -(evil-define-local-var evil-last-undo-entry nil - "Information about the latest undo entry in the buffer. -This should be a pair (OBJ . CONS) where OBJ is the entry as an -object, and CONS is a copy of the entry.") - -(evil-define-local-var evil-current-insertion nil - "Information about the latest insertion in insert state. -This should be a pair (BEG . END) that describes the -buffer-region of the newly inserted text.") - -(defvar evil-last-insertion nil - "The last piece of inserted text.") - -(defvar evil-last-small-deletion nil - "The last piece of deleted text. -The text should be less than a line.") - -(defvar evil-was-yanked-without-register t - "Whether text being saved to the numbered-register ring was -not deleted and not yanked to a specific register.") - -(defvar evil-paste-count nil - "The count argument of the current paste command.") - -(defvar evil--cursor-after nil - "Internal flag for gp & gP.") - -(defvar evil-temporary-undo nil - "When undo is disabled in current buffer. -Certain commands depending on undo use this variable -instead of `buffer-undo-list'.") - -(evil-define-local-var evil-undo-list-pointer nil - "Everything up to this mark is united in the undo-list.") - -(defvar evil-in-single-undo nil - "Set to non-nil if the current undo steps are connected.") - -(defvar evil-flash-timer nil - "Timer for flashing search results.") - -(defvar evil-search-prompt nil - "String to use for search prompt.") - -(defvar evil-search-forward-history nil - "History of forward searches.") - -(defvar evil-search-backward-history nil - "History of backward searches.") - -(defvar evil-inner-text-objects-map (make-sparse-keymap) - "Keymap for inner text objects.") - -(defvar evil-outer-text-objects-map (make-sparse-keymap) - "Keymap for outer text objects.") - -(defvar evil-window-map (make-sparse-keymap) - "Keymap for window-related commands.") - -(evil-define-local-var evil-input-method nil - "Input method used in Insert state and Emacs state.") - -;;; Visual state - -(evil-define-local-var evil-visual-beginning nil - "The beginning of the Visual selection, a marker.") - -(evil-define-local-var evil-visual-end nil - "The end of the Visual selection, a marker.") - -(evil-define-local-var evil-visual-point nil - "The position of point in Visual state, a marker.") - -(evil-define-local-var evil-visual-mark nil - "The position of mark in Visual state, a marker.") - -(evil-define-local-var evil-visual-selection nil - "The kind of Visual selection. -This is a selection as defined by `evil-define-visual-selection'.") - -(evil-define-local-var evil-prev-visual-point nil - "The previous position of point in Visual state, a marker.") - -(evil-define-local-var evil-prev-visual-mark nil - "The previous position of mark in Visual state, a marker.") - -(evil-define-local-var evil-prev-visual-selection nil - "The previous kind of Visual selection. -This is a selection as defined by `evil-define-visual-selection'.") - -;; we could infer the direction by comparing `evil-visual-mark' -;; and `evil-visual-point', but destructive operations may -;; displace the markers -(evil-define-local-var evil-visual-direction 0 - "Whether point follows mark in Visual state. -Negative if point precedes mark, otherwise positive. -See also the function `evil-visual-direction'.") - -(evil-define-local-var evil-visual-properties nil - "Property list of miscellaneous Visual properties.") - -(evil-define-local-var evil-visual-region-expanded nil - "Whether the region matches the Visual selection. -That is, whether the positions of point and mark have been -expanded to coincide with the selection's boundaries. -This makes the selection available to functions acting -on Emacs' region.") - -(defvar evil-transient-mouse-selection nil - "Whether the region selected by the mouse is discarded by the next command. -By default, the region is not discarded. If non-nil, exit visual state -immediately before the next command. To use the region selected by the mouse, -execute a command which would usually enter visual state, such as -\\[evil-visual-char] or \\[evil-visual-block].") - -(defvar evil--region-from-mouse nil - "Whether the region was set by the mouse.") - -(evil-define-local-var evil-visual-overlay nil - "Overlay for highlighting the Visual selection. -Not used for blockwise selections, in which case -see `evil-visual-block-overlays'.") - -(evil-define-local-var evil-visual-block-overlays nil - "Overlays for Visual Block selection, one for each line. -They are reused to minimize flicker.") - -(defvar evil-visual-alist nil - "Association list of Visual selection functions. -Elements have the form (NAME . FUNCTION).") - -(evil-define-local-var evil-visual-x-select-timer nil - "Timer for updating the X selection in visual state.") - -(defvar evil-visual-x-select-timeout 0.1 - "Time in seconds for the update of the X selection.") - -(declare-function origami-open-all-nodes "ext:origami.el") -(declare-function origami-close-all-nodes "ext:origami.el") -(declare-function origami-toggle-node "ext:origami.el") -(declare-function origami-open-node "ext:origami.el") -(declare-function origami-open-node-recursively "ext:origami.el") -(declare-function origami-close-node "ext:origami.el") - -(defvar evil-fold-list - `(((vdiff-mode) - :open-all vdiff-open-all-folds - :close-all vdiff-close-all-folds - :toggle ,(lambda () (call-interactively 'vdiff-toggle-fold)) - :open ,(lambda () (call-interactively 'vdiff-open-fold)) - :open-rec ,(lambda () (call-interactively 'vdiff-open-fold)) - :close ,(lambda () (call-interactively 'vdiff-close-fold))) - ((vdiff-3way-mode) - :open-all vdiff-open-all-folds - :close-all vdiff-close-all-folds - :toggle ,(lambda () (call-interactively 'vdiff-toggle-fold)) - :open ,(lambda () (call-interactively 'vdiff-open-fold)) - :open-rec ,(lambda () (call-interactively 'vdiff-open-fold)) - :close ,(lambda () (call-interactively 'vdiff-close-fold))) - ((hs-minor-mode) - :open-all hs-show-all - :close-all hs-hide-all - :toggle hs-toggle-hiding - :open hs-show-block - :open-rec nil - :close hs-hide-block) - ((hide-ifdef-mode) - :open-all show-ifdefs - :close-all hide-ifdefs - :toggle nil - :open show-ifdef-block - :open-rec nil - :close hide-ifdef-block) - ((outline-mode - outline-minor-mode - org-mode - markdown-mode) - :open-all show-all - :close-all ,(lambda () - (with-no-warnings (hide-sublevels 1))) - :toggle outline-toggle-children - :open ,(lambda () - (with-no-warnings - (show-entry) - (show-children))) - :open-rec show-subtree - :close hide-subtree) - ((origami-mode) - :open-all ,(lambda () (origami-open-all-nodes (current-buffer))) - :close-all ,(lambda () (origami-close-all-nodes (current-buffer))) - :toggle ,(lambda () (origami-toggle-node (current-buffer) (point))) - :open ,(lambda () (origami-open-node (current-buffer) (point))) - :open-rec ,(lambda () (origami-open-node-recursively (current-buffer) (point))) - :close ,(lambda () (origami-close-node (current-buffer) (point))))) - "Actions to be performed for various folding operations. - -The value should be a list of fold handlers, were a fold handler has -the format: - - ((MODES) PROPERTIES) - -MODES acts as a predicate, containing the symbols of all major or -minor modes for which the handler should match. For example: - - \\='((outline-minor-mode org-mode) ...) - -would match for either outline-minor-mode or org-mode, even though the -former is a minor mode and the latter is a major. - -PROPERTIES specifies possible folding actions and the functions to be -applied in the event of a match on one (or more) of the MODES; the -supported properties are: - - - `:open-all' - Open all folds. - - `:close-all' - Close all folds. - - `:toggle' - Toggle the display of the fold at point. - - `:open' - Open the fold at point. - - `:open-rec' - Open the fold at point recursively. - - `:close' - Close the fold at point. - -Each value must be a function. A value of `nil' will cause the action -to be ignored for that respective handler. For example: - - `((org-mode) - :close-all nil - :open ,(lambda () - (show-entry) - (show-children)) - :close hide-subtree) - -would ignore `:close-all' actions and invoke the provided functions on -`:open' or `:close'.") - -;;; Ex - -(define-obsolete-variable-alias 'evil-ex-map 'evil-ex-shortcut-map "1.15.0") -(defvar evil-ex-shortcut-map (make-sparse-keymap) - "Keymap for Ex. -Key sequences bound in this map are immediately executed.") - -;; Intentionally does not inherit from `minibuffer-local-map', as users -;; are encouraged to instead set this as the parent of that keymap. -(defvar evil-command-line-map (make-sparse-keymap) - "Keymap used for the various Evil command-lines. -Modifying this keymap corresponds to using the \":cmap\" Vim command. -See `evil-ex-completion-map' and `evil-ex-search-keymap' which inherit -from this keymap.") - -(defvar evil-ex-completion-map (make-sparse-keymap) - "Keymap for Ex.") - -(defvar evil-ex-initial-input nil - "Additional initial content of the Ex command line. -This content of this variable is appended to the Ex command line -when Ex is started interactively.") - -(defvar evil-ex-history nil - "History of Ex commands.") - -(define-obsolete-variable-alias - 'evil-ex-current-buffer 'evil-ex-original-buffer "1.15.0") -(defvar evil-ex-original-buffer nil - "Buffer that was current when the Evil command line was started.") - -(defvar evil-ex-point nil - "The point position when the Ex command was called.") - -(defvar evil-called-from-ex-p nil - "Non-nil if a command is currently being called as an Ex command.") - -(defvar evil-ex-range nil - "The current range of the Ex command.") - -(defvar evil-ex-bang nil - "The \"!\" argument of the current Ex command.") - -(defvar evil-ex-argument nil - "The current argument of the Ex command.") - -(defvar evil-previous-shell-command nil - "The last shell command.") - -;; Eval -(defvar evil-eval-history nil - "History of eval input, from the `=' register.") - -(defvar evil-eval-map (make-sparse-keymap) - "Keymap for eval input.") - -;; Searching -(defvar evil-ex-search-history nil - "The history for the search command.") - -(defvar evil-ex-search-direction nil - "The direction of the current search, either `forward' or `backward'.") - -(defvar evil-ex-search-count nil - "The count of the current search.") - -(defvar evil-ex-search-start-point nil - "The point where the search started.") - -(defvar evil-ex-search-overlay nil - "The overlay for the current search result.") - -(defvar evil-ex-search-pattern nil - "The last search pattern.") - -(defvar evil-ex-search-offset nil - "The last search offset.") - -(defvar evil-ex-search-match-beg nil - "The beginning position of the last match.") - -(defvar evil-ex-search-match-end nil - "The end position of the last match.") - -(defvar evil-ex-substitute-pattern nil - "The last substitute pattern.") - -(defvar evil-ex-substitute-replacement nil - "The last substitute replacement.") - -(defvar evil-ex-substitute-flags nil - "The last substitute flags.") - -(defvar evil-ex-substitute-current-replacement nil - "The actual replacement.") - -(defvar evil-ex-last-was-search nil - "Non-nil if the previous was a search. -Otherwise the previous command is assumed as substitute.") - -;; The lazy-highlighting framework -(evil-define-local-var evil-ex-active-highlights-alist nil - "An alist of currently active highlights.") - -(evil-define-local-var evil-ex-hl-update-timer nil - "Time used for updating highlights.") - -(defvar evil-ex-search-keymap (make-sparse-keymap) - "Keymap used in ex-search-mode.") - -(defcustom evil-want-empty-ex-last-command t - "Whether to default to evil-ex-previous-command at empty ex prompt." - :type 'boolean - :group 'evil) - -(defconst evil-version - (eval-when-compile - (with-temp-buffer - (let ((dir (file-name-directory (or load-file-name - byte-compile-current-file)))) - ;; git repository - (if (and (file-exists-p (concat dir "/.git")) - (ignore-errors - (zerop (call-process "git" nil '(t nil) nil - "rev-parse" - "--short" "HEAD")))) - (progn - (goto-char (point-min)) - (concat "evil-git-" - (buffer-substring (point-min) - (line-end-position)))) - ;; no repo, use plain version - "1.15.0")))) - "The current version of Evil") - -(defcustom evil-want-integration t - "Whether to load evil-integration.el. -This variable must be set before Evil is loaded." - :type 'boolean - :group 'evil) - -(defcustom evil-want-keybinding t - "Whether to load evil-keybindings.el. - -This loads a set of keybindings for evil in other modes as well as -setting the initial evil state in those modes. - -This variable must be set before evil is loaded." - :type 'boolean - :group 'evil) - -(defcustom evil-want-minibuffer nil - "Whether to enable Evil in minibuffer(s)." - :type 'boolean - :group 'evil - :set #'(lambda (sym value) - (set-default sym value) - (if value - (add-hook 'minibuffer-setup-hook 'evil-initialize) - (remove-hook 'minibuffer-setup-hook 'evil-initialize)))) - -(defun evil--redo-placeholder (_count) - (user-error "Customize `evil-undo-system' for redo functionality.")) - -(defvar evil-undo-function #'undo - "Function to be used by `evil-undo'. -Customized via `evil-undo-system'.") - -(defvar evil-redo-function #'evil--redo-placeholder - "Function to be used by `evil-redo'. -Customized via `evil-undo-system'.") - -(defun evil-set-undo-system (system) - "Set `evil-undo-function' and `evil-redo-function' by SYSTEM." - (cond - ((not system) - (setq evil-undo-function #'undo - evil-redo-function #'evil--redo-placeholder)) - ((eq system 'undo-redo) - (setq evil-undo-function #'undo-only - evil-redo-function #'undo-redo)) - ((eq system 'undo-tree) - (setq evil-undo-function 'undo-tree-undo - evil-redo-function 'undo-tree-redo)) - ((eq system 'undo-fu) - (setq evil-undo-function 'undo-fu-only-undo - evil-redo-function 'undo-fu-only-redo)) - (t (error "Unknown undo system `%s'" system)))) - -(defcustom evil-undo-system nil - "Undo system Evil should use. -If equal to `undo-tree' or `undo-fu', those packages must be -installed. If equal to `undo-tree', `undo-tree-mode' must also be -activated. If equal to `undo-redo', Evil uses commands natively -available in Emacs 28." - :type '(choice (const :tag "Vanilla undo" nil) - (const undo-redo) - (const undo-tree) - (const undo-fu)) - :group 'evil - :set #'(lambda (sym value) - (evil-set-undo-system value) - (set-default sym value))) - -(defcustom evil-visual-update-x-selection-p t - "Whether to update the X PRIMARY selection with the current visual region." - :type 'boolean - :group 'evil) - -(defun evil-version () - (interactive) - (message "Evil version %s" evil-version)) - -(provide 'evil-vars) - -;;; evil-vars.el ends here diff --git a/.config/emacs/lisp/evil/evil.el b/.config/emacs/lisp/evil/evil.el deleted file mode 100644 index 757a564..0000000 --- a/.config/emacs/lisp/evil/evil.el +++ /dev/null @@ -1,158 +0,0 @@ -;;; evil.el --- Extensible vi layer -*- lexical-binding: t; -*- - -;; The following list of authors was kept up to date until the beginning of -;; 2017, when evil moved under new maintainers. For authors since then, please -;; consult the git logs. - -;; Alessandro Piras -;; Alexander Baier -;; Antono Vasiljev -;; Bailey Ling -;; Barry O'Reilly -;; Christoph Lange -;; Daniel Reiter -;; Eivind Fonn -;; Emanuel Evans -;; Eric Siegel -;; Eugene Yaremenko -;; Frank Fischer -;; Frank Terbeck -;; Gordon Gustafson -;; Herbert Jones -;; Jonas Bernoulli -;; Jonathan Claggett -;; José A. Romero L. -;; Justin Burkett -;; Lars Andersen -;; Lintaro Ina -;; Lukasz Wrzosek -;; Marian Schubert -;; Matthew Malcomson <> -;; Michael Markert -;; Mike Gerwitz -;; Nikolai Weibull -;; phaebz -;; ralesi -;; Rodrigo Setti -;; Sanel Zukan -;; Sarah Brofeldt -;; Simon Hafner -;; Stefan Wehr -;; Sune Simonsen -;; Thomas Hisch -;; Tim Harper -;; Tom Willemse -;; Trevor Murphy -;; Ulrich Müller -;; Vasilij Schneidermann -;; Vegard Øye -;; Winfred Lu -;; Wolfgang Jenkner -;; Xiao Hanyu -;; York Zhao - -;; The following line is included for NonGNU ELPA's build script: -;; Maintainer: Tom Dalziel - -;; Maintainers: The emacs-evil team. -;; To get in touch, please use the bug tracker or the -;; mailing list (see below). -;; Created: 2011-03-01 -;; Version: 1.15.0 -;; Package-Requires: ((emacs "24.1") (cl-lib "0.5") (goto-chg "1.6") (nadvice "0.3")) -;; Keywords: emulations -;; URL: https://github.com/emacs-evil/evil -;; Repository: https://github.com/emacs-evil/evil.git -;; EmacsWiki: http://www.emacswiki.org/emacs/Evil -;; Bug tracker: https://github.com/emacs-evil/evil/issues -;; If you have bug reports, suggestions or patches, please -;; create an issue at the bug tracker (open for everyone). -;; Other discussions (tips, extensions) go to the mailing list. -;; Mailing list: -;; Subscribe: http://tinyurl.com/implementations-list -;; Newsgroup: nntp://news.gmane.org/gmane.emacs.vim-emulation -;; Archives: http://dir.gmane.org/gmane.emacs.vim-emulation -;; You don't have to subscribe to post; we usually reply -;; within a few days and CC our replies back to you. -;; -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This file is part of Evil. -;; -;; Evil is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Evil is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Evil. If not, see . - -;;; Commentary: - -;; Evil is an extensible vi layer for Emacs. It emulates the main -;; features of Vim, and provides facilities for writing custom -;; extensions. -;; -;; Evil lives in a Git repository. To obtain Evil, do -;; -;; git clone git://github.com/emacs-evil/evil.git -;; -;; Move Evil to ~/.emacs.d/evil (or somewhere else in the `load-path'). -;; Then add the following lines to ~/.emacs: -;; -;; (add-to-list 'load-path "~/.emacs.d/evil") -;; (require 'evil) -;; (evil-mode 1) -;; -;; Evil requires undo-redo (Emacs 28), undo-fu or undo-tree for redo -;; functionality. Otherwise, Evil uses regular Emacs undo. -;; -;; https://codeberg.org/ideasman42/emacs-undo-fu -;; https://melpa.org/#/undo-fu -;; https://gitlab.com/tsc25/undo-tree -;; https://elpa.gnu.org/packages/undo-tree.html -;; -;; Evil requires `goto-last-change' and `goto-last-change-reverse' -;; function for the corresponding motions g; g, as well as the -;; last-change-register `.'. One package providing these functions is -;; goto-chg.el: -;; -;; https://github.com/emacs-evil/goto-chg -;; https://melpa.org/#/goto-chg -;; https://elpa.nongnu.org/nongnu/goto-chg.html -;; -;; Without this package the corresponding motions will raise an error. - -;;; Code: - -(require 'evil-vars) -(require 'evil-common) -(require 'evil-core) -(require 'evil-states) -(require 'evil-repeat) -(require 'evil-macros) -(require 'evil-search) -(require 'evil-ex) -(require 'evil-types) -(require 'evil-commands) -(require 'evil-jumps) -(require 'evil-maps) - -(when evil-want-integration - (require 'evil-integration)) - -(when evil-want-keybinding - (require 'evil-keybindings)) - -(run-hooks 'evil-after-load-hook) - -(provide 'evil) - -;;; evil.el ends here diff --git a/.config/emacs/lisp/evil/scripts/evil-extract-docstrings b/.config/emacs/lisp/evil/scripts/evil-extract-docstrings deleted file mode 100755 index 55dbd79..0000000 --- a/.config/emacs/lisp/evil/scripts/evil-extract-docstrings +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env -S emacs --script - -(setq cur-path (file-name-directory load-file-name)) - -(add-to-list 'load-path (expand-file-name ".." cur-path)) -(require 'evil) -(require 'evil-digraphs) -(require 'json) -(require 'help) - -(defun mark-command-keys (string) - "Mark key bindings in STRING with the \":kbd:\" Sphinx role." - (when string - (cl-loop - for prev = 0 then pos until (>= prev (length string)) - for pos = (next-single-property-change prev 'face string (length string)) - concat - (let ((s (substring string prev pos))) - (if (eq (get-text-property prev 'face string) 'help-key-binding) - (format ":kbd:`%s`" s) - s))))) - -(let (vars) - (mapatoms - (lambda (sym) - (when (string-prefix-p "evil-" (symbol-name sym)) - (let ((default (eval (car (get sym 'standard-value))))) - (push `(,sym (default . ,(cond - ((consp default) (format "%S" default)) - ((symbolp default) (symbol-name default)) - (t default))) - (local . ,(local-variable-if-set-p sym)) - (default-type . ,(type-of default)) - (var-docstring . ,(mark-command-keys (documentation-property sym 'variable-documentation))) - (fn-docstring . ,(ignore-errors (mark-command-keys (documentation sym)))) - (arglist . ,(help-function-arglist sym)) - (functionp . ,(functionp sym)) - (macrop . ,(macrop sym))) - vars))))) - (with-temp-file (expand-file-name "../doc/docstringdb.json" cur-path) - (insert (json-encode vars)))) diff --git a/.config/emacs/lisp/evil/scripts/evil-release-stable b/.config/emacs/lisp/evil/scripts/evil-release-stable deleted file mode 100755 index c075903..0000000 --- a/.config/emacs/lisp/evil/scripts/evil-release-stable +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env ruby - -# Copyright (c) 2015 Frank Fischer -# -# This program is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see - - -# This script releases a new (minor) stable release given that some -# new commits on the stable branch since the last tag exist. - -Dir.chdir File.dirname(__FILE__) - -def die(msg = "Failed") - STDERR.puts msg - exit 1 -end - -def run(cmd) - system(cmd) or die(cmd) -end - -run 'hg pull' -run 'hg update -r stable' - -tag = `hg tags`.split("\n").select{|line| line =~ /^\d+\.\d+\.\d+/}.map do |line| - tag, rev = line.split - major, minor, tiny = tag.split(/\./).map(&:to_i) - [major, minor, tiny, rev[/\d+/].to_i] -end.max - -tag or die 'No tagged revision found' - -stable = `hg log -r 'branch(stable) and not file("../.hgtags") and not ..tag("re:\\d+\\.\\d+\\.\\d+")' | wc -l`.to_i != 0 - -if stable - new_tag = "#{tag[0]}.#{tag[1]}.#{tag[2]+1}" - run "make -C .. nversion VERSION='#{new_tag}'" - run "hg commit -m 'update version to #{new_tag}'" - run "hg tag -m 'version #{new_tag}' -r stable #{new_tag}" - run "hg push -r stable" -end diff --git a/.config/emacs/lisp/evil/scripts/evilupdate b/.config/emacs/lisp/evil/scripts/evilupdate deleted file mode 100755 index 27e832b..0000000 --- a/.config/emacs/lisp/evil/scripts/evilupdate +++ /dev/null @@ -1,177 +0,0 @@ -#!/usr/bin/emacs --script -;;; evilupate.el -- Publishing script for Evil - -;;; Header: - -;; This file is not part of Emacs - -;; Author: Frank Fischer -;; Maintainer: Frank Fischer -;; Version: 1.0 -;; Package-Requires: ((emacs "24.3") (s "1.9.0") (f "0.17.2") yaoddmuse) - -;; The contents of this file are subject to the GPL License, Version 3.0. - -;; Copyright (C) 2015, 2016, Frank Fischer - -;; This program is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; This is a small script to update Evil's version at certain places: -;; -;; - topic of the IRC channel #evil-mode in irc.libera.chat -;; - EmacsWiki page -;; - header of all source files -;; - the ELPA package file -;; -;; The script should be invoked with the new version string -;; -;; evil-update.el 1.2.3 -;; - -;;; Code: - -(package-initialize) - -(require 'f) -(require 'erc) -(require 'yaoddmuse) - -(defconst evilupdate-irc-nick "lyrobot") -(defconst evilupdate-irc-channel "#evil-mode") -(defconst evilupdate-irc-topic - "Evil = Extensible vi layer for Emacs | Current version: VERSION | https://github.com/emacs-evil/evil | If you don't get an answer here, please use the mailing-list implementations-list@lists.ourproject.org") -(defconst evilupdate-wiki-page "Evil") -(defvar evilupdate-version "1.0.0") -(defvar evilupdate-done nil) - -(defun evilupdate-wait () - "Wait until `evilupdate-done' is set to t." - (while (not evilupdate-done) - (sleep-for 1)) - (setq evilupdate-done nil)) - -(defun evilupdate-done () - "Set `evilupdate-done' to t to stop the corresponding `evilupdate-wait'." - (setq evilupdate-done t)) - -(defun evilupdate-update-irc () - "Update the topic of the IRC channel." - (let ((erc-nick evilupdate-irc-nick) - (erc-autojoin-channels-alist nil) - (auth-sources nil)) - (erc-tls :server "irc.libera.chat" :port "6697" :nick evilupdate-irc-nick) - (add-hook 'erc-join-hook - (lambda () - (let (case-fold-search) - (erc-set-topic (replace-regexp-in-string "VERSION" - evilupdate-version - evilupdate-irc-topic - nil t))) - (erc-quit-server "") - (sleep-for 5) - (evilupdate-done))) - (erc-join-channel evilupdate-irc-channel) - (evilupdate-wait))) - -(defun evilupdate-wiki-trace (page-buffer-name) - "Callback for updating the EmacsWiki page in buffer PAGE-BUFFER-NAME." - (with-current-buffer page-buffer-name - (goto-char (point-min)) - (when (re-search-forward "Current stable version: \\*\\*\\([^*]*\\)\\*\\*") - (goto-char (match-beginning 1)) - (delete-region (match-beginning 1) (match-end 1)) - (insert evilupdate-version) - (yaoddmuse-post-buffer (current-buffer) evilupdate-version nil) - (evilupdate-done)))) - -(unless (require 'nadvice nil t) - (defadvice yaoddmuse-display-page (around evilupdate activate) - (evilupdate-wiki-trace (ad-get-arg 0)))) - -(defun evilupdate-update-emacswiki () - "Update the version information on the EmacsWiki page." - (setq yaoddmuse-wikis - '(("EmacsWiki" "https://www.emacswiki.org/emacs" utf-8 "uihnscuskc=1;"))) - (when (featurep 'nadvice) - (advice-add 'yaoddmuse-display-page :after 'evilupdate-wiki-trace)) - (yaoddmuse-edit "EmacsWiki" evilupdate-wiki-page t) - (evilupdate-wait)) - -(defun evilupdate-update-regexp (file regexp) - "Update version tag in FILE. -The version tag is defined by the REGEXP, in particular by the first -match group." - (find-file file) - (goto-char (point-min)) - (when (re-search-forward regexp nil t) - (goto-char (match-beginning 1)) - (delete-region (match-beginning 1) (match-end 1)) - (insert evilupdate-version) - (save-buffer))) - -(defun evilupdate-update-files () - "Replace version comments in all source files." - (dolist (file (f-glob "*.el")) - (evilupdate-update-regexp file ";;\\s-*Version:\\s-*\\([^\n]+\\)"))) - -(defun evilupdate-update-pkg () - "Replace version in package file." - (evilupdate-update-regexp "evil-pkg.el" "\"evil\"[ \t\n\r]*\"\\([^\"]+\\)\"")) - -(defun evilupdate-update-var () - "Replace version in `evil-version' variable." - (evilupdate-update-regexp - "evil-vars.el" - "t \"\\([^\"]*\\)\"[) \n\r\t]*\"The current version of Evil")) - -(defun evilupdate-update-news () - "Send an posting to the mailing list." - (shell-command (concat "thunderbird -compose \"newsgroups=gmane.emacs.vim-emulation,preselectid=id2,subject='[ANN] Evil version " evilupdate-version " released',body='" - "Evil version " evilupdate-version " has been released. - -The stable version can be installed from MELPA stable [1] and NonGNU ELPA [2]. -The latest development version is available from MELPA [3]. - -The Evil developers. - -[1] http://stable.melpa.org -[2] https://elpa.nongnu.org/nongnu/evil.html -[3] http://melpa.org -'\""))) - -(defun evilupdate-update (version nonews) - "Update Evil to VERSION. -If NONEWS is non-nil do not post a message to the newsgroup." - (setq evilupdate-cnt 0) - (setq evilupdate-version version) - (evilupdate-update-emacswiki) - (evilupdate-update-irc) - (evilupdate-update-files) - (evilupdate-update-pkg) - (evilupdate-update-var) - (unless nonews (evilupdate-update-news))) - -(cond - ((= (length argv) 2) - (unless (equal (car argv) "nonews") - (user-error "Usage: evilupdate.el [-n] VERSION")) - (evilupdate-update (cadr argv) t)) - ((= (length argv) 1) - (evilupdate-update (cadr argv))) - (t - (user-error "Usage: evilupdate.el [-n] VERSION"))) - -;;; evilupdate.el ends here diff --git a/.config/emacs/lisp/expand-region/cc-mode-expansions.el b/.config/emacs/lisp/expand-region/cc-mode-expansions.el deleted file mode 100644 index 126b7f1..0000000 --- a/.config/emacs/lisp/expand-region/cc-mode-expansions.el +++ /dev/null @@ -1,186 +0,0 @@ -;;; cc-mode-expansions.el --- C-specific expansions for expand-region -*- lexical-binding: t; -*- - -;; Copyright (C) 2012-2023 Free Software Foundation, Inc - -;; Author: François Févotte -;; Based on js-mode-expansions by: Magnar Sveen -;; Keywords: marking region - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; -;; Extra expansions for C-like modes that I've found useful so far: -;; -;; er/c-mark-statement -;; Captures simple and more complex statements. -;; -;; er/c-mark-fully-qualified-name -;; Captures identifiers composed of several '::'-separated parts. -;; -;; er/c-mark-function-call[-1|-2] -;; Captures an identifier followed by a '()'-enclosed block. -;; -;; er/c-mark-statement-block[-1|-2] -;; Captures a statement followed by a '{}'-enclosed block. -;; This matches function definitions and if/for/... constructs. -;; -;; er/c-mark-vector-access[-1|-2] -;; Captures an identifier followed by a '[]'-enclosed block. -;; -;; Feel free to contribute any other expansions for C at -;; -;; https://github.com/magnars/expand-region.el - -;;; Code: - -(require 'expand-region-core) -(require 'er-basic-expansions) -(require 'cc-cmds) - -(defun er/c-mark-statement () - "Mark the current C statement. - -This function tries to ensure that pair-delimited substring are -either fully inside or fully outside the statement." - (interactive) - (unless (use-region-p) - (set-mark (point))) - - (if (< (point) (mark)) - (exchange-point-and-mark)) - - ;; Contract the region a bit to make the - ;; er/c-mark-statement function idempotent - (when (>= (- (point) (mark)) 2) - (exchange-point-and-mark) - (forward-char) - (exchange-point-and-mark) - (backward-char)) - - (let (beg end) - ;; Determine boundaries of the outside-pairs region - (save-mark-and-excursion - (c-end-of-statement) - (er/mark-outside-pairs) - (setq beg (point) - end (mark))) - - ;; Determine boundaries of the statement as given - ;; by c-beginning-of-statement/c-end-of-statement - (c-end-of-statement) - (exchange-point-and-mark) - (c-end-of-statement)(c-beginning-of-statement 1) - - ;; If the two regions overlap, expand the region - (cond ((and (<= (point) beg) - (< (mark) end)) - (set-mark end)) - ((and (> (point) beg) - (>= (mark) end)) - (goto-char beg) - (c-end-of-statement) - (c-beginning-of-statement 1))))) - -(defun er/c-mark-fully-qualified-name () - "Mark the current C++ fully qualified identifier. - -This function captures identifiers composed of multiple -'::'-separated parts." - (interactive) - (er/mark-symbol) - (when (use-region-p) - (when (> (point) (mark)) - (exchange-point-and-mark)) - (while (er/looking-back-exact "::") - (backward-char 2) - (skip-syntax-backward "_w")) - (exchange-point-and-mark) - (while (looking-at "::") - (forward-char 2) - (skip-syntax-forward "_w")) - (exchange-point-and-mark))) - -(defmacro er/c-define-construct (name mark-first-part open-brace doc) - (let ((docstring (make-symbol "docstring-tmp"))) - (setq docstring - (concat - doc "\n\n" - "This function tries to mark a region consisting of two parts:\n" - (format " - the first part is marked using `%s'\n" (symbol-name mark-first-part)) - (format " - the second part is a block beginning with %S\n\n" open-brace))) - `(progn - (defun ,(intern (concat (symbol-name name) "-1")) () - ,(concat docstring - "This function assumes that point is in the first part and the\n" - "region is active.\n\n" - (format "See also `%s'." (concat (symbol-name name) "-2"))) - (interactive) - (when (use-region-p) - (,mark-first-part) - (exchange-point-and-mark) - (let ((oldpos (point))) - (skip-syntax-forward " ") - (if (looking-at ,open-brace) - (progn (forward-sexp) - (exchange-point-and-mark)) - (goto-char oldpos))))) - (defun ,(intern (concat (symbol-name name) "-2")) () - ,(concat docstring - "This function assumes that the block constituting the second part\n" - "is already marked and active.\n\n" - (format "See also `%s'." (concat (symbol-name name) "-1"))) - (interactive) - (when (use-region-p) - (when (> (point) (mark)) - (exchange-point-and-mark)) - (when (looking-at ,open-brace) - (let ((beg (point)) - (end (progn (forward-sexp 1) - (point)))) - (goto-char beg) - (skip-syntax-backward " ") - (backward-char) - (deactivate-mark) - (,mark-first-part) - (set-mark end)))))))) - -(er/c-define-construct er/c-mark-function-call er/c-mark-fully-qualified-name "(" - "Mark the current function call.") -(er/c-define-construct er/c-mark-statement-block er/c-mark-statement "{" - "Mark the current block construct (like if, for, etc.)") -(er/c-define-construct er/c-mark-vector-access er/c-mark-fully-qualified-name "\\[" - "Mark the current vector access.") - -(defun er/add-cc-mode-expansions () - "Adds expansions for buffers in c-mode." - (set (make-local-variable 'er/try-expand-list) - (append er/try-expand-list - '(er/c-mark-statement - er/c-mark-fully-qualified-name - er/c-mark-function-call-1 er/c-mark-function-call-2 - er/c-mark-statement-block-1 er/c-mark-statement-block-2 - er/c-mark-vector-access-1 er/c-mark-vector-access-2)))) - -(er/enable-mode-expansions 'c-mode #'er/add-cc-mode-expansions) -(er/enable-mode-expansions 'c++-mode #'er/add-cc-mode-expansions) -(er/enable-mode-expansions 'objc-mode #'er/add-cc-mode-expansions) -(er/enable-mode-expansions 'java-mode #'er/add-cc-mode-expansions) -(er/enable-mode-expansions 'idl-mode #'er/add-cc-mode-expansions) -(er/enable-mode-expansions 'pike-mode #'er/add-cc-mode-expansions) -(er/enable-mode-expansions 'awk-mode #'er/add-cc-mode-expansions) - -(provide 'cc-mode-expansions) - -;; cc-mode-expansions.el ends here diff --git a/.config/emacs/lisp/expand-region/er-basic-expansions.el b/.config/emacs/lisp/expand-region/er-basic-expansions.el deleted file mode 100644 index 08cdc56..0000000 --- a/.config/emacs/lisp/expand-region/er-basic-expansions.el +++ /dev/null @@ -1,267 +0,0 @@ -;;; er-basic-expansions.el --- Words, symbols, strings, et al -*- lexical-binding: t; -*- - -;; Copyright (C) 2011-2023 Free Software Foundation, Inc - -;; Author: Magnar Sveen -;; Keywords: marking region - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; Expansions that are useful in any major mode. - -;;; Code: - -(require 'expand-region-core) - -(defun er/mark-word () - "Mark the entire word around or in front of point." - (interactive) - (let ((word-regexp "\\sw")) - (when (or (looking-at word-regexp) - (er/looking-back-on-line word-regexp)) - (skip-syntax-forward "w") - (set-mark (point)) - (skip-syntax-backward "w")))) - -(defun er/mark-symbol () - "Mark the entire symbol around or in front of point." - (interactive) - (let ((symbol-regexp "\\s_\\|\\sw")) - (when (or (looking-at symbol-regexp) - (er/looking-back-on-line symbol-regexp)) - (skip-syntax-forward "_w") - (set-mark (point)) - (skip-syntax-backward "_w")))) - -(defun er/mark-symbol-with-prefix () - "Mark the entire symbol around or in front of point, including prefix." - (interactive) - (let ((symbol-regexp "\\s_\\|\\sw") - (prefix-regexp "\\s'")) - (when (or (looking-at prefix-regexp) - (looking-at symbol-regexp) - (er/looking-back-on-line symbol-regexp)) - (skip-syntax-forward "'") - (skip-syntax-forward "_w") - (set-mark (point)) - (skip-syntax-backward "_w") - (skip-syntax-backward "'")))) - -;; Mark method call - -(defun er/mark-next-accessor () - "Presumes that current symbol is already marked, skips over one -period and marks next symbol." - (interactive) - (when (use-region-p) - (when (< (point) (mark)) - (exchange-point-and-mark)) - ;; (let ((symbol-regexp "\\s_\\|\\sw")) - (when (looking-at "\\.") - (forward-char 1) - (skip-syntax-forward "_w") - (exchange-point-and-mark)))) ;; ) - -(defun er/mark-method-call () - "Mark the current symbol (including dots) and then paren to closing paren." - (interactive) - (let ((symbol-regexp "\\(\\s_\\|\\sw\\|\\.\\)+")) - (when (or (looking-at symbol-regexp) - (er/looking-back-on-line symbol-regexp)) - (skip-syntax-backward "_w.") - (set-mark (point)) - (when (looking-at symbol-regexp) - (goto-char (match-end 0))) - (if (looking-at "(") - (forward-list)) - (exchange-point-and-mark)))) - -;; Comments - -(defun er--point-is-in-comment-p () - "t if point is in comment, otherwise nil" - (or (nth 4 (syntax-ppss)) - (memq (get-text-property (point) 'face) '(font-lock-comment-face font-lock-comment-delimiter-face)))) - -(defun er/mark-comment () - "Mark the entire comment around point." - (interactive) - (when (er--point-is-in-comment-p) - (let ((p (point))) - (while (and (er--point-is-in-comment-p) (not (eobp))) - (forward-char 1)) - (skip-chars-backward "\n\r") - (set-mark (point)) - (goto-char p) - (while (er--point-is-in-comment-p) - (forward-char -1)) - (forward-char 1)))) - -;; Quotes - -(defun er--current-quotes-char () - "The char that is the current quote delimiter" - (nth 3 (syntax-ppss))) - -(defalias 'er--point-inside-string-p #'er--current-quotes-char) - -(defun er--move-point-forward-out-of-string () - "Move point forward until it exits the current quoted string." - (er--move-point-backward-out-of-string) - (forward-sexp)) - -(defun er--move-point-backward-out-of-string () - "Move point backward until it exits the current quoted string." - (goto-char (nth 8 (syntax-ppss)))) - -(defun er/mark-inside-quotes () - "Mark the inside of the current string, not including the quotation marks." - (interactive) - (when (er--point-inside-string-p) - (er--move-point-backward-out-of-string) - (forward-char) - (set-mark (point)) - (er--move-point-forward-out-of-string) - (backward-char) - (exchange-point-and-mark))) - -(defun er/mark-outside-quotes () - "Mark the current string, including the quotation marks." - (interactive) - (if (er--point-inside-string-p) - (er--move-point-backward-out-of-string) - (when (and (not (use-region-p)) - (er/looking-back-on-line "\\s\"")) - (backward-char) - (er--move-point-backward-out-of-string))) - (when (looking-at "\\s\"") - (set-mark (point)) - (forward-char) - (er--move-point-forward-out-of-string) - (exchange-point-and-mark))) - -;; Pairs - ie [] () {} etc - -(defun er--point-inside-pairs-p () - "Is point inside any pairs?" - (> (car (syntax-ppss)) 0)) - -(defun er/mark-inside-pairs () - "Mark inside pairs (as defined by the mode), not including the pairs." - (interactive) - (when (er--point-inside-pairs-p) - (goto-char (nth 1 (syntax-ppss))) - (set-mark (save-excursion - (forward-char 1) - (skip-chars-forward er--space-str) - (point))) - (forward-list) - (backward-char) - (skip-chars-backward er--space-str) - (exchange-point-and-mark))) - -(defun er--looking-at-pair () - "Is point looking at an opening pair char?" - (looking-at "\\s(")) - -(defun er--looking-at-marked-pair () - "Is point looking at a pair that is entirely marked?" - (and (er--looking-at-pair) - (use-region-p) - (>= (mark) - (save-excursion - (forward-list) - (point))))) - -(defun er/mark-outside-pairs () - "Mark pairs (as defined by the mode), including the pair chars." - (interactive) - (if (and (er/looking-back-on-line "\\s)+\\=") - (not (er--looking-at-pair))) - (ignore-errors (backward-list 1)) - (skip-chars-forward er--space-str)) - (when (and (er--point-inside-pairs-p) - (or (not (er--looking-at-pair)) - (er--looking-at-marked-pair))) - (goto-char (nth 1 (syntax-ppss)))) - (when (er--looking-at-pair) - (set-mark (point)) - (forward-list) - (exchange-point-and-mark))) - -(require 'thingatpt) - -(defun er/mark-url () - (interactive) - (end-of-thing 'url) - (set-mark (point)) - (beginning-of-thing 'url)) - -(defun er/mark-email () - (interactive) - (end-of-thing 'email) - (set-mark (point)) - (beginning-of-thing 'email)) - -(defun er/mark-defun () - "Mark defun around or in front of point." - (interactive) - (end-of-defun) - (skip-chars-backward er--space-str) - (set-mark (point)) - (beginning-of-defun) - (skip-chars-forward er--space-str)) - -;; Methods to try expanding to -(setq er/try-expand-list - (append '(er/mark-word - er/mark-symbol - er/mark-symbol-with-prefix - er/mark-next-accessor - er/mark-method-call - er/mark-inside-quotes - er/mark-outside-quotes - er/mark-inside-pairs - er/mark-outside-pairs - er/mark-comment - er/mark-url - er/mark-email - er/mark-defun) - er/try-expand-list)) - -(when (and (>= emacs-major-version 29) - (treesit-available-p)) - (defun er/mark-ts-node () - "Mark tree sitter node around or after point." - (interactive) - (when (treesit-language-at (point)) - (let* ((node (if (use-region-p) - (treesit-node-on (region-beginning) (region-end)) - (treesit-node-at (point)))) - (node-start (treesit-node-start node)) - (node-end (treesit-node-end node))) - ;; when the node fits the region exactly, try its parent node instead - (when (and (= (region-beginning) node-start) - (= (region-end) node-end)) - (when-let ((node (treesit-node-parent node))) - (setq node-start (treesit-node-start node) - node-end (treesit-node-end node)))) - (goto-char node-start) - (set-mark node-end)))) - (setq er/try-expand-list (append er/try-expand-list '(er/mark-ts-node)))) - -(provide 'er-basic-expansions) -;;; er-basic-expansions.el ends here diff --git a/.config/emacs/lisp/expand-region/expand-region-core.el b/.config/emacs/lisp/expand-region/expand-region-core.el deleted file mode 100644 index c239fd1..0000000 --- a/.config/emacs/lisp/expand-region/expand-region-core.el +++ /dev/null @@ -1,322 +0,0 @@ -;;; expand-region-core.el --- Increase selected region by semantic units. -*- lexical-binding: t; -*- - -;; Copyright (C) 2011-2023 Free Software Foundation, Inc - -;; Author: Magnar Sveen -;; Keywords: marking region - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; The core functionality of expand-region. - -;; See README.md - -;;; Code: - -(require 'expand-region-custom) -(declare-function er/expand-region "expand-region") - -(defvar er/history '() - "A history of start and end points so we can contract after expanding.") - -;; history is always local to a single buffer -(make-variable-buffer-local 'er/history) - -(defvar er--space-str " \t\n") -(defvar er--blank-list (append er--space-str nil)) - -(defvar er--show-expansion-message nil) - -(defvar er/try-expand-list nil - "A list of functions that are tried when expanding.") - -(defvar er/save-mode-excursion nil - "A function to save excursion state when expanding.") - -(defsubst er--first-invocation () - "t if this is the first invocation of `er/expand-region' or `er/contract-region'." - (not (memq last-command '(er/expand-region er/contract-region)))) - -(defun er--prepare-expanding () - (when (and (er--first-invocation) - (not (use-region-p))) - (push-mark nil t) ;; one for keeping starting position - (push-mark nil t)) ;; one for replace by set-mark in expansions - - (when (not transient-mark-mode) - (setq-local transient-mark-mode (cons 'only transient-mark-mode)))) - -(defun er--copy-region-to-register () - (when (and (stringp expand-region-autocopy-register) - (> (length expand-region-autocopy-register) 0)) - (set-register (aref expand-region-autocopy-register 0) - (filter-buffer-substring (region-beginning) (region-end))))) - -;; save-mark-and-excursion in Emacs 25 works like save-excursion did before -(eval-when-compile - (when (< emacs-major-version 25) - (defmacro save-mark-and-excursion (&rest body) - `(save-excursion ,@body)))) - -(defmacro er--save-excursion (&rest body) - `(let ((action (lambda () - (save-mark-and-excursion ,@body)))) - (if er/save-mode-excursion - (funcall er/save-mode-excursion action) - (funcall action)))) - -(defun er--expand-region-1 () - "Increase selected region by semantic units. -Basically it runs all the mark-functions in `er/try-expand-list' -and chooses the one that increases the size of the region while -moving point or mark as little as possible." - (let* ((p1 (point)) - (p2 (if (use-region-p) (mark) (point))) - (start (min p1 p2)) - (end (max p1 p2)) - (try-list er/try-expand-list) - (best-start (point-min)) - (best-end (point-max)) - ;; (set-mark-default-inactive nil) - ) - - ;; add hook to clear history on buffer changes - (unless er/history - (add-hook 'after-change-functions #'er/clear-history t t)) - - ;; remember the start and end points so we can contract later - ;; unless we're already at maximum size - (unless (and (= start best-start) - (= end best-end)) - (push (cons p1 p2) er/history)) - - (when (and expand-region-skip-whitespace - (er--point-is-surrounded-by-white-space) - (= start end)) - (skip-chars-forward er--space-str) - (setq start (point))) - - (while try-list - (er--save-excursion - (ignore-errors - (funcall (car try-list)) - (when (and (region-active-p) - (er--this-expansion-is-better start end best-start best-end)) - (setq best-start (point)) - (setq best-end (mark)) - (when (and er--show-expansion-message (not (minibufferp))) - (message "%S" (car try-list)))))) - (setq try-list (cdr try-list))) - - (setq deactivate-mark nil) - ;; if smart cursor enabled, decide to put it at start or end of region: - (if (and expand-region-smart-cursor - (not (= start best-start))) - (progn (goto-char best-end) - (set-mark best-start)) - (goto-char best-start) - (set-mark best-end)) - - (er--copy-region-to-register) - - (when (and (= best-start (point-min)) - (= best-end (point-max))) ;; We didn't find anything new, so exit early - 'early-exit))) - -(defun er--this-expansion-is-better (start end best-start best-end) - "t if the current region is an improvement on previous expansions. - -This is provided as a separate function for those that would like -to override the heuristic." - (and - (<= (point) start) - (>= (mark) end) - (> (- (mark) (point)) (- end start)) - (or (> (point) best-start) - (and (= (point) best-start) - (< (mark) best-end))))) - -;;;###autoload -(defun er/contract-region (arg) - "Contract the selected region to its previous size. -With prefix argument contracts that many times. -If prefix argument is negative calls `er/expand-region'. -If prefix argument is 0 it resets point and mark to their state -before calling `er/expand-region' for the first time." - (interactive "p") - (if (< arg 0) - (er/expand-region (- arg)) - (when er/history - ;; Be sure to reset them all if called with 0 - (when (= arg 0) - (setq arg (length er/history))) - - (when (not transient-mark-mode) - (setq-local transient-mark-mode (cons 'only transient-mark-mode))) - - ;; Advance through the list the desired distance - (while (and (cdr er/history) - (> arg 1)) - (setq arg (- arg 1)) - (setq er/history (cdr er/history))) - ;; Reset point and mark - (let* ((last (pop er/history)) - (start (car last)) - (end (cdr last))) - (goto-char start) - (set-mark end) - - (er--copy-region-to-register) - - (when (eq start end) - (deactivate-mark) - (er/clear-history)))))) - -(defun er/prepare-for-more-expansions-internal (repeat-key-str) - "Return bindings and a message to inform user about them" - (let ((msg (format "Type %s to expand again" repeat-key-str)) - (bindings (list (cons repeat-key-str '(er/expand-region 1))))) - ;; If contract and expand are on the same binding, ignore contract - (unless (string-equal repeat-key-str expand-region-contract-fast-key) - (setq msg (concat msg (format ", %s to contract" expand-region-contract-fast-key))) - (push (cons expand-region-contract-fast-key '(er/contract-region 1)) bindings)) - ;; If reset and either expand or contract are on the same binding, ignore reset - (unless (or (string-equal repeat-key-str expand-region-reset-fast-key) - (string-equal expand-region-contract-fast-key expand-region-reset-fast-key)) - (setq msg (concat msg (format ", %s to reset" expand-region-reset-fast-key))) - (push (cons expand-region-reset-fast-key '(er/expand-region 0)) bindings)) - (cons msg bindings))) - -(defun er/prepare-for-more-expansions () - "Let one expand more by just pressing the last key." - (let* ((repeat-key (event-basic-type last-input-event)) - (repeat-key-str (single-key-description repeat-key)) - (msg-and-bindings (er/prepare-for-more-expansions-internal repeat-key-str)) - (msg (car msg-and-bindings)) - (bindings (cdr msg-and-bindings))) - (when repeat-key - (er/set-temporary-overlay-map - (let ((map (make-sparse-keymap))) - (dolist (binding bindings map) - (define-key map (read-kbd-macro (car binding)) - `(lambda () - (interactive) - (setq this-command `,(cadr ',binding)) - (or (not expand-region-show-usage-message) (minibufferp) (message "%s" ,msg)) - (eval `,(cdr ',binding)))))) - t) - (or (not expand-region-show-usage-message) (minibufferp) (message "%s" msg))))) - -(defalias 'er/set-temporary-overlay-map - (if (fboundp 'set-temporary-overlay-map) ;Emacs≥24.3 - #'set-temporary-overlay-map - ;; Backport this function from newer emacs versions - (lambda (map &optional keep-pred) - "Set a new keymap that will only exist for a short period of time. -The new keymap to use must be given in the MAP variable. When to -remove the keymap depends on user input and KEEP-PRED: - -- if KEEP-PRED is nil (the default), the keymap disappears as - soon as any key is pressed, whether or not the key is in MAP; - -- if KEEP-PRED is t, the keymap disappears as soon as a key *not* - in MAP is pressed; - -- otherwise, KEEP-PRED must be a 0-arguments predicate that will - decide if the keymap should be removed (if predicate returns - nil) or kept (otherwise). The predicate will be called after - each key sequence." - - (let* ((clearfunsym (make-symbol "clear-temporary-overlay-map")) - (overlaysym (make-symbol "t")) - (alist (list (cons overlaysym map))) - (clearfun - `(lambda () - (unless ,(cond ((null keep-pred) nil) - ((eq t keep-pred) - `(eq this-command - (lookup-key ',map - (this-command-keys-vector)))) - (t `(funcall ',keep-pred))) - (remove-hook 'pre-command-hook ',clearfunsym) - (setq emulation-mode-map-alists - (delq ',alist emulation-mode-map-alists)))))) - (set overlaysym overlaysym) - (fset clearfunsym clearfun) - (add-hook 'pre-command-hook clearfunsym) - - (push alist emulation-mode-map-alists))))) - -(advice-add 'keyboard-quit :before #'er--collapse-region-before) -(advice-add 'cua-cancel :before #'er--collapse-region-before) -(defun er--collapse-region-before (&rest _) - ;; FIXME: Re-use `er--first-invocation'? - (when (memq last-command '(er/expand-region er/contract-region)) - (er/contract-region 0))) - -(advice-add 'minibuffer-keyboard-quit - :around #'er--collapse-region-minibuffer-keyboard-quit) -(defun er--collapse-region-minibuffer-keyboard-quit (orig-fun &rest args) - ;; FIXME: Re-use `er--first-invocation'? - (if (memq last-command '(er/expand-region er/contract-region)) - (er/contract-region 0) - (apply orig-fun args))) - - -(defun er/clear-history (&rest _) - "Clear the history." - (setq er/history '()) - (remove-hook 'after-change-functions #'er/clear-history t)) - -(defun er--point-is-surrounded-by-white-space () - (and (or (memq (char-before) er--blank-list) - (eq (point) (point-min))) - (memq (char-after) er--blank-list))) - -(defun er/enable-mode-expansions (mode add-fn) - (add-hook (intern (format "%s-hook" mode)) add-fn) - (save-window-excursion ;; FIXME: Why? - (dolist (buffer (buffer-list)) - (with-current-buffer buffer - (when (derived-mode-p mode) - (funcall add-fn)))))) - -(defun er/enable-minor-mode-expansions (mode add-fn) - (add-hook (intern (format "%s-hook" mode)) add-fn) - (save-window-excursion - (dolist (buffer (buffer-list)) - (with-current-buffer buffer - (when (symbol-value mode) - (funcall add-fn)))))) - -;; Some more performant version of `looking-back' - -(defun er/looking-back-on-line (regexp) - "Version of `looking-back' that only checks current line." - (looking-back regexp (line-beginning-position))) - -(defun er/looking-back-exact (s) - "Version of `looking-back' that only looks for exact matches, no regexp." - (string= s (buffer-substring (- (point) (length s)) - (point)))) - -(defun er/looking-back-max (regexp count) - "Version of `looking-back' that only check COUNT chars back." - (looking-back regexp (max 1 (- (point) count)))) - -(provide 'expand-region-core) - -;;; expand-region-core.el ends here diff --git a/.config/emacs/lisp/expand-region/expand-region-custom.el b/.config/emacs/lisp/expand-region/expand-region-custom.el deleted file mode 100644 index f86f861..0000000 --- a/.config/emacs/lisp/expand-region/expand-region-custom.el +++ /dev/null @@ -1,115 +0,0 @@ -;;; expand-region-custom.el --- Increase selected region by semantic units. -*- lexical-binding: t; -*- - -;; Copyright (C) 2012-2023 Free Software Foundation, Inc - -;; Author: Magnar Sveen -;; Keywords: marking region - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; This file holds customization variables. - -;;; Code: - -;;;###autoload -(defgroup expand-region nil - "Increase selected region by semantic units." - :group 'tools) - -;;;###autoload -(defcustom expand-region-preferred-python-mode 'python - "The name of your preferred python mode." - :type '(choice (const :tag "Emacs' python.el" python) - (const :tag "fgallina's python.el" fgallina-python) - (const :tag "python-mode.el" python-mode))) - -;;;###autoload -(defcustom expand-region-guess-python-mode t - "If expand-region should attempt to guess your preferred python mode." - :type '(choice (const :tag "Guess" t) - (const :tag "Do not guess" nil))) - -(defun expand-region-guess-python-mode () - "Guess the user's preferred python mode." - (setq expand-region-preferred-python-mode - (if (fboundp 'python-setup-brm) - 'python - 'fgallina-python))) - -;;;###autoload -(defcustom expand-region-autocopy-register "" - "Register to copy most recent expand or contract to. - -Activated when set to a string of a single character (for example, \"e\")." - :type 'string) - -;;;###autoload -(defcustom expand-region-skip-whitespace t - "If expand-region should skip past whitespace on initial expansion." - :type '(choice (const :tag "Skip whitespace" t) - (const :tag "Do not skip whitespace" nil))) - -;;;###autoload -(defcustom expand-region-fast-keys-enabled t - "If expand-region should bind fast keys after initial expand/contract." - :type '(choice (const :tag "Enable fast keys" t) - (const :tag "Disable fast keys" nil))) - -;;;###autoload -(defcustom expand-region-contract-fast-key "-" - "Key to use after an initial expand/contract to contract once more." - :type 'string) - -;;;###autoload -(defcustom expand-region-reset-fast-key "0" - "Key to use after an initial expand/contract to undo." - :type 'string) - -;;;###autoload -(defcustom expand-region-exclude-text-mode-expansions - '(html-mode nxml-mode) - "List of modes derived from `text-mode' to exclude from text mode expansions." - :type '(repeat (symbol :tag "Major Mode" unknown))) - -;;;###autoload -(defcustom expand-region-smart-cursor nil - "Defines whether the cursor should be placed intelligently after expansion. - -If set to t, and the cursor is already at the beginning of the new region, -keep it there; otherwise, put it at the end of the region. - -If set to nil, always place the cursor at the beginning of the region." - :type '(choice (const :tag "Smart behaviour" t) - (const :tag "Standard behaviour" nil))) - -;;;###autoload -(define-obsolete-variable-alias 'er/enable-subword-mode? - 'expand-region-subword-enabled "2019-03-23") - -;;;###autoload -(defcustom expand-region-subword-enabled nil - "Whether expand-region should use subword expansions." - :type '(choice (const :tag "Enable subword expansions" t) - (const :tag "Disable subword expansions" nil))) - -(defcustom expand-region-show-usage-message t - "Whether expand-region should show usage message." - :group 'expand-region - :type 'boolean) - -(provide 'expand-region-custom) - -;;; expand-region-custom.el ends here diff --git a/.config/emacs/lisp/expand-region/expand-region.el b/.config/emacs/lisp/expand-region/expand-region.el deleted file mode 100644 index 9f63d51..0000000 --- a/.config/emacs/lisp/expand-region/expand-region.el +++ /dev/null @@ -1,198 +0,0 @@ -;;; expand-region.el --- Increase selected region by semantic units. -*- lexical-binding: t; -*- - -;; Copyright (C) 2011-2023 Free Software Foundation, Inc - -;; Author: Magnar Sveen -;; Keywords: marking region -;; URL: https://github.com/magnars/expand-region.el -;; Version: 1.0.0 -;; Package-Requires: ((emacs "24.4")) - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; Expand region increases the selected region by semantic units. Just keep -;; pressing the key until it selects what you want. - -;; An example: - -;; (setq alphabet-start "abc def") - -;; With the cursor at the `c`, it starts by marking the entire word `abc`, then -;; expand to the contents of the quotes `abc def`, then to the entire quote -;; `"abc def"`, then to the contents of the sexp `setq alphabet-start "abc def"` -;; and finally to the entire sexp. - -;; You can set it up like this: - -;; (require 'expand-region) -;; (global-set-key (kbd "C-=") 'er/expand-region) - -;; There's also `er/contract-region` if you expand too far. - -;; ## Video - -;; You can [watch an intro to expand-region at Emacs Rocks](http://emacsrocks.com/e09.html). - -;; ## Language support - -;; Expand region works fairly well with most languages, due to the general -;; nature of the basic expansions: - -;; er/mark-word -;; er/mark-symbol -;; er/mark-method-call -;; er/mark-inside-quotes -;; er/mark-outside-quotes -;; er/mark-inside-pairs -;; er/mark-outside-pairs - -;; However, most languages also will benefit from some specially crafted -;; expansions. For instance, expand-region comes with these extra expansions for -;; html-mode: - -;; er/mark-html-attribute -;; er/mark-inner-tag -;; er/mark-outer-tag - -;; You can add your own expansions to the languages of your choice simply by -;; creating a function that looks around point to see if it's inside or looking -;; at the construct you want to mark, and if so - mark it. - -;; There's plenty of examples to look at in these files. - -;; After you make your function, add it to a buffer-local version of -;; the `er/try-expand-list`. - -;; **Example:** - -;; Let's say you want expand-region to also mark paragraphs and pages in -;; text-mode. Incidentally Emacs already comes with `mark-paragraph` and -;; `mark-page`. To add it to the try-list, do this: - -;; (defun er/add-text-mode-expansions () -;; (setq-local er/try-expand-list (append -;; er/try-expand-list -;; '(mark-paragraph -;; mark-page)))) - -;; (er/enable-mode-expansions 'text-mode #'er/add-text-mode-expansions) - -;; Add that to its own file, and require it at the bottom of this one, -;; where it says "Mode-specific expansions" - -;; **Warning:** Badly written expansions might slow down expand-region -;; dramatically. Remember to exit quickly before you start traversing -;; the entire document looking for constructs to mark. - -;; ## Contribute - -;; If you make some nice expansions for your favorite mode, it would be -;; great if you opened a pull-request. The repo is at: - -;; https://github.com/magnars/expand-region.el - -;; Changes to `expand-region-core` itself must be accompanied by feature tests. -;; They are written in [Ecukes](http://ecukes.info), a Cucumber for Emacs. - -;; To fetch the test dependencies: - -;; $ cd /path/to/expand-region -;; $ git submodule init -;; $ git submodule update - -;; Run the tests with: - -;; $ ./util/ecukes/ecukes features - -;; If you want to add feature-tests for your mode-specific expansions as well, -;; that is utterly excellent. - -;; ## Contributors - -;; * [Josh Johnston](https://github.com/joshwnj) contributed `er/contract-region` -;; * [Le Wang](https://github.com/lewang) contributed consistent handling of the mark ring, expanding into pairs/quotes just left of the cursor, and general code clean-up. -;; * [Matt Briggs](https://github.com/mbriggs) contributed expansions for ruby-mode. -;; * [Ivan Andrus](https://github.com/gvol) contributed expansions for python-mode, text-mode, LaTeX-mode and nxml-mode. -;; * [Raimon Grau](https://github.com/kidd) added support for when transient-mark-mode is off. -;; * [Gleb Peregud](https://github.com/gleber) contributed expansions for erlang-mode. -;; * [fgeller](https://github.com/fgeller) and [edmccard](https://github.com/edmccard) contributed better support for python and its multiple modes. -;; * [François Févotte](https://github.com/ffevotte) contributed expansions for C and C++. -;; * [Roland Walker](https://github.com/rolandwalker) added option to copy the contents of the most recent action to a register, and some fixes. -;; * [Damien Cassou](https://github.com/DamienCassou) added option to continue expanding/contracting with fast keys after initial expand. - -;; Thanks! - -;;; Code: - -(require 'expand-region-core) -(require 'expand-region-custom) -(require 'er-basic-expansions) - -;;;###autoload -(defun er/expand-region (arg) - "Increase selected region by semantic units. - -With prefix argument expands the region that many times. -If prefix argument is negative calls `er/contract-region'. -If prefix argument is 0 it resets point and mark to their state -before calling `er/expand-region' for the first time." - (interactive "p") - (if (< arg 1) - (er/contract-region (- arg)) - (er--prepare-expanding) - (while (>= arg 1) - (setq arg (- arg 1)) - (when (eq 'early-exit (er--expand-region-1)) - (setq arg 0))) - (when (and expand-region-fast-keys-enabled - (not (memq last-command '(er/expand-region er/contract-region)))) - (er/prepare-for-more-expansions)))) - -;; (eval-after-load 'clojure-mode '(require 'clojure-mode-expansions)) -;; (eval-after-load 'erlang-mode '(require 'erlang-mode-expansions)) -;; (eval-after-load 'feature-mode '(require 'feature-mode-expansions)) -;; (eval-after-load 'sgml-mode '(require 'html-mode-expansions)) ;; html-mode is defined in sgml-mode.el -;; (eval-after-load 'rhtml-mode '(require 'html-mode-expansions)) -;; (eval-after-load 'nxhtml-mode '(require 'html-mode-expansions)) -;; (eval-after-load 'web-mode '(require 'web-mode-expansions)) -;; (eval-after-load 'js '(require 'js-mode-expansions)) -;; (eval-after-load 'js2-mode '(require 'js-mode-expansions)) -;; (eval-after-load 'js2-mode '(require 'js2-mode-expansions)) -;; (eval-after-load 'js3-mode '(require 'js-mode-expansions)) -;; (eval-after-load 'latex '(require 'latex-mode-expansions)) -;; (eval-after-load 'nxml-mode '(require 'nxml-mode-expansions)) -;; (eval-after-load 'octave-mod '(require 'octave-expansions)) -;; (eval-after-load 'octave '(require 'octave-expansions)) -;; (eval-after-load 'python '(progn -;; (when expand-region-guess-python-mode -;; (expand-region-guess-python-mode)) -;; (if (eq 'python expand-region-preferred-python-mode) -;; (require 'python-el-expansions) -;; (require 'python-el-fgallina-expansions)))) -;; (eval-after-load 'python-mode '(require 'python-mode-expansions)) -;; (eval-after-load 'ruby-mode '(require 'ruby-mode-expansions)) -;; (eval-after-load 'org '(require 'the-org-mode-expansions)) -(eval-after-load 'cc-mode '(require 'cc-mode-expansions)) -;; (eval-after-load 'text-mode '(require 'text-mode-expansions)) -;; (eval-after-load 'cperl-mode '(require 'cperl-mode-expansions)) -;; (eval-after-load 'sml-mode '(require 'sml-mode-expansions)) -;; (eval-after-load 'enh-ruby-mode '(require 'enh-ruby-mode-expansions)) -;; (eval-after-load 'subword '(require 'subword-mode-expansions)) -;; (eval-after-load 'yaml-mode '(require 'yaml-mode-expansions)) - -(provide 'expand-region) - -;;; expand-region.el ends here diff --git a/.config/emacs/lisp/helpful.el b/.config/emacs/lisp/helpful.el deleted file mode 100644 index 9516e46..0000000 --- a/.config/emacs/lisp/helpful.el +++ /dev/null @@ -1,3111 +0,0 @@ -;;; helpful.el --- A better *help* buffer -*- lexical-binding: t; -*- - -;; Copyright (C) 2017-2022 Wilfred Hughes - -;; Author: Wilfred Hughes -;; URL: https://github.com/Wilfred/helpful -;; Keywords: help, lisp -;; Version: 0.22 -;; Package-Requires: ((emacs "25") (dash "2.18.0") (s "1.11.0") (f "0.20.0") (elisp-refs "1.2")) - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; Helpful is a replacement for *help* buffers that provides much more -;; contextual information. To get started, try: -;; `M-x helpful-function RET helpful-function -;; -;; The full set of commands you can try is: -;; -;; * helpful-function -;; * helpful-command -;; * helpful-key -;; * helpful-macro -;; * helpful-callable -;; * helpful-variable -;; * helpful-at-point -;; -;; For more information and screenshots, see -;; https://github.com/wilfred/helpful - -;;; Code: - -(require 'elisp-refs) -(require 'help) -(require 'help-fns) -(require 'dash) -(require 's) -(require 'f) -(require 'find-func) -(require 'nadvice) -(require 'info-look) -(require 'edebug) -(require 'trace) -(require 'imenu) -(require 'cc-langs) - -(declare-function org-link-types "ol" ()) -(declare-function org-link-store-props "ol" (&rest plist)) -(declare-function org-link-get-parameter "ol" (type key)) - -(defvar-local helpful--sym nil) -(defvar-local helpful--callable-p nil) -(defvar-local helpful--associated-buffer nil - "The buffer being used when showing inspecting -buffer-local variables.") -(defvar-local helpful--start-buffer nil - "The buffer we were originally called from.") -(defvar-local helpful--view-literal nil - "Whether to show a value as a literal, or a pretty interactive -view.") -(defvar-local helpful--first-display t - "Whether this is the first time this results buffer has been -displayed. - -Nil means that we're refreshing, so we don't want to clobber any -settings changed by the user.") - -(defgroup helpful nil - "A rich help system with contextual information." - :link '(url-link "https://github.com/Wilfred/helpful") - :group 'help) - -(defcustom helpful-max-buffers - 5 - "Helpful will kill the least recently used Helpful buffer -if there are more than this many. - -To disable cleanup entirely, set this variable to nil. See also -`helpful-kill-buffers' for a one-off cleanup." - :type '(choice (const nil) number) - :group 'helpful) - -(defcustom helpful-switch-buffer-function - #'pop-to-buffer - "Function called to display the *Helpful* buffer." - :type 'function - :group 'helpful) - -(defcustom helpful-set-variable-function - (if (< 29 emacs-major-version) #'setopt #'setq) - "Function used by `helpful--set' to interactively set variables." - :type 'function - :group 'helpful) - -;; TODO: explore whether more basic highlighting is fast enough to -;; handle larger functions. See `c-font-lock-init' and its use of -;; font-lock-keywords-1. -(defconst helpful-max-highlight 5000 - "Don't highlight code with more than this many characters. - -This is currently only used for C code, as lisp highlighting -seems to be more efficient. This may change again in future. - -See `this-command' as an example of a large piece of C code that -can make Helpful very slow.") - -(defun helpful--kind-name (symbol callable-p) - "Describe what kind of symbol this is." - (cond - ((not callable-p) "variable") - ((commandp symbol) "command") - ((macrop symbol) "macro") - ((functionp symbol) "function") - ((special-form-p symbol) "special form"))) - -(defun helpful--buffer (symbol callable-p) - "Return a buffer to show help for SYMBOL in." - (let* ((current-buffer (current-buffer)) - (buf-name - (format "*helpful %s*" - (if (symbolp symbol) - (format "%s: %s" - (helpful--kind-name symbol callable-p) - symbol) - "lambda"))) - (buf (get-buffer buf-name))) - (unless buf - ;; If we need to create the buffer, ensure we don't exceed - ;; `helpful-max-buffers' by killing the least recently used. - (when (numberp helpful-max-buffers) - (let* ((buffers (buffer-list)) - (helpful-bufs (--filter (with-current-buffer it - (eq major-mode 'helpful-mode)) - buffers)) - ;; `buffer-list' seems to be ordered by most recently - ;; visited first, so keep those. - (excess-buffers (-drop (1- helpful-max-buffers) helpful-bufs))) - ;; Kill buffers so we have one buffer less than the maximum - ;; before we create a new one. - (-each excess-buffers #'kill-buffer))) - - (setq buf (get-buffer-create buf-name))) - - ;; Initialise the buffer with the symbol and associated data. - (with-current-buffer buf - (helpful-mode) - (setq helpful--sym symbol) - (setq helpful--callable-p callable-p) - (setq helpful--start-buffer current-buffer) - (setq helpful--associated-buffer current-buffer) - (setq list-buffers-directory - (if (symbolp symbol) (format "%s: %s" (helpful--kind-name symbol callable-p) symbol) "lambda")) - (if (helpful--primitive-p symbol callable-p) - (setq-local comment-start "//") - (setq-local comment-start ";"))) - buf)) - -(defface helpful-heading - '((t (:weight bold))) - "Face used for headings in Helpful buffers.") - -(defun helpful--heading (text) - "Propertize TEXT as a heading." - (propertize (concat text "\n") 'face 'helpful-heading)) - -(defun helpful--format-closure (sym form) - "Given a closure, return an equivalent defun form." - (-let (((_keyword _env args . body) form) - (docstring nil)) - (when (stringp (car body)) - (setq docstring (car body)) - (setq body (cdr body)) - ;; Ensure that the docstring doesn't have lines starting with (, - ;; or it breaks indentation. - (setq docstring - (s-replace "\n(" "\n\\(" docstring))) - (if docstring - `(defun ,sym ,args ,docstring ,@body) - `(defun ,sym ,args ,@body)))) - -(defun helpful--pretty-print (value) - "Pretty-print VALUE. - -If VALUE is very big, the user may press \\[keyboard-quit] to -gracefully stop the printing. If VALUE is self-referential, the -error will be caught and displayed." - ;; Inspired by `ielm-eval-input'. - (condition-case err - (s-trim-right (pp-to-string value)) - (error - (propertize (format "(Display error: %s)" (cadr err)) - 'face 'font-lock-comment-face)) - (quit - (propertize "(User quit during pretty-printing.)" - 'face 'font-lock-comment-face)))) - -(defun helpful--sort-symbols (sym-list) - "Sort symbols in SYM-LIST alphabetically." - (--sort - (string< (symbol-name it) (symbol-name other)) - sym-list)) - -(defun helpful--button (text type &rest properties) - ;; `make-text-button' mutates our string to add properties. Copy - ;; TEXT to prevent mutating our arguments, and to support 'pure' - ;; strings, which are read-only. - (setq text (substring-no-properties text)) - (apply #'make-text-button - text nil - :type type - properties)) - -(defun helpful--canonical-symbol (sym callable-p) - "If SYM is an alias, return the underlying symbol. -Return SYM otherwise." - (let ((depth 0)) - (if (and (symbolp sym) callable-p) - (progn - ;; Follow the chain of symbols until we find a symbol that - ;; isn't pointing to a symbol. - (while (and (symbolp (symbol-function sym)) - (< depth 10)) - (setq sym (symbol-function sym)) - (setq depth (1+ depth))) - ;; If this is an alias to a primitive, return the - ;; primitive's symbol. - (when (subrp (symbol-function sym)) - (setq sym (intern (subr-name (symbol-function sym)))))) - (setq sym (indirect-variable sym)))) - sym) - -(defun helpful--aliases (sym callable-p) - "Return all the aliases for SYM." - (let ((canonical (helpful--canonical-symbol sym callable-p)) - aliases) - (mapatoms - (lambda (s) - (when (and - ;; Skip variables that aren't bound, so we're faster. - (if callable-p (fboundp s) (boundp s)) - - ;; If this symbol is a new alias for our target sym, - ;; add it. - (eq canonical (helpful--canonical-symbol s callable-p)) - - ;; Don't include SYM. - (not (eq sym s))) - (push s aliases)))) - (helpful--sort-symbols aliases))) - -(defun helpful--obsolete-info (sym callable-p) - (when (symbolp sym) - (get sym (if callable-p 'byte-obsolete-info 'byte-obsolete-variable)))) - -(defun helpful--format-alias (sym callable-p) - (let ((obsolete-info (helpful--obsolete-info sym callable-p)) - (sym-button (helpful--button - (symbol-name sym) - 'helpful-describe-exactly-button - 'symbol sym - 'callable-p callable-p))) - (cond - (obsolete-info - (-if-let (version (-last-item obsolete-info)) - (format "%s (obsolete since %s)" sym-button version) - (format "%s (obsolete)" sym-button))) - (t - sym-button)))) - -(defun helpful--indent-rigidly (s amount) - "Indent string S by adding AMOUNT spaces to each line." - (with-temp-buffer - (insert s) - (indent-rigidly (point-min) (point-max) amount) - (buffer-string))) - -(defun helpful--format-properties (symbol) - "Return a string describing all the properties of SYMBOL." - (let* ((syms-and-vals - (-partition 2 (and (symbolp symbol) (symbol-plist symbol)))) - (syms-and-vals - (-sort (-lambda ((sym1 _) (sym2 _)) - (string-lessp (symbol-name sym1) (symbol-name sym2))) - syms-and-vals)) - (lines - (--map - (-let* (((sym val) it) - (pretty-val - (helpful--pretty-print val))) - (format "%s\n%s%s" - (propertize (symbol-name sym) - 'face 'font-lock-constant-face) - (helpful--indent-rigidly pretty-val 2) - (cond - ;; Also offer to disassemble byte-code - ;; properties. - ((byte-code-function-p val) - (format "\n %s" - (helpful--make-disassemble-button val))) - ((eq sym 'ert--test) - (format "\n %s" - (helpful--make-run-test-button symbol))) - (t - "")))) - syms-and-vals))) - (when lines - (s-join "\n" lines)))) - -(define-button-type 'helpful-forget-button - 'action #'helpful--forget - 'symbol nil - 'callable-p nil - 'follow-link t - 'help-echo "Unbind this function") - -;; TODO: it would be nice to optionally delete the source code too. -(defun helpful--forget (button) - "Unbind the current symbol." - (let* ((sym (button-get button 'symbol)) - (callable-p (button-get button 'callable-p)) - (kind (helpful--kind-name sym callable-p))) - (when (yes-or-no-p (format "Forget %s %s?" kind sym)) - (if callable-p - (fmakunbound sym) - (makunbound sym)) - (message "Forgot %s %s." kind sym) - (kill-buffer (current-buffer))))) - -(define-button-type 'helpful-c-source-directory - 'action #'helpful--c-source-directory - 'follow-link t - 'help-echo "Set directory to Emacs C source code") - -(defun helpful--c-source-directory (_button) - "Set `find-function-C-source-directory' so we can show the -source code to primitives." - (let ((emacs-src-dir (read-directory-name "Path to Emacs source code: "))) - ;; Let the user specify the source path with or without src/, - ;; which is a subdirectory in the Emacs tree. - (unless (equal (f-filename emacs-src-dir) "src") - (setq emacs-src-dir (f-join emacs-src-dir "src"))) - (setq find-function-C-source-directory emacs-src-dir)) - (helpful-update)) - -(define-button-type 'helpful-disassemble-button - 'action #'helpful--disassemble - 'follow-link t - 'object nil - 'help-echo "Show disassembled bytecode") - -(defun helpful--disassemble (button) - "Disassemble the current symbol." - ;; `disassemble' can handle both symbols (e.g. 'when) and raw - ;; byte-code objects. - (disassemble (button-get button 'object))) - -(define-button-type 'helpful-run-test-button - 'action #'helpful--run-test - 'follow-link t - 'symbol nil - 'help-echo "Run ERT test") - -(defun helpful--run-test (button) - "Disassemble the current symbol." - (ert (button-get button 'symbol))) - -(define-button-type 'helpful-edebug-button - 'action #'helpful--edebug - 'follow-link t - 'symbol nil - 'help-echo "Toggle edebug (re-evaluates definition)") - -(defun helpful--kbd-macro-p (sym) - "Is SYM a keyboard macro?" - (and (symbolp sym) - (let ((func (symbol-function sym))) - (or (stringp func) - (vectorp func))))) - -(defun helpful--edebug-p (sym) - "Does function SYM have its definition patched by edebug?" - (let ((fn-def (indirect-function sym))) - ;; Edebug replaces function source code with a sexp that has - ;; `edebug-enter', `edebug-after' etc interleaved. This means the - ;; function is interpreted, so `indirect-function' returns a list. - (when (and (consp fn-def) (consp (cdr fn-def))) - (-let [fn-end (-last-item fn-def)] - (and (consp fn-end) - (eq (car fn-end) 'edebug-enter)))))) - -(defun helpful--can-edebug-p (sym callable-p buf pos) - "Can we use edebug with SYM?" - (and - ;; SYM must be a function. - callable-p - ;; The function cannot be a primitive, it must be defined in elisp. - (not (helpful--primitive-p sym callable-p)) - ;; We need to be able to find its definition, or we can't step - ;; through the source. - buf pos)) - -(defun helpful--toggle-edebug (sym) - "Enable edebug when function SYM is called, -or disable if already enabled." - (-let ((should-edebug (not (helpful--edebug-p sym))) - ((buf pos created) (helpful--definition sym t))) - (if (and buf pos) - (progn - (with-current-buffer buf - (save-excursion - (save-restriction - (widen) - (goto-char pos) - - (let* ((edebug-all-forms should-edebug) - (edebug-all-defs should-edebug) - (form (edebug-read-top-level-form))) - ;; Based on `edebug-eval-defun'. - (eval (eval-sexp-add-defvars form) lexical-binding))))) - ;; If we're enabling edebug, we need the source buffer to - ;; exist. Otherwise, we can clean it up. - (when (and created (not should-edebug)) - (kill-buffer buf))) - - (user-error "Could not find source for edebug")))) - -(defun helpful--edebug (button) - "Toggle edebug for the current symbol." - (helpful--toggle-edebug (button-get button 'symbol)) - (helpful-update)) - -(define-button-type 'helpful-trace-button - 'action #'helpful--trace - 'follow-link t - 'symbol nil - 'help-echo "Toggle function tracing") - -(defun helpful--trace (button) - "Toggle tracing for the current symbol." - (let ((sym (button-get button 'symbol))) - (if (trace-is-traced sym) - (untrace-function sym) - (trace-function sym))) - (helpful-update)) - -(define-button-type 'helpful-navigate-button - 'action #'helpful--navigate - 'path nil - 'position nil - 'follow-link t - 'help-echo "Navigate to definition") - -(defun helpful--goto-char-widen (pos) - "Move point to POS in the current buffer. -If narrowing is in effect, widen if POS isn't in the narrowed area." - (when (or (< pos (point-min)) - (> pos (point-max))) - (widen)) - (goto-char pos)) - -(defun helpful--navigate (button) - "Navigate to the path this BUTTON represents." - (find-file (substring-no-properties (button-get button 'path))) - ;; We use `get-text-property' to work around an Emacs 25 bug: - ;; http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=f7c4bad17d83297ee9a1b57552b1944020f23aea - (-when-let (pos (get-text-property button 'position - (marker-buffer button))) - (helpful--goto-char-widen pos))) - -(defun helpful--navigate-button (text path &optional pos) - "Return a button that opens PATH and puts point at POS." - (helpful--button - text - 'helpful-navigate-button - 'path path - 'position pos)) - -(define-button-type 'helpful-buffer-button - 'action #'helpful--switch-to-buffer - 'buffer nil - 'position nil - 'follow-link t - 'help-echo "Switch to this buffer") - -(defun helpful--switch-to-buffer (button) - "Navigate to the buffer this BUTTON represents." - (let ((buf (button-get button 'buffer)) - (pos (button-get button 'position))) - (switch-to-buffer buf) - (when pos - (helpful--goto-char-widen pos)))) - -(defun helpful--buffer-button (buffer &optional pos) - "Return a button that switches to BUFFER and puts point at POS." - (helpful--button - (buffer-name buffer) - 'helpful-buffer-button - 'buffer buffer - 'position pos)) - -(define-button-type 'helpful-customize-button - 'action #'helpful--customize - 'symbol nil - 'follow-link t - 'help-echo "Open Customize for this symbol") - -(defun helpful--customize (button) - "Open Customize for this symbol." - (customize-variable (button-get button 'symbol))) - -(define-button-type 'helpful-associated-buffer-button - 'action #'helpful--associated-buffer - 'symbol nil - 'prompt-p nil - 'follow-link t - 'help-echo "Change associated buffer") - -(defun helpful--read-live-buffer (prompt predicate) - "Read a live buffer name, and return the buffer object. - -This is largely equivalent to `read-buffer', but counsel.el -overrides that to include previously opened buffers." - (let* ((names (-map #'buffer-name (buffer-list))) - (default - (cond - ;; If we're already looking at a buffer-local value, start - ;; the prompt from the relevant buffer. - ((and helpful--associated-buffer - (buffer-live-p helpful--associated-buffer)) - (buffer-name helpful--associated-buffer)) - ;; If we're looking at the global value, offer the initial - ;; buffer. - ((and helpful--start-buffer - (buffer-live-p helpful--start-buffer)) - (buffer-name helpful--start-buffer)) - ;; If we're looking at the global value and have no initial - ;; buffer, choose the first normal buffer. - (t - (--first (and (not (s-starts-with-p " " it)) - (not (s-starts-with-p "*" it))) - names)) - ))) - (get-buffer - (completing-read - prompt - names - predicate - t - nil - nil - default)))) - -(defun helpful--associated-buffer (button) - "Change the associated buffer, so we can see buffer-local values." - (let ((sym (button-get button 'symbol)) - (prompt-p (button-get button 'prompt-p))) - (if prompt-p - (setq helpful--associated-buffer - (helpful--read-live-buffer - "View variable in: " - (lambda (buf-name) - (local-variable-p sym (get-buffer buf-name))))) - (setq helpful--associated-buffer nil))) - (helpful-update)) - -(define-button-type 'helpful-toggle-button - 'action #'helpful--toggle - 'symbol nil - 'buffer nil - 'follow-link t - 'help-echo "Toggle this symbol between t and nil") - -(defun helpful--toggle (button) - "Toggle the symbol between nil and t." - (let ((sym (button-get button 'symbol)) - (buf (button-get button 'buffer))) - (save-current-buffer - ;; If this is a buffer-local variable, ensure we're in the right - ;; buffer. - (when buf - (set-buffer buf)) - (set sym (not (symbol-value sym)))) - (helpful-update))) - -(define-button-type 'helpful-set-button - 'action #'helpful--set - 'symbol nil - 'buffer nil - 'follow-link t - 'help-echo "Set the value of this symbol") - -(defun helpful--set (button) - "Set the value of this symbol." - (let* ((sym (button-get button 'symbol)) - (buf (button-get button 'buffer)) - (sym-value (helpful--sym-value sym buf)) - (set-func (if (local-variable-p sym buf) - "setq" - (symbol-name helpful-set-variable-function))) - ;; Inspired by `counsel-read-setq-expression'. - (expr - (minibuffer-with-setup-hook - (lambda () - (add-function :before-until (local 'eldoc-documentation-function) - #'elisp-eldoc-documentation-function) - (run-hooks 'eval-expression-minibuffer-setup-hook) - (goto-char (minibuffer-prompt-end)) - (forward-char (length (format "(%s %S " set-func sym)))) - (read-from-minibuffer - "Eval: " - (format - (if (or (consp sym-value) - (and (symbolp sym-value) - (not (null sym-value)) - (not (keywordp sym-value)))) - "(%s %s '%S)" - "(%s %s %S)") - set-func sym sym-value) - read-expression-map t - 'read-expression-history)))) - (save-current-buffer - ;; If this is a buffer-local variable, ensure we're in the right - ;; buffer. - (when buf - (set-buffer buf)) - (eval-expression expr)) - (helpful-update))) - -(define-button-type 'helpful-view-literal-button - 'action #'helpful--view-literal - 'help-echo "Toggle viewing as a literal") - -(defun helpful--view-literal (_button) - "Set the value of this symbol." - (setq helpful--view-literal - (not helpful--view-literal)) - (helpful-update)) - -(define-button-type 'helpful-all-references-button - 'action #'helpful--all-references - 'symbol nil - 'callable-p nil - 'follow-link t - 'help-echo "Find all references to this symbol") - -(defun helpful--all-references (button) - "Find all the references to the symbol that this BUTTON represents." - (let ((sym (button-get button 'symbol)) - (callable-p (button-get button 'callable-p))) - (cond - ((not callable-p) - (elisp-refs-variable sym)) - ((functionp sym) - (elisp-refs-function sym)) - ((macrop sym) - (elisp-refs-macro sym))))) - -(define-button-type 'helpful-callees-button - 'action #'helpful--show-callees - 'symbol nil - 'source nil - 'follow-link t - 'help-echo "Find the functions called by this function/macro") - -(defun helpful--display-callee-group (callees) - "Insert every entry in CALLEES." - (dolist (sym (helpful--sort-symbols callees)) - (insert " " - (helpful--button - (symbol-name sym) - 'helpful-describe-exactly-button - 'symbol sym - 'callable-p t) - "\n"))) - -(defun helpful--show-callees (button) - "Find all the references to the symbol that this BUTTON represents." - (let* ((buf (get-buffer-create "*helpful callees*")) - (sym (button-get button 'symbol)) - (raw-source (button-get button 'source)) - (source - (if (stringp raw-source) - (read raw-source) - raw-source)) - (syms (helpful--callees source)) - (primitives (-filter (lambda (sym) (helpful--primitive-p sym t)) syms)) - (compounds (-remove (lambda (sym) (helpful--primitive-p sym t)) syms))) - - (pop-to-buffer buf) - (let ((inhibit-read-only t)) - (erase-buffer) - - ;; TODO: Macros used, special forms used, global vars used. - (insert (format "Functions called by %s:\n\n" sym)) - (helpful--display-callee-group compounds) - - (when primitives - (insert "\n") - (insert (format "Primitives called by %s:\n\n" sym)) - (helpful--display-callee-group primitives)) - - (goto-char (point-min)) - - (helpful-mode)))) - -(define-button-type 'helpful-manual-button - 'action #'helpful--manual - 'symbol nil - 'follow-link t - 'help-echo "View this symbol in the Emacs manual") - -(defun helpful--manual (button) - "Open the manual for the system that this BUTTON represents." - (let ((sym (button-get button 'symbol))) - (info-lookup 'symbol sym #'emacs-lisp-mode))) - -(define-button-type 'helpful-describe-button - 'action #'helpful--describe - 'symbol nil - 'follow-link t - 'help-echo "Describe this symbol") - -(defun helpful--describe (button) - "Describe the symbol that this BUTTON represents." - (let ((sym (button-get button 'symbol))) - (helpful-symbol sym))) - -(define-button-type 'helpful-describe-exactly-button - 'action #'helpful--describe-exactly - 'symbol nil - 'callable-p nil - 'follow-link t - 'help-echo "Describe this symbol") - -(defun helpful--describe-exactly (button) - "Describe the symbol that this BUTTON represents. -This differs from `helpful--describe' because here we know -whether the symbol represents a variable or a callable." - (let ((sym (button-get button 'symbol)) - (callable-p (button-get button 'callable-p))) - (if callable-p - (helpful-callable sym) - (helpful-variable sym)))) - -(define-button-type 'helpful-info-button - 'action #'helpful--info - 'info-node nil - 'follow-link t - 'help-echo "View this Info node") - -(defun helpful--info (button) - "Describe the symbol that this BUTTON represents." - (info (button-get button 'info-node))) - -(define-button-type 'helpful-shortdoc-button - 'action #'helpful--shortdoc - 'info-node nil - 'follow-link t - 'help-echo "View this Shortdoc group") - -(defun helpful--shortdoc (button) - "Describe the symbol that this BUTTON represents." - (shortdoc-display-group (button-get button 'shortdoc-group) - (button-get button 'symbol))) - -(defun helpful--split-first-line (docstring) - "If the first line is a standalone sentence, ensure we have a -blank line afterwards." - (let* ((lines (s-lines docstring)) - (first-line (-first-item lines)) - (second-line (when (> (length lines) 1) (nth 1 lines)))) - (if (and (s-ends-with-p "." first-line) - (stringp second-line) - (not (equal second-line ""))) - (s-join "\n" - (-cons* first-line "" (cdr lines))) - docstring))) - -(defun helpful--propertize-sym-ref (sym-name before-txt after-txt) - "Given a symbol name from a docstring, convert to a button (if -bound) or else highlight." - (let* ((sym (intern sym-name))) - (cond - ;; Highlight keywords. - ((s-matches-p - (rx ":" - symbol-start - (+? (or (syntax word) (syntax symbol))) - symbol-end) - sym-name) - (propertize sym-name - 'face 'font-lock-builtin-face)) - ((and (boundp sym) (s-ends-with-p "variable " (downcase before-txt))) - (helpful--button - sym-name - 'helpful-describe-exactly-button - 'symbol sym - 'callable-p nil)) - ((and (fboundp sym) - (or - (s-starts-with-p " command" (downcase after-txt)) - (s-ends-with-p "command " (downcase before-txt)) - (s-ends-with-p "function " (downcase before-txt)))) - (helpful--button - sym-name - 'helpful-describe-exactly-button - 'symbol sym - 'callable-p t)) - ;; Only create a link if this is a symbol that is bound as a - ;; variable or callable. - ((or (boundp sym) (fboundp sym)) - (helpful--button - sym-name - 'helpful-describe-button - 'symbol sym)) - ;; If this is already a button, don't modify it. - ((get-text-property 0 'button sym-name) - sym-name) - ;; Highlight the quoted string. - (t - (propertize sym-name - 'face 'font-lock-constant-face))))) - -(defun helpful--propertize-info (docstring) - "Convert info references in DOCSTRING to buttons." - (replace-regexp-in-string - ;; Replace all text that looks like a link to an Info page. - (rx (seq (group - bow - (any "Ii") - "nfo" - (one-or-more whitespace)) - (group - (or "node" "anchor") - (one-or-more whitespace)) - (any "'`‘") - (group - (one-or-more - (not (any "'’")))) - (any "'’"))) - (lambda (it) - ;; info-name matches "[Ii]nfo ". - ;; space matches "node " or "anchor ". - ;; info-node has the form "(cl)Loop Facility". - (let ((info-name (match-string 1 it)) - (space (match-string 2 it)) - (info-node (match-string 3 it))) - ;; If the docstring doesn't specify a manual, assume the Emacs manual. - (save-match-data - (unless (string-match "^([^)]+)" info-node) - (setq info-node (concat "(emacs)" info-node)))) - (concat - info-name - space - (helpful--button - info-node - 'helpful-info-button - 'info-node info-node)))) - docstring - t t)) - -(defun helpful--keymap-keys (keymap) - "Return all the keys and commands in KEYMAP. -Flattens nested keymaps and follows remapped commands. - -Returns a list of pairs (KEYCODES COMMAND), where KEYCODES is a -vector suitable for `key-description', and COMMAND is a smbol." - (cond - ;; Prefix keys. - ((and - (symbolp keymap) - (fboundp keymap) - ;; Prefix keys use a keymap in the function slot of a symbol. - (keymapp (symbol-function keymap))) - (helpful--keymap-keys (symbol-function keymap))) - ;; Other symbols or compiled functions mean we've reached a leaf, - ;; so this is a command we can call. - ((or - (symbolp keymap) - (functionp keymap) - ;; Strings or vectors mean a keyboard macro. - (stringp keymap) - (vectorp keymap)) - `(([] ,keymap))) - ((stringp (car keymap)) - (helpful--keymap-keys (cdr keymap))) - ;; Otherwise, recurse on the keys at this level of the keymap. - (t - (let (result) - (dolist (item (cdr keymap)) - (cond - ((and (consp item) - (eq (car item) 'menu-bar)) - ;; Skip menu bar items. - nil) - ;; Sparse keymaps are lists. - ((consp item) - (-let [(keycode . value) item] - (-each (helpful--keymap-keys value) - (-lambda ((keycodes command)) - (push (list (vconcat (vector keycode) keycodes) command) - result))))) - ;; Dense keymaps are char-tables. - ((char-table-p item) - (map-char-table - (lambda (keycode value) - (-each (helpful--keymap-keys value) - (-lambda ((keycodes command)) - (push (list (vconcat (vector keycode) keycodes) command) - result)))) - item)))) - ;; For every command `new-func' mapped to a command `orig-func', show `new-func' with - ;; the key sequence for `orig-func'. - (setq result - (-map-when - (-lambda ((keycodes _)) - (and (> (length keycodes) 1) - (eq (elt keycodes 0) 'remap))) - (-lambda ((keycodes command)) - (list - (where-is-internal (elt keycodes 1) global-map t) - command)) - result)) - ;; Preserve the original order of the keymap. - (nreverse result))))) - -(defun helpful--format-hook (hook-val) - "Given a list value assigned to a hook, format it with links to functions." - (let ((lines - (--map - (if (and (symbolp it) (fboundp it)) - (helpful--button - (symbol-name it) - 'helpful-describe-exactly-button - 'symbol it - 'callable-p t) - (helpful--syntax-highlight (helpful--pretty-print it))) - hook-val))) - (format "(%s)" - (s-join "\n " lines)))) - -;; TODO: unlike `substitute-command-keys', this shows keybindings -;; which are currently shadowed (e.g. a global minor mode map). -(defun helpful--format-keymap (keymap) - "Format KEYMAP." - (let* ((keys-and-commands (helpful--keymap-keys keymap)) - ;; Convert keycodes [27 i] to "C-M-i". - (keys (-map #'-first-item keys-and-commands)) - ;; Add padding so all our strings are the same length. - (formatted-keys (-map #'key-description keys)) - (max-formatted-length (-max (cons 0 (-map #'length formatted-keys)))) - (aligned-keys (--map (s-pad-right (1+ max-formatted-length) - " " it) - formatted-keys)) - ;; Format commands as buttons. - (commands (-map (-lambda ((_ command)) command) - keys-and-commands)) - (formatted-commands - (--map - (cond - ((symbolp it) - (helpful--button - (symbol-name it) - 'helpful-describe-button - 'symbol it)) - ((or (stringp it) (vectorp it)) - "Keyboard Macro") - (t - "#")) - commands)) - ;; Build lines for display. - (lines - (-map (-lambda ((key . command)) (format "%s %s" key command)) - (-zip-pair aligned-keys formatted-commands)))) - ;; The flattened keymap will have normal bindings first, and - ;; inherited bindings last. Sort so that we group by prefix. - (s-join "\n" (-sort #'string< lines)))) - -(defun helpful--format-commands (str keymap) - "Replace all the \\[ references in STR with buttons." - (replace-regexp-in-string - ;; Text of the form \\[foo-command] - (rx "\\[" (group (+ (not (in "]")))) "]") - (lambda (it) - (let* ((button-face (if (>= emacs-major-version 28) 'help-key-binding 'button)) - (symbol-name (match-string 1 it)) - (symbol (intern symbol-name)) - (key (where-is-internal symbol keymap t)) - (key-description - (if key - (key-description key) - (format "M-x %s" symbol-name)))) - (helpful--button - key-description - 'helpful-describe-exactly-button - 'symbol symbol - 'callable-p t - 'face button-face))) - str - t - t)) - -(defun helpful--chars-before (pos n) - "Return up to N chars before POS in the current buffer. -The string may be shorter than N or empty if out-of-range." - (buffer-substring - (max (point-min) (- pos n)) - pos)) - -(defun helpful--chars-after (pos n) - "Return up to N chars after POS in the current buffer. -The string may be shorter than N or empty if out-of-range." - (buffer-substring - pos - (min (point-max) (+ pos n)))) - -(defun helpful--format-command-keys (docstring) - "Convert command key references and keymap references -in DOCSTRING to buttons. - -Emacs uses \\= to escape \\[ references, so replace that -unescaping too." - ;; Loosely based on `substitute-command-keys', but converts - ;; references to buttons. - (let ((keymap nil)) - (with-temp-buffer - (insert docstring) - (goto-char (point-min)) - (while (not (eobp)) - (cond - ((looking-at - ;; Text of the form "foo" - (rx "\"")) - ;; For literal strings, escape backslashes so our output - ;; shows copy-pasteable literals. - (let* ((start-pos (point)) - (end-pos (progn (forward-char) (search-forward "\"" nil t))) - contents) - (if end-pos - (progn - (setq contents (buffer-substring start-pos end-pos)) - (delete-region start-pos end-pos) - (insert (s-replace "\\" "\\\\" contents))) - (forward-char 1)))) - ((looking-at - ;; Text of the form \=X - (rx "\\=")) - ;; Remove the escaping, then step over the escaped char. - ;; Step over the escaped character. - (delete-region (point) (+ (point) 2)) - (forward-char 1)) - ((looking-at - ;; Text of the form `foo' - (rx "`")) - (let* ((start-pos (point)) - (end-pos (search-forward "'" nil t)) - (contents - (when end-pos - (buffer-substring (1+ start-pos) (1- end-pos))))) - (cond - ((null contents) - ;; If there's no closing ' to match the opening `, just - ;; leave it. - (goto-char (1+ start-pos))) - ((s-contains-p "`" contents) - ;; If we have repeated backticks `foo `bar', leave the - ;; first one. - (goto-char (1+ start-pos))) - ((s-contains-p "\\[" contents) - (delete-region start-pos end-pos) - (insert (helpful--format-commands contents keymap))) - ;; Highlight a normal `foo', extracting the surrounding - ;; text so we can detect e.g. "function `foo'". - (t - (let ((before (helpful--chars-before start-pos 10)) - (after (helpful--chars-after end-pos 10))) - (delete-region start-pos end-pos) - (insert (helpful--propertize-sym-ref contents before after))))))) - ((looking-at - ;; Text of the form \\ - (rx "\\<" (group (+ (not (in ">")))) ">" - (? "\n"))) - (let* ((symbol-with-parens (match-string 0)) - (symbol-name (match-string 1))) - ;; Remove the original string. - (delete-region (point) - (+ (point) (length symbol-with-parens))) - ;; Set the new keymap. - (setq keymap (symbol-value (intern symbol-name))))) - ((looking-at - ;; Text of the form \\{foo-mode-map} - (rx "\\{" (group (+ (not (in "}")))) "}")) - (let* ((symbol-with-parens (match-string 0)) - (symbol-name (match-string 1)) - (keymap - ;; Gracefully handle variables not being defined. - (ignore-errors - (symbol-value (intern symbol-name))))) - ;; Remove the original string. - (delete-region (point) - (+ (point) (length symbol-with-parens))) - (if keymap - (insert (helpful--format-keymap keymap)) - (insert (format "Keymap %s is not currently defined." - symbol-name))))) - ((looking-at - ;; Text of the form \\[foo-command] - (rx "\\[" (group (+ (not (in "]")))) "]")) - (let* ((symbol-with-parens (match-string 0))) - ;; Remove the original string. - (delete-region (point) - (+ (point) (length symbol-with-parens))) - ;; Add a button. - (insert (helpful--format-commands symbol-with-parens keymap)))) - ;; Don't modify other characters. - (t - (forward-char 1)))) - (buffer-string)))) - -;; TODO: fix upstream Emacs bug that means `-map' is not highlighted -;; in the docstring for `--map'. -(defun helpful--format-docstring (docstring) - "Replace cross-references with links in DOCSTRING." - (-> docstring - (helpful--split-first-line) - (helpful--propertize-info) - (helpful--propertize-links) - (helpful--propertize-bare-links) - (helpful--format-command-keys) - (s-trim))) - -(define-button-type 'helpful-link-button - 'action #'helpful--follow-link - 'follow-link t - 'help-echo "Follow this link") - -(defun helpful--propertize-links (docstring) - "Convert URL links in docstrings to buttons." - (replace-regexp-in-string - (rx "URL `" (group (*? any)) "'") - (lambda (match) - (let ((url (match-string 1 match))) - (concat "URL " - (helpful--button - url - 'helpful-link-button - 'url url)))) - docstring)) - -(defun helpful--propertize-bare-links (docstring) - "Convert URL links in docstrings to buttons." - (replace-regexp-in-string - (rx (group (or string-start space "<")) - (group "http" (? "s") "://" (+? (not (any space)))) - (group (? (any "." ">" ")")) - (or space string-end ">"))) - (lambda (match) - (let ((space-before (match-string 1 match)) - (url (match-string 2 match)) - (after (match-string 3 match))) - (concat - space-before - (helpful--button - url - 'helpful-link-button - 'url url) - after))) - docstring)) - -(defun helpful--follow-link (button) - "Follow the URL specified by BUTTON." - (browse-url (button-get button 'url))) - -(defconst helpful--highlighting-funcs - '(ert--activate-font-lock-keywords - highlight-quoted-mode - rainbow-delimiters-mode) - "Highlighting functions that are safe to run in a temporary buffer. -This is used in `helpful--syntax-highlight' to support extra -highlighting that the user may have configured in their mode -hooks.") - -;; TODO: crashes on `backtrace-frame' on a recent checkout. - -(defun helpful--syntax-highlight (source &optional mode) - "Return a propertized version of SOURCE in MODE." - (unless mode - (setq mode #'emacs-lisp-mode)) - (if (or - (< (length source) helpful-max-highlight) - (eq mode 'emacs-lisp-mode)) - (with-temp-buffer - (insert source) - - ;; Switch to major-mode MODE, but don't run any hooks. - (delay-mode-hooks (funcall mode)) - - ;; `delayed-mode-hooks' contains mode hooks like - ;; `emacs-lisp-mode-hook'. Build a list of functions that are run - ;; when the mode hooks run. - (let (hook-funcs) - (dolist (hook delayed-mode-hooks) - (let ((funcs (symbol-value hook))) - (setq hook-funcs (append hook-funcs funcs)))) - - ;; Filter hooks to those that relate to highlighting, and run them. - (setq hook-funcs (-intersection hook-funcs helpful--highlighting-funcs)) - (-map #'funcall hook-funcs)) - - (if (fboundp 'font-lock-ensure) - (font-lock-ensure) - (with-no-warnings - (font-lock-fontify-buffer))) - (buffer-string)) - ;; SOURCE was too long to highlight in a reasonable amount of - ;; time. - (concat - (propertize - "// Skipping highlighting due to " - 'face 'font-lock-comment-face) - (helpful--button - "helpful-max-highlight" - 'helpful-describe-exactly-button - 'symbol 'helpful-max-highlight - 'callable-p nil) - (propertize - ".\n" - 'face 'font-lock-comment-face) - source))) - -(defun helpful--source (sym callable-p buf pos) - "Return the source code of SYM. -If the source code cannot be found, return the sexp used." - (catch 'source - (unless (symbolp sym) - (throw 'source sym)) - - (let ((source nil)) - (when (and buf pos) - (with-current-buffer buf - (save-excursion - (save-restriction - (goto-char pos) - - (if (and (helpful--primitive-p sym callable-p) - (not callable-p)) - ;; For variables defined in .c files, only show the - ;; DEFVAR expression rather than the huge containing - ;; function. - (progn - (setq pos (line-beginning-position)) - ;; HACK Use the elisp syntax table even though the file is a - ;; C file. This is a temporary workaround for issue #329. - (with-syntax-table emacs-lisp-mode-syntax-table - (forward-list)) - (forward-char) - (narrow-to-region pos (point))) - ;; Narrow to the top-level definition. - (let ((parse-sexp-ignore-comments t)) - (narrow-to-defun t))) - - ;; If there was a preceding comment, POS will be - ;; after that comment. Move the position to include that comment. - (setq pos (point-min)) - - (setq source (buffer-substring-no-properties (point-min) (point-max)))))) - (setq source (s-trim-right source)) - (when (and source (buffer-file-name buf)) - (setq source (propertize source - 'helpful-path (buffer-file-name buf) - 'helpful-pos pos - 'helpful-pos-is-start t))) - (throw 'source source))) - - (when callable-p - ;; Could not find source -- probably defined interactively, or via - ;; a macro, or file has changed. - ;; TODO: verify that the source hasn't changed before showing. - ;; TODO: offer to download C sources for current version. - (throw 'source (indirect-function sym))))) - -(defun helpful--has-shortdoc-p (sym) - "Return non-nil if shortdoc.el is available and SYM is in a shortdoc group." - (and (featurep 'shortdoc) - (shortdoc-function-groups sym))) - -(defun helpful--in-manual-p (sym) - "Return non-nil if SYM is in an Info manual." - (let ((completions - (cl-letf (((symbol-function #'message) - (lambda (_format-string &rest _args)))) - (info-lookup->completions 'symbol 'emacs-lisp-mode)))) - (-when-let (buf (get-buffer " temp-info-look")) - (kill-buffer buf)) - (or (assoc sym completions) - (assoc-string sym completions)))) - -(defun helpful--version-info (sym) - "If SYM has version information, format and return it. -Return nil otherwise." - (when (symbolp sym) - (let ((package-version - (get sym 'custom-package-version)) - (emacs-version - (get sym 'custom-version))) - (cond - (package-version - (format - "This variable was added, or its default value changed, in %s version %s." - (or (car-safe package-version) "unknown") - (or (cdr-safe package-version) "unknown"))) - (emacs-version - (format - "This variable was added, or its default value changed, in Emacs %s." - emacs-version)))))) - -(defun helpful--library-path (library-name) - "Find the absolute path for the source of LIBRARY-NAME. - -LIBRARY-NAME takes the form \"foo.el\" , \"foo.el\" or -\"src/foo.c\". - -If .elc files exist without the corresponding .el, return nil." - (when (member (f-ext library-name) '("c" "rs")) - (setq library-name - (f-expand library-name - (f-parent find-function-C-source-directory)))) - (condition-case nil - (find-library-name library-name) - (error nil))) - -(defun helpful--macroexpand-try (form) - "Try to fully macroexpand FORM. -If it fails, attempt to partially macroexpand FORM." - (catch 'result - (ignore-errors - ;; Happy path: we can fully expand the form. - (throw 'result (macroexpand-all form))) - (ignore-errors - ;; Attempt one level of macroexpansion. - (throw 'result (macroexpand-1 form))) - ;; Fallback: just return the original form. - form)) - -(defun helpful--tree-any-p (pred tree) - "Walk TREE, applying PRED to every subtree. -Return t if PRED ever returns t." - (catch 'found - (let ((stack (list tree))) - (while stack - (let ((next (pop stack))) - (cond - ((funcall pred next) - (throw 'found t)) - ((consp next) - (push (car next) stack) - (push (cdr next) stack)))))) - nil)) - -(defun helpful--find-by-macroexpanding (buf sym callable-p) - "Search BUF for the definition of SYM by macroexpanding -interesting forms in BUF." - (catch 'found - (with-current-buffer buf - (save-excursion - (goto-char (point-min)) - (condition-case nil - (while t - (let ((form (read (current-buffer))) - (var-def-p - (lambda (sexp) - (and (eq (car-safe sexp) 'defvar) - (eq (car-safe (cdr sexp)) sym)))) - (fn-def-p - (lambda (sexp) - ;; `defun' ultimately expands to `defalias'. - (and (eq (car-safe sexp) 'defalias) - (equal (car-safe (cdr sexp)) `(quote ,sym)))))) - (setq form (helpful--macroexpand-try form)) - - (when (helpful--tree-any-p - (if callable-p fn-def-p var-def-p) - form) - ;; `read' puts point at the end of the form, so go - ;; back to the start. - (throw 'found (scan-sexps (point) -1))))) - (end-of-file nil)))))) - -(defun helpful--open-if-needed (path) - "Return a list (BUF OPENED) where BUF is a buffer visiting PATH. -If a buffer already exists, return that. If not, open PATH with -the `emacs-lisp-mode' syntax table active but skip any hooks." - (let ((initial-buffers (buffer-list)) - (buf nil) - (opened nil) - ;; Skip running hooks that may prompt the user. - (find-file-hook nil) - ;; If we end up opening a buffer, don't bother with file - ;; variables. It prompts the user, and we discard the buffer - ;; afterwards anyway. - (enable-local-variables nil)) - ;; Opening large .c files can be slow (e.g. when looking at - ;; `defalias'), especially if the user has configured mode hooks. - ;; - ;; Bind `auto-mode-alist' to nil, so we open the buffer in - ;; `fundamental-mode' if it isn't already open. - (let ((auto-mode-alist nil)) - (setq buf (find-file-noselect path))) - - (unless (-contains-p initial-buffers buf) - (setq opened t) - - (let ((syntax-table emacs-lisp-mode-syntax-table)) - (when (s-ends-with-p ".c" path) - (setq syntax-table (make-syntax-table)) - (c-populate-syntax-table syntax-table)) - - ;; If it's a freshly opened buffer, we need to set the syntax - ;; table so we can search correctly. - (with-current-buffer buf - (set-syntax-table syntax-table)))) - - (list buf opened))) - -(defun helpful--definition (sym callable-p) - "Return a list (BUF POS OPENED) where SYM is defined. - -BUF is the buffer containing the definition. If the user wasn't -already visiting this buffer, OPENED is t and callers should kill -the buffer when done. - -POS is the position of the start of the definition within the -buffer." - (let ((primitive-p (helpful--primitive-p sym callable-p)) - (library-name nil) - (src-path nil) - (buf nil) - (pos nil) - (opened nil)) - ;; We shouldn't be called on primitive functions if we don't have - ;; a directory of Emacs C sourcecode. - (cl-assert - (or find-function-C-source-directory - (not primitive-p))) - - (when (symbolp sym) - (if callable-p - (setq library-name (cdr (find-function-library sym))) - ;; Based on `find-variable-noselect'. - (setq library-name - (or - (symbol-file sym 'defvar) - (help-C-file-name sym 'var))))) - - (when library-name - (setq src-path (helpful--library-path library-name))) - - (cond - ((and (not (symbolp sym)) (functionp sym)) - (list nil nil nil)) - ((and callable-p library-name) - (when src-path - (-let [(src-buf src-opened) (helpful--open-if-needed src-path)] - (setq buf src-buf) - (setq opened src-opened)) - - ;; Based on `find-function-noselect'. - (with-current-buffer buf - ;; `find-function-search-for-symbol' moves point. Prevent - ;; that. - (save-excursion - ;; Narrowing has been fixed upstream: - ;; http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=abd18254aec76b26e86ae27e91d2c916ec20cc46 - (save-restriction - (widen) - (setq pos - (cdr (find-function-search-for-symbol sym nil library-name)))))) - ;; If we found the containing buffer, but not the symbol, attempt - ;; to find it by macroexpanding interesting forms. - (when (and buf (not pos)) - (setq pos (helpful--find-by-macroexpanding buf sym t))))) - ;; A function, but no file found. - (callable-p - ;; Functions defined interactively may have an edebug property - ;; that contains the location of the definition. - (-when-let (edebug-info (get sym 'edebug)) - (-let [marker (if (consp edebug-info) - (car edebug-info) - edebug-info)] - (setq buf (marker-buffer marker)) - (setq pos (marker-position marker))))) - ((and (not callable-p) src-path) - (-let [(src-buf src-opened) (helpful--open-if-needed src-path)] - (setq buf src-buf) - (setq opened src-opened) - - (with-current-buffer buf - ;; `find-function-search-for-symbol' moves point. Prevent - ;; that. - (save-excursion - (condition-case _err - (setq pos (cdr (find-variable-noselect sym library-name))) - (search-failed nil) - ;; If your current Emacs instance doesn't match the source - ;; code configured in find-function-C-source-directory, we can - ;; get an error about not finding source. Try - ;; `default-tab-width' against Emacs trunk. - (error nil))))))) - - (list buf pos opened))) - -(defun helpful--reference-positions (sym callable-p buf) - "Return all the buffer positions of references to SYM in BUF." - (-let* ((forms-and-bufs - (elisp-refs--search-1 - (list buf) - (lambda (buf) - (elisp-refs--read-and-find - buf sym - (if callable-p - #'elisp-refs--function-p - #'elisp-refs--variable-p))))) - ;; Since we only searched one buffer, we know that - ;; forms-and-bufs has only one item. - (forms-and-buf (-first-item forms-and-bufs)) - ((forms . _buf) forms-and-buf)) - (-map - (-lambda ((_code start-pos _end-pos)) start-pos) - forms))) - -(defun helpful--all-keymap-syms () - "Return all keymaps defined in this Emacs instance." - (let (keymaps) - (mapatoms - (lambda (sym) - (when (and (boundp sym) (keymapp (symbol-value sym))) - (push sym keymaps)))) - keymaps)) - -(defun helpful--key-sequences (command-sym keymap global-keycodes) - "Return all the key sequences of COMMAND-SYM in KEYMAP." - (let* ((keycodes - ;; Look up this command in the keymap, its parent and the - ;; global map. We need to include the global map to find - ;; remapped commands. - (where-is-internal command-sym keymap nil t)) - ;; Look up this command in the parent keymap. - (parent-keymap (keymap-parent keymap)) - (parent-keycodes - (when parent-keymap - (where-is-internal - command-sym (list parent-keymap) nil t))) - ;; Look up this command in the global map. - (global-keycodes - (unless (eq keymap global-map) - global-keycodes))) - (->> keycodes - ;; Ignore keybindings from the parent or global map. - (--remove (or (-contains-p global-keycodes it) - (-contains-p parent-keycodes it))) - ;; Convert raw keycode vectors into human-readable strings. - (-map #'key-description)))) - -(defun helpful--keymaps-containing (command-sym) - "Return a list of pairs listing keymap names that contain COMMAND-SYM, -along with the keybindings in each keymap. - -Keymap names are typically variable names, but may also be -descriptions of values in `minor-mode-map-alist'. - -We ignore keybindings that are menu items, and ignore keybindings -from parent keymaps. - -`widget-global-map' is also ignored as it generally contains the -same bindings as `global-map'." - (let* ((keymap-syms (helpful--all-keymap-syms)) - (keymap-sym-vals (-map #'symbol-value keymap-syms)) - (global-keycodes (where-is-internal - command-sym (list global-map) nil t)) - matching-keymaps) - ;; Look for this command in all keymaps bound to variables. - (-map - (-lambda ((keymap-sym . keymap)) - (let ((key-sequences (helpful--key-sequences command-sym keymap global-keycodes))) - (when (and key-sequences (not (eq keymap-sym 'widget-global-map))) - (push (cons (symbol-name keymap-sym) key-sequences) - matching-keymaps)))) - (-zip-pair keymap-syms keymap-sym-vals)) - - ;; Look for this command in keymaps used by minor modes that - ;; aren't bound to variables. - (-map - (-lambda ((minor-mode . keymap)) - ;; Only consider this keymap if we didn't find it bound to a variable. - (when (and (keymapp keymap) - (not (memq keymap keymap-sym-vals))) - (let ((key-sequences (helpful--key-sequences command-sym keymap global-keycodes))) - (when key-sequences - (push (cons (format "minor-mode-map-alist (%s)" minor-mode) - key-sequences) - matching-keymaps))))) - ;; TODO: examine `minor-mode-overriding-map-alist' too. - minor-mode-map-alist) - - matching-keymaps)) - -(defun helpful--merge-alists (l1 l2) - "Given two alists mapping symbols to lists, return a single -alist with the lists concatenated." - (let* ((l1-keys (-map #'-first-item l1)) - (l2-keys (-map #'-first-item l2)) - (l2-extra-keys (-difference l2-keys l1-keys)) - (l2-extra-values - (--map (assoc it l2) l2-extra-keys)) - (l1-with-values - (-map (-lambda ((key . values)) - (cons key (append values - (cdr (assoc key l2))))) - l1))) - (append l1-with-values l2-extra-values))) - -(defun helpful--keymaps-containing-aliases (command-sym aliases) - "Return a list of pairs mapping keymap symbols to the -keybindings for COMMAND-SYM in each keymap. - -Includes keybindings for aliases, unlike -`helpful--keymaps-containing'." - (let* ((syms (cons command-sym aliases)) - (syms-keymaps (-map #'helpful--keymaps-containing syms))) - (-reduce #'helpful--merge-alists syms-keymaps))) - -(defun helpful--format-keys (command-sym aliases) - "Describe all the keys that call COMMAND-SYM." - (let (mode-lines - global-lines) - (--each (helpful--keymaps-containing-aliases command-sym aliases) - (-let [(map . keys) it] - (dolist (key keys) - (push - (format "%s %s" - (propertize map 'face 'font-lock-variable-name-face) - (if (>= emacs-major-version 28) - (propertize key 'face 'help-key-binding) - key)) - (if (eq map 'global-map) global-lines mode-lines))))) - (setq global-lines (-sort #'string< global-lines)) - (setq mode-lines (-sort #'string< mode-lines)) - (-let [lines (-concat global-lines mode-lines)] - (if lines - (s-join "\n" lines) - "This command is not in any keymaps.")))) - -(defun helpful--outer-sexp (buf pos) - "Find position POS in BUF, and return the name of the outer sexp, -along with its position. - -Moves point in BUF." - (with-current-buffer buf - (goto-char pos) - (let* ((ppss (syntax-ppss)) - (outer-sexp-posns (nth 9 ppss))) - (when outer-sexp-posns - (goto-char (car outer-sexp-posns)))) - (list (point) (-take 2 (read buf))))) - -(defun helpful--count-values (items) - "Return an alist of the count of each value in ITEMS. -E.g. (x x y z y) -> ((x . 2) (y . 2) (z . 1))" - (let (counts) - (dolist (item items (nreverse counts)) - (-if-let (item-and-count (assoc item counts)) - (setcdr item-and-count (1+ (cdr item-and-count))) - (push (cons item 1) counts))))) - -(defun helpful--without-advice (sym) - "Given advised function SYM, return the function object -without the advice. Assumes function has been loaded." - (advice--cd*r - (advice--symbol-function sym))) - -(defun helpful--advised-p (sym) - "Does SYM have advice associated with it?" - (and (symbolp sym) - (advice--p (advice--symbol-function sym)))) - -(defun helpful--format-head (head) - "Given a 'head' (the first two symbols of a sexp) format and -syntax highlight it." - (-let* (((def name) head) - (formatted-name - (if (and (consp name) (eq (car name) 'quote)) - (format "'%S" (cadr name)) - (format "%S" name))) - (formatted-def - (format "(%s %s ...)" def formatted-name)) - ) - (helpful--syntax-highlight formatted-def))) - -(defun helpful--format-reference (head longest-head ref-count position path) - "Return a syntax-highlighted version of HEAD, with a link -to its source location." - (let ((formatted-count - (format "%d reference%s" - ref-count (if (> ref-count 1) "s" "")))) - (propertize - (format - "%s %s" - (s-pad-right longest-head " " (helpful--format-head head)) - (propertize formatted-count 'face 'font-lock-comment-face)) - 'helpful-path path - 'helpful-pos position))) - -(defun helpful--format-position-heads (position-heads path) - "Given a list of outer sexps, format them for display. -POSITION-HEADS takes the form ((123 (defun foo)) (456 (defun bar)))." - (let ((longest-head - (->> position-heads - (-map (-lambda ((_pos head)) (helpful--format-head head))) - (-map #'length) - (-max)))) - (->> (helpful--count-values position-heads) - (-map (-lambda (((pos head) . count)) - (helpful--format-reference head longest-head count pos path))) - (s-join "\n")))) - -(defun helpful--primitive-p (sym callable-p) - "Return t if SYM is defined in C." - (let ((subrp (if (fboundp 'subr-primitive-p) - #'subr-primitive-p - #'subrp))) - (cond - ((and callable-p (helpful--advised-p sym)) - (funcall subrp (helpful--without-advice sym))) - (callable-p - (funcall subrp (indirect-function sym))) - (t - (let ((filename (find-lisp-object-file-name sym 'defvar))) - (or (eq filename 'C-source) - (and (stringp filename) - (let ((ext (file-name-extension filename))) - (or (equal ext "c") - (equal ext "rs")))))))))) - -(defun helpful--sym-value (sym buf) - "Return the value of SYM in BUF." - (cond - ;; If we're given a buffer, look up the variable in that buffer. - (buf - (with-current-buffer buf - (symbol-value sym))) - ;; If we don't have a buffer, and this is a buffer-local variable, - ;; ensure we return the default value. - ((local-variable-if-set-p sym) - (default-value sym)) - ;; Otherwise, just return the value in the current buffer, which is - ;; the global value. - (t - (symbol-value sym)))) - -(defun helpful--insert-section-break () - "Insert section break into helpful buffer." - (insert "\n\n")) - -(defun helpful--insert-implementations () - "When `helpful--sym' is a generic method, insert its implementations." - (let ((func helpful--sym) - (content)) - (when (fboundp #'cl--generic-describe) - (with-temp-buffer - (declare-function cl--generic-describe "cl-generic" (function)) - (cl--generic-describe func) - (goto-char (point-min)) - (when (re-search-forward "^Implementations:$" nil t) - (setq content (buffer-substring (point) (point-max))))) - (when content - (helpful--insert-section-break) - (insert (helpful--heading "Implementations") (s-trim content)))))) - -(defun helpful--calculate-references (sym callable-p source-path) - "Calculate references for SYM in SOURCE-PATH." - (when source-path - (let* ((primitive-p (helpful--primitive-p sym callable-p)) - (buf (elisp-refs--contents-buffer source-path)) - (positions - (if primitive-p - nil - (helpful--reference-positions - helpful--sym helpful--callable-p buf))) - (return-value (--map (helpful--outer-sexp buf it) positions))) - (kill-buffer buf) - return-value))) - -(defun helpful--make-shortdoc-sentence (sym) - "Make a line for shortdoc groups of SYM." - (when (featurep 'shortdoc) - (-when-let (groups (--map (helpful--button - (symbol-name it) - 'helpful-shortdoc-button - 'shortdoc-group it) - (shortdoc-function-groups sym))) - (if (= 1 (length groups)) - (format "Other relevant functions are documented in the %s group." - (car groups)) - (format "Other relevant functions are documented in the %s groups." - (concat (s-join ", " (butlast groups)) - " and " (car (last groups)))))))) - -(defun helpful--make-manual-button (sym) - "Make manual button for SYM." - (helpful--button - "View in manual" - 'helpful-manual-button - 'symbol sym)) - -(defun helpful--make-toggle-button (sym buffer) - "Make toggle button for SYM in BUFFER." - (helpful--button - "Toggle" - 'helpful-toggle-button - 'symbol sym - 'buffer buffer)) - -(defun helpful--make-set-button (sym buffer) - "Make set button for SYM in BUFFER." - (helpful--button - "Set" - 'helpful-set-button - 'symbol sym - 'buffer buffer)) - -(defun helpful--make-toggle-literal-button () - "Make set button for SYM in BUFFER." - (helpful--button - (if helpful--view-literal - ;; TODO: only offer for strings that have newlines, tabs or - ;; properties. - "Pretty view" - "View as literal") - 'helpful-view-literal-button)) - -(defun helpful--make-customize-button (sym) - "Make customize button for SYM." - (helpful--button - "Customize" - 'helpful-customize-button - 'symbol sym)) - -(defun helpful--make-references-button (sym callable-p) - "Make references button for SYM." - (helpful--button - "Find all references" - 'helpful-all-references-button - 'symbol sym - 'callable-p callable-p)) - -(defun helpful--make-edebug-button (sym) - "Make edebug button for SYM." - (helpful--button - (format "%s edebug" - (if (helpful--edebug-p sym) - "Disable" "Enable")) - 'helpful-edebug-button - 'symbol sym)) - -(defun helpful--make-tracing-button (sym) - "Make tracing button for SYM." - (helpful--button - (format "%s tracing" - (if (trace-is-traced sym) - "Disable" "Enable")) - 'helpful-trace-button - 'symbol sym)) - -(defun helpful--make-disassemble-button (obj) - "Make disassemble button for OBJ. -OBJ may be a symbol or a compiled function object." - (helpful--button - "Disassemble" - 'helpful-disassemble-button - 'object obj)) - -(defun helpful--make-run-test-button (sym) - "Make an ERT test button for SYM." - (helpful--button - "Run test" - 'helpful-run-test-button - 'symbol sym)) - -(defun helpful--make-forget-button (sym callable-p) - "Make forget button for SYM." - (helpful--button - "Forget" - 'helpful-forget-button - 'symbol sym - 'callable-p callable-p)) - -(defun helpful--make-callees-button (sym source) - (helpful--button - (format "Functions used by %s" sym) - 'helpful-callees-button - 'symbol sym - 'source source)) - -;; TODO: this only reports if a function is autoloaded because we -;; autoloaded it. This ignores newly defined functions that are -;; autoloaded. Built-in help has this limitation too, but if we can -;; find the source, we should instead see if there's an autoload -;; cookie. -(defun helpful--autoloaded-p (sym buf) - "Return non-nil if function SYM is autoloaded." - (-when-let (file-name (buffer-file-name buf)) - (setq file-name (s-chop-suffix ".gz" file-name)) - (condition-case nil - (help-fns--autoloaded-p sym file-name) - ; new in Emacs 29.0.50 - ; see https://github.com/Wilfred/helpful/pull/283 - (error (help-fns--autoloaded-p sym))))) - -(defun helpful--compiled-p (sym) - "Return non-nil if function SYM is byte-compiled" - (and (symbolp sym) - (byte-code-function-p (symbol-function sym)))) - -(defun helpful--native-compiled-p (sym) - "Return non-nil if function SYM is native-compiled" - (and (symbolp sym) - (fboundp 'subr-native-elisp-p) - (subr-native-elisp-p (symbol-function sym)))) - -(defun helpful--join-and (items) - "Join a list of strings with commas and \"and\"." - (cond - ((= (length items) 0) - "") - ((= (length items) 1) - (car items)) - (t - (format "%s and %s" - (s-join ", " (-drop-last 1 items)) - (-last-item items))))) - -(defun helpful--summary (sym callable-p buf pos) - "Return a one sentence summary for SYM." - (-let* ((primitive-p (helpful--primitive-p sym callable-p)) - (canonical-sym (helpful--canonical-symbol sym callable-p)) - (alias-p (not (eq canonical-sym sym))) - (alias-button - (if callable-p - ;; Show a link to 'defalias' in the manual. - (helpful--button - "function alias" - 'helpful-manual-button - 'symbol 'defalias) - ;; Show a link to the variable aliases section in the - ;; manual. - (helpful--button - "alias" - 'helpful-info-button - 'info-node "(elisp)Variable Aliases"))) - (special-form-button - (helpful--button - "special form" - 'helpful-info-button - 'info-node "(elisp)Special Forms")) - (user-option-button - (helpful--button - "customizable" - 'helpful-info-button - 'info-node "(elisp)Variable Definitions")) - (keyboard-macro-button - (helpful--button - "keyboard macro" - 'helpful-info-button - 'info-node "(elisp)Keyboard Macros")) - (interactive-button - (helpful--button - "interactive" - 'helpful-info-button - 'info-node "(elisp)Using Interactive")) - (autoload-button - (helpful--button - "autoloaded" - 'helpful-info-button - 'info-node "(elisp)Autoload")) - (compiled-button - (helpful--button - "byte-compiled" - 'helpful-info-button - 'info-node "(elisp)Byte Compilation")) - (native-compiled-button - (helpful--button - "natively compiled" - 'helpful-describe-button - 'symbol 'native-compile)) - (buffer-local-button - (helpful--button - "buffer-local" - 'helpful-info-button - 'info-node "(elisp)Buffer-Local Variables")) - (autoloaded-p - (and callable-p buf (helpful--autoloaded-p sym buf))) - (compiled-p - (and callable-p (helpful--compiled-p sym))) - (native-compiled-p - (and callable-p (helpful--native-compiled-p sym))) - (buttons - (list - (if alias-p alias-button) - (if (and callable-p autoloaded-p) autoload-button) - (if (and callable-p (commandp sym)) interactive-button) - (if compiled-p compiled-button) - (if native-compiled-p native-compiled-button) - (if (and (not callable-p) (custom-variable-p sym)) - user-option-button) - (if (and (not callable-p) (local-variable-if-set-p sym)) - buffer-local-button))) - (description - (helpful--join-and (-non-nil buttons))) - (kind - (cond - ((special-form-p sym) - special-form-button) - (alias-p - (format "for %s," - (helpful--button - (symbol-name canonical-sym) - 'helpful-describe-exactly-button - 'symbol canonical-sym - 'callable-p callable-p))) - ((not callable-p) "variable") - ((macrop sym) "macro") - ((helpful--kbd-macro-p sym) keyboard-macro-button) - (t "function"))) - (defined - (cond - (buf - (let ((path (buffer-file-name buf))) - (if path - (format - "defined in %s" - (helpful--navigate-button - (file-name-nondirectory path) path pos)) - (format "defined in buffer %s" - (helpful--buffer-button buf pos))))) - (primitive-p - "defined in C source code") - ((helpful--kbd-macro-p sym) nil) - (t - "without a source file")))) - - (s-word-wrap - 70 - (format "%s is %s %s %s%s." - (if (symbolp sym) - (helpful--format-symbol sym) - "This lambda") - (if (string-match-p - (rx bos (or "a" "e" "i" "o" "u")) - description) - "an" - "a") - description - kind - (if defined (concat " " defined) ""))))) - -(defun helpful--callees (form) - "Given source code FORM, return a list of all the functions called." - (let* ((expanded-form (macroexpand-all form)) - ;; Find all the functions called after macro expansion. - (all-fns (helpful--callees-1 expanded-form)) - ;; Only consider the functions that were in the original code - ;; before macro expansion. - (form-syms (-filter #'symbolp (-flatten form))) - (form-fns (--filter (memq it form-syms) all-fns))) - (-distinct form-fns))) - -(defun helpful--callees-1 (form) - "Return a list of all the functions called in FORM. -Assumes FORM has been macro expanded. The returned list -may contain duplicates." - (cond - ((not (consp form)) - nil) - ;; See `(elisp)Special Forms'. For these special forms, we recurse - ;; just like functions but ignore the car. - ((memq (car form) '(and catch defconst defvar if interactive - or prog1 prog2 progn save-current-buffer - save-restriction setq setq-default - track-mouse unwind-protect while)) - (-flatten - (-map #'helpful--callees-1 (cdr form)))) - - ((eq (car form) 'cond) - (let* ((clauses (cdr form)) - (clause-fns - ;; Each clause is a list of forms. - (--map - (-map #'helpful--callees-1 it) clauses))) - (-flatten clause-fns))) - - ((eq (car form) 'condition-case) - (let* ((protected-form (nth 2 form)) - (protected-form-fns (helpful--callees-1 protected-form)) - (handlers (-drop 3 form)) - (handler-bodies (-map #'cdr handlers)) - (handler-fns - (--map - (-map #'helpful--callees-1 it) handler-bodies))) - (append - protected-form-fns - (-flatten handler-fns)))) - - ;; Calling a function with a well known higher order function, for - ;; example (funcall 'foo 1 2). - ((and - (memq (car form) '(funcall apply call-interactively - mapcar mapc mapconcat -map)) - (eq (car-safe (nth 1 form)) 'quote)) - (cons - (cadr (nth 1 form)) - (-flatten - (-map #'helpful--callees-1 (cdr form))))) - - ((eq (car form) 'function) - (let ((arg (nth 1 form))) - (if (symbolp arg) - ;; #'foo, which is the same as (function foo), is a function - ;; reference. - (list arg) - ;; Handle (function (lambda ...)). - (helpful--callees-1 arg)))) - - ((eq (car form) 'lambda) - ;; Only consider the body, not the param list. - (-flatten (-map #'helpful--callees-1 (-drop 2 form)))) - - ((eq (car form) 'closure) - ;; Same as lambda, but has an additional argument of the - ;; closed-over variables. - (-flatten (-map #'helpful--callees-1 (-drop 3 form)))) - - ((memq (car form) '(let let*)) - ;; Extract function calls used to set the let-bound variables. - (let* ((var-vals (-second-item form)) - (var-val-callees - (--map - (if (consp it) - (-map #'helpful--callees-1 it) - nil) - var-vals))) - (append - (-flatten var-val-callees) - ;; Function calls in the let body. - (-map #'helpful--callees-1 (-drop 2 form))))) - - ((eq (car form) 'quote) - nil) - (t - (cons - (car form) - (-flatten - (-map #'helpful--callees-1 (cdr form))))))) - -(defun helpful--ensure-loaded () - "Ensure the symbol associated with the current buffer has been loaded." - (when (and helpful--callable-p - (symbolp helpful--sym)) - (let ((fn-obj (symbol-function helpful--sym))) - (when (autoloadp fn-obj) - (autoload-do-load fn-obj))))) - -(defun helpful--hook-p (symbol value) - "Does SYMBOL look like a hook?" - (and - (or - (s-ends-with-p "-hook" (symbol-name symbol)) - ;; E.g. `after-change-functions', which can be used with - ;; `add-hook'. - (s-ends-with-p "-functions" (symbol-name symbol))) - (consp value))) - -(defun helpful--format-value (sym value) - "Format VALUE as a string." - (cond - (helpful--view-literal - (helpful--syntax-highlight (helpful--pretty-print value))) - ;; Allow strings to be viewed with properties rendered in - ;; Emacs, rather than as a literal. - ((stringp value) - value) - ;; Allow keymaps to be viewed with keybindings shown and - ;; links to the commands bound. - ((keymapp value) - (helpful--format-keymap value)) - ((helpful--hook-p sym value) - (helpful--format-hook value)) - (t - (helpful--pretty-print value)))) - -(defun helpful--original-value (sym) - "Return the original value for SYM, if any. - -If SYM has an original value, return it in a list. Return nil -otherwise." - (let* ((orig-val-expr (get sym 'standard-value))) - (when (consp orig-val-expr) - (ignore-errors - (list - (eval (car orig-val-expr))))))) - -(defun helpful--original-value-differs-p (sym) - "Return t if SYM has an original value, and its current -value is different." - (let ((orig-val-list (helpful--original-value sym))) - (and (consp orig-val-list) - (not (eq (car orig-val-list) - (symbol-value sym)))))) - -(defun helpful-update () - "Update the current *Helpful* buffer to the latest -state of the current symbol." - (interactive) - (cl-assert (not (null helpful--sym))) - (unless (buffer-live-p helpful--associated-buffer) - (setq helpful--associated-buffer nil)) - (helpful--ensure-loaded) - (-let* ((val - ;; Look at the value before setting `inhibit-read-only', so - ;; users can see the correct value of that variable. - (unless helpful--callable-p - (helpful--sym-value helpful--sym helpful--associated-buffer))) - (inhibit-read-only t) - (start-line (line-number-at-pos)) - (start-column (current-column)) - (primitive-p (helpful--primitive-p helpful--sym helpful--callable-p)) - (canonical-sym (helpful--canonical-symbol helpful--sym helpful--callable-p)) - (look-for-src (or (not primitive-p) - find-function-C-source-directory)) - ((buf pos opened) - (if look-for-src - (helpful--definition helpful--sym helpful--callable-p) - '(nil nil nil))) - (source (when look-for-src - (helpful--source helpful--sym helpful--callable-p buf pos))) - (source-path (when buf - (buffer-file-name buf))) - (references (helpful--calculate-references - helpful--sym helpful--callable-p - source-path)) - (aliases (helpful--aliases helpful--sym helpful--callable-p))) - - (erase-buffer) - - (insert (helpful--summary helpful--sym helpful--callable-p buf pos)) - - (when (helpful--obsolete-info helpful--sym helpful--callable-p) - (insert - "\n\n" - (helpful--format-obsolete-info helpful--sym helpful--callable-p))) - - (when (and helpful--callable-p - (not (helpful--kbd-macro-p helpful--sym))) - (helpful--insert-section-break) - (insert - (helpful--heading "Signature") - (helpful--syntax-highlight (helpful--signature helpful--sym)))) - - (when (not helpful--callable-p) - (helpful--insert-section-break) - (let* ((sym helpful--sym) - (multiple-views-p - (or (stringp val) - (keymapp val) - (helpful--hook-p sym val)))) - (when helpful--first-display - (if (stringp val) - ;; For strings, it's more intuitive to display them as - ;; literals, so "1" and 1 are distinct. - (setq helpful--view-literal t) - ;; For everything else, prefer the pretty view if available. - (setq helpful--view-literal nil))) - (insert - (helpful--heading - (cond - ;; Buffer-local variable and we're looking at the value in - ;; a specific buffer. - ((and - helpful--associated-buffer - (local-variable-p sym helpful--associated-buffer)) - (format "Value in %s" - (helpful--button - (format "#" (buffer-name helpful--associated-buffer)) - 'helpful-buffer-button - 'buffer helpful--associated-buffer - 'position pos))) - ;; Buffer-local variable but default/global value. - ((local-variable-if-set-p sym) - "Global Value") - ;; This variable is not buffer-local. - (t "Value"))) - (helpful--format-value sym val) - "\n\n") - (when (helpful--original-value-differs-p sym) - (insert - (helpful--heading "Original Value") - (helpful--format-value - sym - (car (helpful--original-value sym))) - "\n\n")) - (when multiple-views-p - (insert (helpful--make-toggle-literal-button) " ")) - - (when (local-variable-if-set-p sym) - (insert - (helpful--button - "Buffer values" - 'helpful-associated-buffer-button - 'symbol sym - 'prompt-p t) - " " - (helpful--button - "Global value" - 'helpful-associated-buffer-button - 'symbol sym - 'prompt-p nil) - " ")) - (when (memq (helpful--sym-value helpful--sym helpful--associated-buffer) '(nil t)) - (insert (helpful--make-toggle-button helpful--sym helpful--associated-buffer) " ")) - (insert (helpful--make-set-button helpful--sym helpful--associated-buffer)) - (when (custom-variable-p helpful--sym) - (insert " " (helpful--make-customize-button helpful--sym))))) - - (let ((docstring (helpful--docstring helpful--sym helpful--callable-p)) - (version-info (unless helpful--callable-p - (helpful--version-info helpful--sym)))) - (when (or docstring version-info) - (helpful--insert-section-break) - (insert - (helpful--heading "Documentation")) - (when docstring - (insert (helpful--format-docstring docstring))) - (when version-info - (insert "\n\n" (s-word-wrap 70 version-info))) - (when (and (symbolp helpful--sym) - helpful--callable-p - (helpful--has-shortdoc-p helpful--sym)) - (insert "\n\n") - (insert (helpful--make-shortdoc-sentence helpful--sym))) - (when (and (symbolp helpful--sym) (helpful--in-manual-p helpful--sym)) - (insert "\n\n") - (insert (helpful--make-manual-button helpful--sym))))) - - ;; Show keybindings. - ;; TODO: allow users to conveniently add and remove keybindings. - (when (commandp helpful--sym) - (helpful--insert-section-break) - (insert - (helpful--heading "Key Bindings") - (helpful--format-keys helpful--sym aliases))) - - (helpful--insert-section-break) - - (insert - (helpful--heading "References") - (let ((src-button - (when source-path - (helpful--navigate-button - (file-name-nondirectory source-path) - source-path - (or pos - 0))))) - (cond - ((and source-path references) - (format "References in %s:\n%s" - src-button - (helpful--format-position-heads references source-path))) - ((and source-path primitive-p) - (format - "Finding references in a .%s file is not supported." - (f-ext source-path))) - (source-path - (format "%s is unused in %s." - helpful--sym - src-button)) - ((and primitive-p (null find-function-C-source-directory)) - "C code is not yet loaded.") - (t - "Could not find source file."))) - "\n\n" - (helpful--make-references-button helpful--sym helpful--callable-p)) - - (when (and - helpful--callable-p - (symbolp helpful--sym) - source - (not primitive-p)) - (insert - " " - (helpful--make-callees-button helpful--sym source))) - - (when (helpful--advised-p helpful--sym) - (helpful--insert-section-break) - (insert - (helpful--heading "Advice") - (format "This %s is advised." - (if (macrop helpful--sym) "macro" "function")))) - - (let ((can-edebug - (helpful--can-edebug-p helpful--sym helpful--callable-p buf pos)) - (can-trace - (and (symbolp helpful--sym) - helpful--callable-p - ;; Tracing uses advice, and you can't apply advice to - ;; primitive functions that are replaced with special - ;; opcodes. For example, `narrow-to-region'. - (not (plist-get (symbol-plist helpful--sym) 'byte-opcode)))) - (can-disassemble - (and helpful--callable-p (not primitive-p))) - (can-forget - (and (not (special-form-p helpful--sym)) - (not primitive-p)))) - (when (or can-edebug can-trace can-disassemble can-forget) - (helpful--insert-section-break) - (insert (helpful--heading "Debugging"))) - (when can-edebug - (insert - (helpful--make-edebug-button helpful--sym))) - (when can-trace - (when can-edebug - (insert " ")) - (insert - (helpful--make-tracing-button helpful--sym))) - - (when (and - (or can-edebug can-trace) - (or can-disassemble can-forget)) - (insert "\n")) - - (when can-disassemble - (insert (helpful--make-disassemble-button helpful--sym))) - - (when can-forget - (when can-disassemble - (insert " ")) - (insert (helpful--make-forget-button helpful--sym helpful--callable-p)))) - - (when aliases - (helpful--insert-section-break) - (insert - (helpful--heading "Aliases") - (s-join "\n" (--map (helpful--format-alias it helpful--callable-p) - aliases)))) - - (when helpful--callable-p - (helpful--insert-implementations)) - - (helpful--insert-section-break) - - (when (or source-path primitive-p) - (insert - (helpful--heading - (if (eq helpful--sym canonical-sym) - "Source Code" - "Alias Source Code")) - (cond - (source-path - (concat - (propertize (format "%s Defined in " (if primitive-p "//" ";;")) - 'face 'font-lock-comment-face) - (helpful--navigate-button - (f-abbrev source-path) - source-path - pos) - "\n")) - (primitive-p - (concat - (propertize - "C code is not yet loaded." - 'face 'font-lock-comment-face) - "\n\n" - (helpful--button - "Set C source directory" - 'helpful-c-source-directory)))))) - (when source - (insert - (cond - ((stringp source) - (let ((mode (when primitive-p - (pcase (file-name-extension source-path) - ("c" 'c-mode) - ("rs" (when (fboundp 'rust-mode) 'rust-mode)))))) - (helpful--syntax-highlight source mode))) - ((and (consp source) (eq (car source) 'closure)) - (helpful--syntax-highlight - (concat ";; Closure converted to defun by helpful.\n" - (helpful--pretty-print - (helpful--format-closure helpful--sym source))))) - (t - (helpful--syntax-highlight - (concat - (if (eq helpful--sym canonical-sym) - ";; Could not find source code, showing raw function object.\n" - ";; Could not find alias source code, showing raw function object.\n") - (helpful--pretty-print source))))))) - - (helpful--insert-section-break) - - (-when-let (formatted-props (helpful--format-properties helpful--sym)) - (insert - (helpful--heading "Symbol Properties") - formatted-props)) - - (goto-char (point-min)) - (forward-line (1- start-line)) - (forward-char start-column) - (setq helpful--first-display nil) - - (when opened - (kill-buffer buf)))) - -;; TODO: this isn't sufficient for `edebug-eval-defun'. -(defun helpful--skip-advice (docstring) - "Remove mentions of advice from DOCSTRING." - (let* ((lines (s-lines docstring)) - (relevant-lines - (--drop-while - (or (s-starts-with-p ":around advice:" it) - (s-starts-with-p "This function has :around advice:" it)) - lines))) - (s-trim (s-join "\n" relevant-lines)))) - -(defun helpful--format-argument (arg) - "Format ARG (a symbol) according to Emacs help conventions." - (let ((arg-str (symbol-name arg))) - (if (s-starts-with-p "&" arg-str) - arg-str - (s-upcase arg-str)))) - -(defun helpful--format-symbol (sym) - "Format symbol as a string, escaping as necessary." - ;; Arguably this is an Emacs bug. We should be able to use - ;; (format "%S" sym) - ;; but that converts foo? to "foo\\?". You can see this in other - ;; parts of the Emacs UI, such as ERT. - (s-replace " " "\\ " (format "%s" sym))) - -;; TODO: this is broken for -any?. -(defun helpful--signature (sym) - "Get the signature for function SYM, as a string. -For example, \"(some-func FOO &optional BAR)\"." - (let (docstring-sig - source-sig - (advertised-args - (when (symbolp sym) - (gethash (symbol-function sym) advertised-signature-table)))) - ;; Get the usage from the function definition. - (let* ((function-args - (cond - ((symbolp sym) - (help-function-arglist sym)) - ((or (byte-code-function-p sym) - (if (fboundp 'interpreted-function-p) - (interpreted-function-p sym))) - ;; argdesc can be a list of arguments or an integer - ;; encoding the min/max number of arguments. See - ;; Byte-Code Function Objects in the elisp manual. - (let ((argdesc (aref sym 0))) - (if (consp argdesc) - argdesc - ;; TODO: properly handle argdesc values. - nil))) - (t - ;; Interpreted function (lambda ...) - (cadr sym)))) - (formatted-args - (cond - (advertised-args - (-map #'helpful--format-argument advertised-args)) - ((listp function-args) - (-map #'helpful--format-argument function-args)) - (t - (list function-args))))) - (setq source-sig - (cond - ;; If it's a function object, just show the arguments. - ((not (symbolp sym)) - (format "(%s)" - (s-join " " formatted-args))) - ;; If it has multiple arguments, join them with spaces. - (formatted-args - (format "(%s %s)" - (helpful--format-symbol sym) - (s-join " " formatted-args))) - ;; Otherwise, this function takes no arguments when called. - (t - (format "(%s)" (helpful--format-symbol sym)))))) - - ;; If the docstring ends with (fn FOO BAR), extract that. - (-when-let (docstring (documentation sym)) - (-when-let (docstring-with-usage (help-split-fundoc docstring sym)) - (setq docstring-sig (car docstring-with-usage)))) - - (cond - ;; Advertised signature always wins. - (advertised-args - source-sig) - ;; If that's not set, use the usage specification in the - ;; docstring, if present. - (docstring-sig - (replace-regexp-in-string "\\\\=\\(['\\`‘’]\\)" "\\1" docstring-sig t)) - (t - ;; Otherwise, just use the signature from the source code. - source-sig)))) - -(defun helpful--format-obsolete-info (sym callable-p) - (-let [(use _ date) (helpful--obsolete-info sym callable-p)] - (helpful--format-docstring - (s-word-wrap - 70 - (format "This %s is obsolete%s%s" - (helpful--kind-name sym callable-p) - (if date (format " since %s" date) - "") - (cond ((stringp use) (concat "; " use)) - (use (format "; use `%s' instead." use)) - (t "."))))))) - -(defun helpful--docstring (sym callable-p) - "Get the docstring for SYM. -Note that this returns the raw docstring, including \\=\\= -escapes that are used by `substitute-command-keys'." - (let ((text-quoting-style 'grave) - docstring) - (if callable-p - (progn - (setq docstring (documentation sym t)) - (-when-let (docstring-with-usage (help-split-fundoc docstring sym)) - (setq docstring (cdr docstring-with-usage)) - (when docstring - ;; Advice mutates the docstring, see - ;; `advice--make-docstring'. Undo that. - ;; TODO: Only do this if the function is advised. - (setq docstring (helpful--skip-advice docstring))))) - (setq docstring - (documentation-property sym 'variable-documentation t))) - docstring)) - -(defun helpful--read-symbol (prompt default-val predicate) - "Read a symbol from the minibuffer, with completion. -Returns the symbol." - (when (and default-val - (not (funcall predicate default-val))) - (setq default-val nil)) - (when default-val - ;; `completing-read' expects a string. - (setq default-val (symbol-name default-val)) - - ;; TODO: Only modify the prompt when we don't have ido/ivy/helm, - ;; because the default is obvious for them. - (setq prompt - (replace-regexp-in-string - (rx ": " eos) - (format " (default: %s): " default-val) - prompt))) - (intern (completing-read prompt obarray - predicate t nil nil - default-val))) - -(defun helpful--update-and-switch-buffer (symbol callable-p) - "Update and switch to help buffer for SYMBOL." - (let ((buf (helpful--buffer symbol callable-p))) - (with-current-buffer buf - (helpful-update)) - (funcall helpful-switch-buffer-function buf))) - -;;;###autoload -(defun helpful-function (symbol) - "Show help for function named SYMBOL. - -See also `helpful-macro', `helpful-command' and `helpful-callable'." - (interactive - (list (helpful--read-symbol - "Function: " - (helpful--callable-at-point) - #'functionp))) - (helpful--update-and-switch-buffer symbol t)) - -;;;###autoload -(defun helpful-command (symbol) - "Show help for interactive function named SYMBOL. - -See also `helpful-function'." - (interactive - (list (helpful--read-symbol - "Command: " - (helpful--callable-at-point) - #'commandp))) - (helpful--update-and-switch-buffer symbol t)) - -;;;###autoload -(defun helpful-key (key-sequence) - "Show help for interactive command bound to KEY-SEQUENCE." - (interactive - (list (read-key-sequence "Press key: "))) - (let ((sym (key-binding key-sequence))) - (cond - ((null sym) - (user-error "No command is bound to %s" - (key-description key-sequence))) - ((commandp sym t) - (helpful--update-and-switch-buffer sym t)) - (t - (user-error "%s is bound to %s which is not a command" - (key-description key-sequence) - sym))))) - -;;;###autoload -(defun helpful-macro (symbol) - "Show help for macro named SYMBOL." - (interactive - (list (helpful--read-symbol - "Macro: " - (helpful--callable-at-point) - #'macrop))) - (helpful--update-and-switch-buffer symbol t)) - -;;;###autoload -(defun helpful-callable (symbol) - "Show help for function, macro or special form named SYMBOL. - -See also `helpful-macro', `helpful-function' and `helpful-command'." - (interactive - (list (helpful--read-symbol - "Callable: " - (helpful--callable-at-point) - #'fboundp))) - (helpful--update-and-switch-buffer symbol t)) - -(defun helpful--variable-p (symbol) - "Return non-nil if SYMBOL is a variable." - (or (get symbol 'variable-documentation) - (and (boundp symbol) - (not (keywordp symbol)) - (not (eq symbol nil)) - (not (eq symbol t))))) - -(defun helpful--bound-p (symbol) - "Return non-nil if SYMBOL is a variable, callable, or face. - -This differs from `boundp' because we do not consider nil, t -or :foo." - (or (fboundp symbol) - (helpful--variable-p symbol) - (facep symbol))) - -(defun helpful--bookmark-jump (bookmark) - "Create and switch to helpful bookmark BOOKMARK." - (let ((callable-p (bookmark-prop-get bookmark 'callable-p)) - (sym (bookmark-prop-get bookmark 'sym)) - (position (bookmark-prop-get bookmark 'position))) - (if callable-p - (helpful-callable sym) - (helpful-variable sym)) - (goto-char position))) - -(defun helpful--bookmark-make-record () - "Create a bookmark record for helpful buffers. - -See docs of `bookmark-make-record-function'." - `((sym . ,helpful--sym) - (callable-p . ,helpful--callable-p) - (position . ,(point)) - (handler . helpful--bookmark-jump))) - -(defun helpful--convert-c-name (symbol var) - "Convert SYMBOL from a C name to an Elisp name. -E.g. convert `Fmake_string' to `make-string' or -`Vgc_cons_percentage' to `gc-cons-percentage'. Interpret -SYMBOL as variable name if VAR, else a function name. Return -nil if SYMBOL doesn't begin with \"F\" or \"V\"." - (let ((string (symbol-name symbol)) - (prefix (if var "V" "F"))) - (when (s-starts-with-p prefix string) - (intern - (s-chop-prefix - prefix - (s-replace "_" "-" string)))))) - -(defun helpful--disambiguate (sym choices) - "Prompt the user to disambiguate SYM via a `read-char-choice' selection. - -CHOICES is a list of tuples of the form (FN DESC CHAR), where - - CHAR is the input character associated with the choice - DESC is a short description of the choice to display in the prompt. - FN is the function being chosen, which takes SYM as an argument. - -For instance, the choice (#'helpful-variable \"[v]ariable\" ?v) -calls (helpful-variable SYM) when the key `v' is pressed in the prompt." - (let* ((prompt (format "%s is ambiguous: describe %s ?" - (propertize (symbol-name sym) 'face font-lock-keyword-face) - (mapconcat (-lambda ((_ desc _)) desc) - choices " / "))) - (chars (mapcar (-lambda ((_ _ char)) char) - choices)) - (lookup (mapcar (-lambda ((fn _ char)) (cons char fn)) - choices)) - (input (read-char-choice prompt chars))) - (funcall (alist-get input lookup) sym))) - -;;;###autoload -(defun helpful-symbol (symbol) - "Show help for SYMBOL, a variable, function, macro, or face. - -See also `helpful-callable' and `helpful-variable'." - (interactive - (list (helpful--read-symbol - "Symbol: " - (helpful--symbol-at-point) - #'helpful--bound-p))) - (let (choices) - (when-let (c-var-sym (helpful--convert-c-name symbol t)) - (push (list (lambda (_) (helpful-variable c-var-sym)) - "c-style [V]ariable" ?V) - choices)) - (when-let (c-fn-sym (helpful--convert-c-name symbol nil)) - (push (list (lambda (_) (helpful-callable c-fn-sym)) - "c-style [F]unction" ?F) - choices)) - (when (fboundp symbol) - (push (list #'helpful-callable "[c]allable" ?c) choices)) - (when (boundp symbol) - (push (list #'helpful-variable "[v]ariable" ?v) choices)) - (when (facep symbol) - (push (list (lambda (face) - (describe-face face) - (funcall helpful-switch-buffer-function (help-buffer))) - "[f]ace" ?f) - choices)) - (cond - ((null choices) - (user-error "Not bound: %S" symbol)) - ((= 1 (length choices)) - (funcall (caar choices) symbol)) - (t (helpful--disambiguate symbol choices))))) - -;;;###autoload -(defun helpful-variable (symbol) - "Show help for variable named SYMBOL." - (interactive - (list (helpful--read-symbol - "Variable: " - (helpful--variable-at-point) - #'helpful--variable-p))) - (helpful--update-and-switch-buffer symbol nil)) - -(defun helpful--variable-at-point-exactly () - "Return the symbol at point, if it's a bound variable." - (let ((var (variable-at-point))) - ;; `variable-at-point' uses 0 rather than nil to signify no symbol - ;; at point (presumably because 'nil is a symbol). - (unless (symbolp var) - (setq var nil)) - (when (helpful--variable-p var) - var))) - -(defun helpful--variable-defined-at-point () - "Return the variable defined in the form enclosing point." - ;; TODO: do the same thing if point is just before a top-level form. - (save-excursion - (save-restriction - (widen) - (let* ((ppss (syntax-ppss)) - (sexp-start (nth 1 ppss)) - sexp) - (when sexp-start - (goto-char sexp-start) - (setq sexp (condition-case nil - (read (current-buffer)) - (error nil))) - (when (memq (car-safe sexp) - (list 'defvar 'defvar-local 'defcustom 'defconst)) - (nth 1 sexp))))))) - -(defun helpful--variable-at-point () - "Return the variable exactly under point, or defined at point." - (let ((var (helpful--variable-at-point-exactly))) - (if var - var - (let ((var (helpful--variable-defined-at-point))) - (when (helpful--variable-p var) - var))))) - -(defun helpful--callable-at-point () - (let ((sym (symbol-at-point)) - (enclosing-sym (function-called-at-point))) - (if (fboundp sym) - sym - enclosing-sym))) - -(defun helpful--symbol-at-point-exactly () - "Return the symbol at point, if it's bound." - (let ((sym (symbol-at-point))) - (when (helpful--bound-p sym) - sym))) - -(defun helpful--symbol-at-point () - "Find the most relevant symbol at or around point. -Returns nil if nothing found." - (or - (helpful--symbol-at-point-exactly) - (helpful--callable-at-point) - (helpful--variable-at-point))) - -;;;###autoload -(defun helpful-at-point () - "Show help for the symbol at point." - (interactive) - (-if-let (symbol (helpful--symbol-at-point)) - (helpful-symbol symbol) - (user-error "There is no symbol at point."))) - -(defun helpful--imenu-index () - "Return a list of headings in the current buffer, suitable for -imenu." - (let (headings) - (goto-char (point-min)) - (while (not (eobp)) - (when (eq (get-text-property (point) 'face) - 'helpful-heading) - (push - (cons - (buffer-substring-no-properties - (line-beginning-position) (line-end-position)) - (line-beginning-position)) - headings)) - (forward-line)) - (nreverse headings))) - -(defun helpful--flash-region (start end) - "Temporarily highlight region from START to END." - (let ((overlay (make-overlay start end))) - (overlay-put overlay 'face 'highlight) - (run-with-timer 1.5 nil 'delete-overlay overlay))) - -(defun helpful-visit-reference () - "Go to the reference at point." - (interactive) - (let* ((sym helpful--sym) - (path (get-text-property (point) 'helpful-path)) - (pos (get-text-property (point) 'helpful-pos)) - (pos-is-start (get-text-property (point) 'helpful-pos-is-start))) - (when (and path pos) - ;; If we're looking at a source excerpt, calculate the offset of - ;; point, so we don't just go the start of the excerpt. - (when pos-is-start - (save-excursion - (let ((offset 0)) - (while (and - (get-text-property (point) 'helpful-pos) - (not (eobp))) - (backward-char 1) - (setq offset (1+ offset))) - ;; On the last iteration we moved outside the source - ;; excerpt, so we overcounted by one character. - (setq offset (1- offset)) - - ;; Set POS so we go to exactly the place in the source - ;; code where point was in the helpful excerpt. - (setq pos (+ pos offset))))) - - (find-file path) - (helpful--goto-char-widen pos) - (recenter 0) - (save-excursion - (let ((defun-end (scan-sexps (point) 1))) - (while (re-search-forward - (rx-to-string `(seq symbol-start ,(symbol-name sym) symbol-end)) - defun-end t) - (helpful--flash-region (match-beginning 0) (match-end 0)))))))) - -(defun helpful-kill-buffers () - "Kill all `helpful-mode' buffers. - -See also `helpful-max-buffers'." - (interactive) - (dolist (buffer (buffer-list)) - (when (eq (buffer-local-value 'major-mode buffer) 'helpful-mode) - (kill-buffer buffer)))) - -(defvar helpful-mode-map - (let* ((map (make-sparse-keymap))) - (define-key map (kbd "g") #'helpful-update) - (define-key map [remap revert-buffer] #'helpful-update) - (when (fboundp 'revert-buffer-quick) - (define-key map [remap revert-buffer-quick] #'helpful-update)) - - (define-key map (kbd "RET") #'helpful-visit-reference) - - (define-key map (kbd "TAB") #'forward-button) - (define-key map (kbd "") #'backward-button) - - (define-key map (kbd "n") #'forward-button) - (define-key map (kbd "p") #'backward-button) - map) - "Keymap for `helpful-mode'.") - -(declare-function bookmark-prop-get "bookmark" (bookmark prop)) -(declare-function bookmark-make-record-default "bookmark" - (&optional no-file no-context posn)) -;; Ensure this variable is defined even if bookmark.el isn't loaded -;; yet. This follows the pattern in help-mode.el.gz. -;; TODO: find a cleaner solution. -(defvar bookmark-make-record-function) - -(defun helpful--add-support-for-org-links () - "Improve support for org \"help\" links through helpful." - (helpful--support-storing-org-links) - (helpful--prefer-helpful-when-following-org-link)) - -(defun helpful--support-storing-org-links () - "Make `org-store-link' in a helpful buffer return a \"help\" link." - (when (and (fboundp 'org-link-set-parameters) - (not (-contains-p (org-link-types) "helpful"))) - (org-link-set-parameters "helpful" - :store #'helpful--org-link-store))) - -(defun helpful--org-link-store () - "Store \"help\" type link when in a helpful buffer." - (when (derived-mode-p 'helpful-mode) - ;; Create a "help" link instead of a dedicated "helpful" link: the - ;; author of the Org document uses helpful, but this is not - ;; necessarily the case of the reader of the document. - (org-link-store-props :type "help" - :link (format "help:%s" helpful--sym) - :description nil))) - -(defun helpful--prefer-helpful-when-following-org-link () - "Prefer helpful when using `org-open-at-point' on a \"help\" link." - (when (fboundp 'org-link-set-parameters) - (let ((follow-function (org-link-get-parameter "help" :follow))) - (when (not (equal follow-function #'helpful--org-link-follow)) - (org-link-set-parameters "help" - :follow #'helpful--org-link-follow))))) - -(defun helpful--org-link-follow (link _) - (helpful-symbol (intern link))) - -(defun helpful--outline-function (&optional bound move backward looking-at) - "`outline-search-function' for `helpful-mode`. -See documentation of `outline-search-function' for BOUND, MOVE, -BACKWARD and LOOKING-AT." - (if looking-at - (eq 'helpful-heading (get-text-property (point) 'face)) - (let ((heading-found nil) - (bound (if bound bound (if backward (point-min) (point-max))))) - (save-excursion - (when (eq 'helpful-heading (get-text-property (point) 'face)) - (forward-line (if backward -1 1))) - (if backward - (while (not (or (eq (point) bound) - (eq 'helpful-heading (get-text-property (point) 'face)))) - (goto-char (or (previous-single-property-change (point) 'face nil bound) - bound))) - (goto-char (or (text-property-any (point) bound 'face 'helpful-heading) - bound))) - (when (eq 'helpful-heading (get-text-property (point) 'face)) - (setq heading-found (point)))) - (if heading-found - (progn - (goto-char heading-found) - (set-match-data (list heading-found heading-found))) - (when move - (goto-char bound) nil))))) - -(define-derived-mode helpful-mode special-mode "Helpful" - "Major mode for *Helpful* buffers." - (add-hook 'xref-backend-functions #'elisp--xref-backend nil t) - - (setq imenu-create-index-function #'helpful--imenu-index) - ;; Prevent imenu converting "Source Code" to "Source.Code". - (setq-local imenu-space-replacement " ") - - ;; Enable users to bookmark helpful buffers. - (set (make-local-variable 'bookmark-make-record-function) - #'helpful--bookmark-make-record) - - ;; Enable outline support for Emacs 29 and newer - (unless (< emacs-major-version 29) - (setq-local outline-search-function #'helpful--outline-function)) - - ;; This function should normally only be called once after Org and - ;; helpful are loaded. To avoid using `eval-after-load' (which is - ;; only recommended in user init files), the function is called each - ;; time the major mode is used. - (helpful--add-support-for-org-links)) - -(provide 'helpful) -;;; helpful.el ends here diff --git a/.config/emacs/lisp/jai-mode.el b/.config/emacs/lisp/jai-mode.el deleted file mode 100644 index 6d42673..0000000 --- a/.config/emacs/lisp/jai-mode.el +++ /dev/null @@ -1,331 +0,0 @@ -;;; jai-mode.el --- Major mode for JAI -*- lexical-binding: t; -*- - -;; Copyright (C) 2015-2023 Kristoffer Grönlund -;; Copyright (C) 2023-2026 Valentin Ignatev - -;; Initial author: Kristoffer Grönlund -;; Current maintainer: Valentin Ignatev -;; URL: https://github.com/valignatev/jai-mode -;; Version: 0.0.1 -;; Package-Requires: ((emacs "26.1")) -;; Keywords: languages - -;; This file is not part of GNU Emacs. - -;; This program is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: -;; -;; Major mode for JAI -;; - -;;; Code: - -(require 'rx) -(require 'js) -(require 'compile) - -(defconst jai-mode-syntax-table - (let ((table (make-syntax-table))) - (modify-syntax-entry ?\" "\"" table) - (modify-syntax-entry ?\\ "\\" table) - - ;; additional symbols - (modify-syntax-entry ?_ "w" table) - - (modify-syntax-entry ?' "." table) - (modify-syntax-entry ?: "." table) - (modify-syntax-entry ?+ "." table) - (modify-syntax-entry ?- "." table) - (modify-syntax-entry ?% "." table) - (modify-syntax-entry ?& "." table) - (modify-syntax-entry ?| "." table) - (modify-syntax-entry ?^ "." table) - (modify-syntax-entry ?! "." table) - (modify-syntax-entry ?= "." table) - (modify-syntax-entry ?< "." table) - (modify-syntax-entry ?> "." table) - (modify-syntax-entry ?? "." table) - - ;; Modify some syntax entries to allow nested block comments - (modify-syntax-entry ?/ ". 124b" table) - (modify-syntax-entry ?* ". 23n" table) - (modify-syntax-entry ?\n "> b" table) - (modify-syntax-entry ?\^m "> b" table) - - table)) - - -;; This is needed for correct directive indentation. -;; This jai-mode uses js-mode indentation, and it defines a bunch of C++-compatible crap -;; for whatever reason. You could ask "what does javascript mode have to do with C++ preprocessor?", -;; or "why does jai-mode use javascript indentation?". -;; And my answer to that is - senator, I don't know, I just work here. -;; This hack essentially turns those into "impossible" regexes -;; (a word boundary at the beginning (`\\_<`) immediately followed by a word boundary at the end (`\\_>`)) -;; bypassing that codepath in js-mode entirely. -(defconst cpp-font-lock-keywords-source-directives "\\_<\\_>") -(defconst js--opt-cpp-start "\\_<\\_>") -(defconst js--macro-decl-re "\\_<\\_>") - -(defconst jai-builtins - '("it" "it_index")) - -(defconst jai-keywords - '("if" "ifx" "else" "then" "while" "for" "switch" "case" "struct" "enum" - "return" "remove" "continue" "break" "defer" "inline" "no_inline" - "using" "code_of" "initializer_of" "size_of" "type_of" "cast" "type_info" - "null" "true" "false" "xx" "context" "operator" "push_context" "is_constant" - "enum_flags" "union" "interface")) - -(defconst jai-typenames - '("int" "u64" "u32" "u16" "u8" - "s64" "s32" "s16" "s8" "float" - "float32" "float64" "string" - "bool" "void")) - -(defun jai-wrap-word-rx (s) - (concat "\\<" s "\\>")) - -(defun jai-keywords-rx (keywords) - "build keyword regexp" - (jai-wrap-word-rx (regexp-opt keywords t))) - -(defconst jai-dollar-type-rx (rx (group "$" (or (1+ word) (opt "$"))))) -(defconst jai-number-rx - (rx (and - symbol-start - (or (and (+ digit) (opt (and (any "eE") (opt (any "-+")) (+ digit)))) - (and "0" (any "xX") (+ hex-digit))) - (opt (and (any "_" "A-Z" "a-z") (* (any "_" "A-Z" "a-z" "0-9")))) - symbol-end))) - -(defun jai-syntax-propertize-function (start end) - "Mark all heredoc regions as strings in the buffer." - (goto-char start) - ;; If we're already inside a herestring we have to take care of that one first - (when-let* ((ppss (syntax-ppss)) - (inside (eq t (nth 3 ppss))) - (start-pos (nth 8 ppss)) - (tag (get-text-property start-pos 'here-string-marker))) - (when (re-search-forward (concat "^[[:space:]]*" (regexp-quote tag) "[[:punct:]]*.*$") end 'move) - (let ((end (match-end 0))) - (put-text-property (1- end) end 'syntax-table (string-to-syntax "|")) - ) - )) - (while (re-search-forward "#string +\\([a-zA-Z_][a-zA-Z0-9_]+\\)" end 'move) - (unless (nth 4 (syntax-ppss)) - (let ((tag (match-string 1)) - (beg (match-beginning 1))) - (unless (string= tag "CODE") - (put-text-property beg (1+ beg) 'here-string-marker tag) - (put-text-property beg (1+ beg) 'syntax-table (string-to-syntax "|")) - (when (re-search-forward (concat "^[[:space:]]*" "\\(" (regexp-quote tag) "\\)" "\\([[:space:]]*[[:punct:]]*.*$\\)") end 'move) - ;; Apply string syntax to everything between the start and end of heredoc - (let ((end (match-end 1))) - (put-text-property (1- end) end 'syntax-table (string-to-syntax "|")) - )))) - - ) - ) - ) - -(defun jai-postfix-cast-syntax (limit) - "Font-lock matcher for cast syntax: foo.(Type). -Matches the .( and the closing ) with balanced parens in between, -and highlights the type name inside." - (let ((found nil)) - (while (and (not found) (re-search-forward "\\.(" limit t)) - (let ((open-paren-pos (1- (point))) - (cast-start (match-beginning 0))) - (save-excursion - (goto-char open-paren-pos) - ;; Use forward-sexp to find the matching closing paren - (condition-case nil - (progn - (forward-sexp 1) - (let ((close-paren-pos (point)) - (inner-start (1+ open-paren-pos)) - (inner-end (1- (point))) - (type-start nil) - (type-end nil)) - ;; Look for the last word in the cast expression - (goto-char inner-start) - (while (re-search-forward "\\([[:word:]]+\\)" inner-end t) - (setq type-start (match-beginning 1)) - (setq type-end (match-end 1))) - ;; Store the positions for font-lock - (set-match-data (list cast-start close-paren-pos - cast-start (+ cast-start 2) ; subgroup 1: .( - (1- close-paren-pos) close-paren-pos ; subgroup 2: ) - type-start type-end)) ; subgroup 3: Type (or nil if no word found) - (setq found t))) - (error nil))))) ; If forward-sexp fails, continue searching - found)) - -(defconst jai-font-lock-defaults - `(;; .() Cast syntax - put this FIRST so it has priority - ;; Matching the type inside of .() is hacky. - ;; It breaks apart with things like foo.(get_type(baz=bark)) - (jai-postfix-cast-syntax - (1 font-lock-keyword-face) - (2 font-lock-keyword-face) - (3 font-lock-type-face)) - - ;; Keywords - (,(jai-keywords-rx jai-keywords) 1 font-lock-keyword-face) - - ;; single quote characters - ("\\('[[:word:]]\\)\\>" 1 font-lock-constant-face) - - ;; Variables - (,(jai-keywords-rx jai-builtins) 1 font-lock-variable-name-face) - - ;; Hash directives - ("#\\w+" . font-lock-preprocessor-face) - - ;; At notes - ("@\\w+" . font-lock-preprocessor-face) - - ;; Strings - ("\\\".*\\\"" . font-lock-string-face) - - ;; Numbers - (,(jai-wrap-word-rx jai-number-rx) . font-lock-constant-face) - - ;; Procedure names - ("\\([[:word:]]+\\)[[:space:]]*:[[:space:]]*:?[[:space:]]*\\(inline\\|#type\\)?[[:space:]]*\(" 1 font-lock-function-name-face) - - ;; Types - - (,(jai-keywords-rx jai-typenames) 1 font-lock-type-face) - - (,jai-dollar-type-rx 1 font-lock-type-face) - - ;; Foo.{} and bar.[] matching - ("\\([[:word:]]+\\)\\.\\(\{\\|\\[\\)" 1 font-lock-type-face) - - ("\\([[:word:]]+\\)[[:space:]]*:[[:space:]]*:[[:space:]]*\\(struct\\|enum\\|union\\|#type,\\)" 1 font-lock-type-face) - ;; TODO: This detects false-positives in case of `for it_index, it: foo`, it thinks that foo is a type. - ;; Emacs regexes do not support negative lookaheads, so I'd need to add proper logic to jai-syntax-propertize-function - ;; but it's too hard for now. Oh well! - ("[[:word:]]+[[:space:]]*:[[:space:]]*\\**\\(\\[[[:word:]]*\\]\\|\\[\\.\\.\\]\\)?*[[:space:]]*\\**[[:space:]]*\\([[:word:]]+\\)" 2 font-lock-type-face) - - ("---" . font-lock-constant-face) - )) - -;; add setq-local for older emacs versions -(unless (fboundp 'setq-local) - (defmacro setq-local (var val) - `(set (make-local-variable ',var) ,val))) - -(defconst jai--defun-rx "\(.*\).*\{") - -(defmacro jai-paren-level () - `(car (syntax-ppss))) - -(defun jai-line-is-defun () - "return t if current line begins a procedure" - (interactive) - (save-excursion - (beginning-of-line) - (let (found) - (while (and (not (eolp)) (not found)) - (if (looking-at jai--defun-rx) - (setq found t) - (forward-char 1))) - found))) - -(defun jai-beginning-of-defun () - "Go to line on which current function starts." - (interactive) - (let ((orig-level (jai-paren-level))) - (while (and - (not (jai-line-is-defun)) - (not (bobp)) - (> orig-level 0)) - (setq orig-level (jai-paren-level)) - (while (>= (jai-paren-level) orig-level) - (skip-chars-backward "^{") - (backward-char)))) - (when (jai-line-is-defun) - (beginning-of-line))) - -(defun jai-end-of-defun () - "Go to line on which current function ends." - (interactive) - (let ((orig-level (jai-paren-level))) - (when (> orig-level 0) - (jai-beginning-of-defun) - (end-of-line) - (setq orig-level (jai-paren-level)) - (skip-chars-forward "^}") - (while (>= (jai-paren-level) orig-level) - (skip-chars-forward "^}") - (forward-char))))) - -(defalias 'jai-parent-mode - (if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode)) - -;; imenu hookup -(add-hook 'jai-mode-hook - (lambda () - (setq imenu-generic-expression - '(("type" "^\\(.*:*.*\\) : " 1) - ("function" "^\\(.*\\) :: " 1) - ("struct" "^\\(.*\\) *:: *\\(struct\\)\\(.*\\){" 1))))) - -;; NOTE: taken from the scala-indent package and modified for Jai. -;; Still uses the js-indent-line as a base, which will have to be -;; replaced when the language is more mature. -(defun jai--indent-on-parentheses () - (when (and (= (char-syntax (char-before)) ?\)) - (= (save-excursion (back-to-indentation) (point)) (1- (point)))) - (js-indent-line))) - -(defun jai--add-self-insert-hooks () - (add-hook 'post-self-insert-hook - 'jai--indent-on-parentheses)) - -;;;###autoload -(define-derived-mode jai-mode jai-parent-mode "Jai" - :syntax-table jai-mode-syntax-table - :group 'jai - (setq bidi-paragraph-direction 'left-to-right) - (setq-local require-final-newline mode-require-final-newline) - (setq-local parse-sexp-ignore-comments t) - (setq-local comment-start-skip "\\(//+\\|/\\*+\\)\\s *") - (setq-local comment-start "//") - (setq-local block-comment-start "/*") - (setq-local block-comment-end "*/") - (setq-local indent-line-function 'js-indent-line) - (setq-local font-lock-defaults '(jai-font-lock-defaults)) - (setq-local beginning-of-defun-function 'jai-beginning-of-defun) - (setq-local end-of-defun-function 'jai-end-of-defun) - (setq-local syntax-propertize-function 'jai-syntax-propertize-function) - ;; add indent functionality to some characters - (jai--add-self-insert-hooks) - - (font-lock-ensure)) - -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.jai\\'" . jai-mode)) - -(defconst jai--error-regexp - "\\([^ \n:]+.*\.jai\\):\\([0-9]+\\),\\([0-9]+\\):") -(push `(jai ,jai--error-regexp 1 2 3 2) compilation-error-regexp-alist-alist) -(push 'jai compilation-error-regexp-alist) - -(provide 'jai-mode) -;;; jai-mode.el ends here diff --git a/.config/emacs/lisp/libs/compat-31.el b/.config/emacs/lisp/libs/compat-31.el deleted file mode 100644 index 2b61749..0000000 --- a/.config/emacs/lisp/libs/compat-31.el +++ /dev/null @@ -1,416 +0,0 @@ -;;; compat-31.el --- Functionality added in Emacs 31 -*- lexical-binding: t; -*- - -;; Copyright (C) 2025-2026 Free Software Foundation, Inc. - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; Functionality added in Emacs 31, needed by older Emacs versions. - -;;; Code: - -(eval-when-compile (load "compat-macs.el" nil t t)) -(compat-require compat-30 "30.1") - -;; TODO Update to 31.1 as soon as the Emacs emacs-31 branch version bumped -(compat-version "31.0.50") - -;;;; Defined in subr.el - -(compat-defun error-type-p (symbol) ;; - "Return non-nil if SYMBOL is a condition type." - (get symbol 'error-conditions)) - -(compat-defun error-has-type-p (error condition) ;; - "Return non-nil if ERROR is of type CONDITION (or a subtype of it)." - (unless (let ((type (car-safe error))) - (and type (symbolp type) (listp (cdr error)) - (error-type-p type))) - (signal 'wrong-type-argument (list error))) - (or (eq condition t) - (memq condition (get (car error) 'error-conditions)))) - -(compat-defalias error-type car ;; - "Return the symbol which represents the type of ERROR. -\n(fn ERROR)") - -(compat-defalias error-slot-value elt ;; - "Access the SLOT of object ERROR. -Slots are specified by position, and slot 0 is the error symbol. -\n(fn ERROR SLOT)") - -(compat-defun ensure-proper-list (object) ;; - "Return OBJECT as a list. -If OBJECT is already a proper list, return OBJECT itself. If it's not a -proper list, return a one-element list containing OBJECT. - -`ensure-list' is usually preferable because that function runs in -constant time, but this one has to traverse the whole of OBJECT." - (declare (side-effect-free error-free)) - (if (proper-list-p object) - object - (list object))) - -(compat-defun set-local (variable value) ;; - "Make VARIABLE buffer local and set it to VALUE." - (set (make-local-variable variable) value)) - -(compat-defun take-while (pred list) ;; - "Return the longest prefix of LIST whose elements satisfy PRED." - (let ((r nil)) - (while (and list (funcall pred (car list))) - (push (car list) r) - (setq list (cdr list))) - (nreverse r))) - -(compat-defun drop-while (pred list) ;; - "Skip initial elements of LIST satisfying PRED and return the rest." - (while (and list (funcall pred (car list))) - (setq list (cdr list))) - list) - -(compat-defun all (pred list) ;; - "Non-nil if PRED is true for all elements in LIST." - (not (drop-while pred list))) - -(compat-defun member-if (pred list) ;; - "Non-nil if PRED is true for at least one element in LIST. -Returns the LIST suffix starting at the first element that satisfies PRED, -or nil if none does." - (drop-while (lambda (x) (not (funcall pred x))) list)) - -(compat-defalias any member-if) ;; - -(compat-defun hash-table-contains-p (key table) ;; - "Return non-nil if TABLE has an element with KEY." - (declare (side-effect-free t)) - (let ((missing '#:missing)) - (not (eq (gethash key table missing) missing)))) - -(compat-defmacro static-when (condition &rest body) ;; - "A conditional compilation macro. -Evaluate CONDITION at macro-expansion time. If it is non-nil, -expand the macro to evaluate all BODY forms sequentially and return -the value of the last one, or nil if there are none." - (declare (indent 1) (debug t)) - (if body - (if (eval condition lexical-binding) - (cons 'progn body) - nil) - (macroexp-warn-and-return (format-message "`static-when' with empty body") - (list 'progn nil nil) '(empty-body static-when) t))) - -(compat-defmacro static-unless (condition &rest body) ;; - "A conditional compilation macro. -Evaluate CONDITION at macro-expansion time. If it is nil, -expand the macro to evaluate all BODY forms sequentially and return -the value of the last one, or nil if there are none." - (declare (indent 1) (debug t)) - (if body - (if (eval condition lexical-binding) - nil - (cons 'progn body)) - (macroexp-warn-and-return (format-message "`static-unless' with empty body") - (list 'progn nil nil) '(empty-body static-unless) t))) - -(compat-defun oddp (integer) ;; - "Return t if INTEGER is odd." - (not (eq (% integer 2) 0))) - -(compat-defun evenp (integer) ;; - "Return t if INTEGER is even." - (eq (% integer 2) 0)) - -(compat-defun plusp (number) ;; - "Return t if NUMBER is positive." - (> number 0)) - -(compat-defun minusp (number) ;; - "Return t if NUMBER is negative." - (< number 0)) - -(compat-defmacro incf (place &optional delta) ;; - "Increment PLACE by DELTA (default to 1). - -The DELTA is first added to PLACE, and then stored in PLACE. -Return the incremented value of PLACE. - -See also `decf'." - (gv-letplace (getter setter) place - (funcall setter `(+ ,getter ,(or delta 1))))) - -(compat-defmacro decf (place &optional delta) ;; - "Decrement PLACE by DELTA (default to 1). - -The DELTA is first subtracted from PLACE, and then stored in PLACE. -Return the decremented value of PLACE. - -See also `incf'." - (gv-letplace (getter setter) place - (funcall setter `(- ,getter ,(or delta 1))))) - -;;;; Defined in color.el - -(compat-defun color-blend (a b &optional alpha) ;; - "Blend the two colors A and B in linear space with ALPHA. -A and B should be lists (RED GREEN BLUE), where each element is -between 0.0 and 1.0, inclusive. ALPHA controls the influence A -has on the result and should be between 0.0 and 1.0, inclusive. - -For instance: - - (color-blend \\='(1 0.5 1) \\='(0 0 0) 0.75) - => (0.75 0.375 0.75)" - (setq alpha (or alpha 0.5)) - (let (blend) - (dotimes (i 3) - (push (+ (* (nth i a) alpha) (* (nth i b) (- 1 alpha))) blend)) - (nreverse blend))) - -;;;; Defined in time-date.el - -(compat-defvar seconds-to-string ;; - (list (list 1 "ms" 0.001) - (list 100 "s" 1) - (list (* 60 100) "m" 60.0) - (list (* 3600 30) "h" 3600.0) - (list (* 3600 24 400) "d" (* 3600.0 24.0)) - (list nil "y" (* 365.25 24 3600))) - "Formatting used by the function `seconds-to-string'.") - -(compat-defvar seconds-to-string-readable ;; - `(("Y" "year" "years" ,(round (* 60 60 24 365.2425))) - ("M" "month" "months" ,(round (* 60 60 24 30.436875))) - ("w" "week" "weeks" ,(* 60 60 24 7)) - ("d" "day" "days" ,(* 60 60 24)) - ("h" "hour" "hours" ,(* 60 60)) - ("m" "minute" "minutes" 60) - ("s" "second" "seconds" 1)) - "Formatting used by the function `seconds-to-string' with READABLE set. -The format is an alist, with string keys ABBREV-UNIT, and elements like: - - (ABBREV-UNIT UNIT UNIT-PLURAL SECS) - -where UNIT is a unit of time, ABBREV-UNIT is the abbreviated form of -UNIT, UNIT-PLURAL is the plural form of UNIT, and SECS is the number of -seconds per UNIT.") - -(compat-defun seconds-to-string (delay &optional readable abbrev precision) ;; - "Handle optional arguments READABLE, ABBREV and PRECISION." - :extended t - (cond - ((< delay 0) - (concat "-" (seconds-to-string (- delay) readable precision))) - (readable - (let* ((stsa seconds-to-string-readable) - (expanded (eq readable 'expanded)) - digits - (round-to (cond - ((wholenump precision) - (setq digits precision) - (expt 10 (- precision))) - ((and (floatp precision) (< precision 1.)) - (setq digits (- (floor (log precision 10)))) - precision) - (t (setq digits 0) 1))) - (dformat (if (> digits 0) (format "%%0.%df" digits))) - (padding (if abbrev "" " ")) - here cnt cnt-pre here-pre cnt-val isfloatp) - (if (= (round delay round-to) 0) - (format "0%s" (if abbrev "s" " seconds")) - (while (and (setq here (pop stsa)) stsa - (< (/ delay (nth 3 here)) 1))) - (or (and - expanded stsa ; smaller unit remains - (progn - (setq - here-pre here here (car stsa) - cnt-pre (floor (/ (float delay) (nth 3 here-pre))) - cnt (round - (/ (- (float delay) (* cnt-pre (nth 3 here-pre))) - (nth 3 here)) - round-to)) - (if (> cnt 0) t (setq cnt cnt-pre here here-pre here-pre nil)))) - (setq cnt (round (/ (float delay) (nth 3 here)) round-to))) - (setq cnt-val (* cnt round-to) - isfloatp (and (> digits 0) - (> (- cnt-val (floor cnt-val)) 0.))) - (cl-labels - ((unit (val here &optional plural) - (cond (abbrev (car here)) - ((and (not plural) (<= (floor val) 1)) (nth 1 here)) - (t (nth 2 here))))) - (concat - (when here-pre - (concat (number-to-string cnt-pre) padding - (unit cnt-pre here-pre) " ")) - (if isfloatp (format dformat cnt-val) - (number-to-string (floor cnt-val))) - padding - (unit cnt-val here isfloatp)))))) ; float formats are always plural - ((= 0 delay) "0s") - (t (let ((sts seconds-to-string) here) - (while (and (car (setq here (pop sts))) - (<= (car here) delay))) - (concat (format "%.2f" (/ delay (car (cddr here)))) (cadr here)))))) - -;;;; Defined in minibuffer.el - -(compat-defun completion-list-candidate-at-point (&optional pt) ;; - "Candidate string and bounds at PT in completions buffer. -The return value has the format (STR BEG END). -The optional argument PT defaults to (point)." - (let ((pt (or pt (point))) beg end) - (cond - ((and (/= pt (point-max)) (get-text-property pt 'mouse-face)) - (setq end pt beg (1+ pt))) - ((and (/= pt (point-min)) (get-text-property (1- pt) 'mouse-face)) - (setq end (1- pt) beg pt))) - (when (and beg end) - (setq beg (previous-single-property-change beg 'mouse-face)) - (setq end (or (next-single-property-change end 'mouse-face) (point-max))) - (list (or (get-text-property beg 'completion--string) - (buffer-substring beg end)) - beg end)))) - -(compat-defun completion-table-with-metadata (table metadata) ;; - "Return new completion TABLE with METADATA. -METADATA should be an alist of completion metadata. See -`completion-metadata' for a list of supported metadata." - (lambda (string pred action) - (if (eq action 'metadata) - `(metadata . ,metadata) - (complete-with-action action table string pred)))) - -;;;; Defined in subr-x.el - -(compat-defun add-remove--display-text-property (start end spec value &optional object remove) ;; - "Helper function for `add-display-text-property' and `remove-display-text-property'." - (let ((sub-start start) - (sub-end 0) - (limit (if (stringp object) - (min (length object) end) - (min end (point-max)))) - disp) - (while (< sub-end end) - (setq sub-end (next-single-property-change sub-start 'display object - limit)) - (if (not (setq disp (get-text-property sub-start 'display object))) - (unless remove - (put-text-property sub-start sub-end 'display (list spec value) - object)) - (let ((changed nil) - type) - (setq disp - (cond - ((vectorp disp) - (setq type 'vector) - (seq-into disp 'list)) - ((or (not (consp (car-safe disp))) - (eq (caar disp) 'margin)) - (setq type 'scalar) - (list disp)) - (t - (setq type 'list) - disp))) - (when-let* ((old (assoc spec disp))) - (setq disp (if (eq type 'list) - (remove old disp) - (delete old disp)) - changed t)) - (unless remove - (setq disp (cons (list spec value) disp) - changed t)) - (when changed - (if (not disp) - (remove-text-properties sub-start sub-end '(display nil) object) - (when (eq type 'vector) - (setq disp (seq-into disp 'vector))) - (put-text-property sub-start sub-end 'display disp object))))) - (setq sub-start sub-end)))) - -(compat-defun remove-display-text-property (start end spec &optional object) ;; - "Remove the display specification SPEC from the text from START to END. -SPEC is the car of the display specification to remove, e.g. `height'. -If any text in the region has other display specifications, those specs -are retained. - -OBJECT is either a string or a buffer to remove the specification from. -If omitted, OBJECT defaults to the current buffer." - (add-remove--display-text-property start end spec nil object 'remove)) - -(compat-defvar work-buffer-limit 10 ;; - "Maximum number of reusable work buffers. -When this limit is exceeded, newly allocated work buffers are -automatically killed, which means that in a such case -`with-work-buffer' becomes equivalent to `with-temp-buffer'.") - -;; On Emacs 29 and newer `kill-all-local-variables' has a KILL-PERMANENT argument. -(static-if (< emacs-major-version 29) nil - (compat-defvar work-buffer--list nil ;; - "List of work buffers.") - - (compat-defun work-buffer--get () ;; - "Get a work buffer." - (let ((buffer (pop work-buffer--list))) - (if (buffer-live-p buffer) - buffer - (generate-new-buffer " *work*" t)))) - - (compat-defun work-buffer--release (buffer) ;; - "Release work BUFFER." - (if (buffer-live-p buffer) - (with-current-buffer buffer - (let ((inhibit-read-only t)) - (erase-buffer) - (delete-all-overlays)) - (let (change-major-mode-hook) - (setq buffer-read-only nil) - (kill-all-local-variables t)) - (push buffer work-buffer--list))) - (when (> (length work-buffer--list) work-buffer-limit) - (mapc #'kill-buffer (nthcdr work-buffer-limit work-buffer--list)) - (setq work-buffer--list (ntake work-buffer-limit work-buffer--list))))) - -(compat-defmacro with-work-buffer (&rest body) ;; - "Create a work buffer, and evaluate BODY there like `progn'. -Like `with-temp-buffer', but reuse an already created temporary buffer -when possible, instead of creating a new one on each call. Avoid -retaining state referring to a work buffer, and kill any indirect -buffers you create that use a work buffer as a base." - (declare (indent 0) (debug t)) - (static-if (< emacs-major-version 29) - `(with-temp-buffer ,@body) - (let ((work-buffer (make-symbol "work-buffer"))) - `(let ((,work-buffer (work-buffer--get))) - (with-current-buffer ,work-buffer - (unwind-protect - (progn ,@body) - (work-buffer--release ,work-buffer))))))) - -;;;; Defined in button.el - -(compat-defun unbuttonize-region (start end) ;; - "Remove all the buttons between START and END. -This removes both text-property and overlay based buttons." - (dolist (o (overlays-in start end)) - (when (overlay-get o 'button) - (delete-overlay o))) - (with-silent-modifications - (remove-text-properties start end (button--properties nil nil nil)) - (add-face-text-property start end 'button nil))) - -(provide 'compat-31) -;;; compat-31.el ends here diff --git a/.config/emacs/lisp/libs/compat-macs.el b/.config/emacs/lisp/libs/compat-macs.el deleted file mode 100644 index b3206f7..0000000 --- a/.config/emacs/lisp/libs/compat-macs.el +++ /dev/null @@ -1,272 +0,0 @@ -;;; compat-macs.el --- Compatibility Macros -*- lexical-binding: t; no-byte-compile: t; -*- - -;; Copyright (C) 2021-2026 Free Software Foundation, Inc. - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; WARNING: This file provides *internal* macros. The macros are used -;; by Compat to facilitate the definition of compatibility functions, -;; compatibility macros and compatibility variables. The -;; `compat-macs' feature should never be loaded at runtime in your -;; Emacs and will only be used during byte compilation. Every -;; definition provided here is internal, may change any time between -;; Compat releases and must not be used by other packages. - -;;; Code: - -;; We always require subr-x at compile time for the fboundp check -;; since definitions have been moved around. The cl-lib macros are -;; needed by compatibility definitions. -(require 'subr-x) -(require 'cl-lib) - -(defvar compat-macs--version nil - "Version of the currently defined compatibility definitions.") - -(defun compat-macs--strict (cond &rest error) - "Assert strict COND, otherwise fail with ERROR." - (when (bound-and-true-p compat-strict) - (apply #'compat-macs--assert cond error))) - -(defun compat-macs--assert (cond &rest error) - "Assert COND, otherwise fail with ERROR." - (unless cond (apply #'error error))) - -(defun compat-macs--docstring (type name docstring) - "Format DOCSTRING for NAME of TYPE. -Prepend compatibility notice to the actual documentation string." - (with-temp-buffer - (insert - (format - "[Compatibility %s for `%s', defined in Emacs %s. \ -See (compat) Emacs %s' for more details.]\n\n%s" - type name compat-macs--version compat-macs--version docstring)) - (let ((fill-column 80)) - (fill-region (point-min) (point-max))) - (buffer-string))) - -(defun compat-macs--check-attributes (attrs preds) - "Check ATTRS given PREDS predicate plist and return rest." - (while (keywordp (car attrs)) - (compat-macs--assert (cdr attrs) "Attribute list length is odd") - (compat-macs--assert (let ((p (plist-get preds (car attrs)))) - (and p (or (eq p t) (funcall p (cadr attrs))))) - "Invalid attribute %s" (car attrs)) - (setq attrs (cddr attrs))) - attrs) - -(defun compat-macs--guard (attrs preds fun) - "Guard compatibility definition generation. -The version constraints specified by ATTRS are checked. PREDS is -a plist of predicates for arguments which are passed to FUN." - (declare (indent 2)) - (compat-macs--assert compat-macs--version "No `compat-version' was declared") - (let* ((body (compat-macs--check-attributes - attrs `(,@preds :feature symbolp))) - (feature (plist-get attrs :feature)) - (attrs `(:body ,body ,@attrs)) - args) - ;; Require feature at compile time - (when feature - (compat-macs--assert (not (eq feature 'subr-x)) "Invalid feature subr-x") - (require feature)) - ;; The current Emacs must be older than the currently declared version. - (when (version< emacs-version compat-macs--version) - (while preds - (push (plist-get attrs (car preds)) args) - (setq preds (cddr preds))) - (setq body (apply fun (nreverse args))) - (if (and feature body) - `(with-eval-after-load ',feature ,@body) - (macroexp-progn body))))) - -(defun compat-macs--defun (type name arglist docstring rest) - "Define function NAME of TYPE with ARGLIST and DOCSTRING. -REST are attributes and the function BODY." - (compat-macs--guard - rest (list :extended (lambda (x) (or (booleanp x) (version-to-list x))) - :obsolete (lambda (x) (or (booleanp x) (stringp x))) - :body t) - (lambda (extended obsolete body) - (when (stringp extended) - (compat-macs--assert - (and (version< extended compat-macs--version) (version< "25.1" extended)) - "Invalid :extended version %s for %s %s" extended type name) - (setq extended (version<= extended emacs-version))) - (compat-macs--strict (eq extended (fboundp name)) - "Wrong :extended flag for %s %s" type name) - ;; Remove unsupported declares. It might be possible to set these - ;; properties otherwise. That should be looked into and implemented - ;; if it is the case. - (when (and (listp (car-safe body)) (eq (caar body) 'declare) (<= emacs-major-version 25)) - (setcar body (assq-delete-all 'pure (assq-delete-all - 'side-effect-free (car body))))) - ;; Use `:extended' name if the function is already defined. - (let* ((defname (if (and extended (fboundp name)) - (intern (format "compat--%s" name)) - name)) - (def `(,(if (memq '&key arglist) - (if (eq type 'macro) 'cl-defmacro 'cl-defun) - (if (eq type 'macro) 'defmacro 'defun)) - ,defname ,arglist - ,(compat-macs--docstring type name docstring) - ,@body))) - `(,@(if (eq defname name) - ;; An additional fboundp check is performed at runtime to make - ;; sure that we never redefine an existing definition if Compat - ;; is loaded on a newer Emacs version. Declare the function, - ;; such that the byte compiler does not complain about possibly - ;; missing functions at runtime. The warnings are generated due - ;; to the fboundp check. - `((declare-function ,name nil) - (unless (fboundp ',name) ,def)) - (list def)) - ,@(when obsolete - `((make-obsolete - ',defname ,(if (stringp obsolete) obsolete "No substitute") - ,compat-macs--version)))))))) - -(defmacro compat-guard (cond &rest rest) - "Guard definition with a runtime COND and a version check. -The runtime condition must make sure that no definition is -overridden. REST is an attribute plist followed by the definition -body. The attributes specify the conditions under which the -definition is generated. - -- :feature :: Wrap the definition with `with-eval-after-load' for - the given feature." - (declare (debug ([&rest keywordp sexp] def-body)) - (indent 1)) - (compat-macs--guard rest '(:body t) - (lambda (body) - (compat-macs--assert body "The guarded body is empty") - (if (eq cond t) - body - (compat-macs--strict (eval cond t) "Guard %S failed" cond) - `((when ,cond ,@body)))))) - -(defmacro compat-defalias (name def &rest attrs) - "Define compatibility alias NAME as DEF. -ATTRS is a plist of attributes, which specify the conditions -under which the definition is generated. - -- :obsolete :: Mark the alias as obsolete if t. - -- :feature :: See `compat-guard'." - (declare (debug (name symbolp [&rest keywordp sexp]))) - (compat-macs--guard attrs '(:obsolete booleanp) - (lambda (obsolete) - (compat-macs--strict (not (fboundp name)) "%s already defined" name) - ;; The fboundp check is performed at runtime to make sure that we never - ;; redefine an existing definition if Compat is loaded on a newer Emacs - ;; version. - `((unless (fboundp ',name) - (defalias ',name ',def - ,(compat-macs--docstring 'function name - (get name 'function-documentation))) - ,@(when obsolete - `((make-obsolete ',name ',def ,compat-macs--version)))))))) - -(defmacro compat-defun (name arglist docstring &rest rest) - "Define compatibility function NAME with arguments ARGLIST. -The function must be documented in DOCSTRING. REST is an -attribute plist followed by the function body. The attributes -specify the conditions under which the definition is generated. - -- :extended :: Mark the function as extended if t. The function - must be called explicitly via `compat-call'. This attribute - should be used for functions which extend already existing - functions, e.g., functions which changed their calling - convention or their behavior. The value can also be a version - string, which specifies the Emacs version when the original - version of the function was introduced. - -- :obsolete :: Mark the function as obsolete if t, can be a - string describing the obsoletion. - -- :feature :: See `compat-guard'." - (declare (debug (&define name (&rest symbolp) - stringp - [&rest keywordp sexp] - def-body)) - (doc-string 3) (indent 2)) - (compat-macs--defun 'function name arglist docstring rest)) - -(defmacro compat-defmacro (name arglist docstring &rest rest) - "Define compatibility macro NAME with arguments ARGLIST. -The macro must be documented in DOCSTRING. REST is an attribute -plist followed by the macro body. See `compat-defun' for -details." - (declare (debug compat-defun) (doc-string 3) (indent 2)) - (compat-macs--defun 'macro name arglist docstring rest)) - -(defmacro compat-defvar (name initval docstring &rest attrs) - "Define compatibility variable NAME with initial value INITVAL. -The variable must be documented in DOCSTRING. ATTRS is a plist -of attributes, which specify the conditions under which the -definition is generated. - -- :constant :: Mark the variable as constant if t. - -- :risky :: Mark the variable as risky if t. - -- :local :: Make the variable buffer-local if t. If the value is - `permanent' make the variable additionally permanently local. - -- :obsolete :: Mark the variable as obsolete if t, can be a - string describing the obsoletion. - -- :feature :: See `compat-guard'." - (declare (debug (name form stringp [&rest keywordp sexp])) - (doc-string 3) (indent 2)) - (compat-macs--guard - attrs (list :constant #'booleanp - :risky #'booleanp - :local (lambda (x) (memq x '(nil t permanent))) - :obsolete (lambda (x) (or (booleanp x) (stringp x)))) - (lambda (constant risky local obsolete) - (compat-macs--strict (not (boundp name)) "%s already defined" name) - (compat-macs--assert (not (and constant local)) "Both :constant and :local") - (compat-macs--assert (not (and local risky)) "Both :risky and :local") - ;; The boundp check is performed at runtime to make sure that we never - ;; redefine an existing definition if Compat is loaded on a newer Emacs - ;; version. - `((defvar ,name) - (unless (boundp ',name) - (,(if constant 'defconst 'defvar) - ,name ,initval - ,(compat-macs--docstring 'variable name docstring)) - ,@(when obsolete - `((make-obsolete-variable - ',name ,(if (stringp obsolete) obsolete "No substitute") - ,compat-macs--version)))) - ,@(and local `((make-variable-buffer-local ',name))) - ,@(and risky `((put ',name 'risky-local-variable t))) - ,@(and (eq local 'permanent) `((put ',name 'permanent-local t))))))) - -(defmacro compat-version (version) - "Set the Emacs version that is currently being handled to VERSION." - (setq compat-macs--version version) - nil) - -(defmacro compat-require (feature version) - "Require FEATURE if the Emacs version is less than VERSION." - (when (version< emacs-version version) - (require feature) - `(require ',feature))) - -(provide 'compat-macs) -;;; compat-macs.el ends here diff --git a/.config/emacs/lisp/libs/compat.el b/.config/emacs/lisp/libs/compat.el deleted file mode 100644 index deec131..0000000 --- a/.config/emacs/lisp/libs/compat.el +++ /dev/null @@ -1,93 +0,0 @@ -;;; compat.el --- Emacs Lisp Compatibility Library -*- lexical-binding: t; -*- - -;; Copyright (C) 2021-2026 Free Software Foundation, Inc. - -;; Author: Philip Kaludercic , Daniel Mendler -;; Maintainer: Philip Kaludercic , Daniel Mendler -;; Version: 31.0.0.1 -;; URL: https://github.com/emacs-compat/compat -;; Package-Requires: ((emacs "25.1")) -;; Keywords: lisp, maint - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; Compat is the Elisp forwards compatibility library, which provides -;; definitions introduced in newer Emacs versions. The definitions -;; are only installed if necessary for your current Emacs version. If -;; Compat is compiled on a recent version of Emacs, all of the -;; definitions are disabled at compile time, such that no negative -;; performance impact is incurred. The provided compatibility -;; implementations of functions and macros are at least subsets of the -;; actual implementations. Be sure to read the documentation string -;; and the Compat manual. -;; -;; Not every function provided in newer versions of Emacs is provided -;; here. Some depend on new features from the C core, others cannot -;; be implemented to a meaningful degree. Please consult the Compat -;; manual for details regarding the usage of the Compat library and -;; the provided functionality. - -;; The main audience for this library are not regular users, but -;; package maintainers. Therefore no commands, user-facing modes or -;; user options are implemented here. - -;;; Code: - -;; Ensure that the newest compatibility layer is required at compile -;; time and runtime, but only if needed. -(eval-when-compile - (defmacro compat--maybe-require () - (when (< emacs-major-version 31) - (require 'compat-31) - '(require 'compat-31)))) -(compat--maybe-require) - -;;;; Macros for extended compatibility function calls - -(defmacro compat-function (fun) - "Return compatibility function symbol for FUN. - -If the Emacs version provides a sufficiently recent version of -FUN, the symbol FUN is returned itself. Otherwise the macro -returns the symbol of a compatibility function which supports the -behavior and calling convention of the current stable Emacs -version. For example Compat 29.1 will provide compatibility -functions which implement the behavior and calling convention of -Emacs 29.1. - -See also `compat-call' to directly call compatibility functions." - (let ((compat (intern (format "compat--%s" fun)))) - `#',(if (fboundp compat) compat fun))) - -(defmacro compat-call (fun &rest args) - "Call compatibility function or macro FUN with ARGS. - -A good example function is `plist-get' which was extended with an -additional predicate argument in Emacs 29.1. The compatibility -function, which supports this additional argument, can be -obtained via (compat-function plist-get) and called -via (compat-call plist-get plist prop predicate). It is not -possible to directly call (plist-get plist prop predicate) on -Emacs older than 29.1, since the original `plist-get' function -does not yet support the predicate argument. Note that the -Compat library never overrides existing functions. - -See also `compat-function' to lookup compatibility functions." - (let ((compat (intern (format "compat--%s" fun)))) - `(,(if (fboundp compat) compat fun) ,@args))) - -(provide 'compat) -;;; compat.el ends here diff --git a/.config/emacs/lisp/libs/cond-let.el b/.config/emacs/lisp/libs/cond-let.el deleted file mode 100644 index 825705c..0000000 --- a/.config/emacs/lisp/libs/cond-let.el +++ /dev/null @@ -1,567 +0,0 @@ -;;; cond-let.el --- Additional and improved binding conditionals -*- lexical-binding:t -*- - -;; Copyright (C) 2025-2026 Jonas Bernoulli - -;; May contain traces of Emacs, which is -;; Copyright (C) 1985-2025 Free Software Foundation, Inc. - -;; Author: Jonas Bernoulli -;; Homepage: https://github.com/tarsius/cond-let -;; Keywords: extensions - -;; Package-Version: 1.1.2 -;; Package-Requires: ((emacs "28.1")) - -;; SPDX-License-Identifier: GPL-3.0-or-later - -;; This file is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation, either version 3 of the License, -;; or (at your option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this file. If not, see . - -;;; Commentary: - -;; Emacs provides the binding conditionals `if-let', `if-let*', -;; `when-let', `when-let*', `and-let*' and `while-let'. - -;; This package implements the missing `and-let' and `while-let*'; -;; and the original `cond-let', `cond-let*', `when$', `and$' and -;; `thread$'. - -;; This package additionally provides more consistent and improved -;; implementations of the binding conditionals already provided by -;; Emacs. Merely loading this library does not shadow the built-in -;; implementations; this can optionally be done in the context of -;; an individual library, as described below. - -;; `cond-let' and `cond-let*' are provided exactly under these names. -;; The names of all other macros implemented by this package begin -;; with `cond-let--', the package's prefix for private symbol. - -;; Users of this package are not expected to use these unwieldy -;; names. Instead one should use Emacs' shorthand feature to use -;; all or some of these macros by their conceptual names. E.g., if -;; you want to use all of the available macros, add this at the end -;; of a library. - -;; Local Variables: -;; read-symbol-shorthands: ( -;; ("and$" . "cond-let--and$") -;; ("thread$" . "cond-let--thread$") -;; ("when$" . "cond-let--when$") -;; ("and-let*" . "cond-let--and-let*") -;; ("and-let" . "cond-let--and-let") -;; ("if-let*" . "cond-let--if-let*") -;; ("if-let" . "cond-let--if-let") -;; ("when-let*" . "cond-let--when-let*") -;; ("when-let" . "cond-let--when-let") -;; ("while-let*" . "cond-let--while-let*") -;; ("while-let" . "cond-let--while-let")) -;; End: - -;; You can think of these file-local settings as import statements of -;; sorts. If you do this, then this package's implementations shadow -;; the built-in implementations. Doing so does not affect any other -;; libraries, which continue to use the built-in implementations. - -;; Due to limitations of the shorthand implementation this has to be -;; done for each individual library. "dir-locals.el" cannot be used. - -;; If you use `when$', `and$' and `thread$', you might want to add -;; this to your configuration: - -;; (with-eval-after-load 'cond-let -;; (font-lock-add-keywords 'emacs-lisp-mode -;; cond-let-font-lock-keywords t)) - -;; For information about the individual macros, please refer to their -;; docstrings. - -;; See also https://github.com/tarsius/cond-let/wiki. - -;;; Code: -;;; Cond - -(defun cond-let--prepare-clauses (tag sequential clauses) - "Used by macros `cond-let*' and `cond-let'." - (let (body) - (dolist (clause (nreverse clauses)) - (cond - ((vectorp clause) - (setq body - `((,(if (and sequential (length> clause 1)) 'let* 'let) - ,(mapcar (lambda (vec) (append vec nil)) clause) - ,@body)))) - ((let (varlist) - (while (vectorp (car clause)) - (push (append (pop clause) nil) varlist)) - (push (cond - (varlist - `(,(pcase (list (and body t) - (and sequential (length> varlist 1))) - ('(t t ) 'cond-let--when-let*) - (`(t ,_) 'cond-let--when-let) - ('(nil t ) 'cond-let--and-let*) - (`(nil ,_) 'cond-let--and-let)) - ,(nreverse varlist) - ,(if body - `(throw ',tag ,(macroexp-progn clause)) - (macroexp-progn clause)))) - ((length= clause 1) - (if body - (let ((a (gensym "anon"))) - `(let ((,a ,(car clause))) - (when ,a (throw ',tag ,a)))) - (car clause))) - ((and (eq (car clause) t) (not body)) - (macroexp-progn (cdr clause))) - (t - `(when ,(pop clause) - (throw ',tag ,(macroexp-progn clause))))) - body))))) - body)) - -(defmacro cond-let* (&rest clauses) - "Try each clause until one succeeds. - -Each clause has one of these forms: -- a plain clause (CONDITION BODY...) -- a binding clause ([SYMBOL VALUEFORM]... BODY...) -- a binding vector [[SYMBOL VALUEFORM]...] - -A (CONDITION BODY...) clause works as for `cond'. Evaluate CONDITION, -and if it yields non-nil, the clause succeeds. Then evaluate BODY forms -sequentially and return the value of the last; or if there are no BODY -forms, return the value of CONDITION. If CONDITION yields nil, do not -evaluate the BODY forms and instead proceed to the next clause. - -A ([SYMBOL VALUEFORM]... BODY...) clause begins with one or more binding -vectors, followed by one or more BODY forms. Bind SYMBOL to the value -of VALUEFORM. Each VALUEFORM can refer to symbols already bound by this -VARLIST (as for `let*'). - -If all VALUEFORMs yield non-nil, evaluate BODY forms sequentially, with -VARLIST's bindings in effect, and return the value of the last form. - -If any VALUEFORM yields nil, evaluate neither the remaining VALUEFORMs -nor the BODY forms, and proceed to the next clause. - -A [[SYMBOL VALUEFORM]...] form creates bindings, which extend to all -remaining clauses and binding vectors. Unlike for the previous form, -always bind all SYMBOLs, even if a VALUEFORM yields nil. Always proceed -to the next clause." - (declare (indent 0) - (debug (&rest [&or - (vector &rest (vector symbolp form)) - ([&rest (vector symbolp form)] body) - (form body)]))) - (let ((tag (gensym ":cond-let*"))) - `(catch ',tag - ,@(cond-let--prepare-clauses tag t clauses)))) - -(defmacro cond-let (&rest clauses) - "Try each clause until one succeeds. - -Each clause has one of these forms: -- a plain clause (CONDITION BODY...) -- a binding clause ([SYMBOL VALUEFORM]... BODY...) -- a binding vector [[SYMBOL VALUEFORM]...] - -A (CONDITION BODY...) clause works as for `cond'. Evaluate CONDITION, -and if it yields non-nil, the clause succeeds. Then evaluate BODY forms -sequentially and return the value of the last; or if there are no BODY -forms, return the value of CONDITION. If CONDITION yields nil, do not -evaluate the BODY forms and instead proceed to the next clause. - -A ([SYMBOL VALUEFORM]... BODY...) clause begins with one or more binding -vectors, followed by one or more BODY forms. Bind SYMBOL to the value -of VALUEFORM. Evaluate all VALUEFORMs before binding their respective -SYMBOLs (as for `let'). - -If all VALUEFORMs yield non-nil, evaluate BODY forms sequentially, with -VARLIST's bindings in effect, and return the value of the last form. - -If any VALUEFORM yields nil, evaluate neither the remaining VALUEFORMs -nor the BODY forms, and proceed to the next clause. - -A [[SYMBOL VALUEFORM]...] form creates bindings, which extend to all -remaining clauses and binding vectors. Evaluate all VALUEFORMs before -binding their respective SYMBOLs. Unlike for the previous form, bind -all SYMBOLs, even if a VALUEFORM yields nil. Always proceed to the -next clause." - (declare (indent 0) - (debug cond-let*)) - (let ((tag (gensym ":cond-let"))) - `(catch ',tag - ,@(cond-let--prepare-clauses tag nil clauses)))) - -;;; Common - -(defun cond-let--prepare-varlist (varlist) - "Used by Cond-Let's `when-let*', `and-let*' and `while-let*'. -Also used by other macros via `cond-let--prepare-varforms'. -Return (VARLIST LASTVAR)." - (let (prevvar) - (list (mapcar (lambda (binding) - (unless (length= binding 2) - (signal 'error (cons "Invalid binding" binding))) - (pcase-let ((`(,var ,form) binding)) - (when (string-prefix-p "_" (symbol-name var)) - (setq var (gensym "anon"))) - (prog1 (if prevvar - `(,var (and ,prevvar ,form)) - (list var form)) - (setq prevvar var)))) - varlist) - prevvar))) - -(defun cond-let--prepare-varforms (varlist &optional if-let) - "Used by Cond-Let's `when-let', `and-let', `while-let' and `if-let'. -Return (ANON-VARLIST ANON-SETQ VARLIST LASTVAR), or if the length of -VARLIST is 1 and IF-LET is nil, return (nil nil VARLIST LASTVAR)." - (if (and (not if-let) - (length= varlist 1)) - `(nil nil ,@(cond-let--prepare-varlist varlist)) - (let ((triples - (mapcar (lambda (binding) - (unless (length= binding 2) - (signal 'error (cons "Invalid binding" binding))) - (pcase-let ((`(,var ,form) binding)) - (when (string-prefix-p "_" (symbol-name var)) - (setq var nil)) - (list (and var (gensym "anon")) - var - form))) - varlist))) - (list (mapcan (pcase-lambda (`(,anon ,_ ,_)) - (and anon (list anon))) - triples) - (mapcar (pcase-lambda (`(,anon ,_ ,form)) - (if anon - `(setq ,anon ,form) - form)) - triples) - (mapcan (pcase-lambda (`(,anon ,var ,_)) - (and var `((,var ,anon)))) - triples) - (cadr (car (last triples))))))) - -;;; And - -(defmacro cond-let--and-let* (varlist &optional bodyform) - "Bind according to VARLIST until one yields nil, else evaluate BODYFORM. - -Each element of VARLIST is a list (SYMBOL VALUEFORM), which binds SYMBOL -to the value of VALUEFORM. Each VALUEFORM can refer to symbols already -bound by this VARLIST (as for `let*'). - -Evaluate VALUEFORMs until on of them yields nil. If that happens return -nil, and evaluate neither the remaining VALUEFORMs nor BODYFORM. If all -VALUEFORMs yield non-nil, evaluate BODYFORM with the bindings in effect, -and return its value; or if there is no BODYFORM, the value of the last -VALUEFORM." - (declare (indent 1) - (debug ((&rest (symbolp form)) form))) - (pcase-let ((`(,varlist ,lastvar) - (cond-let--prepare-varlist varlist))) - `(let* ,varlist - ,(if bodyform - `(and ,lastvar ,bodyform) - lastvar)))) - -(defmacro cond-let--and-let (varlist &optional bodyform) - "Bind according to VARLIST until one yields nil, else evaluate BODYFORM. - -Each element of VARLIST is a list (SYMBOL VALUEFORM), which binds SYMBOL -to the value of VALUEFORM. Evaluate all VALUEFORMs before binding their -respective SYMBOLs (as for `let'). - -Evaluate VALUEFORMs until on of them yields nil. If that happens return -nil, and evaluate neither the remaining VALUEFORMs nor BODYFORM. If all -VALUEFORMs yield non-nil, evaluate BODYFORM with the bindings in effect, -and return its value; or if there is no BODYFORM, the value of the last -VALUEFORM." - (declare (indent 1) - (debug cond-let--and-let*)) - (pcase-let ((`(,anon ,set ,bind ,lastvar) - (cond-let--prepare-varforms varlist))) - (cond (anon - `(let ,anon - (and ,@set - (let ,bind - ,(or bodyform lastvar))))) - (t - `(let ,bind - ,(if bodyform - `(and ,lastvar ,bodyform) - lastvar)))))) - -;;; Thread - -(defmacro cond-let--and$ (form form2 &rest forms) - "Bind variables according to each FORM until one of them yields nil. - -Evaluate the first FORM and if that yields a non-nil value, bind the -symbol `$' to that value, and evaluate the next FORM with that binding -in effect. Repeat this process with subsequent FORMs until one yields -nil, then return nil without evaluate the remaining FORMs. If all -FORMs yield non-nil, return the value of the last FORM. - -\(fn FORM FORM...)" - (declare (indent 0) - (debug t)) - `(,(if forms 'let* 'let) - (($ ,form) - ,@(and forms - (mapcar (lambda (form) - `($ (and $ ,form))) - (cons form2 (butlast forms))))) - (and $ - ,(or (car (last forms)) - form2)))) - -(defmacro cond-let--thread$ (form form2 &rest forms) - "Bind variable `$' to value of nth FORM before evaluating nth+1 FORM. - -Evaluate the first FORM and bind the symbol `$' to its value. -Then evaluate the next FORM with that binding in effect. Repeat this -process with subsequent FORMs, and return the value of the last FORM. - -\(fn FORM FORM...)" - (declare (indent 0) - (debug t)) - `(,(if forms 'let* 'let) - (($ ,form) - ,@(and forms - (mapcar (lambda (form) - `($ ,form)) - (cons form2 (butlast forms))))) - ,(or (car (last forms)) - form2))) - -;;; If - -(defmacro cond-let--if-let* (varlist then &rest else) - "Bind variables according to VARLIST and evaluate THEN or ELSE. - -Each element of VARLIST is a list (SYMBOL VALUEFORM), which binds SYMBOL -to the value of VALUEFORM. Each VALUEFORM can refer to symbols already -bound by this VARLIST (as for `let*'). - -If all VALUEFORMs yield non-nil, evaluate THEN with VARLIST's bindings -in effect, and return its value. THEN must be one expression. - -If any VALUEFORM yields nil, evaluate ELSE sequentially and return the -value of the last form; or if there are no ELSE forms return nil. The -bindings from VARLIST do _not_ extend to the ELSE forms. - -\(fn VARLIST THEN [ELSE...])" - (declare (indent 2) - (debug ((&rest (symbolp form)) form body))) - (pcase-let ((`(,varlist ,lastvar) - (cond-let--prepare-varlist varlist)) - (tag (gensym ":if-let*"))) - `(catch ',tag - (let* ,varlist - (when ,lastvar - (throw ',tag ,then))) - ,@else))) - -(defmacro cond-let--if-let (varlist then &rest else) - "Bind variables according to VARLIST and evaluate THEN or ELSE. - -Each element of VARLIST is a list (SYMBOL VALUEFORM), which binds SYMBOL -to the value of VALUEFORM. Evaluate all VALUEFORMs before binding their -respective SYMBOLs (as for `let'). - -If all VALUEFORMs yield non-nil, evaluate THEN with VARLIST's bindings -in effect, and return its value. THEN must be one expression. - -If any VALUEFORM yields nil, evaluate ELSE sequentially and return the -value of the last form; or if there are no ELSE forms return nil. The -bindings from VARLIST do _not_ extend to the ELSE forms. - -\(fn VARLIST THEN [ELSE...])" - (declare (indent 2) - (debug cond-let--if-let*)) - (pcase-let* ((`(,anon ,set ,bind ,_) - (cond-let--prepare-varforms varlist t)) - (set (if (length= set 1) (car set) (cons 'and set)))) - `(let ,anon - (if ,set - (let ,bind - ,then) - ,@else)))) - -;;; When - -(defmacro cond-let--when-let* (varlist bodyform &rest body) - "Bind variables according to VARLIST and conditionally evaluate BODY. - -Each element of VARLIST is a list (SYMBOL VALUEFORM), which binds SYMBOL -to the value of VALUEFORM. Each VALUEFORM can refer to symbols already -bound by this VARLIST (as for `let*'). - -If all VALUEFORMs yield non-nil, evaluate BODY forms sequentially, with -VARLIST's bindings in effect, and return the value of the last form. - -If any VALUEFORM yields nil, evaluate neither the remaining VALUEFORMs -nor the BODY forms, and instead return nil. - -BODY must be one or more expressions. If VARLIST is empty, do nothing -and return nil. - -\(fn VARLIST BODY...)" - (declare (indent 1) - (debug ((&rest (symbolp form)) form body))) - (pcase-let ((`(,varlist ,lastvar) - (cond-let--prepare-varlist varlist))) - `(let* ,varlist - (when ,lastvar - ,bodyform ,@body)))) - -(defmacro cond-let--when-let (varlist bodyform &rest body) - "Bind variables according to VARLIST and conditionally evaluate BODY. - -Each element of VARLIST is a list (SYMBOL VALUEFORM), which binds SYMBOL -to the value of VALUEFORM. Evaluate all VALUEFORMs before binding their -respective SYMBOLs (as for `let'). - -If all VALUEFORMs yield non-nil, evaluate BODY forms sequentially, with -VARLIST's bindings in effect, and return the value of the last form. - -If any VALUEFORM yields nil, evaluate neither the remaining VALUEFORMs -nor the BODY forms, and instead return nil. - -BODY must be one or more expressions. If VARLIST is empty, do nothing -and return nil. - -\(fn VARLIST BODY...)" - (declare (indent 1) - (debug cond-let--when-let*)) - (pcase-let ((`(,anon ,set ,bind ,lastvar) - (cond-let--prepare-varforms varlist))) - (cond (anon - `(let ,anon - (when (and ,@set) - (let ,bind - ,bodyform ,@body)))) - (t - `(let ,bind - (when ,lastvar - ,bodyform ,@body)))))) - -(defmacro cond-let--when$ (varform bodyform &rest body) - "Bind variable `$' to value of VARFORM and conditionally evaluate BODY. - -If VARFORM yields a non-nil value, bind the symbol `$' to that value, -evaluate BODY with that binding in effect, and return the value of the -last form. If VARFORM yields nil, do not evaluate BODY, and return nil. -BODY must be one or more expressions. If VARLIST is empty, do nothing -and return nil. - -\(fn VARFORM BODY...)" - (declare (indent 1) - (debug t)) - `(let (($ ,varform)) - (when $ - ,bodyform ,@body))) - -;;; While - -(defmacro cond-let--while-let* (varlist &rest body) - "Bind variables according to VARLIST, conditionally evaluate BODY, and repeat. - -Each element of VARLIST is a list (SYMBOL VALUEFORM), which binds SYMBOL -to the value of VALUEFORM. Each VALUEFORM can refer to symbols already -bound by this VARLIST (as for `let*'). - -If all VALUEFORMs yield non-nil, evaluate BODY forms sequentially, with -VARLIST's bindings in effect, and repeat the loop. - -If any VALUEFORM yields nil, evaluate neither the remaining VALUEFORMs -nor the BODY forms, and instead return, always yielding nil. - -BODY can be zero or more expressions. - -\(fn VARLIST [BODY...])" - (declare (indent 1) - (debug ((&rest (symbolp form)) body))) - (pcase-let ((`(,varlist ,lastvar) - (cond-let--prepare-varlist varlist)) - (tag (gensym ":while-let*"))) - `(catch ',tag - (while t - (let* ,varlist - (if ,lastvar - ,(macroexp-progn body) - (throw ',tag nil))))))) - -(defmacro cond-let--while-let (varlist bodyform &rest body) - "Bind variables according to VARLIST, conditionally evaluate BODY, and repeat. - -Each element of VARLIST is a list (SYMBOL VALUEFORM), which binds SYMBOL -to the value of VALUEFORM. Evaluate all VALUEFORMs before binding their -respective SYMBOLs (as for `let'). - -If all VALUEFORMs yield non-nil, evaluate BODY forms sequentially, with -VARLIST's bindings in effect, and repeat the loop. - -If any VALUEFORM yields nil, evaluate neither the remaining VALUEFORMs -nor the BODY forms, and instead return, always yielding nil. - -BODY can be one or more expressions. - -\(fn VARLIST BODY...)" - (declare (indent 1) - (debug ((&rest (symbolp form)) form body))) - (pcase-let ((`(,anon ,set ,bind ,lastvar) - (cond-let--prepare-varforms varlist)) - (tag (gensym ":while-let"))) - (cond (anon - `(catch ',tag - (while t - (let ,anon - (if (and ,@set) - (let ,bind - ,bodyform ,@body) - (throw ',tag nil)))))) - (t - `(catch ',tag - (while t - (let ,bind - (if ,lastvar - ,(macroexp-progn (cons bodyform body)) - (throw ',tag nil))))))))) - -;;; Font-Lock - -(defvar cond-let-font-lock-keywords - '(("\\_<\\$\\_>" 0 'font-lock-variable-name-face)) - "Highlight `$' using `font-lock-variable-name-face'. -To add these keywords, add this to your configuration: -\(font-lock-add-keywords \\='emacs-lisp-mode cond-let-font-lock-keywords t)") - -;;; Compatibility - -(defalias 'cond-let--and> #'cond-let--and$ - "Instead of this alias, use `cond-let--and$' via `and$' shorthand. - -This alias will likely be declared obsolete in 2027. If you would like -to continue to use it, please get in contact before then. This alias -might eventually be removed altogether; again subject to user feedback. - -If you do not care about the symbol `cond-let--and>', but want to keep -using the respective `and>' shorthand, you can future-proof that now, -by changing the shorthand definition to (\"and>\" . \"cond-let--and$\").") - -(provide 'cond-let) -;;; cond-let.el ends here diff --git a/.config/emacs/lisp/libs/cond-let.elc b/.config/emacs/lisp/libs/cond-let.elc deleted file mode 100644 index bb18a18..0000000 Binary files a/.config/emacs/lisp/libs/cond-let.elc and /dev/null differ diff --git a/.config/emacs/lisp/libs/dash.el b/.config/emacs/lisp/libs/dash.el deleted file mode 100644 index 41d1e53..0000000 --- a/.config/emacs/lisp/libs/dash.el +++ /dev/null @@ -1,4176 +0,0 @@ -;;; dash.el --- A modern list library for Emacs -*- lexical-binding: t -*- - -;; Copyright (C) 2012-2026 Free Software Foundation, Inc. - -;; Author: Magnar Sveen -;; Maintainer: Basil L. Contovounesios -;; Version: 2.20.0 -;; Package-Requires: ((emacs "24")) -;; Keywords: extensions, lisp -;; URL: https://github.com/magnars/dash.el - -;; This program is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; A modern list API for Emacs. -;; -;; Dash is a utility library that affords functional programming -;; patterns inspired by Clojure, particularly in the realm of list -;; manipulation. Examples include higher-order functions (map, reduce, -;; filter) and derivatives (drop, flatten, sum); function combinators -;; (partial application, argument flipping, composition); and threading -;; and anaphoric macros with destructuring support. -;; -;; Dash is particularly useful in providing a broad and consistent API -;; across many Emacs versions. -;; -;; Documentation and examples are in the manual at Info node `(dash) Top' -;; and on the web at https://elpa.gnu.org/packages/doc/dash.html, as well -;; as in the project’s README.md file. - -;;; Code: - -(eval-when-compile - (unless (fboundp 'static-if) - (defmacro static-if (condition then-form &rest else-forms) - "Expand to THEN-FORM or ELSE-FORMS based on compile-time CONDITION. -Polyfill for Emacs 30 `static-if'." - (declare (debug (sexp sexp &rest sexp)) (indent 2)) - (if (eval condition lexical-binding) - then-form - (cons 'progn else-forms)))) - - ;; TODO: Emacs 24.3 first introduced `gv', so remove this and all - ;; calls to `defsetf' when support for earlier versions is dropped. - (unless (fboundp 'gv-define-setter) - (require 'cl)) - - ;; - 24.3 started complaining about unknown `declare' props. - ;; - 25 introduced `pure' and `side-effect-free'. - ;; - 30 introduced `important-return-value'. - (when (boundp 'defun-declarations-alist) - (dolist (prop '(important-return-value pure side-effect-free)) - (unless (assq prop defun-declarations-alist) - (push (list prop #'ignore) defun-declarations-alist))))) - -(defgroup dash () - "Customize group for Dash, a modern list library." - :group 'extensions - :group 'lisp - :prefix "dash-") - -(defmacro !cons (car cdr) - "Destructive: Set CDR to the cons of CAR and CDR." - (declare (debug (form symbolp))) - `(setq ,cdr (cons ,car ,cdr))) - -(defmacro !cdr (list) - "Destructive: Set LIST to the cdr of LIST." - (declare (debug (symbolp))) - `(setq ,list (cdr ,list))) - -(defmacro --each (list &rest body) - "Evaluate BODY for each element of LIST and return nil. -Each element of LIST in turn is bound to `it' and its index -within LIST to `it-index' before evaluating BODY. -This is the anaphoric counterpart to `-each'." - (declare (debug (form body)) (indent 1)) - (let ((l (make-symbol "list")) - (i (make-symbol "i"))) - `(let ((,l ,list) - (,i 0)) - (while ,l - (let ((it (pop ,l)) (it-index ,i)) - (ignore it it-index) - ,@body) - (setq ,i (1+ ,i)))))) - -(defun -each (list fn) - "Call FN on each element of LIST. -Return nil; this function is intended for side effects. - -Its anaphoric counterpart is `--each'. - -For access to the current element's index in LIST, see -`-each-indexed'." - (declare (indent 1)) - (ignore (mapc fn list))) - -(defalias '--each-indexed '--each) - -(defun -each-indexed (list fn) - "Call FN on each index and element of LIST. -For each ITEM at INDEX in LIST, call (funcall FN INDEX ITEM). -Return nil; this function is intended for side effects. - -See also: `-map-indexed'." - (declare (indent 1)) - (--each list (funcall fn it-index it))) - -(defmacro --each-while (list pred &rest body) - "Evaluate BODY for each item in LIST, while PRED evaluates to non-nil. -Each element of LIST in turn is bound to `it' and its index -within LIST to `it-index' before evaluating PRED or BODY. Once -an element is reached for which PRED evaluates to nil, no further -BODY is evaluated. The return value is always nil. -This is the anaphoric counterpart to `-each-while'." - (declare (debug (form form body)) (indent 2)) - (let ((l (make-symbol "list")) - (i (make-symbol "i")) - (elt (make-symbol "elt"))) - `(let ((,l ,list) - (,i 0) - ,elt) - (while (when ,l - (setq ,elt (car-safe ,l)) - (let ((it ,elt) (it-index ,i)) - (ignore it it-index) - ,pred)) - (let ((it ,elt) (it-index ,i)) - (ignore it it-index) - ,@body) - (setq ,i (1+ ,i) ,l (cdr ,l)))))) - -(defun -each-while (list pred fn) - "Call FN on each ITEM in LIST, while (PRED ITEM) is non-nil. -Once an ITEM is reached for which PRED returns nil, FN is no -longer called. Return nil; this function is intended for side -effects. - -Its anaphoric counterpart is `--each-while'." - (declare (indent 2)) - (--each-while list (funcall pred it) (funcall fn it))) - -(defmacro --each-r (list &rest body) - "Evaluate BODY for each element of LIST in reversed order. -Each element of LIST in turn, starting at its end, is bound to -`it' and its index within LIST to `it-index' before evaluating -BODY. The return value is always nil. -This is the anaphoric counterpart to `-each-r'." - (declare (debug (form body)) (indent 1)) - (let ((v (make-symbol "vector")) - (i (make-symbol "i"))) - ;; Implementation note: building a vector is considerably faster - ;; than building a reversed list (vector takes less memory, so - ;; there is less GC), plus `length' comes naturally. In-place - ;; `nreverse' would be faster still, but BODY would be able to see - ;; that, even if the modification was undone before we return. - `(let* ((,v (vconcat ,list)) - (,i (length ,v)) - it it-index) - (ignore it it-index) - (while (> ,i 0) - (setq ,i (1- ,i) it-index ,i it (aref ,v ,i)) - ,@body)))) - -(defun -each-r (list fn) - "Call FN on each element of LIST in reversed order. -Return nil; this function is intended for side effects. - -Its anaphoric counterpart is `--each-r'." - (--each-r list (funcall fn it))) - -(defmacro --each-r-while (list pred &rest body) - "Eval BODY for each item in reversed LIST, while PRED evals to non-nil. -Each element of LIST in turn, starting at its end, is bound to -`it' and its index within LIST to `it-index' before evaluating -PRED or BODY. Once an element is reached for which PRED -evaluates to nil, no further BODY is evaluated. The return value -is always nil. -This is the anaphoric counterpart to `-each-r-while'." - (declare (debug (form form body)) (indent 2)) - (let ((v (make-symbol "vector")) - (i (make-symbol "i")) - (elt (make-symbol "elt"))) - `(let* ((,v (vconcat ,list)) - (,i (length ,v)) - ,elt it it-index) - (ignore it it-index) - (while (when (> ,i 0) - (setq ,i (1- ,i) it-index ,i) - (setq ,elt (aref ,v ,i) it ,elt) - ,pred) - (setq it-index ,i it ,elt) - ,@body)))) - -(defun -each-r-while (list pred fn) - "Call FN on each ITEM in reversed LIST, while (PRED ITEM) is non-nil. -Once an ITEM is reached for which PRED returns nil, FN is no -longer called. Return nil; this function is intended for side -effects. - -Its anaphoric counterpart is `--each-r-while'." - (--each-r-while list (funcall pred it) (funcall fn it))) - -(defmacro --dotimes (num &rest body) - "Evaluate BODY NUM times, presumably for side effects. -BODY is evaluated with the local variable `it' temporarily bound -to successive integers running from 0, inclusive, to NUM, -exclusive. BODY is not evaluated if NUM is less than 1. -This is the anaphoric counterpart to `-dotimes'." - (declare (debug (form body)) (indent 1)) - (let ((n (make-symbol "num")) - (i (make-symbol "i"))) - `(let ((,n ,num) - (,i 0) - it) - (ignore it) - (while (< ,i ,n) - (setq it ,i ,i (1+ ,i)) - ,@body)))) - -(defun -dotimes (num fn) - "Call FN NUM times, presumably for side effects. -FN is called with a single argument on successive integers -running from 0, inclusive, to NUM, exclusive. FN is not called -if NUM is less than 1. - -This function's anaphoric counterpart is `--dotimes'." - (declare (indent 1)) - (--dotimes num (funcall fn it))) - -(defun -map (fn list) - "Apply FN to each item in LIST and return the list of results. - -This function's anaphoric counterpart is `--map'." - (declare (important-return-value t)) - (mapcar fn list)) - -(defmacro --map (form list) - "Eval FORM for each item in LIST and return the list of results. -Each element of LIST in turn is bound to `it' before evaluating -FORM. -This is the anaphoric counterpart to `-map'." - (declare (debug (def-form form))) - `(mapcar (lambda (it) (ignore it) ,form) ,list)) - -(defmacro --reduce-from (form init list) - "Accumulate a value by evaluating FORM across LIST. -This macro is like `--each' (which see), but it additionally -provides an accumulator variable `acc' which it successively -binds to the result of evaluating FORM for the current LIST -element before processing the next element. For the first -element, `acc' is initialized with the result of evaluating INIT. -The return value is the resulting value of `acc'. If LIST is -empty, FORM is not evaluated, and the return value is the result -of INIT. -This is the anaphoric counterpart to `-reduce-from'." - (declare (debug (form form form))) - `(let ((acc ,init)) - (--each ,list (setq acc ,form)) - acc)) - -(defun -reduce-from (fn init list) - "Reduce the function FN across LIST, starting with INIT. -Return the result of applying FN to INIT and the first element of -LIST, then applying FN to that result and the second element, -etc. If LIST is empty, return INIT without calling FN. - -This function's anaphoric counterpart is `--reduce-from'. - -For other folds, see also `-reduce' and `-reduce-r'." - (declare (important-return-value t)) - (--reduce-from (funcall fn acc it) init list)) - -(defmacro --reduce (form list) - "Accumulate a value by evaluating FORM across LIST. -This macro is like `--reduce-from' (which see), except the first -element of LIST is taken as INIT. Thus if LIST contains a single -item, it is returned without evaluating FORM. If LIST is empty, -FORM is evaluated with `it' and `acc' bound to nil. -This is the anaphoric counterpart to `-reduce'." - (declare (debug (form form))) - (let ((lv (make-symbol "list-value"))) - `(let ((,lv ,list)) - (if ,lv - (--reduce-from ,form (car ,lv) (cdr ,lv)) - ;; Explicit nil binding pacifies lexical "variable left uninitialized" - ;; warning. See issue #377 and upstream https://bugs.gnu.org/47080. - (let ((acc nil) (it nil)) - (ignore acc it) - ,form))))) - -(defun -reduce (fn list) - "Reduce the function FN across LIST. -Return the result of applying FN to the first two elements of -LIST, then applying FN to that result and the third element, etc. -If LIST contains a single element, return it without calling FN. -If LIST is empty, return the result of calling FN with no -arguments. - -This function's anaphoric counterpart is `--reduce'. - -For other folds, see also `-reduce-from' and `-reduce-r'." - (declare (important-return-value t)) - (if list - (-reduce-from fn (car list) (cdr list)) - (funcall fn))) - -(defmacro --reduce-r-from (form init list) - "Accumulate a value by evaluating FORM across LIST in reverse. -This macro is like `--reduce-from', except it starts from the end -of LIST. -This is the anaphoric counterpart to `-reduce-r-from'." - (declare (debug (form form form))) - `(let ((acc ,init)) - (--each-r ,list (setq acc ,form)) - acc)) - -(defun -reduce-r-from (fn init list) - "Reduce the function FN across LIST in reverse, starting with INIT. -Return the result of applying FN to the last element of LIST and -INIT, then applying FN to the second-to-last element and the -previous result of FN, etc. That is, the first argument of FN is -the current element, and its second argument the accumulated -value. If LIST is empty, return INIT without calling FN. - -This function is like `-reduce-from' but the operation associates -from the right rather than left. In other words, it starts from -the end of LIST and flips the arguments to FN. Conceptually, it -is like replacing the conses in LIST with applications of FN, and -its last link with INIT, and evaluating the resulting expression. - -This function's anaphoric counterpart is `--reduce-r-from'. - -For other folds, see also `-reduce-r' and `-reduce'." - (declare (important-return-value t)) - (--reduce-r-from (funcall fn it acc) init list)) - -(defmacro --reduce-r (form list) - "Accumulate a value by evaluating FORM across LIST in reverse order. -This macro is like `--reduce', except it starts from the end of -LIST. -This is the anaphoric counterpart to `-reduce-r'." - (declare (debug (form form))) - `(--reduce ,form (reverse ,list))) - -(defun -reduce-r (fn list) - "Reduce the function FN across LIST in reverse. -Return the result of applying FN to the last two elements of -LIST, then applying FN to the third-to-last element and the -previous result of FN, etc. That is, the first argument of FN is -the current element, and its second argument the accumulated -value. If LIST contains a single element, return it without -calling FN. If LIST is empty, return the result of calling FN -with no arguments. - -This function is like `-reduce' but the operation associates from -the right rather than left. In other words, it starts from the -end of LIST and flips the arguments to FN. Conceptually, it is -like replacing the conses in LIST with applications of FN, -ignoring its last link, and evaluating the resulting expression. - -This function's anaphoric counterpart is `--reduce-r'. - -For other folds, see also `-reduce-r-from' and `-reduce'." - (declare (important-return-value t)) - (if list - (--reduce-r (funcall fn it acc) list) - (funcall fn))) - -(defmacro --reductions-from (form init list) - "Return a list of FORM's intermediate reductions across LIST. -That is, a list of the intermediate values of the accumulator -when `--reduce-from' (which see) is called with the same -arguments. -This is the anaphoric counterpart to `-reductions-from'." - (declare (debug (form form form))) - `(nreverse - (--reduce-from (cons (let ((acc (car acc))) (ignore acc) ,form) acc) - (list ,init) - ,list))) - -(defun -reductions-from (fn init list) - "Return a list of FN's intermediate reductions across LIST. -That is, a list of the intermediate values of the accumulator -when `-reduce-from' (which see) is called with the same -arguments. - -This function's anaphoric counterpart is `--reductions-from'. - -For other folds, see also `-reductions' and `-reductions-r'." - (declare (important-return-value t)) - (--reductions-from (funcall fn acc it) init list)) - -(defmacro --reductions (form list) - "Return a list of FORM's intermediate reductions across LIST. -That is, a list of the intermediate values of the accumulator -when `--reduce' (which see) is called with the same arguments. -This is the anaphoric counterpart to `-reductions'." - (declare (debug (form form))) - (let ((lv (make-symbol "list-value"))) - `(let ((,lv ,list)) - (if ,lv - (--reductions-from ,form (car ,lv) (cdr ,lv)) - ;; Explicit nil binding pacifies lexical "variable left uninitialized" - ;; warning. See issue #377 and upstream https://bugs.gnu.org/47080. - (let ((acc nil) (it nil)) - (ignore acc it) - (list ,form)))))) - -(defun -reductions (fn list) - "Return a list of FN's intermediate reductions across LIST. -That is, a list of the intermediate values of the accumulator -when `-reduce' (which see) is called with the same arguments. - -This function's anaphoric counterpart is `--reductions'. - -For other folds, see also `-reductions' and `-reductions-r'." - (declare (important-return-value t)) - (if list - (--reductions-from (funcall fn acc it) (car list) (cdr list)) - (list (funcall fn)))) - -(defmacro --reductions-r-from (form init list) - "Return a list of FORM's intermediate reductions across reversed LIST. -That is, a list of the intermediate values of the accumulator -when `--reduce-r-from' (which see) is called with the same -arguments. -This is the anaphoric counterpart to `-reductions-r-from'." - (declare (debug (form form form))) - `(--reduce-r-from (cons (let ((acc (car acc))) (ignore acc) ,form) acc) - (list ,init) - ,list)) - -(defun -reductions-r-from (fn init list) - "Return a list of FN's intermediate reductions across reversed LIST. -That is, a list of the intermediate values of the accumulator -when `-reduce-r-from' (which see) is called with the same -arguments. - -This function's anaphoric counterpart is `--reductions-r-from'. - -For other folds, see also `-reductions' and `-reductions-r'." - (declare (important-return-value t)) - (--reductions-r-from (funcall fn it acc) init list)) - -(defmacro --reductions-r (form list) - "Return a list of FORM's intermediate reductions across reversed LIST. -That is, a list of the intermediate values of the accumulator -when `--reduce-re' (which see) is called with the same arguments. -This is the anaphoric counterpart to `-reductions-r'." - (declare (debug (form list))) - (let ((lv (make-symbol "list-value"))) - `(let ((,lv (reverse ,list))) - (if ,lv - (--reduce-from (cons (let ((acc (car acc))) (ignore acc) ,form) acc) - (list (car ,lv)) - (cdr ,lv)) - ;; Explicit nil binding pacifies lexical "variable left uninitialized" - ;; warning. See issue #377 and upstream https://bugs.gnu.org/47080. - (let ((acc nil) (it nil)) - (ignore acc it) - (list ,form)))))) - -(defun -reductions-r (fn list) - "Return a list of FN's intermediate reductions across reversed LIST. -That is, a list of the intermediate values of the accumulator -when `-reduce-r' (which see) is called with the same arguments. - -This function's anaphoric counterpart is `--reductions-r'. - -For other folds, see also `-reductions-r-from' and -`-reductions'." - (declare (important-return-value t)) - (if list - (--reductions-r (funcall fn it acc) list) - (list (funcall fn)))) - -(defmacro --filter (form list) - "Return a new list of the items in LIST for which FORM evals to non-nil. -Each element of LIST in turn is bound to `it' and its index -within LIST to `it-index' before evaluating FORM. -This is the anaphoric counterpart to `-filter'. -For the opposite operation, see also `--remove'." - (declare (debug (form form))) - (let ((r (make-symbol "result"))) - `(let (,r) - (--each ,list (when ,form (push it ,r))) - (nreverse ,r)))) - -(defun -filter (pred list) - "Return a new list of the items in LIST for which PRED returns non-nil. - -Alias: `-select'. - -This function's anaphoric counterpart is `--filter'. - -For similar operations, see also `-keep' and `-remove'." - (declare (important-return-value t)) - (--filter (funcall pred it) list)) - -(defalias '-select '-filter) -(defalias '--select '--filter) - -(defmacro --remove (form list) - "Return a new list of the items in LIST for which FORM evals to nil. -Each element of LIST in turn is bound to `it' and its index -within LIST to `it-index' before evaluating FORM. -This is the anaphoric counterpart to `-remove'. -For the opposite operation, see also `--filter'." - (declare (debug (form form))) - `(--filter (not ,form) ,list)) - -(defun -remove (pred list) - "Return a new list of the items in LIST for which PRED returns nil. - -Alias: `-reject'. - -This function's anaphoric counterpart is `--remove'. - -For similar operations, see also `-keep' and `-filter'." - (declare (important-return-value t)) - (--remove (funcall pred it) list)) - -(defalias '-reject '-remove) -(defalias '--reject '--remove) - -(defmacro --remove-first (form list) - "Remove the first item from LIST for which FORM evals to non-nil. -Each element of LIST in turn is bound to `it' and its index -within LIST to `it-index' before evaluating FORM. This is a -non-destructive operation, but only the front of LIST leading up -to the removed item is a copy; the rest is LIST's original tail. -If no item is removed, then the result is a complete copy. -This is the anaphoric counterpart to `-remove-first'." - (declare (debug (form form))) - (let ((front (make-symbol "front")) - (tail (make-symbol "tail"))) - `(let ((,tail ,list) ,front) - (--each-while ,tail (not ,form) - (push (pop ,tail) ,front)) - (if ,tail - (nconc (nreverse ,front) (cdr ,tail)) - (nreverse ,front))))) - -(defun -remove-first (pred list) - "Remove the first item from LIST for which PRED returns non-nil. -This is a non-destructive operation, but only the front of LIST -leading up to the removed item is a copy; the rest is LIST's -original tail. If no item is removed, then the result is a -complete copy. - -Alias: `-reject-first'. - -This function's anaphoric counterpart is `--remove-first'. - -See also `-map-first', `-remove-item', and `-remove-last'." - (declare (important-return-value t)) - (--remove-first (funcall pred it) list)) - -;; TODO: #'-quoting the macro upsets Emacs 24. -(defalias '-reject-first #'-remove-first) -(defalias '--reject-first '--remove-first) - -(defmacro --remove-last (form list) - "Remove the last item from LIST for which FORM evals to non-nil. -Each element of LIST in turn is bound to `it' before evaluating -FORM. The result is a copy of LIST regardless of whether an -element is removed. -This is the anaphoric counterpart to `-remove-last'." - (declare (debug (form form))) - `(nreverse (--remove-first ,form (reverse ,list)))) - -(defun -remove-last (pred list) - "Remove the last item from LIST for which PRED returns non-nil. -The result is a copy of LIST regardless of whether an element is -removed. - -Alias: `-reject-last'. - -This function's anaphoric counterpart is `--remove-last'. - -See also `-map-last', `-remove-item', and `-remove-first'." - (declare (important-return-value t)) - (--remove-last (funcall pred it) list)) - -(defalias '-reject-last '-remove-last) -(defalias '--reject-last '--remove-last) - -(defalias '-remove-item #'remove - "Return a copy of LIST with all occurrences of ITEM removed. -The comparison is done with `equal'. -\n(fn ITEM LIST)") - -(defmacro --keep (form list) - "Eval FORM for each item in LIST and return the non-nil results. -Like `--filter', but returns the non-nil results of FORM instead -of the corresponding elements of LIST. Each element of LIST in -turn is bound to `it' and its index within LIST to `it-index' -before evaluating FORM. -This is the anaphoric counterpart to `-keep'." - (declare (debug (form form))) - (let ((r (make-symbol "result")) - (m (make-symbol "mapped"))) - `(let (,r) - (--each ,list (let ((,m ,form)) (when ,m (push ,m ,r)))) - (nreverse ,r)))) - -(defun -keep (fn list) - "Return a new list of the non-nil results of applying FN to each item in LIST. -Like `-filter', but returns the non-nil results of FN instead of -the corresponding elements of LIST. - -Its anaphoric counterpart is `--keep'." - (declare (important-return-value t)) - (--keep (funcall fn it) list)) - -(defun -non-nil (list) - "Return a copy of LIST with all nil items removed." - (declare (side-effect-free t)) - (--filter it list)) - -(defmacro --map-indexed (form list) - "Eval FORM for each item in LIST and return the list of results. -Each element of LIST in turn is bound to `it' and its index -within LIST to `it-index' before evaluating FORM. This is like -`--map', but additionally makes `it-index' available to FORM. - -This is the anaphoric counterpart to `-map-indexed'." - (declare (debug (form form))) - (let ((r (make-symbol "result"))) - `(let (,r) - (--each ,list - (push ,form ,r)) - (nreverse ,r)))) - -(defun -map-indexed (fn list) - "Apply FN to each index and item in LIST and return the list of results. -This is like `-map', but FN takes two arguments: the index of the -current element within LIST, and the element itself. - -This function's anaphoric counterpart is `--map-indexed'. - -For a side-effecting variant, see also `-each-indexed'." - (declare (important-return-value t)) - (--map-indexed (funcall fn it-index it) list)) - -(defmacro --map-when (pred rep list) - "Anaphoric form of `-map-when'." - (declare (debug (form form form))) - (let ((r (make-symbol "result"))) - `(let (,r) - (--each ,list (!cons (if ,pred ,rep it) ,r)) - (nreverse ,r)))) - -(defun -map-when (pred rep list) - "Use PRED to conditionally apply REP to each item in LIST. -Return a copy of LIST where the items for which PRED returns nil -are unchanged, and the rest are mapped through the REP function. - -Alias: `-replace-where' - -See also: `-update-at'" - (declare (important-return-value t)) - (--map-when (funcall pred it) (funcall rep it) list)) - -(defalias '-replace-where '-map-when) -(defalias '--replace-where '--map-when) - -(defun -map-first (pred rep list) - "Use PRED to determine the first item in LIST to call REP on. -Return a copy of LIST where the first item for which PRED returns -non-nil is replaced with the result of calling REP on that item. - -See also: `-map-when', `-replace-first'" - (declare (important-return-value t)) - (let (front) - (while (and list (not (funcall pred (car list)))) - (push (car list) front) - (!cdr list)) - (if list - (-concat (nreverse front) (cons (funcall rep (car list)) (cdr list))) - (nreverse front)))) - -(defmacro --map-first (pred rep list) - "Anaphoric form of `-map-first'." - (declare (debug (def-form def-form form))) - `(-map-first (lambda (it) (ignore it) ,pred) - (lambda (it) (ignore it) ,rep) - ,list)) - -(defun -map-last (pred rep list) - "Use PRED to determine the last item in LIST to call REP on. -Return a copy of LIST where the last item for which PRED returns -non-nil is replaced with the result of calling REP on that item. - -See also: `-map-when', `-replace-last'" - (declare (important-return-value t)) - (nreverse (-map-first pred rep (reverse list)))) - -(defmacro --map-last (pred rep list) - "Anaphoric form of `-map-last'." - (declare (debug (def-form def-form form))) - `(-map-last (lambda (it) (ignore it) ,pred) - (lambda (it) (ignore it) ,rep) - ,list)) - -(defun -replace (old new list) - "Replace all OLD items in LIST with NEW. - -Elements are compared using `equal'. - -See also: `-replace-at'" - (declare (pure t) (side-effect-free t)) - (--map-when (equal it old) new list)) - -(defun -replace-first (old new list) - "Replace the first occurrence of OLD with NEW in LIST. - -Elements are compared using `equal'. - -See also: `-map-first'" - (declare (pure t) (side-effect-free t)) - (--map-first (equal old it) new list)) - -(defun -replace-last (old new list) - "Replace the last occurrence of OLD with NEW in LIST. - -Elements are compared using `equal'. - -See also: `-map-last'" - (declare (pure t) (side-effect-free t)) - (--map-last (equal old it) new list)) - -(defmacro --mapcat (form list) - "Anaphoric form of `-mapcat'." - (declare (debug (form form))) - `(apply #'append (--map ,form ,list))) - -(defun -mapcat (fn list) - "Return the concatenation of the result of mapping FN over LIST. -Thus function FN should return a list." - (declare (important-return-value t)) - (--mapcat (funcall fn it) list)) - -(defmacro --iterate (form init n) - "Anaphoric version of `-iterate'." - (declare (debug (form form form))) - (let ((res (make-symbol "result")) - (len (make-symbol "n"))) - `(let ((,len ,n)) - (when (> ,len 0) - (let* ((it ,init) - (,res (list it))) - (dotimes (_ (1- ,len)) - (push (setq it ,form) ,res)) - (nreverse ,res)))))) - -(defun -iterate (fun init n) - "Return a list of iterated applications of FUN to INIT. - -This means a list of the form: - - (INIT (FUN INIT) (FUN (FUN INIT)) ...) - -N is the length of the returned list." - (declare (important-return-value t)) - (--iterate (funcall fun it) init n)) - -(defun -flatten (l) - "Take a nested list L and return its contents as a single, flat list. - -Note that because nil represents a list of zero elements (an -empty list), any mention of nil in L will disappear after -flattening. If you need to preserve nils, consider `-flatten-n' -or map them to some unique symbol and then map them back. - -Conses of two atoms are considered \"terminals\", that is, they -aren't flattened further. - -See also: `-flatten-n'" - (declare (pure t) (side-effect-free t)) - (if (and (listp l) (listp (cdr l))) - (-mapcat '-flatten l) - (list l))) - -(defun -flatten-n (num list) - "Flatten NUM levels of a nested LIST. - -See also: `-flatten'" - (declare (pure t) (side-effect-free t)) - (dotimes (_ num) - (setq list (apply #'append (mapcar #'-list list)))) - list) - -(defalias '-concat #'append - "Concatenate all SEQUENCES and make the result a list. -The result is a list whose elements are the elements of all the arguments. -Each argument may be a list, vector or string. - -All arguments except the last argument are copied. The last argument -is just used as the tail of the new list. If the last argument is not -a list, this results in a dotted list. - -As an exception, if all the arguments except the last are nil, and the -last argument is not a list, the return value is that last argument -unaltered, not a list. - -\(fn &rest SEQUENCES)") - -(defalias '-copy #'copy-sequence - "Create a shallow copy of LIST. -The elements of LIST are not copied; they are shared with the original. -\n(fn LIST)") - -(defmacro --splice (pred form list) - "Splice lists generated by FORM in place of items satisfying PRED in LIST. - -Evaluate PRED for each element of LIST in turn bound to `it'. -Whenever the result of PRED is nil, leave that `it' is-is. -Otherwise, evaluate FORM with the same `it' binding still in -place. The result should be a (possibly empty) list of items to -splice in place of `it' in LIST. - -This can be useful as an alternative to the `,@' construct in a -`\\=`' structure, in case you need to splice several lists at -marked positions (for example with keywords). - -This is the anaphoric counterpart to `-splice'." - (declare (debug (form form form))) - (let ((r (make-symbol "result"))) - `(let (,r) - (--each ,list - (if ,pred - (--each ,form (push it ,r)) - (push it ,r))) - (nreverse ,r)))) - -(defun -splice (pred fun list) - "Splice lists generated by FUN in place of items satisfying PRED in LIST. - -Call PRED on each element of LIST. Whenever the result of PRED -is nil, leave that `it' as-is. Otherwise, call FUN on the same -`it' that satisfied PRED. The result should be a (possibly -empty) list of items to splice in place of `it' in LIST. - -This can be useful as an alternative to the `,@' construct in a -`\\=`' structure, in case you need to splice several lists at -marked positions (for example with keywords). - -This function's anaphoric counterpart is `--splice'. - -See also: `-splice-list', `-insert-at'." - (declare (important-return-value t)) - (--splice (funcall pred it) (funcall fun it) list)) - -(defun -splice-list (pred new-list list) - "Splice NEW-LIST in place of elements matching PRED in LIST. - -See also: `-splice', `-insert-at'" - (declare (important-return-value t)) - (-splice pred (lambda (_) new-list) list)) - -(defmacro --splice-list (pred new-list list) - "Anaphoric form of `-splice-list'." - (declare (debug (def-form form form))) - `(-splice-list (lambda (it) (ignore it) ,pred) ,new-list ,list)) - -(defun -cons* (&rest args) - "Make a new list from the elements of ARGS. -The last 2 elements of ARGS are used as the final cons of the -result, so if the final element of ARGS is not a list, the result -is a dotted list. With no ARGS, return nil." - (declare (side-effect-free t)) - (let* ((len (length args)) - (tail (nthcdr (- len 2) args)) - (last (cdr tail))) - (if (null last) - (car args) - (setcdr tail (car last)) - args))) - -(defun -snoc (list elem &rest elements) - "Append ELEM to the end of the list. - -This is like `cons', but operates on the end of list. - -If any ELEMENTS are given, append them to the list as well." - (declare (side-effect-free t)) - (-concat list (list elem) elements)) - -(defmacro --first (form list) - "Return the first item in LIST for which FORM evals to non-nil. -Return nil if no such element is found. -Each element of LIST in turn is bound to `it' and its index -within LIST to `it-index' before evaluating FORM. -This is the anaphoric counterpart to `-first'." - (declare (debug (form form))) - (let ((n (make-symbol "needle"))) - `(let (,n) - (--each-while ,list (or (not ,form) - (ignore (setq ,n it)))) - ,n))) - -(defun -first (pred list) - "Return the first item in LIST for which PRED returns non-nil. -Return nil if no such element is found. - -To get the first item in the list no questions asked, -use `-first-item'. - -Alias: `-find'. - -This function's anaphoric counterpart is `--first'." - (declare (important-return-value t)) - (--first (funcall pred it) list)) - -(defalias '-find #'-first) -(defalias '--find '--first) - -(defmacro --some (form list) - "Return non-nil if FORM evals to non-nil for at least one item in LIST. -If so, return the first such result of FORM. -Each element of LIST in turn is bound to `it' and its index -within LIST to `it-index' before evaluating FORM. -This is the anaphoric counterpart to `-some'." - (declare (debug (form form))) - (let ((n (make-symbol "needle"))) - `(let (,n) - (--each-while ,list (not (setq ,n ,form))) - ,n))) - -(defun -some (pred list) - "Return (PRED x) for the first LIST item where (PRED x) is non-nil, else nil. - -Alias: `-any'. - -This function's anaphoric counterpart is `--some'." - (declare (important-return-value t)) - (--some (funcall pred it) list)) - -(defalias '-any '-some) -(defalias '--any '--some) - -(defmacro --every (form list) - "Return non-nil if FORM evals to non-nil for all items in LIST. -If so, return the last such result of FORM. Otherwise, once an -item is reached for which FORM yields nil, return nil without -evaluating FORM for any further LIST elements. -Each element of LIST in turn is bound to `it' and its index -within LIST to `it-index' before evaluating FORM. - -This macro is like `--every-p', but on success returns the last -non-nil result of FORM instead of just t. - -This is the anaphoric counterpart to `-every'." - (declare (debug (form form))) - (let ((a (make-symbol "all"))) - `(let ((,a t)) - (--each-while ,list (setq ,a ,form)) - ,a))) - -(defun -every (pred list) - "Return non-nil if PRED returns non-nil for all items in LIST. -If so, return the last such result of PRED. Otherwise, once an -item is reached for which PRED returns nil, return nil without -calling PRED on any further LIST elements. - -This function is like `-every-p', but on success returns the last -non-nil result of PRED instead of just t. - -This function's anaphoric counterpart is `--every'." - (declare (important-return-value t)) - (--every (funcall pred it) list)) - -(defmacro --last (form list) - "Anaphoric form of `-last'." - (declare (debug (form form))) - (let ((n (make-symbol "needle"))) - `(let (,n) - (--each ,list - (when ,form (setq ,n it))) - ,n))) - -(defun -last (pred list) - "Return the last x in LIST where (PRED x) is non-nil, else nil." - (declare (important-return-value t)) - (--last (funcall pred it) list)) - -(defalias '-first-item #'car - "Return the first item of LIST, or nil on an empty list. - -See also: `-second-item', `-last-item', etc. - -\(fn LIST)") - -;; Ensure that calls to `-first-item' are compiled to a single opcode, -;; just like `car'. -(put '-first-item 'byte-opcode 'byte-car) -(put '-first-item 'byte-compile 'byte-compile-one-arg) -(put '-first-item 'pure t) -(put '-first-item 'side-effect-free t) - -(defalias '-second-item #'cadr - "Return the second item of LIST, or nil if LIST is too short. - -See also: `-first-item', `-third-item', etc. - -\(fn LIST)") - -(put '-second-item 'pure t) -(put '-second-item 'side-effect-free t) - -(defalias '-third-item - (if (fboundp 'caddr) - #'caddr - (lambda (list) (car (cddr list)))) - "Return the third item of LIST, or nil if LIST is too short. - -See also: `-second-item', `-fourth-item', etc. - -\(fn LIST)") - -(put '-third-item 'pure t) -(put '-third-item 'side-effect-free t) - -(defalias '-fourth-item - (if (fboundp 'cadddr) - #'cadddr - (lambda (list) (cadr (cddr list)))) - "Return the fourth item of LIST, or nil if LIST is too short. - -See also: `-third-item', `-fifth-item', etc. - -\(fn LIST)") - -(put '-fourth-item 'pure t) -(put '-fourth-item 'side-effect-free t) - -(defun -fifth-item (list) - "Return the fifth item of LIST, or nil if LIST is too short. - -See also: `-fourth-item', `-last-item', etc." - (declare (pure t) (side-effect-free t)) - (car (cddr (cddr list)))) - -(defun -last-item (list) - "Return the last item of LIST, or nil on an empty list. - -See also: `-first-item', etc." - (declare (pure t) (side-effect-free t)) - (car (last list))) - -(static-if (fboundp 'gv-define-setter) - (gv-define-setter -last-item (val x) `(setcar (last ,x) ,val)) - (defsetf -last-item (x) (val) `(setcar (last ,x) ,val))) - -(defun -butlast (list) - "Return a list of all items in list except for the last." - ;; no alias as we don't want magic optional argument - (declare (pure t) (side-effect-free t)) - (butlast list)) - -(defmacro --count (pred list) - "Anaphoric form of `-count'." - (declare (debug (form form))) - (let ((r (make-symbol "result"))) - `(let ((,r 0)) - (--each ,list (when ,pred (setq ,r (1+ ,r)))) - ,r))) - -(defun -count (pred list) - "Counts the number of items in LIST where (PRED item) is non-nil." - (declare (important-return-value t)) - (--count (funcall pred it) list)) - -(defun ---truthy? (obj) - "Return OBJ as a boolean value (t or nil)." - (declare (pure t) (side-effect-free error-free)) - (and obj t)) - -(defmacro --any? (form list) - "Anaphoric form of `-any?'." - (declare (debug (form form))) - `(and (--some ,form ,list) t)) - -(defun -any? (pred list) - "Return t if (PRED X) is non-nil for any X in LIST, else nil. - -Alias: `-any-p', `-some?', `-some-p'" - (declare (important-return-value t)) - (--any? (funcall pred it) list)) - -(defalias '-some? '-any?) -(defalias '--some? '--any?) -(defalias '-any-p '-any?) -(defalias '--any-p '--any?) -(defalias '-some-p '-any?) -(defalias '--some-p '--any?) - -(defmacro --all? (form list) - "Return t if FORM evals to non-nil for all items in LIST. -Otherwise, once an item is reached for which FORM yields nil, -return nil without evaluating FORM for any further LIST elements. -Each element of LIST in turn is bound to `it' and its index -within LIST to `it-index' before evaluating FORM. - -The similar macro `--every' is more widely useful, since it -returns the last non-nil result of FORM instead of just t on -success. - -Alias: `--all-p', `--every-p', `--every?'. - -This is the anaphoric counterpart to `-all?'." - (declare (debug (form form))) - `(and (--every ,form ,list) t)) - -(defun -all? (pred list) - "Return t if (PRED X) is non-nil for all X in LIST, else nil. -In the latter case, stop after the first X for which (PRED X) is -nil, without calling PRED on any subsequent elements of LIST. - -The similar function `-every' is more widely useful, since it -returns the last non-nil result of PRED instead of just t on -success. - -Alias: `-all-p', `-every-p', `-every?'. - -This function's anaphoric counterpart is `--all?'." - (declare (important-return-value t)) - (--all? (funcall pred it) list)) - -(defalias '-every? '-all?) -(defalias '--every? '--all?) -(defalias '-all-p '-all?) -(defalias '--all-p '--all?) -(defalias '-every-p '-all?) -(defalias '--every-p '--all?) - -(defmacro --none? (form list) - "Anaphoric form of `-none?'." - (declare (debug (form form))) - `(--all? (not ,form) ,list)) - -(defun -none? (pred list) - "Return t if (PRED X) is nil for all X in LIST, else nil. - -Alias: `-none-p'" - (declare (important-return-value t)) - (--none? (funcall pred it) list)) - -(defalias '-none-p '-none?) -(defalias '--none-p '--none?) - -(defmacro --only-some? (form list) - "Anaphoric form of `-only-some?'." - (declare (debug (form form))) - (let ((y (make-symbol "yes")) - (n (make-symbol "no"))) - `(let (,y ,n) - (--each-while ,list (not (and ,y ,n)) - (if ,form (setq ,y t) (setq ,n t))) - (---truthy? (and ,y ,n))))) - -(defun -only-some? (pred list) - "Return t if different LIST items both satisfy and do not satisfy PRED. -That is, if PRED returns both nil for at least one item, and -non-nil for at least one other item in LIST. Return nil if all -items satisfy the predicate or none of them do. - -Alias: `-only-some-p'" - (declare (important-return-value t)) - (--only-some? (funcall pred it) list)) - -(defalias '-only-some-p '-only-some?) -(defalias '--only-some-p '--only-some?) - -(defun -slice (list from &optional to step) - "Return copy of LIST, starting from index FROM to index TO. - -FROM or TO may be negative. These values are then interpreted -modulo the length of the list. - -If STEP is a number, only each STEPth item in the resulting -section is returned. Defaults to 1." - (declare (side-effect-free t)) - (let ((length (length list)) - (new-list nil)) - ;; to defaults to the end of the list - (setq to (or to length)) - (setq step (or step 1)) - ;; handle negative indices - (when (< from 0) - (setq from (mod from length))) - (when (< to 0) - (setq to (mod to length))) - - ;; iterate through the list, keeping the elements we want - (--each-while list (< it-index to) - (when (and (>= it-index from) - (= (mod (- from it-index) step) 0)) - (push it new-list))) - (nreverse new-list))) - -(defmacro --take-while (form list) - "Take successive items from LIST for which FORM evals to non-nil. -Each element of LIST in turn is bound to `it' and its index -within LIST to `it-index' before evaluating FORM. Return a new -list of the successive elements from the start of LIST for which -FORM evaluates to non-nil. -This is the anaphoric counterpart to `-take-while'." - (declare (debug (form form))) - (let ((r (make-symbol "result"))) - `(let (,r) - (--each-while ,list ,form (push it ,r)) - (nreverse ,r)))) - -(defun -take-while (pred list) - "Take successive items from LIST for which PRED returns non-nil. -PRED is a function of one argument. Return a new list of the -successive elements from the start of LIST for which PRED returns -non-nil. - -This function's anaphoric counterpart is `--take-while'. - -For another variant, see also `-drop-while'." - (declare (important-return-value t)) - (--take-while (funcall pred it) list)) - -(defmacro --drop-while (form list) - "Drop successive items from LIST for which FORM evals to non-nil. -Each element of LIST in turn is bound to `it' and its index -within LIST to `it-index' before evaluating FORM. Return the -tail (not a copy) of LIST starting from its first element for -which FORM evaluates to nil. -This is the anaphoric counterpart to `-drop-while'." - (declare (debug (form form))) - (let ((l (make-symbol "list"))) - `(let ((,l ,list)) - (--each-while ,l ,form (pop ,l)) - ,l))) - -(defun -drop-while (pred list) - "Drop successive items from LIST for which PRED returns non-nil. -PRED is a function of one argument. Return the tail (not a copy) -of LIST starting from its first element for which PRED returns -nil. - -This function's anaphoric counterpart is `--drop-while'. - -For another variant, see also `-take-while'." - (declare (important-return-value t)) - (--drop-while (funcall pred it) list)) - -;; Added in Emacs 29. -(static-if (fboundp 'take) - (defun dash--take (n list) - "Return the first N elements of LIST. -Like `take', but ensure result is fresh." - (let ((prefix (take n list))) - (if (eq prefix list) - ;; If same list is returned, make a copy. - (copy-sequence prefix) - prefix)))) - -(defun -take (n list) - "Return a copy of the first N items in LIST. -Return a copy of LIST if it contains N items or fewer. -Return nil if N is zero or less. - -See also: `-take-last'." - (declare (side-effect-free t)) - (static-if (fboundp 'dash--take) - (dash--take n list) - (--take-while (< it-index n) list))) - -(defun -take-last (n list) - "Return a copy of the last N items of LIST in order. -Return a copy of LIST if it contains N items or fewer. -Return nil if N is zero or less. - -See also: `-take'." - (declare (side-effect-free t)) - (copy-sequence (last list n))) - -(defalias '-drop #'nthcdr - "Return the tail (not a copy) of LIST without the first N items. -Return nil if LIST contains N items or fewer. -Return LIST if N is zero or less. - -For another variant, see also `-drop-last'. -\n(fn N LIST)") - -(defun -drop-last (n list) - "Return a copy of LIST without its last N items. -Return a copy of LIST if N is zero or less. -Return nil if LIST contains N items or fewer. - -See also: `-drop'." - (declare (side-effect-free t)) - (static-if (fboundp 'dash--take) - (dash--take (- (length list) n) list) - (nbutlast (copy-sequence list) n))) - -(defun -split-at (n list) - "Split LIST into two sublists after the Nth element. -The result is a list of two elements (TAKE DROP) where TAKE is a -new list of the first N elements of LIST, and DROP is the -remaining elements of LIST (not a copy). TAKE and DROP are like -the results of `-take' and `-drop', respectively, but the split -is done in a single list traversal." - (declare (side-effect-free t)) - (let (result) - (--each-while list (< it-index n) - (push (pop list) result)) - (list (nreverse result) list))) - -(defun -rotate (n list) - "Rotate LIST N places to the right (left if N is negative). -The time complexity is O(n)." - (declare (pure t) (side-effect-free t)) - (cond ((null list) ()) - ((zerop n) (copy-sequence list)) - ((let* ((len (length list)) - (n-mod-len (mod n len)) - (new-tail-len (- len n-mod-len))) - (append (nthcdr new-tail-len list) (-take new-tail-len list)))))) - -(defun -insert-at (n x list) - "Return a list with X inserted into LIST at position N. - -See also: `-splice', `-splice-list'" - (declare (pure t) (side-effect-free t)) - (let ((split-list (-split-at n list))) - (nconc (car split-list) (cons x (cadr split-list))))) - -(defun -replace-at (n x list) - "Return a list with element at Nth position in LIST replaced with X. - -See also: `-replace'" - (declare (pure t) (side-effect-free t)) - (let ((split-list (-split-at n list))) - (nconc (car split-list) (cons x (cdr (cadr split-list)))))) - -(defun -update-at (n func list) - "Use FUNC to update the Nth element of LIST. -Return a copy of LIST where the Nth element is replaced with the -result of calling FUNC on it. - -See also: `-map-when'" - (declare (important-return-value t)) - (let ((split-list (-split-at n list))) - (nconc (car split-list) - (cons (funcall func (car (cadr split-list))) - (cdr (cadr split-list)))))) - -(defmacro --update-at (n form list) - "Anaphoric version of `-update-at'." - (declare (debug (form def-form form))) - `(-update-at ,n (lambda (it) (ignore it) ,form) ,list)) - -(defun -remove-at (n list) - "Return LIST with its element at index N removed. -That is, remove any element selected as (nth N LIST) from LIST -and return the result. - -This is a non-destructive operation: parts of LIST (but not -necessarily all of it) are copied as needed to avoid -destructively modifying it. - -See also: `-remove-at-indices', `-remove'." - (declare (pure t) (side-effect-free t)) - (if (zerop n) - (cdr list) - (--remove-first (= it-index n) list))) - -(defun -remove-at-indices (indices list) - "Return LIST with its elements at INDICES removed. -That is, for each index I in INDICES, remove any element selected -as (nth I LIST) from LIST. - -This is a non-destructive operation: parts of LIST (but not -necessarily all of it) are copied as needed to avoid -destructively modifying it. - -See also: `-remove-at', `-remove'." - (declare (pure t) (side-effect-free t)) - (setq indices (--drop-while (< it 0) (-sort #'< indices))) - (let ((i (pop indices)) res) - (--each-while list i - (pop list) - (if (/= it-index i) - (push it res) - (while (and indices (= (car indices) i)) - (pop indices)) - (setq i (pop indices)))) - (nconc (nreverse res) list))) - -(defmacro --split-with (pred list) - "Anaphoric form of `-split-with'." - (declare (debug (form form))) - (let ((l (make-symbol "list")) - (r (make-symbol "result")) - (c (make-symbol "continue"))) - `(let ((,l ,list) - (,r nil) - (,c t)) - (while (and ,l ,c) - (let ((it (car ,l))) - (if (not ,pred) - (setq ,c nil) - (!cons it ,r) - (!cdr ,l)))) - (list (nreverse ,r) ,l)))) - -(defun -split-with (pred list) - "Split LIST into a prefix satisfying PRED, and the rest. -The first sublist is the prefix of LIST with successive elements -satisfying PRED, and the second sublist is the remaining elements -that do not. The result is like performing - - ((-take-while PRED LIST) (-drop-while PRED LIST)) - -but in no more than a single pass through LIST." - (declare (important-return-value t)) - (--split-with (funcall pred it) list)) - -(defmacro -split-on (item list) - "Split the LIST each time ITEM is found. - -Unlike `-partition-by', the ITEM is discarded from the results. -Empty lists are also removed from the result. - -Comparison is done by `equal'. - -See also `-split-when'" - (declare (debug (def-form form))) - `(-split-when (lambda (it) (equal it ,item)) ,list)) - -(defmacro --split-when (form list) - "Anaphoric version of `-split-when'." - (declare (debug (def-form form))) - `(-split-when (lambda (it) (ignore it) ,form) ,list)) - -(defun -split-when (fn list) - "Split the LIST on each element where FN returns non-nil. - -Unlike `-partition-by', the \"matched\" element is discarded from -the results. Empty lists are also removed from the result. - -This function can be thought of as a generalization of -`split-string'." - (declare (important-return-value t)) - (let (r s) - (while list - (if (not (funcall fn (car list))) - (push (car list) s) - (when s (push (nreverse s) r)) - (setq s nil)) - (!cdr list)) - (when s (push (nreverse s) r)) - (nreverse r))) - -(defmacro --separate (form list) - "Anaphoric form of `-separate'." - (declare (debug (form form))) - (let ((y (make-symbol "yes")) - (n (make-symbol "no"))) - `(let (,y ,n) - (--each ,list (if ,form (!cons it ,y) (!cons it ,n))) - (list (nreverse ,y) (nreverse ,n))))) - -(defun -separate (pred list) - "Split LIST into two sublists based on whether items satisfy PRED. -The result is like performing - - ((-filter PRED LIST) (-remove PRED LIST)) - -but in a single pass through LIST." - (declare (important-return-value t)) - (--separate (funcall pred it) list)) - -(defun dash--partition-all-in-steps-reversed (n step list) - "Like `-partition-all-in-steps', but the result is reversed." - (when (< step 1) - (signal 'wrong-type-argument - `("Step size < 1 results in juicy infinite loops" ,step))) - (let (result) - (while list - (push (-take n list) result) - (setq list (nthcdr step list))) - result)) - -(defun -partition-all-in-steps (n step list) - "Partition LIST into sublists of length N that are STEP items apart. -Adjacent groups may overlap if N exceeds the STEP stride. -Trailing groups may contain less than N items." - (declare (pure t) (side-effect-free t)) - (nreverse (dash--partition-all-in-steps-reversed n step list))) - -(defun -partition-in-steps (n step list) - "Partition LIST into sublists of length N that are STEP items apart. -Like `-partition-all-in-steps', but if there are not enough items -to make the last group N-sized, those items are discarded." - (declare (pure t) (side-effect-free t)) - (let ((result (dash--partition-all-in-steps-reversed n step list))) - (while (and result (< (length (car result)) n)) - (pop result)) - (nreverse result))) - -(defun -partition-all (n list) - "Return a new list with the items in LIST grouped into N-sized sublists. -The last group may contain less than N items." - (declare (pure t) (side-effect-free t)) - (-partition-all-in-steps n n list)) - -(defun -partition (n list) - "Return a new list with the items in LIST grouped into N-sized sublists. -If there are not enough items to make the last group N-sized, -those items are discarded." - (declare (pure t) (side-effect-free t)) - (-partition-in-steps n n list)) - -(defmacro --partition-by (form list) - "Anaphoric form of `-partition-by'." - (declare (debug (form form))) - (let ((r (make-symbol "result")) - (s (make-symbol "sublist")) - (v (make-symbol "value")) - (n (make-symbol "new-value")) - (l (make-symbol "list"))) - `(let ((,l ,list)) - (when ,l - (let* ((,r nil) - (it (car ,l)) - (,s (list it)) - (,v ,form) - (,l (cdr ,l))) - (while ,l - (let* ((it (car ,l)) - (,n ,form)) - (unless (equal ,v ,n) - (!cons (nreverse ,s) ,r) - (setq ,s nil) - (setq ,v ,n)) - (!cons it ,s) - (!cdr ,l))) - (!cons (nreverse ,s) ,r) - (nreverse ,r)))))) - -(defun -partition-by (fn list) - "Apply FN to each item in LIST, splitting it each time FN returns a new value." - (declare (important-return-value t)) - (--partition-by (funcall fn it) list)) - -(defmacro --partition-by-header (form list) - "Anaphoric form of `-partition-by-header'." - (declare (debug (form form))) - (let ((r (make-symbol "result")) - (s (make-symbol "sublist")) - (h (make-symbol "header-value")) - (b (make-symbol "seen-body?")) - (n (make-symbol "new-value")) - (l (make-symbol "list"))) - `(let ((,l ,list)) - (when ,l - (let* ((,r nil) - (it (car ,l)) - (,s (list it)) - (,h ,form) - (,b nil) - (,l (cdr ,l))) - (while ,l - (let* ((it (car ,l)) - (,n ,form)) - (if (equal ,h ,n) - (when ,b - (!cons (nreverse ,s) ,r) - (setq ,s nil) - (setq ,b nil)) - (setq ,b t)) - (!cons it ,s) - (!cdr ,l))) - (!cons (nreverse ,s) ,r) - (nreverse ,r)))))) - -(defun -partition-by-header (fn list) - "Apply FN to the first item in LIST. That is the header -value. Apply FN to each item in LIST, splitting it each time FN -returns the header value, but only after seeing at least one -other value (the body)." - (declare (important-return-value t)) - (--partition-by-header (funcall fn it) list)) - -(defmacro --partition-after-pred (form list) - "Partition LIST after each element for which FORM evaluates to non-nil. -Each element of LIST in turn is bound to `it' before evaluating -FORM. - -This is the anaphoric counterpart to `-partition-after-pred'." - (let ((l (make-symbol "list")) - (r (make-symbol "result")) - (s (make-symbol "sublist"))) - `(let ((,l ,list) ,r ,s) - (when ,l - (--each ,l - (push it ,s) - (when ,form - (push (nreverse ,s) ,r) - (setq ,s ()))) - (when ,s - (push (nreverse ,s) ,r)) - (nreverse ,r))))) - -(defun -partition-after-pred (pred list) - "Partition LIST after each element for which PRED returns non-nil. - -This function's anaphoric counterpart is `--partition-after-pred'." - (declare (important-return-value t)) - (--partition-after-pred (funcall pred it) list)) - -(defun -partition-before-pred (pred list) - "Partition directly before each time PRED is true on an element of LIST." - (declare (important-return-value t)) - (nreverse (-map #'reverse - (-partition-after-pred pred (reverse list))))) - -(defun -partition-after-item (item list) - "Partition directly after each time ITEM appears in LIST." - (declare (pure t) (side-effect-free t)) - (-partition-after-pred (lambda (ele) (equal ele item)) - list)) - -(defun -partition-before-item (item list) - "Partition directly before each time ITEM appears in LIST." - (declare (pure t) (side-effect-free t)) - (-partition-before-pred (lambda (ele) (equal ele item)) - list)) - -(defmacro --group-by (form list) - "Anaphoric form of `-group-by'." - (declare (debug t)) - (let ((n (make-symbol "n")) - (k (make-symbol "k")) - (grp (make-symbol "grp"))) - `(nreverse - (-map - (lambda (,n) - (cons (car ,n) - (nreverse (cdr ,n)))) - (--reduce-from - (let* ((,k (,@form)) - (,grp (assoc ,k acc))) - (if ,grp - (setcdr ,grp (cons it (cdr ,grp))) - (push - (list ,k it) - acc)) - acc) - nil ,list))))) - -(defun -group-by (fn list) - "Separate LIST into an alist whose keys are FN applied to the -elements of LIST. Keys are compared by `equal'." - (declare (important-return-value t)) - (--group-by (funcall fn it) list)) - -(defun -interpose (sep list) - "Return a new list of all elements in LIST separated by SEP." - (declare (side-effect-free t)) - (let (result) - (when list - (!cons (car list) result) - (!cdr list)) - (while list - (setq result (cons (car list) (cons sep result))) - (!cdr list)) - (nreverse result))) - -(defun -interleave (&rest lists) - "Return a new list of the first item in each list, then the second etc." - (declare (side-effect-free t)) - (when lists - (let (result) - (while (-none? 'null lists) - (--each lists (!cons (car it) result)) - (setq lists (-map 'cdr lists))) - (nreverse result)))) - -(defmacro --zip-with (form list1 list2) - "Zip LIST1 and LIST2 into a new list according to FORM. -That is, evaluate FORM for each item pair from the two lists, and -return the list of results. The result is as long as the shorter -list. - -Each element of LIST1 and each element of LIST2 in turn are bound -pairwise to `it' and `other', respectively, and their index -within the list to `it-index', before evaluating FORM. - -This is the anaphoric counterpart to `-zip-with'." - (declare (debug (form form form))) - (let ((r (make-symbol "result")) - (l2 (make-symbol "list2"))) - `(let ((,l2 ,list2) ,r) - (--each-while ,list1 ,l2 - (let ((other (pop ,l2))) - (ignore other) - (push ,form ,r))) - (nreverse ,r)))) - -(defun -zip-with (fn list1 list2) - "Zip LIST1 and LIST2 into a new list using the function FN. -That is, apply FN pairwise taking as first argument the next -element of LIST1 and as second argument the next element of LIST2 -at the corresponding position. The result is as long as the -shorter list. - -This function's anaphoric counterpart is `--zip-with'. - -For other zips, see also `-zip-lists' and `-zip-fill'." - (declare (important-return-value t)) - (--zip-with (funcall fn it other) list1 list2)) - -(defun -zip-lists (&rest lists) - "Zip LISTS together. - -Group the head of each list, followed by the second element of -each list, and so on. The number of returned groupings is equal -to the length of the shortest input list, and the length of each -grouping is equal to the number of input LISTS. - -The return value is always a list of proper lists, in contrast to -`-zip' which returns a list of dotted pairs when only two input -LISTS are provided. - -See also: `-zip-pair'." - (declare (pure t) (side-effect-free t)) - (when lists - (let (results) - (while (--every it lists) - (push (mapcar #'car lists) results) - (setq lists (mapcar #'cdr lists))) - (nreverse results)))) - -(defun -zip-lists-fill (fill-value &rest lists) - "Zip LISTS together, padding shorter lists with FILL-VALUE. -This is like `-zip-lists' (which see), except it retains all -elements at positions beyond the end of the shortest list. The -number of returned groupings is equal to the length of the -longest input list, and the length of each grouping is equal to -the number of input LISTS." - (declare (pure t) (side-effect-free t)) - (when lists - (let (results) - (while (--some it lists) - (push (--map (if it (car it) fill-value) lists) results) - (setq lists (mapcar #'cdr lists))) - (nreverse results)))) - -(defun -unzip-lists (lists) - "Unzip LISTS. - -This works just like `-zip-lists' (which see), but takes a list -of lists instead of a variable number of arguments, such that - - (-unzip-lists (-zip-lists ARGS...)) - -is identity (given that the lists comprising ARGS are of the same -length)." - (declare (pure t) (side-effect-free t)) - (apply #'-zip-lists lists)) - -(defalias 'dash--length= - (if (fboundp 'length=) - #'length= - (lambda (list length) - (cond ((< length 0) nil) - ((zerop length) (null list)) - ((let ((last (nthcdr (1- length) list))) - (and last (null (cdr last)))))))) - "Return non-nil if LIST is of LENGTH. -This is a compatibility shim for `length=' in Emacs 28. -\n(fn LIST LENGTH)") - -(defun dash--zip-lists-or-pair (_form &rest lists) - "Return a form equivalent to applying `-zip' to LISTS. -This `compiler-macro' warns about discouraged `-zip' usage and -delegates to `-zip-lists' or `-zip-pair' depending on the number -of LISTS." - (if (not (dash--length= lists 2)) - (cons #'-zip-lists lists) - (let ((pair (cons #'-zip-pair lists)) - (msg "Use -zip-pair instead of -zip to get a list of pairs")) - (if (fboundp 'macroexp-warn-and-return) - (macroexp-warn-and-return msg pair) - (message msg) - pair)))) - -(defun -zip (&rest lists) - "Zip LISTS together. - -Group the head of each list, followed by the second element of -each list, and so on. The number of returned groupings is equal -to the length of the shortest input list, and the number of items -in each grouping is equal to the number of input LISTS. - -If only two LISTS are provided as arguments, return the groupings -as a list of dotted pairs. Otherwise, return the groupings as a -list of proper lists. - -Since the return value changes form depending on the number of -arguments, it is generally recommended to use `-zip-lists' -instead, or `-zip-pair' if a list of dotted pairs is desired. - -See also: `-unzip'." - (declare (compiler-macro dash--zip-lists-or-pair) - (pure t) (side-effect-free t)) - ;; For backward compatibility, return a list of dotted pairs if two - ;; arguments were provided. - (apply (if (dash--length= lists 2) #'-zip-pair #'-zip-lists) lists)) - -(defun -zip-pair (&rest lists) - "Zip LIST1 and LIST2 together. - -Make a pair with the head of each list, followed by a pair with -the second element of each list, and so on. The number of pairs -returned is equal to the length of the shorter input list. - -See also: `-zip-lists'." - (declare (advertised-calling-convention (list1 list2) "2.20.0") - (pure t) (side-effect-free t)) - (if (dash--length= lists 2) - (--zip-with (cons it other) (car lists) (cadr lists)) - (apply #'-zip-lists lists))) - -(defun -zip-fill (fill-value &rest lists) - "Zip LISTS together, padding shorter lists with FILL-VALUE. -This is like `-zip' (which see), except it retains all elements -at positions beyond the end of the shortest list. The number of -returned groupings is equal to the length of the longest input -list, and the length of each grouping is equal to the number of -input LISTS. - -Since the return value changes form depending on the number of -arguments, it is generally recommended to use `-zip-lists-fill' -instead, unless a list of dotted pairs is explicitly desired." - (declare (pure t) (side-effect-free t)) - (cond ((null lists) ()) - ((dash--length= lists 2) - (let ((list1 (car lists)) - (list2 (cadr lists)) - results) - (while (or list1 list2) - (push (cons (if list1 (pop list1) fill-value) - (if list2 (pop list2) fill-value)) - results)) - (nreverse results))) - ((apply #'-zip-lists-fill fill-value lists)))) - -(defun -unzip (lists) - "Unzip LISTS. - -This works just like `-zip' (which see), but takes a list of -lists instead of a variable number of arguments, such that - - (-unzip (-zip L1 L2 L3 ...)) - -is identity (given that the lists are of the same length, and -that `-zip' is not called with two arguments, because of the -caveat described in its docstring). - -Note in particular that calling `-unzip' on a list of two lists -will return a list of dotted pairs. - -Since the return value changes form depending on the number of -LISTS, it is generally recommended to use `-unzip-lists' instead." - (declare (pure t) (side-effect-free t)) - (apply #'-zip lists)) - -(defun -cycle (list) - "Return an infinite circular copy of LIST. -The returned list cycles through the elements of LIST and repeats -from the beginning." - (declare (side-effect-free t)) - ;; Also works with sequences that aren't lists. - (let ((newlist (append list ()))) - (nconc newlist newlist))) - -(defun -pad (fill-value &rest lists) - "Pad each of LISTS with FILL-VALUE until they all have equal lengths. - -Ensure all LISTS are as long as the longest one by repeatedly -appending FILL-VALUE to the shorter lists, and return the -resulting LISTS." - (declare (pure t) (side-effect-free t)) - (let* ((lens (mapcar #'length lists)) - (maxlen (apply #'max 0 lens))) - (--map (append it (make-list (- maxlen (pop lens)) fill-value)) lists))) - -(defmacro --annotate (form list) - "Pair each item in LIST with the result of evaluating FORM. - -Return an alist of (RESULT . ITEM), where each ITEM is the -corresponding element of LIST, and RESULT is the value obtained -by evaluating FORM with ITEM bound to `it'. - -This is the anaphoric counterpart to `-annotate'." - (declare (debug (form form))) - `(--map (cons ,form it) ,list)) - -(defun -annotate (fn list) - "Pair each item in LIST with the result of passing it to FN. - -Return an alist of (RESULT . ITEM), where each ITEM is the -corresponding element of LIST, and RESULT is the value obtained -by calling FN on ITEM. - -This function's anaphoric counterpart is `--annotate'." - (declare (important-return-value t)) - (--annotate (funcall fn it) list)) - -(defun dash--table-carry (lists restore-lists &optional re) - "Helper for `-table' and `-table-flat'. - -If a list overflows, carry to the right and reset the list." - (while (not (or (car lists) - (equal lists '(nil)))) - (setcar lists (car restore-lists)) - (pop (cadr lists)) - (!cdr lists) - (!cdr restore-lists) - (when re - (push (nreverse (car re)) (cadr re)) - (setcar re nil) - (!cdr re)))) - -(defun -table (fn &rest lists) - "Compute outer product of LISTS using function FN. - -The function FN should have the same arity as the number of -supplied lists. - -The outer product is computed by applying fn to all possible -combinations created by taking one element from each list in -order. The dimension of the result is (length lists). - -See also: `-table-flat'" - (declare (important-return-value t)) - (let ((restore-lists (copy-sequence lists)) - (last-list (last lists)) - (re (make-list (length lists) nil))) - (while (car last-list) - (let ((item (apply fn (-map 'car lists)))) - (push item (car re)) - (setcar lists (cdar lists)) ;; silence byte compiler - (dash--table-carry lists restore-lists re))) - (nreverse (car (last re))))) - -(defun -table-flat (fn &rest lists) - "Compute flat outer product of LISTS using function FN. - -The function FN should have the same arity as the number of -supplied lists. - -The outer product is computed by applying fn to all possible -combinations created by taking one element from each list in -order. The results are flattened, ignoring the tensor structure -of the result. This is equivalent to calling: - - (-flatten-n (1- (length lists)) (apply \\='-table fn lists)) - -but the implementation here is much more efficient. - -See also: `-flatten-n', `-table'" - (declare (important-return-value t)) - (let ((restore-lists (copy-sequence lists)) - (last-list (last lists)) - re) - (while (car last-list) - (let ((item (apply fn (-map 'car lists)))) - (push item re) - (setcar lists (cdar lists)) ;; silence byte compiler - (dash--table-carry lists restore-lists))) - (nreverse re))) - -(defmacro --find-index (form list) - "Return the first index in LIST for which FORM evals to non-nil. -Return nil if no such index is found. -Each element of LIST in turn is bound to `it' and its index -within LIST to `it-index' before evaluating FORM. -This is the anaphoric counterpart to `-find-index'." - (declare (debug (form form))) - `(--some (and ,form it-index) ,list)) - -(defun -find-index (pred list) - "Return the index of the first item satisfying PRED in LIST. -Return nil if no such item is found. - -PRED is called with one argument, the current list element, until -it returns non-nil, at which point the search terminates. - -This function's anaphoric counterpart is `--find-index'. - -See also: `-first', `-find-last-index'." - (declare (important-return-value t)) - (--find-index (funcall pred it) list)) - -(defun -elem-index (elem list) - "Return the first index of ELEM in LIST. -That is, the index within LIST of the first element that is -`equal' to ELEM. Return nil if there is no such element. - -See also: `-find-index'." - (declare (pure t) (side-effect-free t)) - (--find-index (equal elem it) list)) - -(defmacro --find-indices (form list) - "Return the list of indices in LIST for which FORM evals to non-nil. -Each element of LIST in turn is bound to `it' and its index -within LIST to `it-index' before evaluating FORM. -This is the anaphoric counterpart to `-find-indices'." - (declare (debug (form form))) - `(--keep (and ,form it-index) ,list)) - -(defun -find-indices (pred list) - "Return the list of indices in LIST satisfying PRED. - -Each element of LIST in turn is passed to PRED. If the result is -non-nil, the index of that element in LIST is included in the -result. The returned indices are in ascending order, i.e., in -the same order as they appear in LIST. - -This function's anaphoric counterpart is `--find-indices'. - -See also: `-find-index', `-elem-indices'." - (declare (important-return-value t)) - (--find-indices (funcall pred it) list)) - -(defun -elem-indices (elem list) - "Return the list of indices at which ELEM appears in LIST. -That is, the indices of all elements of LIST `equal' to ELEM, in -the same ascending order as they appear in LIST." - (declare (pure t) (side-effect-free t)) - (--find-indices (equal elem it) list)) - -(defmacro --find-last-index (form list) - "Return the last index in LIST for which FORM evals to non-nil. -Return nil if no such index is found. -Each element of LIST in turn is bound to `it' and its index -within LIST to `it-index' before evaluating FORM. -This is the anaphoric counterpart to `-find-last-index'." - (declare (debug (form form))) - (let ((i (make-symbol "index"))) - `(let (,i) - (--each ,list - (when ,form (setq ,i it-index))) - ,i))) - -(defun -find-last-index (pred list) - "Return the index of the last item satisfying PRED in LIST. -Return nil if no such item is found. - -Predicate PRED is called with one argument each time, namely the -current list element. - -This function's anaphoric counterpart is `--find-last-index'. - -See also: `-last', `-find-index'." - (declare (important-return-value t)) - (--find-last-index (funcall pred it) list)) - -(defun -select-by-indices (indices list) - "Return a list whose elements are elements from LIST selected -as `(nth i list)` for all i from INDICES." - (declare (pure t) (side-effect-free t)) - (let (r) - (--each indices - (!cons (nth it list) r)) - (nreverse r))) - -(defun -select-columns (columns table) - "Select COLUMNS from TABLE. - -TABLE is a list of lists where each element represents one row. -It is assumed each row has the same length. - -Each row is transformed such that only the specified COLUMNS are -selected. - -See also: `-select-column', `-select-by-indices'" - (declare (pure t) (side-effect-free t)) - (--map (-select-by-indices columns it) table)) - -(defun -select-column (column table) - "Select COLUMN from TABLE. - -TABLE is a list of lists where each element represents one row. -It is assumed each row has the same length. - -The single selected column is returned as a list. - -See also: `-select-columns', `-select-by-indices'" - (declare (pure t) (side-effect-free t)) - (--mapcat (-select-by-indices (list column) it) table)) - -(defmacro -> (x &optional form &rest more) - "Thread the expr through the forms. Insert X as the second item -in the first form, making a list of it if it is not a list -already. If there are more forms, insert the first form as the -second item in second form, etc." - (declare (debug (form &rest [&or symbolp (sexp &rest form)]))) - (cond - ((null form) x) - ((null more) (if (listp form) - `(,(car form) ,x ,@(cdr form)) - (list form x))) - (:else `(-> (-> ,x ,form) ,@more)))) - -(defmacro ->> (x &optional form &rest more) - "Thread the expr through the forms. Insert X as the last item -in the first form, making a list of it if it is not a list -already. If there are more forms, insert the first form as the -last item in second form, etc." - (declare (debug ->)) - (cond - ((null form) x) - ((null more) (if (listp form) - `(,@form ,x) - (list form x))) - (:else `(->> (->> ,x ,form) ,@more)))) - -(defmacro --> (x &rest forms) - "Starting with the value of X, thread each expression through FORMS. - -Insert X at the position signified by the symbol `it' in the first -form. If there are more forms, insert the first form at the position -signified by `it' in the second form, etc." - (declare (debug (form body))) - `(-as-> ,x it ,@forms)) - -(defmacro -as-> (value variable &rest forms) - "Starting with VALUE, thread VARIABLE through FORMS. - -In the first form, bind VARIABLE to VALUE. In the second form, bind -VARIABLE to the result of the first form, and so forth." - (declare (debug (form symbolp body))) - (if (null forms) - `,value - `(let ((,variable ,value)) - (-as-> ,(if (symbolp (car forms)) - (list (car forms) variable) - (car forms)) - ,variable - ,@(cdr forms))))) - -(defmacro -some-> (x &optional form &rest more) - "When expr is non-nil, thread it through the first form (via `->'), -and when that result is non-nil, through the next form, etc." - (declare (debug ->) - (indent 1)) - (if (null form) x - (let ((result (make-symbol "result"))) - `(-some-> (-when-let (,result ,x) - (-> ,result ,form)) - ,@more)))) - -(defmacro -some->> (x &optional form &rest more) - "When expr is non-nil, thread it through the first form (via `->>'), -and when that result is non-nil, through the next form, etc." - (declare (debug ->) - (indent 1)) - (if (null form) x - (let ((result (make-symbol "result"))) - `(-some->> (-when-let (,result ,x) - (->> ,result ,form)) - ,@more)))) - -(defmacro -some--> (expr &rest forms) - "Thread EXPR through FORMS via `-->', while the result is non-nil. -When EXPR evaluates to non-nil, thread the result through the -first of FORMS, and when that result is non-nil, thread it -through the next form, etc." - (declare (debug (form &rest &or symbolp consp)) (indent 1)) - (if (null forms) expr - (let ((result (make-symbol "result"))) - `(-some--> (-when-let (,result ,expr) - (--> ,result ,(car forms))) - ,@(cdr forms))))) - -(defmacro -doto (init &rest forms) - "Evaluate INIT and pass it as argument to FORMS with `->'. -The RESULT of evaluating INIT is threaded through each of FORMS -individually using `->', which see. The return value is RESULT, -which FORMS may have modified by side effect." - (declare (debug (form &rest &or symbolp consp)) (indent 1)) - (let ((retval (make-symbol "result"))) - `(let ((,retval ,init)) - ,@(mapcar (lambda (form) `(-> ,retval ,form)) forms) - ,retval))) - -(defmacro --doto (init &rest forms) - "Anaphoric form of `-doto'. -This just evaluates INIT, binds the result to `it', evaluates -FORMS, and returns the final value of `it'. -Note: `it' need not be used in each form." - (declare (debug (form body)) (indent 1)) - `(let ((it ,init)) - ,@forms - it)) - -(defun -grade-up (comparator list) - "Grade elements of LIST using COMPARATOR relation. -This yields a permutation vector such that applying this -permutation to LIST sorts it in ascending order." - (declare (important-return-value t)) - (->> (--map-indexed (cons it it-index) list) - (-sort (lambda (it other) (funcall comparator (car it) (car other)))) - (mapcar #'cdr))) - -(defun -grade-down (comparator list) - "Grade elements of LIST using COMPARATOR relation. -This yields a permutation vector such that applying this -permutation to LIST sorts it in descending order." - (declare (important-return-value t)) - (->> (--map-indexed (cons it it-index) list) - (-sort (lambda (it other) (funcall comparator (car other) (car it)))) - (mapcar #'cdr))) - -(defvar dash--source-counter 0 - "Monotonic counter for generated symbols.") - -(defun dash--match-make-source-symbol () - "Generate a new dash-source symbol. - -All returned symbols are guaranteed to be unique." - (prog1 (make-symbol (format "--dash-source-%d--" dash--source-counter)) - (setq dash--source-counter (1+ dash--source-counter)))) - -(defun dash--match-ignore-place-p (symbol) - "Return non-nil if SYMBOL is a symbol and starts with _." - (and (symbolp symbol) - (eq (aref (symbol-name symbol) 0) ?_))) - -(defun dash--match-cons-skip-cdr (skip-cdr source) - "Helper function generating idiomatic shifting code." - (cond - ((= skip-cdr 0) - `(pop ,source)) - (t - `(prog1 ,(dash--match-cons-get-car skip-cdr source) - (setq ,source ,(dash--match-cons-get-cdr (1+ skip-cdr) source)))))) - -(defun dash--match-cons-get-car (skip-cdr source) - "Helper function generating idiomatic code to get nth car." - (cond - ((= skip-cdr 0) - `(car ,source)) - ((= skip-cdr 1) - `(cadr ,source)) - (t - `(nth ,skip-cdr ,source)))) - -(defun dash--match-cons-get-cdr (skip-cdr source) - "Helper function generating idiomatic code to get nth cdr." - (cond - ((= skip-cdr 0) - source) - ((= skip-cdr 1) - `(cdr ,source)) - (t - `(nthcdr ,skip-cdr ,source)))) - -(defun dash--match-cons (match-form source) - "Setup a cons matching environment and call the real matcher." - (let ((s (dash--match-make-source-symbol)) - (n 0) - (m match-form)) - (while (and (consp m) - (dash--match-ignore-place-p (car m))) - (setq n (1+ n)) (!cdr m)) - (cond - ;; when we only have one pattern in the list, we don't have to - ;; create a temporary binding (--dash-source--) for the source - ;; and just use the input directly - ((and (consp m) - (not (cdr m))) - (dash--match (car m) (dash--match-cons-get-car n source))) - ;; handle other special types - ((> n 0) - (dash--match m (dash--match-cons-get-cdr n source))) - ;; this is the only entry-point for dash--match-cons-1, that's - ;; why we can't simply use the above branch, it would produce - ;; infinite recursion - (t - (cons (list s source) (dash--match-cons-1 match-form s)))))) - -(defun dash--get-expand-function (type) - "Get expand function name for TYPE." - (intern-soft (format "dash-expand:%s" type))) - -(defun dash--match-cons-1 (match-form source &optional props) - "Match MATCH-FORM against SOURCE. - -MATCH-FORM is a proper or improper list. Each element of -MATCH-FORM is either a symbol, which gets bound to the respective -value in source or another match form which gets destructured -recursively. - -If the cdr of last cons cell in the list is nil, matching stops -there. - -SOURCE is a proper or improper list." - (let ((skip-cdr (or (plist-get props :skip-cdr) 0))) - (cond - ((consp match-form) - (cond - ((cdr match-form) - (cond - ((and (symbolp (car match-form)) - (functionp (dash--get-expand-function (car match-form)))) - (dash--match-kv (dash--match-kv-normalize-match-form match-form) (dash--match-cons-get-cdr skip-cdr source))) - ((dash--match-ignore-place-p (car match-form)) - (dash--match-cons-1 (cdr match-form) source - (plist-put props :skip-cdr (1+ skip-cdr)))) - (t - (-concat (dash--match (car match-form) (dash--match-cons-skip-cdr skip-cdr source)) - (dash--match-cons-1 (cdr match-form) source))))) - (t ;; Last matching place, no need for shift - (dash--match (car match-form) (dash--match-cons-get-car skip-cdr source))))) - ((eq match-form nil) - nil) - (t ;; Handle improper lists. Last matching place, no need for shift - (dash--match match-form (dash--match-cons-get-cdr skip-cdr source)))))) - -(defun dash--match-vector (match-form source) - "Setup a vector matching environment and call the real matcher." - (let ((s (dash--match-make-source-symbol))) - (cond - ;; don't bind `s' if we only have one sub-pattern - ((= (length match-form) 1) - (dash--match (aref match-form 0) `(aref ,source 0))) - ;; if the source is a symbol, we don't need to re-bind it - ((symbolp source) - (dash--match-vector-1 match-form source)) - ;; don't bind `s' if we only have one sub-pattern which is not ignored - ((let* ((ignored-places (mapcar 'dash--match-ignore-place-p match-form)) - (ignored-places-n (length (-remove 'null ignored-places)))) - (when (= ignored-places-n (1- (length match-form))) - (let ((n (-find-index 'null ignored-places))) - (dash--match (aref match-form n) `(aref ,source ,n)))))) - (t - (cons (list s source) (dash--match-vector-1 match-form s)))))) - -(defun dash--match-vector-1 (match-form source) - "Match MATCH-FORM against SOURCE. - -MATCH-FORM is a vector. Each element of MATCH-FORM is either a -symbol, which gets bound to the respective value in source or -another match form which gets destructured recursively. - -If second-from-last place in MATCH-FORM is the symbol &rest, the -next element of the MATCH-FORM is matched against the tail of -SOURCE, starting at index of the &rest symbol. This is -conceptually the same as the (head . tail) match for improper -lists, where dot plays the role of &rest. - -SOURCE is a vector. - -If the MATCH-FORM vector is shorter than SOURCE vector, only -the (length MATCH-FORM) places are bound, the rest of the SOURCE -is discarded." - (let ((i 0) - (l (length match-form)) - (re)) - (while (< i l) - (let ((m (aref match-form i))) - (push (cond - ((and (symbolp m) - (eq m '&rest)) - (prog1 (dash--match - (aref match-form (1+ i)) - `(substring ,source ,i)) - (setq i l))) - ((and (symbolp m) - ;; do not match symbols starting with _ - (not (eq (aref (symbol-name m) 0) ?_))) - (list (list m `(aref ,source ,i)))) - ((not (symbolp m)) - (dash--match m `(aref ,source ,i)))) - re) - (setq i (1+ i)))) - (-flatten-n 1 (nreverse re)))) - -(defun dash--match-kv-normalize-match-form (pattern) - "Normalize kv PATTERN. - -This method normalizes PATTERN to the format expected by -`dash--match-kv'. See `-let' for the specification." - (let ((normalized (list (car pattern))) - (skip nil) - (fill-placeholder (make-symbol "--dash-fill-placeholder--"))) - (-each (-zip-fill fill-placeholder (cdr pattern) (cddr pattern)) - (lambda (pair) - (let ((current (car pair)) - (next (cdr pair))) - (if skip - (setq skip nil) - (if (or (eq fill-placeholder next) - (not (or (and (symbolp next) - (not (keywordp next)) - (not (eq next t)) - (not (eq next nil))) - (and (consp next) - (not (eq (car next) 'quote))) - (vectorp next)))) - (progn - (cond - ((keywordp current) - (push current normalized) - (push (intern (substring (symbol-name current) 1)) normalized)) - ((stringp current) - (push current normalized) - (push (intern current) normalized)) - ((and (consp current) - (eq (car current) 'quote)) - (push current normalized) - (push (cadr current) normalized)) - (t (error "-let: found key `%s' in kv destructuring but its pattern `%s' is invalid and can not be derived from the key" current next))) - (setq skip nil)) - (push current normalized) - (push next normalized) - (setq skip t)))))) - (nreverse normalized))) - -(defun dash--match-kv (match-form source) - "Setup a kv matching environment and call the real matcher. - -kv can be any key-value store, such as plist, alist or hash-table." - (let ((s (dash--match-make-source-symbol))) - (cond - ;; don't bind `s' if we only have one sub-pattern (&type key val) - ((= (length match-form) 3) - (dash--match-kv-1 (cdr match-form) source (car match-form))) - ;; if the source is a symbol, we don't need to re-bind it - ((symbolp source) - (dash--match-kv-1 (cdr match-form) source (car match-form))) - (t - (cons (list s source) (dash--match-kv-1 (cdr match-form) s (car match-form))))))) - -(defun dash-expand:&hash (key source) - "Generate extracting KEY from SOURCE for &hash destructuring." - `(gethash ,key ,source)) - -(defun dash-expand:&plist (key source) - "Generate extracting KEY from SOURCE for &plist destructuring." - `(plist-get ,source ,key)) - -(defun dash-expand:&alist (key source) - "Generate extracting KEY from SOURCE for &alist destructuring." - `(cdr (assoc ,key ,source))) - -(defun dash-expand:&hash? (key source) - "Generate extracting KEY from SOURCE for &hash? destructuring. -Similar to &hash but check whether the map is not nil." - (let ((src (make-symbol "src"))) - `(let ((,src ,source)) - (when ,src (gethash ,key ,src))))) - -(defalias 'dash-expand:&keys #'dash-expand:&plist) - -(defun dash--match-kv-1 (match-form source type) - "Match MATCH-FORM against SOURCE of type TYPE. - -MATCH-FORM is a proper list of the form (key1 place1 ... keyN -placeN). Each placeK is either a symbol, which gets bound to the -value of keyK retrieved from the key-value store, or another -match form which gets destructured recursively. - -SOURCE is a key-value store of type TYPE, which can be a plist, -an alist or a hash table. - -TYPE is a token specifying the type of the key-value store. -Valid values are &plist, &alist and &hash." - (-flatten-n 1 (-map - (lambda (kv) - (let* ((k (car kv)) - (v (cadr kv)) - (getter - (funcall (dash--get-expand-function type) k source))) - (cond - ((symbolp v) - (list (list v getter))) - (t (dash--match v getter))))) - (-partition 2 match-form)))) - -(defun dash--match-symbol (match-form source) - "Bind a symbol. - -This works just like `let', there is no destructuring." - (list (list match-form source))) - -(defun dash--match (match-form source) - "Match MATCH-FORM against SOURCE. - -This function tests the MATCH-FORM and dispatches to specific -matchers based on the type of the expression. - -Key-value stores are disambiguated by placing a token &plist, -&alist or &hash as a first item in the MATCH-FORM." - (cond - ((and (symbolp match-form) - ;; Don't bind things like &keys as if they were vars (#395). - (not (functionp (dash--get-expand-function match-form)))) - (dash--match-symbol match-form source)) - ((consp match-form) - (cond - ;; Handle the "x &as" bindings first. - ((and (consp (cdr match-form)) - (symbolp (car match-form)) - (eq '&as (cadr match-form))) - (let ((s (car match-form))) - (cons (list s source) - (dash--match (cddr match-form) s)))) - ((functionp (dash--get-expand-function (car match-form))) - (dash--match-kv (dash--match-kv-normalize-match-form match-form) source)) - (t (dash--match-cons match-form source)))) - ((vectorp match-form) - ;; We support the &as binding in vectors too - (cond - ((and (> (length match-form) 2) - (symbolp (aref match-form 0)) - (eq '&as (aref match-form 1))) - (let ((s (aref match-form 0))) - (cons (list s source) - (dash--match (substring match-form 2) s)))) - (t (dash--match-vector match-form source)))))) - -(defun dash--normalize-let-varlist (varlist) - "Normalize VARLIST so that every binding is a list. - -`let' allows specifying a binding which is not a list but simply -the place which is then automatically bound to nil, such that all -three of the following are identical and evaluate to nil. - - (let (a) a) - (let ((a)) a) - (let ((a nil)) a) - -This function normalizes all of these to the last form." - (--map (if (consp it) it (list it nil)) varlist)) - -(defmacro -let* (varlist &rest body) - "Bind variables according to VARLIST then eval BODY. - -VARLIST is a list of lists of the form (PATTERN SOURCE). Each -PATTERN is matched against the SOURCE structurally. SOURCE is -only evaluated once for each PATTERN. - -Each SOURCE can refer to the symbols already bound by this -VARLIST. This is useful if you want to destructure SOURCE -recursively but also want to name the intermediate structures. - -See `-let' for the list of all possible patterns." - (declare (debug ((&rest [&or (sexp form) sexp]) body)) - (indent 1)) - (let* ((varlist (dash--normalize-let-varlist varlist)) - (bindings (--mapcat (dash--match (car it) (cadr it)) varlist))) - `(let* ,bindings - ,@body))) - -(defmacro -let (varlist &rest body) - "Bind variables according to VARLIST then eval BODY. - -VARLIST is a list of lists of the form (PATTERN SOURCE). Each -PATTERN is matched against the SOURCE \"structurally\". SOURCE -is only evaluated once for each PATTERN. Each PATTERN is matched -recursively, and can therefore contain sub-patterns which are -matched against corresponding sub-expressions of SOURCE. - -All the SOURCEs are evalled before any symbols are -bound (i.e. \"in parallel\"). - -If VARLIST only contains one (PATTERN SOURCE) element, you can -optionally specify it using a vector and discarding the -outer-most parens. Thus - - (-let ((PATTERN SOURCE)) ...) - -becomes - - (-let [PATTERN SOURCE] ...). - -`-let' uses a convention of not binding places (symbols) starting -with _ whenever it's possible. You can use this to skip over -entries you don't care about. However, this is not *always* -possible (as a result of implementation) and these symbols might -get bound to undefined values. - -Following is the overview of supported patterns. Remember that -patterns can be matched recursively, so every a, b, aK in the -following can be a matching construct and not necessarily a -symbol/variable. - -Symbol: - - a - bind the SOURCE to A. This is just like regular `let'. - -Conses and lists: - - (a) - bind `car' of cons/list to A - - (a . b) - bind car of cons to A and `cdr' to B - - (a b) - bind car of list to A and `cadr' to B - - (a1 a2 a3 ...) - bind 0th car of list to A1, 1st to A2, 2nd to A3... - - (a1 a2 a3 ... aN . rest) - as above, but bind the Nth cdr to REST. - -Vectors: - - [a] - bind 0th element of a non-list sequence to A (works with - vectors, strings, bit arrays...) - - [a1 a2 a3 ...] - bind 0th element of non-list sequence to A0, 1st to - A1, 2nd to A2, ... - If the PATTERN is shorter than SOURCE, the values at - places not in PATTERN are ignored. - If the PATTERN is longer than SOURCE, an `error' is - thrown. - - [a1 a2 a3 ... &rest rest] - as above, but bind the rest of - the sequence to REST. This is - conceptually the same as improper list - matching (a1 a2 ... aN . rest) - -Key/value stores: - - (&plist key0 a0 ... keyN aN) - bind value mapped by keyK in the - SOURCE plist to aK. If the - value is not found, aK is nil. - Uses `plist-get' to fetch values. - - (&alist key0 a0 ... keyN aN) - bind value mapped by keyK in the - SOURCE alist to aK. If the - value is not found, aK is nil. - Uses `assoc' to fetch values. - - (&hash key0 a0 ... keyN aN) - bind value mapped by keyK in the - SOURCE hash table to aK. If the - value is not found, aK is nil. - Uses `gethash' to fetch values. - -Further, special keyword &keys supports \"inline\" matching of -plist-like key-value pairs, similarly to &keys keyword of -`cl-defun'. - - (a1 a2 ... aN &keys key1 b1 ... keyN bK) - -This binds N values from the list to a1 ... aN, then interprets -the cdr as a plist (see key/value matching above). - -A shorthand notation for kv-destructuring exists which allows the -patterns be optionally left out and derived from the key name in -the following fashion: - -- a key :foo is converted into `foo' pattern, -- a key \\='bar is converted into `bar' pattern, -- a key \"baz\" is converted into `baz' pattern. - -That is, the entire value under the key is bound to the derived -variable without any further destructuring. - -This is possible only when the form following the key is not a -valid pattern (i.e. not a symbol, a cons cell or a vector). -Otherwise the matching proceeds as usual and in case of an -invalid spec fails with an error. - -Thus the patterns are normalized as follows: - - ;; derive all the missing patterns - (&plist :foo \\='bar \"baz\") => (&plist :foo foo \\='bar bar \"baz\" baz) - - ;; we can specify some but not others - (&plist :foo \\='bar explicit-bar) => (&plist :foo foo \\='bar explicit-bar) - - ;; nothing happens, we store :foo in x - (&plist :foo x) => (&plist :foo x) - - ;; nothing happens, we match recursively - (&plist :foo (a b c)) => (&plist :foo (a b c)) - -You can name the source using the syntax SYMBOL &as PATTERN. -This syntax works with lists (proper or improper), vectors and -all types of maps. - - (list &as a b c) (list 1 2 3) - -binds A to 1, B to 2, C to 3 and LIST to (1 2 3). - -Similarly: - - (bounds &as beg . end) (cons 1 2) - -binds BEG to 1, END to 2 and BOUNDS to (1 . 2). - - (items &as first . rest) (list 1 2 3) - -binds FIRST to 1, REST to (2 3) and ITEMS to (1 2 3) - - [vect &as _ b c] [1 2 3] - -binds B to 2, C to 3 and VECT to [1 2 3] (_ avoids binding as usual). - - (plist &as &plist :b b) (list :a 1 :b 2 :c 3) - -binds B to 2 and PLIST to (:a 1 :b 2 :c 3). Same for &alist and &hash. - -This is especially useful when we want to capture the result of a -computation and destructure at the same time. Consider the -form (function-returning-complex-structure) returning a list of -two vectors with two items each. We want to capture this entire -result and pass it to another computation, but at the same time -we want to get the second item from each vector. We can achieve -it with pattern - - (result &as [_ a] [_ b]) (function-returning-complex-structure) - -Note: Clojure programmers may know this feature as the \":as -binding\". The difference is that we put the &as at the front -because we need to support improper list binding." - (declare (debug ([&or (&rest [&or (sexp form) sexp]) - (vector [&rest [sexp form]])] - body)) - (indent 1)) - (if (vectorp varlist) - `(let* ,(dash--match (aref varlist 0) (aref varlist 1)) - ,@body) - (let* ((varlist (dash--normalize-let-varlist varlist)) - (inputs (--map-indexed (list (make-symbol (format "input%d" it-index)) (cadr it)) varlist)) - (new-varlist (--zip-with (list (car it) (car other)) - varlist inputs))) - `(let ,inputs - (-let* ,new-varlist ,@body))))) - -(defmacro -lambda (match-form &rest body) - "Return a lambda which destructures its input as MATCH-FORM and executes BODY. - -Note that you have to enclose the MATCH-FORM in a pair of parens, -such that: - - (-lambda (x) body) - (-lambda (x y ...) body) - -has the usual semantics of `lambda'. Furthermore, these get -translated into normal `lambda', so there is no performance -penalty. - -See `-let' for a description of the destructuring mechanism." - (declare (doc-string 2) (indent defun) - (debug (&define sexp - [&optional stringp] - [&optional ("interactive" interactive)] - def-body))) - (cond - ((nlistp match-form) - (signal 'wrong-type-argument (list #'listp match-form))) - ;; No destructuring, so just return regular `lambda' for speed. - ((-all? #'symbolp match-form) - `(lambda ,match-form ,@body)) - ((let ((inputs (--map-indexed - (list it (make-symbol (format "input%d" it-index))) - match-form))) - ;; TODO: because inputs to the `lambda' are evaluated only once, - ;; `-let*' need not create the extra bindings to ensure that. - ;; We should find a way to optimize that. Not critical however. - `(lambda ,(mapcar #'cadr inputs) - (-let* ,inputs ,@body)))))) - -(defmacro -setq (&rest forms) - "Bind each MATCH-FORM to the value of its VAL. - -MATCH-FORM destructuring is done according to the rules of `-let'. - -This macro allows you to bind multiple variables by destructuring -the value, so for example: - - (-setq (a b) x - (&plist :c c) plist) - -expands roughly speaking to the following code - - (setq a (car x) - b (cadr x) - c (plist-get plist :c)) - -Care is taken to only evaluate each VAL once so that in case of -multiple assignments it does not cause unexpected side effects. - -\(fn [MATCH-FORM VAL]...)" - (declare (debug (&rest sexp form)) - (indent 1)) - (when (= (mod (length forms) 2) 1) - (signal 'wrong-number-of-arguments (list '-setq (1+ (length forms))))) - (let* ((forms-and-sources - ;; First get all the necessary mappings with all the - ;; intermediate bindings. - (-map (lambda (x) (dash--match (car x) (cadr x))) - (-partition 2 forms))) - ;; To preserve the logic of dynamic scoping we must ensure - ;; that we `setq' the variables outside of the `let*' form - ;; which holds the destructured intermediate values. For - ;; this we generate for each variable a placeholder which is - ;; bound to (lexically) the result of the destructuring. - ;; Then outside of the helper `let*' form we bind all the - ;; original variables to their respective placeholders. - ;; TODO: There is a lot of room for possible optimization, - ;; for start playing with `special-variable-p' to eliminate - ;; unnecessary re-binding. - (variables-to-placeholders - (-mapcat - (lambda (bindings) - (-map - (lambda (binding) - (let ((var (car binding))) - (list var (make-symbol (concat "--dash-binding-" (symbol-name var) "--"))))) - (--filter (not (string-prefix-p "--" (symbol-name (car it)))) bindings))) - forms-and-sources))) - `(let ,(-map 'cadr variables-to-placeholders) - (let* ,(-flatten-n 1 forms-and-sources) - (setq ,@(-flatten (-map 'reverse variables-to-placeholders)))) - (setq ,@(-flatten variables-to-placeholders))))) - -(defmacro -if-let* (vars-vals then &rest else) - "If all VALS evaluate to true, bind them to their corresponding -VARS and do THEN, otherwise do ELSE. VARS-VALS should be a list -of (VAR VAL) pairs. - -Note: binding is done according to `-let*'. VALS are evaluated -sequentially, and evaluation stops after the first nil VAL is -encountered." - (declare (debug ((&rest (sexp form)) form body)) - (indent 2)) - (->> vars-vals - (--mapcat (dash--match (car it) (cadr it))) - (--reduce-r-from - (let ((var (car it)) - (val (cadr it))) - `(let ((,var ,val)) - (if ,var ,acc ,@else))) - then))) - -(defmacro -if-let (var-val then &rest else) - "If VAL evaluates to non-nil, bind it to VAR and do THEN, -otherwise do ELSE. - -Note: binding is done according to `-let'. - -\(fn (VAR VAL) THEN &rest ELSE)" - (declare (debug ((sexp form) form body)) - (indent 2)) - `(-if-let* (,var-val) ,then ,@else)) - -(defmacro --if-let (val then &rest else) - "If VAL evaluates to non-nil, bind it to symbol `it' and do THEN, -otherwise do ELSE." - (declare (debug (form form body)) - (indent 2)) - `(-if-let (it ,val) ,then ,@else)) - -(defmacro -when-let* (vars-vals &rest body) - "If all VALS evaluate to true, bind them to their corresponding -VARS and execute body. VARS-VALS should be a list of (VAR VAL) -pairs. - -Note: binding is done according to `-let*'. VALS are evaluated -sequentially, and evaluation stops after the first nil VAL is -encountered." - (declare (debug ((&rest (sexp form)) body)) - (indent 1)) - `(-if-let* ,vars-vals (progn ,@body))) - -(defmacro -when-let (var-val &rest body) - "If VAL evaluates to non-nil, bind it to VAR and execute body. - -Note: binding is done according to `-let'. - -\(fn (VAR VAL) &rest BODY)" - (declare (debug ((sexp form) body)) - (indent 1)) - `(-if-let ,var-val (progn ,@body))) - -(defmacro --when-let (val &rest body) - "If VAL evaluates to non-nil, bind it to symbol `it' and -execute body." - (declare (debug (form body)) - (indent 1)) - `(--if-let ,val (progn ,@body))) - -;; TODO: Get rid of this dynamic variable, passing it as an argument -;; instead? -(defvar -compare-fn nil - "Tests for equality use this function, or `equal' if this is nil. - -As a dynamic variable, this should be temporarily bound around -the relevant operation, rather than permanently modified. For -example: - - (let ((-compare-fn #\\='=)) - (-union \\='(1 2 3) \\='(2 3 4)))") - -(defun dash--member-fn () - "Return the flavor of `member' that goes best with `-compare-fn'." - (declare (side-effect-free error-free)) - (let ((cmp -compare-fn)) - (cond ((memq cmp '(nil equal)) #'member) - ((eq cmp #'eq) #'memq) - ((eq cmp #'eql) #'memql) - ((lambda (elt list) - (while (and list (not (funcall cmp elt (car list)))) - (pop list)) - list))))) - -(defun dash--assoc-fn () - "Return the flavor of `assoc' that goes best with `-compare-fn'." - (declare (side-effect-free error-free)) - (let ((cmp -compare-fn)) - (cond ((memq cmp '(nil equal)) #'assoc) - ((eq cmp #'eq) #'assq) - ((lambda (key alist) - ;; Since Emacs 26, `assoc' accepts a custom `testfn'. - ;; Version testing would be simpler here, but feature - ;; testing gets more brownie points, I guess. - (static-if (condition-case nil - (assoc nil () #'eql) - (wrong-number-of-arguments t)) - (--first (and (consp it) (funcall cmp (car it) key)) alist) - (assoc key alist cmp))))))) - -(defun dash--hash-test-fn () - "Return the hash table test function corresponding to `-compare-fn'. -Return nil if `-compare-fn' is not a known test function." - (declare (side-effect-free error-free)) - ;; In theory this could also recognize values that are custom - ;; `hash-table-test's, but too often the :test name is different - ;; from the equality function, so it doesn't seem worthwhile. - (car (memq (or -compare-fn #'equal) '(equal eq eql)))) - -(defvar dash--short-list-length 32 - "Maximum list length considered short, for optimizations. -For example, the speedup afforded by hash table lookup may start -to outweigh its runtime and memory overhead for problem sizes -greater than this value. See also the discussion in PR #305.") - -(defun -distinct (list) - "Return a copy of LIST with all duplicate elements removed. - -The test for equality is done with `equal', or with `-compare-fn' -if that is non-nil. - -Alias: `-uniq'." - (declare (important-return-value t)) - (let (test len) - (cond ((null list) ()) - ;; Use a hash table if `-compare-fn' is a known hash table - ;; test function and the list is long enough. - ((and (setq test (dash--hash-test-fn)) - (> (setq len (length list)) dash--short-list-length)) - (let ((ht (make-hash-table :test test :size len))) - (--filter (unless (gethash it ht) (puthash it t ht)) list))) - ((let ((member (dash--member-fn)) uniq) - (--each list (unless (funcall member it uniq) (push it uniq))) - (nreverse uniq)))))) - -(defalias '-uniq #'-distinct) - -(defun dash--size+ (size1 size2) - "Return the sum of nonnegative fixnums SIZE1 and SIZE2. -Return `most-positive-fixnum' on overflow. This ensures the -result is a valid size, particularly for allocating hash tables, -even in the presence of bignum support." - (declare (side-effect-free t)) - (if (< size1 (- most-positive-fixnum size2)) - (+ size1 size2) - most-positive-fixnum)) - -(defun -union (list1 list2) - "Return a new list of distinct elements appearing in either LIST1 or LIST2. - -The test for equality is done with `equal', or with `-compare-fn' -if that is non-nil." - (declare (important-return-value t)) - (let ((lists (list list1 list2)) test len union) - (cond ((null (or list1 list2))) - ;; Use a hash table if `-compare-fn' is a known hash table - ;; test function and the lists are long enough. - ((and (setq test (dash--hash-test-fn)) - (> (setq len (dash--size+ (length list1) (length list2))) - dash--short-list-length)) - (let ((ht (make-hash-table :test test :size len))) - (dolist (l lists) - (--each l (unless (gethash it ht) - (puthash it t ht) - (push it union)))))) - ((let ((member (dash--member-fn))) - (dolist (l lists) - (--each l (unless (funcall member it union) (push it union))))))) - (nreverse union))) - -(defun -intersection (list1 list2) - "Return a new list of distinct elements appearing in both LIST1 and LIST2. - -The test for equality is done with `equal', or with `-compare-fn' -if that is non-nil." - (declare (important-return-value t)) - (let (test len) - (cond ((null (and list1 list2)) ()) - ;; Use a hash table if `-compare-fn' is a known hash table - ;; test function and either list is long enough. - ((and (setq test (dash--hash-test-fn)) - (> (setq len (length list2)) dash--short-list-length)) - (let ((ht (make-hash-table :test test :size len))) - (--each list2 (puthash it t ht)) - ;; Remove visited elements to avoid duplicates. - (--filter (when (gethash it ht) (remhash it ht) t) list1))) - ((let ((member (dash--member-fn)) intersection) - (--each list1 (and (funcall member it list2) - (not (funcall member it intersection)) - (push it intersection))) - (nreverse intersection)))))) - -(defun -difference (list1 list2) - "Return a new list with the distinct members of LIST1 that are not in LIST2. - -The test for equality is done with `equal', or with `-compare-fn' -if that is non-nil." - (declare (important-return-value t)) - (let (test len1 len2) - (cond ((null list1) ()) - ((null list2) (-distinct list1)) - ;; Use a hash table if `-compare-fn' is a known hash table - ;; test function and the subtrahend is long enough. - ((and (setq test (dash--hash-test-fn)) - (setq len1 (length list1)) - (setq len2 (length list2)) - (> (max len1 len2) dash--short-list-length)) - (let ((ht1 (make-hash-table :test test :size len1)) - (ht2 (make-hash-table :test test :size len2))) - (--each list2 (puthash it t ht2)) - ;; Avoid duplicates by tracking visited items in `ht1'. - (--filter (unless (or (gethash it ht2) (gethash it ht1)) - (puthash it t ht1)) - list1))) - ((let ((member (dash--member-fn)) difference) - (--each list1 - (unless (or (funcall member it list2) - (funcall member it difference)) - (push it difference))) - (nreverse difference)))))) - -(defun -powerset (list) - "Return the power set of LIST." - (declare (pure t) (side-effect-free t)) - (if (null list) (list ()) - (let ((last (-powerset (cdr list)))) - (nconc (mapcar (lambda (x) (cons (car list) x)) last) - last)))) - -(defun -frequencies (list) - "Count the occurrences of each distinct element of LIST. - -Return an alist of (ELEMENT . N), where each ELEMENT occurs N -times in LIST. - -The test for equality is done with `equal', or with `-compare-fn' -if that is non-nil. - -See also `-count' and `-group-by'." - (declare (important-return-value t)) - (let (test len freqs) - (cond ((null list)) - ((and (setq test (dash--hash-test-fn)) - (> (setq len (length list)) dash--short-list-length)) - (let ((ht (make-hash-table :test test :size len))) - ;; Share structure between hash table and returned list. - ;; This affords a single pass that preserves the input - ;; order, conses less garbage, and is faster than a - ;; second traversal (e.g., with `maphash'). - (--each list - (let ((freq (gethash it ht))) - (if freq - (setcdr freq (1+ (cdr freq))) - (push (puthash it (cons it 1) ht) freqs)))))) - ((let ((assoc (dash--assoc-fn))) - (--each list - (let ((freq (funcall assoc it freqs))) - (if freq - (setcdr freq (1+ (cdr freq))) - (push (cons it 1) freqs))))))) - (nreverse freqs))) - -(defun dash--numbers<= (nums) - "Return non-nil if NUMS is a list of non-decreasing numbers." - (declare (pure t) (side-effect-free t)) - (or (null nums) - (let ((prev (pop nums))) - (and (numberp prev) - (--every (and (numberp it) (<= prev (setq prev it))) nums))))) - -(defun dash--next-lex-perm (array n) - "Update ARRAY of N numbers with its next lexicographic permutation. -Return nil if there is no such successor. N should be nonzero. - -This implements the salient steps of Algorithm L (Lexicographic -permutation generation) as described in DE Knuth's The Art of -Computer Programming, Volume 4A / Combinatorial Algorithms, -Part I, Addison-Wesley, 2011, § 7.2.1.2, p. 319." - (setq n (1- n)) - (let* ((l n) - (j (1- n)) - (al (aref array n)) - (aj al)) - ;; L2. [Find j]. - ;; Decrement j until a[j] < a[j+1]. - (while (and (<= 0 j) - (<= aj (setq aj (aref array j)))) - (setq j (1- j))) - ;; Terminate algorithm if j not found. - (when (>= j 0) - ;; L3. [Increase a[j]]. - ;; Decrement l until a[j] < a[l]. - (while (>= aj al) - (setq l (1- l) al (aref array l))) - ;; Swap a[j] and a[l]. - (aset array j al) - (aset array l aj) - ;; L4. [Reverse a[j+1]...a[n]]. - (setq l n) - (while (< (setq j (1+ j)) l) - (setq aj (aref array j)) - (aset array j (aref array l)) - (aset array l aj) - (setq l (1- l))) - array))) - -(defun dash--lex-perms (vec &optional original) - "Return a list of permutations of VEC in lexicographic order. -Specifically, return only the successors of VEC in lexicographic -order. Each returned permutation is a list. VEC should comprise -one or more numbers, and may be destructively modified. - -If ORIGINAL is a vector, then VEC is interpreted as a set of -indices into ORIGINAL. In this case, the indices are permuted, -and the resulting index permutations are used to dereference -elements of ORIGINAL." - (let ((len (length vec)) perms) - (while vec - (push (if original - (--map (aref original it) vec) - (append vec ())) - perms) - (setq vec (dash--next-lex-perm vec len))) - (nreverse perms))) - -(defun dash--uniq-perms (list) - "Return a list of permutations of LIST. -LIST is treated as if all its elements are distinct." - (let* ((vec (vconcat list)) - (idxs (copy-sequence vec))) - ;; Just construct a vector of the list's indices and permute that. - (dotimes (i (length idxs)) - (aset idxs i i)) - (dash--lex-perms idxs vec))) - -(defun dash--multi-perms (list freqs) - "Return a list of permutations of the multiset LIST. -FREQS should be an alist describing the frequency of each element -in LIST, as returned by `-frequencies'." - (let (;; Distinct items in `list', aka the cars of `freqs'. - (uniq (make-vector (length freqs) nil)) - ;; Indices into `uniq'. - (idxs (make-vector (length list) nil)) - ;; Current index into `idxs'. - (i 0)) - (--each freqs - (aset uniq it-index (car it)) - ;; Populate `idxs' with as many copies of each `it-index' as - ;; there are corresponding duplicates. - (dotimes (_ (cdr it)) - (aset idxs i it-index) - (setq i (1+ i)))) - (dash--lex-perms idxs uniq))) - -(defun -permutations (list) - "Return the distinct permutations of LIST. - -Duplicate elements of LIST are determined by `equal', or by -`-compare-fn' if that is non-nil." - (declare (important-return-value t)) - (cond ((null list) (list ())) - ;; Optimization: a traversal of `list' is faster than the - ;; round trip via `dash--uniq-perms' or `dash--multi-perms'. - ((dash--numbers<= list) - (dash--lex-perms (vconcat list))) - ((let ((freqs (-frequencies list))) - ;; Is each element distinct? - (unless (--every (= (cdr it) 1) freqs) - (dash--multi-perms list freqs)))) - ((dash--uniq-perms list)))) - -(defun -inits (list) - "Return all prefixes of LIST." - (declare (pure t) (side-effect-free t)) - (let ((res (list list))) - (setq list (reverse list)) - (while list - (push (reverse (!cdr list)) res)) - res)) - -(defun -tails (list) - "Return all suffixes of LIST." - (declare (pure t) (side-effect-free t)) - (-reductions-r-from #'cons nil list)) - -(defun -common-prefix (&rest lists) - "Return the longest common prefix of LISTS." - (declare (pure t) (side-effect-free t)) - (--reduce (--take-while (and acc (equal (pop acc) it)) it) - lists)) - -(defun -common-suffix (&rest lists) - "Return the longest common suffix of LISTS." - (declare (pure t) (side-effect-free t)) - (nreverse (apply #'-common-prefix (mapcar #'reverse lists)))) - -(defun -contains? (list element) - "Return non-nil if LIST contains ELEMENT. - -The test for equality is done with `equal', or with `-compare-fn' -if that is non-nil. As with `member', the return value is -actually the tail of LIST whose car is ELEMENT. - -Alias: `-contains-p'." - (declare (important-return-value t)) - (funcall (dash--member-fn) element list)) - -(defalias '-contains-p #'-contains?) - -(defun -same-items? (list1 list2) - "Return non-nil if LIST1 and LIST2 have the same distinct elements. - -The order of the elements in the lists does not matter. The -lists may be of different lengths, i.e., contain duplicate -elements. The test for equality is done with `equal', or with -`-compare-fn' if that is non-nil. - -Alias: `-same-items-p'." - (declare (important-return-value t)) - (let (test len1 len2) - (cond ((null (or list1 list2))) - ((null (and list1 list2)) nil) - ;; Use a hash table if `-compare-fn' is a known hash table - ;; test function and either list is long enough. - ((and (setq test (dash--hash-test-fn)) - (setq len1 (length list1)) - (setq len2 (length list2)) - (> (max len1 len2) dash--short-list-length)) - (let ((ht1 (make-hash-table :test test :size len1)) - (ht2 (make-hash-table :test test :size len2))) - (--each list1 (puthash it t ht1)) - ;; Move visited elements from `ht1' to `ht2'. This way, - ;; if visiting all of `list2' leaves `ht1' empty, then - ;; all elements from both lists have been accounted for. - (and (--every (cond ((gethash it ht1) - (remhash it ht1) - (puthash it t ht2)) - ((gethash it ht2))) - list2) - (zerop (hash-table-count ht1))))) - ((let ((member (dash--member-fn))) - (and (--all? (funcall member it list2) list1) - (--all? (funcall member it list1) list2))))))) - -(defalias '-same-items-p #'-same-items?) - -(defun -is-prefix? (prefix list) - "Return non-nil if PREFIX is a prefix of LIST. - -Alias: `-is-prefix-p'." - (declare (pure t) (side-effect-free t)) - (--each-while list (and (equal (car prefix) it) - (!cdr prefix))) - (null prefix)) - -(defun -is-suffix? (suffix list) - "Return non-nil if SUFFIX is a suffix of LIST. - -Alias: `-is-suffix-p'." - (declare (pure t) (side-effect-free t)) - (equal suffix (last list (length suffix)))) - -(defun -is-infix? (infix list) - "Return non-nil if INFIX is infix of LIST. - -This operation runs in O(n^2) time - -Alias: `-is-infix-p'" - (declare (pure t) (side-effect-free t)) - (let (done) - (while (and (not done) list) - (setq done (-is-prefix? infix list)) - (!cdr list)) - done)) - -(defalias '-is-prefix-p '-is-prefix?) -(defalias '-is-suffix-p '-is-suffix?) -(defalias '-is-infix-p '-is-infix?) - -(defun -sort (comparator list) - "Sort LIST, stably, comparing elements using COMPARATOR. -Return the sorted list. LIST is NOT modified by side effects. -COMPARATOR is called with two elements of LIST, and should return non-nil -if the first element should sort before the second." - (declare (important-return-value t)) - (static-if (condition-case nil (sort []) (wrong-number-of-arguments)) - ;; Since Emacs 30. - (sort list :lessp comparator) - (sort (copy-sequence list) comparator))) - -(defmacro --sort (form list) - "Anaphoric form of `-sort'." - (declare (debug (def-form form))) - `(-sort (lambda (it other) (ignore it other) ,form) ,list)) - -(defun -list (&optional arg &rest args) - "Ensure ARG is a list. -If ARG is already a list, return it as is (not a copy). -Otherwise, return a new list with ARG as its only element. - -Another supported calling convention is (-list &rest ARGS). -In this case, if ARG is not a list, a new list with all of -ARGS as elements is returned. This use is supported for -backward compatibility and is otherwise deprecated." - (declare (advertised-calling-convention (arg) "2.18.0") - (pure t) (side-effect-free error-free)) - (if (listp arg) arg (cons arg args))) - -(defun -repeat (n x) - "Return a new list of length N with each element being X. -Return nil if N is less than 1." - (declare (side-effect-free t)) - (and (>= n 0) (make-list n x))) - -(defun -sum (list) - "Return the sum of LIST." - (declare (pure t) (side-effect-free t)) - (apply #'+ list)) - -(defun -running-sum (list) - "Return a list with running sums of items in LIST. -LIST must be non-empty." - (declare (pure t) (side-effect-free t)) - (or list (signal 'wrong-type-argument (list #'consp list))) - (-reductions #'+ list)) - -(defun -product (list) - "Return the product of LIST." - (declare (pure t) (side-effect-free t)) - (apply #'* list)) - -(defun -running-product (list) - "Return a list with running products of items in LIST. -LIST must be non-empty." - (declare (pure t) (side-effect-free t)) - (or list (signal 'wrong-type-argument (list #'consp list))) - (-reductions #'* list)) - -(defun -max (list) - "Return the largest value from LIST of numbers or markers." - (declare (pure t) (side-effect-free t)) - (apply #'max list)) - -(defun -min (list) - "Return the smallest value from LIST of numbers or markers." - (declare (pure t) (side-effect-free t)) - (apply #'min list)) - -(defun -max-by (comparator list) - "Take a comparison function COMPARATOR and a LIST and return -the greatest element of the list by the comparison function. - -See also combinator `-on' which can transform the values before -comparing them." - (declare (important-return-value t)) - (--reduce (if (funcall comparator it acc) it acc) list)) - -(defun -min-by (comparator list) - "Take a comparison function COMPARATOR and a LIST and return -the least element of the list by the comparison function. - -See also combinator `-on' which can transform the values before -comparing them." - (declare (important-return-value t)) - (--reduce (if (funcall comparator it acc) acc it) list)) - -(defmacro --max-by (form list) - "Anaphoric version of `-max-by'. - -The items for the comparator form are exposed as \"it\" and \"other\"." - (declare (debug (def-form form))) - `(-max-by (lambda (it other) (ignore it other) ,form) ,list)) - -(defmacro --min-by (form list) - "Anaphoric version of `-min-by'. - -The items for the comparator form are exposed as \"it\" and \"other\"." - (declare (debug (def-form form))) - `(-min-by (lambda (it other) (ignore it other) ,form) ,list)) - -(defun -iota (count &optional start step) - "Return a list containing COUNT numbers. -Starts from START and adds STEP each time. The default START is -zero, the default STEP is 1. -This function takes its name from the corresponding primitive in -the APL language." - (declare (side-effect-free t)) - (unless (natnump count) - (signal 'wrong-type-argument (list #'natnump count))) - (or start (setq start 0)) - (or step (setq step 1)) - (if (zerop step) - (make-list count start) - (--iterate (+ it step) start count))) - -(defun -fix (fn list) - "Compute the (least) fixpoint of FN with initial input LIST. - -FN is called at least once, results are compared with `equal'." - (declare (important-return-value t)) - (let ((re (funcall fn list))) - (while (not (equal list re)) - (setq list re) - (setq re (funcall fn re))) - re)) - -(defmacro --fix (form list) - "Anaphoric form of `-fix'." - (declare (debug (def-form form))) - `(-fix (lambda (it) (ignore it) ,form) ,list)) - -(defun -unfold (fun seed) - "Build a list from SEED using FUN. - -This is \"dual\" operation to `-reduce-r': while -reduce-r -consumes a list to produce a single value, `-unfold' takes a -seed value and builds a (potentially infinite!) list. - -FUN should return nil to stop the generating process, or a -cons (A . B), where A will be prepended to the result and B is -the new seed." - (declare (important-return-value t)) - (let ((last (funcall fun seed)) r) - (while last - (push (car last) r) - (setq last (funcall fun (cdr last)))) - (nreverse r))) - -(defmacro --unfold (form seed) - "Anaphoric version of `-unfold'." - (declare (debug (def-form form))) - `(-unfold (lambda (it) (ignore it) ,form) ,seed)) - -(defun -cons-pair? (obj) - "Return non-nil if OBJ is a true cons pair. -That is, a cons (A . B) where B is not a list. - -Alias: `-cons-pair-p'." - (declare (pure t) (side-effect-free error-free)) - (nlistp (cdr-safe obj))) - -(defalias '-cons-pair-p '-cons-pair?) - -(defun -cons-to-list (con) - "Convert a cons pair to a list with `car' and `cdr' of the pair respectively." - (declare (pure t) (side-effect-free t)) - (list (car con) (cdr con))) - -(defun -value-to-list (val) - "Convert a value to a list. - -If the value is a cons pair, make a list with two elements, `car' -and `cdr' of the pair respectively. - -If the value is anything else, wrap it in a list." - (declare (pure t) (side-effect-free t)) - (if (-cons-pair? val) (-cons-to-list val) (list val))) - -(defun -tree-mapreduce-from (fn folder init-value tree) - "Apply FN to each element of TREE, and make a list of the results. -If elements of TREE are lists themselves, apply FN recursively to -elements of these nested lists. - -Then reduce the resulting lists using FOLDER and initial value -INIT-VALUE. See `-reduce-r-from'. - -This is the same as calling `-tree-reduce-from' after `-tree-map' -but is twice as fast as it only traverse the structure once." - (declare (important-return-value t)) - (cond - ((null tree) ()) - ((-cons-pair? tree) (funcall fn tree)) - ((consp tree) - (-reduce-r-from - folder init-value - (mapcar (lambda (x) (-tree-mapreduce-from fn folder init-value x)) tree))) - ((funcall fn tree)))) - -(defmacro --tree-mapreduce-from (form folder init-value tree) - "Anaphoric form of `-tree-mapreduce-from'." - (declare (debug (def-form def-form form form))) - `(-tree-mapreduce-from (lambda (it) (ignore it) ,form) - (lambda (it acc) (ignore it acc) ,folder) - ,init-value - ,tree)) - -(defun -tree-mapreduce (fn folder tree) - "Apply FN to each element of TREE, and make a list of the results. -If elements of TREE are lists themselves, apply FN recursively to -elements of these nested lists. - -Then reduce the resulting lists using FOLDER and initial value -INIT-VALUE. See `-reduce-r-from'. - -This is the same as calling `-tree-reduce' after `-tree-map' -but is twice as fast as it only traverse the structure once." - (declare (important-return-value t)) - (cond - ((null tree) ()) - ((-cons-pair? tree) (funcall fn tree)) - ((consp tree) - (-reduce-r folder (mapcar (lambda (x) (-tree-mapreduce fn folder x)) tree))) - ((funcall fn tree)))) - -(defmacro --tree-mapreduce (form folder tree) - "Anaphoric form of `-tree-mapreduce'." - (declare (debug (def-form def-form form))) - `(-tree-mapreduce (lambda (it) (ignore it) ,form) - (lambda (it acc) (ignore it acc) ,folder) - ,tree)) - -(defun -tree-map (fn tree) - "Apply FN to each element of TREE while preserving the tree structure." - (declare (important-return-value t)) - (cond - ((null tree) ()) - ((-cons-pair? tree) (funcall fn tree)) - ((consp tree) - (mapcar (lambda (x) (-tree-map fn x)) tree)) - ((funcall fn tree)))) - -(defmacro --tree-map (form tree) - "Anaphoric form of `-tree-map'." - (declare (debug (def-form form))) - `(-tree-map (lambda (it) (ignore it) ,form) ,tree)) - -(defun -tree-reduce-from (fn init-value tree) - "Use FN to reduce elements of list TREE. -If elements of TREE are lists themselves, apply the reduction recursively. - -FN is first applied to INIT-VALUE and first element of the list, -then on this result and second element from the list etc. - -The initial value is ignored on cons pairs as they always contain -two elements." - (declare (important-return-value t)) - (cond - ((null tree) ()) - ((-cons-pair? tree) tree) - ((consp tree) - (-reduce-r-from - fn init-value - (mapcar (lambda (x) (-tree-reduce-from fn init-value x)) tree))) - (tree))) - -(defmacro --tree-reduce-from (form init-value tree) - "Anaphoric form of `-tree-reduce-from'." - (declare (debug (def-form form form))) - `(-tree-reduce-from (lambda (it acc) (ignore it acc) ,form) - ,init-value ,tree)) - -(defun -tree-reduce (fn tree) - "Use FN to reduce elements of list TREE. -If elements of TREE are lists themselves, apply the reduction recursively. - -FN is first applied to first element of the list and second -element, then on this result and third element from the list etc. - -See `-reduce-r' for how exactly are lists of zero or one element handled." - (declare (important-return-value t)) - (cond - ((null tree) ()) - ((-cons-pair? tree) tree) - ((consp tree) - (-reduce-r fn (mapcar (lambda (x) (-tree-reduce fn x)) tree))) - (tree))) - -(defmacro --tree-reduce (form tree) - "Anaphoric form of `-tree-reduce'." - (declare (debug (def-form form))) - `(-tree-reduce (lambda (it acc) (ignore it acc) ,form) ,tree)) - -(defun -tree-map-nodes (pred fun tree) - "Call FUN on each node of TREE that satisfies PRED. - -If PRED returns nil, continue descending down this node. If PRED -returns non-nil, apply FUN to this node and do not descend -further." - (cond ((funcall pred tree) (funcall fun tree)) - ((and (listp tree) (listp (cdr tree))) - (-map (lambda (x) (-tree-map-nodes pred fun x)) tree)) - (tree))) - -(defmacro --tree-map-nodes (pred form tree) - "Anaphoric form of `-tree-map-nodes'." - (declare (debug (def-form def-form form))) - `(-tree-map-nodes (lambda (it) (ignore it) ,pred) - (lambda (it) (ignore it) ,form) - ,tree)) - -(defun -tree-seq (branch children tree) - "Return a sequence of the nodes in TREE, in depth-first search order. - -BRANCH is a predicate of one argument that returns non-nil if the -passed argument is a branch, that is, a node that can have children. - -CHILDREN is a function of one argument that returns the children -of the passed branch node. - -Non-branch nodes are simply copied." - (declare (important-return-value t)) - (cons tree - (and (funcall branch tree) - (-mapcat (lambda (x) (-tree-seq branch children x)) - (funcall children tree))))) - -(defmacro --tree-seq (branch children tree) - "Anaphoric form of `-tree-seq'." - (declare (debug (def-form def-form form))) - `(-tree-seq (lambda (it) (ignore it) ,branch) - (lambda (it) (ignore it) ,children) - ,tree)) - -(defun -clone (list) - "Create a deep copy of LIST. -The new list has the same elements and structure but all cons are -replaced with new ones. This is useful when you need to clone a -structure such as plist or alist." - (declare (side-effect-free t)) - (-tree-map #'identity list)) - -;;; Combinators - -(defalias '-partial #'apply-partially - "Return a function that is a partial application of FUN to ARGS. -ARGS is a list of the first N arguments to pass to FUN. -The result is a new function which does the same as FUN, except that -the first N arguments are fixed at the values with which this function -was called. -\n(fn FUN &rest ARGS)") - -(defun -rpartial (fn &rest args) - "Return a function that is a partial application of FN to ARGS. -ARGS is a list of the last N arguments to pass to FN. The result -is a new function which does the same as FN, except that the last -N arguments are fixed at the values with which this function was -called. This is like `-partial', except the arguments are fixed -starting from the right rather than the left." - (declare (pure t) (side-effect-free error-free)) - (lambda (&rest args-before) (apply fn (append args-before args)))) - -(defun -juxt (&rest fns) - "Return a function that is the juxtaposition of FNS. -The returned function takes a variable number of ARGS, applies -each of FNS in turn to ARGS, and returns the list of results." - (declare (pure t) (side-effect-free error-free)) - (lambda (&rest args) (mapcar (lambda (x) (apply x args)) fns))) - -(defun -compose (&rest fns) - "Compose FNS into a single composite function. -Return a function that takes a variable number of ARGS, applies -the last function in FNS to ARGS, and returns the result of -calling each remaining function on the result of the previous -function, right-to-left. If no FNS are given, return a variadic -`identity' function." - (declare (pure t) (side-effect-free error-free)) - (let* ((fns (nreverse fns)) - (head (car fns)) - (tail (cdr fns))) - (cond (tail - (lambda (&rest args) - (--reduce-from (funcall it acc) (apply head args) tail))) - (fns head) - ((lambda (&optional arg &rest _) arg))))) - -(defun -applify (fn) - "Return a function that applies FN to a single list of args. -This changes the arity of FN from taking N distinct arguments to -taking 1 argument which is a list of N arguments." - (declare (pure t) (side-effect-free error-free)) - (lambda (args) (apply fn args))) - -(defun -on (op trans) - "Return a function that calls TRANS on each arg and OP on the results. -The returned function takes a variable number of arguments, calls -the function TRANS on each one in turn, and then passes those -results as the list of arguments to OP, in the same order. - -For example, the following pairs of expressions are morally -equivalent: - - (funcall (-on #\\='+ #\\='1+) 1 2 3) = (+ (1+ 1) (1+ 2) (1+ 3)) - (funcall (-on #\\='+ #\\='1+)) = (+)" - (declare (pure t) (side-effect-free error-free)) - (lambda (&rest args) - ;; This unrolling seems to be a relatively cheap way to keep the - ;; overhead of `mapcar' + `apply' in check. - (cond ((cddr args) - (apply op (mapcar trans args))) - ((cdr args) - (funcall op (funcall trans (car args)) (funcall trans (cadr args)))) - (args - (funcall op (funcall trans (car args)))) - ((funcall op))))) - -(defun -flip (fn) - "Return a function that calls FN with its arguments reversed. -The returned function takes the same number of arguments as FN. - -For example, the following two expressions are morally -equivalent: - - (funcall (-flip #\\='-) 1 2) = (- 2 1) - -See also: `-rotate-args'." - (declare (pure t) (side-effect-free error-free)) - (lambda (&rest args) ;; Open-code for speed. - (cond ((cddr args) (apply fn (nreverse args))) - ((cdr args) (funcall fn (cadr args) (car args))) - (args (funcall fn (car args))) - ((funcall fn))))) - -(defun -rotate-args (n fn) - "Return a function that calls FN with args rotated N places to the right. -The returned function takes the same number of arguments as FN, -rotates the list of arguments N places to the right (left if N is -negative) just like `-rotate', and applies FN to the result. - -See also: `-flip'." - (declare (pure t) (side-effect-free t)) - (if (zerop n) - fn - (let ((even (= (% n 2) 0))) - (lambda (&rest args) - (cond ((cddr args) ;; Open-code for speed. - (apply fn (-rotate n args))) - ((cdr args) - (let ((fst (car args)) - (snd (cadr args))) - (funcall fn (if even fst snd) (if even snd fst)))) - (args - (funcall fn (car args))) - ((funcall fn))))))) - -(defun -const (c) - "Return a function that returns C ignoring any additional arguments. - -In types: a -> b -> a" - (declare (pure t) (side-effect-free error-free)) - (lambda (&rest _) c)) - -(defmacro -cut (&rest params) - "Take n-ary function and n arguments and specialize some of them. -Arguments denoted by <> will be left unspecialized. - -See SRFI-26 for detailed description." - (declare (debug (&optional sexp &rest &or "<>" form))) - (let* ((i 0) - (args (--keep (when (eq it '<>) - (setq i (1+ i)) - (make-symbol (format "D%d" i))) - params))) - `(lambda ,args - ,(let ((body (--map (if (eq it '<>) (pop args) it) params))) - (if (eq (car params) '<>) - (cons #'funcall body) - body))))) - -(defun -not (pred) - "Return a predicate that negates the result of PRED. -The returned predicate passes its arguments to PRED. If PRED -returns nil, the result is non-nil; otherwise the result is nil. - -See also: `-andfn' and `-orfn'." - (declare (pure t) (side-effect-free error-free)) - (lambda (&rest args) (not (apply pred args)))) - -(defun -orfn (&rest preds) - "Return a predicate that returns the first non-nil result of PREDS. -The returned predicate takes a variable number of arguments, -passes them to each predicate in PREDS in turn until one of them -returns non-nil, and returns that non-nil result without calling -the remaining PREDS. If all PREDS return nil, or if no PREDS are -given, the returned predicate returns nil. - -See also: `-andfn' and `-not'." - (declare (pure t) (side-effect-free error-free)) - ;; Open-code for speed. - (cond ((cdr preds) (lambda (&rest args) (--some (apply it args) preds))) - (preds (car preds)) - (#'ignore))) - -(defun -andfn (&rest preds) - "Return a predicate that returns non-nil if all PREDS do so. -The returned predicate P takes a variable number of arguments and -passes them to each predicate in PREDS in turn. If any one of -PREDS returns nil, P also returns nil without calling the -remaining PREDS. If all PREDS return non-nil, P returns the last -such value. If no PREDS are given, P always returns non-nil. - -See also: `-orfn' and `-not'." - (declare (pure t) (side-effect-free error-free)) - ;; Open-code for speed. - (cond ((cdr preds) (lambda (&rest args) (--every (apply it args) preds))) - (preds (car preds)) - ((static-if (fboundp 'always) - #'always - (lambda (&rest _) t))))) - -(defun -iteratefn (fn n) - "Return a function FN composed N times with itself. - -FN is a unary function. If you need to use a function of higher -arity, use `-applify' first to turn it into a unary function. - -With n = 0, this acts as identity function. - -In types: (a -> a) -> Int -> a -> a. - -This function satisfies the following law: - - (funcall (-iteratefn fn n) init) = (-last-item (-iterate fn init (1+ n)))." - (declare (pure t) (side-effect-free error-free)) - (lambda (x) (--dotimes n (setq x (funcall fn x))) x)) - -(defun -counter (&optional beg end inc) - "Return a closure that counts from BEG to END, with increment INC. - -The closure will return the next value in the counting sequence -each time it is called, and nil after END is reached. BEG -defaults to 0, INC defaults to 1, and if END is nil, the counter -will increment indefinitely. - -The closure accepts any number of arguments, which are discarded." - (declare (pure t) (side-effect-free error-free)) - (let ((inc (or inc 1)) - (n (or beg 0))) - (lambda (&rest _) - (when (or (not end) (< n end)) - (prog1 n - (setq n (+ n inc))))))) - -(defvar -fixfn-max-iterations 1000 - "The default maximum number of iterations performed by `-fixfn' - unless otherwise specified.") - -(defun -fixfn (fn &optional equal-test halt-test) - "Return a function that computes the (least) fixpoint of FN. - -FN must be a unary function. The returned lambda takes a single -argument, X, the initial value for the fixpoint iteration. The -iteration halts when either of the following conditions is satisfied: - - 1. Iteration converges to the fixpoint, with equality being - tested using EQUAL-TEST. If EQUAL-TEST is not specified, - `equal' is used. For functions over the floating point - numbers, it may be necessary to provide an appropriate - approximate comparison test. - - 2. HALT-TEST returns a non-nil value. HALT-TEST defaults to a - simple counter that returns t after `-fixfn-max-iterations', - to guard against infinite iteration. Otherwise, HALT-TEST - must be a function that accepts a single argument, the - current value of X, and returns non-nil as long as iteration - should continue. In this way, a more sophisticated - convergence test may be supplied by the caller. - -The return value of the lambda is either the fixpoint or, if -iteration halted before converging, a cons with car `halted' and -cdr the final output from HALT-TEST. - -In types: (a -> a) -> a -> a." - (declare (important-return-value t)) - (let ((eqfn (or equal-test 'equal)) - (haltfn (or halt-test - (-not - (-counter 0 -fixfn-max-iterations))))) - (lambda (x) - (let ((re (funcall fn x)) - (halt? (funcall haltfn x))) - (while (and (not halt?) (not (funcall eqfn x re))) - (setq x re - re (funcall fn re) - halt? (funcall haltfn re))) - (if halt? (cons 'halted halt?) - re))))) - -(defun -prodfn (&rest fns) - "Return a function that applies each of FNS to each of a list of arguments. - -Takes a list of N functions and returns a function that takes a -list of length N, applying Ith function to Ith element of the -input list. Returns a list of length N. - -In types (for N=2): ((a -> b), (c -> d)) -> (a, c) -> (b, d) - -This function satisfies the following laws: - - (-compose (-prodfn f g ...) - (-prodfn f\\=' g\\=' ...)) - = (-prodfn (-compose f f\\=') - (-compose g g\\=') - ...) - - (-prodfn f g ...) - = (-juxt (-compose f (-partial #\\='nth 0)) - (-compose g (-partial #\\='nth 1)) - ...) - - (-compose (-prodfn f g ...) - (-juxt f\\=' g\\=' ...)) - = (-juxt (-compose f f\\=') - (-compose g g\\=') - ...) - - (-compose (-partial #\\='nth n) - (-prod f1 f2 ...)) - = (-compose fn (-partial #\\='nth n))" - (declare (pure t) (side-effect-free t)) - (lambda (x) (--zip-with (funcall it other) fns x))) - -;;; Font lock - -(defvar dash--keywords - `(;; TODO: Do not fontify the following automatic variables - ;; globally; detect and limit to their local anaphoric scope. - (,(rx symbol-start (| "acc" "it" "it-index" "other") symbol-end) - . 'font-lock-variable-name-face) - ;; Macros in dev/examples.el. Based on `lisp-mode-symbol-regexp'. - (,(rx ?\( (group (| "defexamples" "def-example-group")) symbol-end - (+ (in "\t ")) - (group (* (| (syntax word) (syntax symbol) (: ?\\ nonl))))) - (1 'font-lock-keyword-face) - (2 'font-lock-function-name-face)) - ;; Symbols in dev/examples.el. - ,(rx symbol-start (| "=>" "~>" "!!>") symbol-end) - ;; Elisp macro fontification was static prior to Emacs 25. - ,@(when (< emacs-major-version 25) - (let ((macs '("!cdr" - "!cons" - "-->" - "--all-p" - "--all?" - "--annotate" - "--any" - "--any-p" - "--any?" - "--count" - "--dotimes" - "--doto" - "--drop-while" - "--each" - "--each-indexed" - "--each-r" - "--each-r-while" - "--each-while" - "--every" - "--every-p" - "--every?" - "--filter" - "--find" - "--find-index" - "--find-indices" - "--find-last-index" - "--first" - "--fix" - "--group-by" - "--if-let" - "--iterate" - "--keep" - "--last" - "--map" - "--map-first" - "--map-indexed" - "--map-last" - "--map-when" - "--mapcat" - "--max-by" - "--min-by" - "--none-p" - "--none?" - "--only-some-p" - "--only-some?" - "--partition-after-pred" - "--partition-by" - "--partition-by-header" - "--reduce" - "--reduce-from" - "--reduce-r" - "--reduce-r-from" - "--reductions" - "--reductions-from" - "--reductions-r" - "--reductions-r-from" - "--reject" - "--reject-first" - "--reject-last" - "--remove" - "--remove-first" - "--remove-last" - "--replace-where" - "--select" - "--separate" - "--some" - "--some-p" - "--some?" - "--sort" - "--splice" - "--splice-list" - "--split-when" - "--split-with" - "--take-while" - "--tree-map" - "--tree-map-nodes" - "--tree-mapreduce" - "--tree-mapreduce-from" - "--tree-reduce" - "--tree-reduce-from" - "--tree-seq" - "--unfold" - "--update-at" - "--when-let" - "--zip-with" - "->" - "->>" - "-as->" - "-cut" - "-doto" - "-if-let" - "-if-let*" - "-lambda" - "-let" - "-let*" - "-setq" - "-some-->" - "-some->" - "-some->>" - "-split-on" - "-when-let" - "-when-let*"))) - `((,(concat "(" (regexp-opt macs 'symbols)) . 1))))) - "Font lock keywords for `dash-fontify-mode'.") - -(defcustom dash-fontify-mode-lighter nil - "Mode line lighter for `dash-fontify-mode'. -Either a string to display in the mode line when -`dash-fontify-mode' is on, or nil to display -nothing (the default)." - :package-version '(dash . "2.18.0") - :type '(choice (string :tag "Lighter" :value " Dash") - (const :tag "Nothing" nil))) - -;;;###autoload -(define-minor-mode dash-fontify-mode - "Toggle fontification of Dash special variables. - -Dash-Fontify mode is a buffer-local minor mode intended for Emacs -Lisp buffers. Enabling it causes the special variables bound in -anaphoric Dash macros to be fontified. These anaphoras include -`it', `it-index', `acc', and `other'. In older Emacs versions -which do not dynamically detect macros, Dash-Fontify mode -additionally fontifies Dash macro calls. - -See also `dash-fontify-mode-lighter' and -`global-dash-fontify-mode'." - :lighter dash-fontify-mode-lighter - (if dash-fontify-mode - (font-lock-add-keywords nil dash--keywords t) - (font-lock-remove-keywords nil dash--keywords)) - (static-if (fboundp 'font-lock-flush) - ;; Added in Emacs 25. - (font-lock-flush) - (when font-lock-mode - ;; Unconditionally enables `font-lock-mode' and is marked - ;; `interactive-only' in later Emacs versions which have - ;; `font-lock-flush'. - (font-lock-fontify-buffer)))) - -(defun dash--turn-on-fontify-mode () - "Enable `dash-fontify-mode' if in an Emacs Lisp buffer." - (when (derived-mode-p #'emacs-lisp-mode) - (dash-fontify-mode))) - -;;;###autoload -(define-globalized-minor-mode global-dash-fontify-mode - dash-fontify-mode dash--turn-on-fontify-mode) - -(defcustom dash-enable-fontlock nil - "If non-nil, fontify Dash macro calls and special variables." - :set (lambda (sym val) - (set-default sym val) - (global-dash-fontify-mode (if val 1 0))) - :type 'boolean) - -(make-obsolete-variable - 'dash-enable-fontlock #'global-dash-fontify-mode "2.18.0") - -(define-obsolete-function-alias - 'dash-enable-font-lock #'global-dash-fontify-mode "2.18.0") - -;;; Info - -(defvar dash--info-doc-spec '("(dash) Index" nil "^ -+ .*: " "\\( \\|$\\)") - "The Dash :doc-spec entry for `info-lookup-alist'. -It is based on that for `emacs-lisp-mode'.") - -(defun dash--info-elisp-docs () - "Return the `emacs-lisp-mode' symbol docs from `info-lookup-alist'. -Specifically, return the cons containing their -`info-lookup->doc-spec' so that we can modify it." - (defvar info-lookup-alist) - (nthcdr 3 (assq #'emacs-lisp-mode (cdr (assq 'symbol info-lookup-alist))))) - -;;;###autoload -(defun dash-register-info-lookup () - "Register the Dash Info manual with `info-lookup-symbol'. -This allows Dash symbols to be looked up with \\[info-lookup-symbol]." - (interactive) - (require 'info-look) - (let ((docs (dash--info-elisp-docs))) - (setcar docs (append (car docs) (list dash--info-doc-spec))) - (info-lookup-reset))) - -(defun dash-unload-function () - "Remove Dash from `info-lookup-alist'. -Used by `unload-feature', which see." - (let ((docs (and (featurep 'info-look) - (dash--info-elisp-docs)))) - (when (member dash--info-doc-spec (car docs)) - (setcar docs (remove dash--info-doc-spec (car docs))) - (info-lookup-reset))) - nil) - -(provide 'dash) -;;; dash.el ends here diff --git a/.config/emacs/lisp/libs/dash.elc b/.config/emacs/lisp/libs/dash.elc deleted file mode 100644 index eb21655..0000000 Binary files a/.config/emacs/lisp/libs/dash.elc and /dev/null differ diff --git a/.config/emacs/lisp/libs/elisp-refs.el b/.config/emacs/lisp/libs/elisp-refs.el deleted file mode 100644 index 21b3546..0000000 --- a/.config/emacs/lisp/libs/elisp-refs.el +++ /dev/null @@ -1,913 +0,0 @@ -;;; elisp-refs.el --- find callers of elisp functions or macros -*- lexical-binding: t; -*- - -;; Copyright (C) 2016-2020 Wilfred Hughes - -;; Author: Wilfred Hughes -;; Version: 1.6 -;; Keywords: lisp -;; Package-Requires: ((dash "2.12.0") (s "1.11.0")) - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; elisp-refs.el is an Emacs package for finding references to -;; functions, macros or variables. Unlike a dumb text search, -;; elisp-refs.el actually parses the code, so it's never confused by -;; comments or `foo-bar' matching `foo'. -;; -;; See https://github.com/Wilfred/refs.el/blob/master/README.md for -;; more information. - -;;; Code: - -(require 'dash) -(require 's) -(require 'format) -(eval-when-compile (require 'cl-lib)) - -(defvar symbols-with-pos-enabled) -(declare-function symbol-with-pos-p nil (object)) -(declare-function symbol-with-pos-pos nil (ls)) - -;;; Internal - -(defvar elisp-refs-verbose t) - -(defun elisp-refs--format-int (integer) - "Format INTEGER as a string, with , separating thousands." - (let ((number (abs integer)) - (parts nil)) - (while (> number 999) - (push (format "%03d" (mod number 1000)) - parts) - (setq number (/ number 1000))) - (push (format "%d" number) parts) - (concat - (if (< integer 0) "-" "") - (s-join "," parts)))) - -(defsubst elisp-refs--start-pos (end-pos) - "Find the start position of form ending at END-POS -in the current buffer." - (let ((parse-sexp-ignore-comments t)) - (scan-sexps end-pos -1))) - -(defun elisp-refs--sexp-positions (buffer start-pos end-pos) - "Return a list of start and end positions of all the sexps -between START-POS and END-POS (inclusive) in BUFFER. - -Positions exclude quote characters, so given 'foo or `foo, we -report the position of the symbol foo. - -Not recursive, so we don't consider subelements of nested sexps." - (let ((positions nil)) - (with-current-buffer buffer - (condition-case _err - (catch 'done - (while t - (let* ((sexp-end-pos (let ((parse-sexp-ignore-comments t)) - (scan-sexps start-pos 1)))) - ;; If we've reached a sexp beyond the range requested, - ;; or if there are no sexps left, we're done. - (when (or (null sexp-end-pos) (> sexp-end-pos end-pos)) - (throw 'done nil)) - ;; Otherwise, this sexp is in the range requested. - (push (list (elisp-refs--start-pos sexp-end-pos) sexp-end-pos) - positions) - (setq start-pos sexp-end-pos)))) - ;; Terminate when we see "Containing expression ends prematurely" - (scan-error nil))) - (nreverse positions))) - -(defun elisp-refs--read-buffer-form (symbols-with-pos) - "Read a form from the current buffer, starting at point. -Returns a list: -\(form form-start-pos form-end-pos symbol-positions read-start-pos) - -In Emacs 28 and earlier, SYMBOL-POSITIONS is a list of 0-indexed -symbol positions relative to READ-START-POS, according to -`read-symbol-positions-list'. - -In Emacs 29+, SYMBOL-POSITIONS is nil. If SYMBOLS-WITH-POS is -non-nil, forms are read with `read-positioning-symbols'." - (let* ((read-with-symbol-positions t) - (read-start-pos (point)) - (form (if (and symbols-with-pos (fboundp 'read-positioning-symbols)) - (read-positioning-symbols (current-buffer)) - (read (current-buffer)))) - (symbols (if (boundp 'read-symbol-positions-list) - read-symbol-positions-list - nil)) - (end-pos (point)) - (start-pos (elisp-refs--start-pos end-pos))) - (list form start-pos end-pos symbols read-start-pos))) - -(defvar elisp-refs--path nil - "A buffer-local variable used by `elisp-refs--contents-buffer'. -Internal implementation detail.") - -(defun elisp-refs--read-all-buffer-forms (buffer symbols-with-pos) - "Read all the forms in BUFFER, along with their positions." - (with-current-buffer buffer - (goto-char (point-min)) - (let ((forms nil)) - (condition-case err - (while t - (push (elisp-refs--read-buffer-form symbols-with-pos) forms)) - (error - (if (or (equal (car err) 'end-of-file) - ;; TODO: this shouldn't occur in valid elisp files, - ;; but it's happening in helm-utils.el. - (equal (car err) 'scan-error)) - ;; Reached end of file, we're done. - (nreverse forms) - ;; Some unexpected error, propagate. - (error "Unexpected error whilst reading %s position %s: %s" - (abbreviate-file-name elisp-refs--path) (point) err))))))) - -(defun elisp-refs--proper-list-p (val) - "Is VAL a proper list?" - (if (fboundp 'proper-list-p) - ;; `proper-list-p' was added in Emacs 27.1. - ;; http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=2fde6275b69fd113e78243790bf112bbdd2fe2bf - (with-no-warnings (proper-list-p val)) - ;; Earlier Emacs versions only had format-proper-list-p. - (with-no-warnings (format-proper-list-p val)))) - -(defun elisp-refs--walk (buffer form start-pos end-pos symbol match-p &optional path) - "Walk FORM, a nested list, and return a list of sublists (with -their positions) where MATCH-P returns t. FORM is traversed -depth-first (pre-order traversal, left-to-right). - -MATCH-P is called with three arguments: -\(SYMBOL CURRENT-FORM PATH). - -PATH is the first element of all the enclosing forms of -CURRENT-FORM, innermost first, along with the index of the -current form. - -For example if we are looking at h in (e f (g h)), PATH takes the -value ((g . 1) (e . 2)). - -START-POS and END-POS should be the position of FORM within BUFFER." - (cond - ((funcall match-p symbol form path) - ;; If this form matches, just return it, along with the position. - (list (list form start-pos end-pos))) - ;; Otherwise, recurse on the subforms. - ((consp form) - (let ((matches nil) - ;; Find the positions of the subforms. - (subforms-positions - (if (eq (car-safe form) '\`) - ;; Kludge: `elisp-refs--sexp-positions' excludes the ` when - ;; calculating positions. So, to find the inner - ;; positions when walking from `(...) to (...), we - ;; don't need to increment the start position. - (cons nil (elisp-refs--sexp-positions buffer start-pos end-pos)) - ;; Calculate the positions after the opening paren. - (elisp-refs--sexp-positions buffer (1+ start-pos) end-pos)))) - ;; For each subform, recurse if it's a list, or a matching symbol. - (--each (-zip-pair form subforms-positions) - (-let [(subform subform-start subform-end) it] - (when (or - (and (consp subform) (elisp-refs--proper-list-p subform)) - (and (symbolp subform) (eq subform symbol))) - (-when-let (subform-matches - (elisp-refs--walk - buffer subform - subform-start subform-end - symbol match-p - (cons (cons (car-safe form) it-index) path))) - (push subform-matches matches))))) - - ;; Concat the results from all the subforms. - (apply #'append (nreverse matches)))))) - -;; TODO: condition-case (condition-case ... (error ...)) is not a call -;; TODO: (cl-destructuring-bind (foo &rest bar) ...) is not a call -;; TODO: letf, cl-letf, -let, -let* -(defun elisp-refs--function-p (symbol form path) - "Return t if FORM looks like a function call to SYMBOL." - (cond - ((not (consp form)) - nil) - ;; Ignore (defun _ (SYMBOL ...) ...) - ((or (equal (car path) '(defsubst . 2)) - (equal (car path) '(defun . 2)) - (equal (car path) '(defmacro . 2)) - (equal (car path) '(cl-defun . 2))) - nil) - ;; Ignore (lambda (SYMBOL ...) ...) - ((equal (car path) '(lambda . 1)) - nil) - ;; Ignore (let (SYMBOL ...) ...) - ;; and (let* (SYMBOL ...) ...) - ((or - (equal (car path) '(let . 1)) - (equal (car path) '(let* . 1))) - nil) - ;; Ignore (let ((SYMBOL ...)) ...) - ((or - (equal (cl-second path) '(let . 1)) - (equal (cl-second path) '(let* . 1))) - nil) - ;; Ignore (declare-function NAME (ARGS...)) - ((equal (car path) '(declare-function . 3)) - nil) - ;; (SYMBOL ...) - ((eq (car form) symbol) - t) - ;; (foo ... #'SYMBOL ...) - ((--any-p (equal it (list 'function symbol)) form) - t) - ;; (funcall 'SYMBOL ...) - ((and (eq (car form) 'funcall) - (equal `',symbol (cl-second form))) - t) - ;; (apply 'SYMBOL ...) - ((and (eq (car form) 'apply) - (equal `',symbol (cl-second form))) - t))) - -(defun elisp-refs--macro-p (symbol form path) - "Return t if FORM looks like a macro call to SYMBOL." - (cond - ((not (consp form)) - nil) - ;; Ignore (defun _ (SYMBOL ...) ...) - ((or (equal (car path) '(defsubst . 2)) - (equal (car path) '(defun . 2)) - (equal (car path) '(defmacro . 2))) - nil) - ;; Ignore (lambda (SYMBOL ...) ...) - ((equal (car path) '(lambda . 1)) - nil) - ;; Ignore (let (SYMBOL ...) ...) - ;; and (let* (SYMBOL ...) ...) - ((or - (equal (car path) '(let . 1)) - (equal (car path) '(let* . 1))) - nil) - ;; Ignore (let ((SYMBOL ...)) ...) - ((or - (equal (cl-second path) '(let . 1)) - (equal (cl-second path) '(let* . 1))) - nil) - ;; (SYMBOL ...) - ((eq (car form) symbol) - t))) - -;; Looking for a special form is exactly the same as looking for a -;; macro. -(defalias 'elisp-refs--special-p 'elisp-refs--macro-p) - -(defun elisp-refs--variable-p (symbol form path) - "Return t if this looks like a variable reference to SYMBOL. -We consider parameters to be variables too." - (cond - ((consp form) - nil) - ;; Ignore (defun _ (SYMBOL ...) ...) - ((or (equal (car path) '(defsubst . 1)) - (equal (car path) '(defun . 1)) - (equal (car path) '(defmacro . 1)) - (equal (car path) '(cl-defun . 1))) - nil) - ;; (let (SYMBOL ...) ...) is a variable, not a function call. - ((or - (equal (cl-second path) '(let . 1)) - (equal (cl-second path) '(let* . 1))) - t) - ;; (lambda (SYMBOL ...) ...) is a variable - ((equal (cl-second path) '(lambda . 1)) - t) - ;; (let ((SYMBOL ...)) ...) is also a variable. - ((or - (equal (cl-third path) '(let . 1)) - (equal (cl-third path) '(let* . 1))) - t) - ;; Ignore (SYMBOL ...) otherwise, we assume it's a function/macro - ;; call. - ((equal (car path) (cons symbol 0)) - nil) - ((eq form symbol) - t))) - -;; TODO: benchmark building a list with `push' rather than using -;; mapcat. -(defun elisp-refs--read-and-find (buffer symbol match-p) - "Read all the forms in BUFFER, and return a list of all forms that -contain SYMBOL where MATCH-P returns t. - -For every matching form found, we return the form itself along -with its start and end position." - (-non-nil - (--mapcat - (-let [(form start-pos end-pos symbol-positions _read-start-pos) it] - ;; Optimisation: if we have a list of positions for the current - ;; form (Emacs 28 and earlier), and it doesn't contain the - ;; symbol we're looking for, don't bother walking the form. - (when (or (null symbol-positions) (assq symbol symbol-positions)) - (elisp-refs--walk buffer form start-pos end-pos symbol match-p))) - (elisp-refs--read-all-buffer-forms buffer nil)))) - -(defun elisp-refs--walk-positioned-symbols (forms symbol) - "Given a nested list of FORMS, return a list of all positions of SYMBOL. -Assumes `symbol-with-pos-pos' is defined (Emacs 29+)." - (cond - ((symbol-with-pos-p forms) - (let ((symbols-with-pos-enabled t)) - (if (eq forms symbol) - (list (list symbol - (symbol-with-pos-pos forms) - (+ (symbol-with-pos-pos forms) (length (symbol-name symbol)))))))) - ((elisp-refs--proper-list-p forms) - ;; Proper list, use `--mapcat` to reduce how much we recurse. - (--mapcat (elisp-refs--walk-positioned-symbols it symbol) forms)) - ((consp forms) - ;; Improper list, we have to recurse on head and tail. - (append (elisp-refs--walk-positioned-symbols (car forms) symbol) - (elisp-refs--walk-positioned-symbols (cdr forms) symbol))) - ((vectorp forms) - (--mapcat (elisp-refs--walk-positioned-symbols it symbol) forms)))) - -(defun elisp-refs--read-and-find-symbol (buffer symbol) - "Read all the forms in BUFFER, and return a list of all -positions of SYMBOL." - (let* ((symbols-with-pos (fboundp 'symbol-with-pos-pos)) - (forms (elisp-refs--read-all-buffer-forms buffer symbols-with-pos))) - - (if symbols-with-pos - (elisp-refs--walk-positioned-symbols forms symbol) - (-non-nil - (--mapcat - (-let [(_ _ _ symbol-positions read-start-pos) it] - (--map - (-let [(sym . offset) it] - (when (eq sym symbol) - (-let* ((start-pos (+ read-start-pos offset)) - (end-pos (+ start-pos (length (symbol-name sym))))) - (list sym start-pos end-pos)))) - symbol-positions)) - forms))))) - -(defun elisp-refs--filter-obarray (pred) - "Return a list of all the items in `obarray' where PRED returns t." - (let (symbols) - (mapatoms (lambda (symbol) - (when (and (funcall pred symbol) - (not (equal (symbol-name symbol) ""))) - (push symbol symbols)))) - symbols)) - -(defun elisp-refs--loaded-paths () - "Return a list of all files that have been loaded in Emacs. -Where the file was a .elc, return the path to the .el file instead." - (let ((elc-paths (-non-nil (mapcar #'-first-item load-history)))) - (-non-nil - (--map - (let ((el-name (format "%s.el" (file-name-sans-extension it))) - (el-gz-name (format "%s.el.gz" (file-name-sans-extension it)))) - (cond ((file-exists-p el-name) el-name) - ((file-exists-p el-gz-name) el-gz-name) - ;; Ignore files where we can't find a .el file. - (t nil))) - elc-paths)))) - -(defun elisp-refs--contents-buffer (path) - "Read PATH into a disposable buffer, and return it. -Works around the fact that Emacs won't allow multiple buffers -visiting the same file." - (let ((fresh-buffer (generate-new-buffer (format " *refs-%s*" path))) - ;; Be defensive against users overriding encoding - ;; configurations (Helpful bugs #75 and #147). - (coding-system-for-read nil) - (file-name-handler-alist - '(("\\(?:\\.dz\\|\\.txz\\|\\.xz\\|\\.lzma\\|\\.lz\\|\\.g?z\\|\\.\\(?:tgz\\|svgz\\|sifz\\)\\|\\.tbz2?\\|\\.bz2\\|\\.Z\\)\\(?:~\\|\\.~[-[:alnum:]:#@^._]+\\(?:~[[:digit:]]+\\)?~\\)?\\'" . - jka-compr-handler) - ("\\(?:^/\\)\\(\\(?:\\(?:\\(-\\|[[:alnum:]]\\{2,\\}\\)\\(?::\\)\\(?:\\([^/:|[:blank:]]+\\)\\(?:@\\)\\)?\\(\\(?:[%._[:alnum:]-]+\\|\\(?:\\[\\)\\(?:\\(?:[[:alnum:]]*:\\)+[.[:alnum:]]*\\)?\\(?:]\\)\\)\\(?:\\(?:#\\)\\(?:[[:digit:]]+\\)\\)?\\)?\\)\\(?:|\\)\\)+\\)?\\(?:\\(-\\|[[:alnum:]]\\{2,\\}\\)\\(?::\\)\\(?:\\([^/:|[:blank:]]+\\)\\(?:@\\)\\)?\\(\\(?:[%._[:alnum:]-]+\\|\\(?:\\[\\)\\(?:\\(?:[[:alnum:]]*:\\)+[.[:alnum:]]*\\)?\\(?:]\\)\\)\\(?:\\(?:#\\)\\(?:[[:digit:]]+\\)\\)?\\)?\\)\\(?::\\)\\([^\n ]*\\'\\)" . tramp-file-name-handler) - ("\\`/:" . file-name-non-special)))) - (with-current-buffer fresh-buffer - (setq-local elisp-refs--path path) - (insert-file-contents path) - ;; We don't enable emacs-lisp-mode because it slows down this - ;; function significantly. We just need the syntax table for - ;; scan-sexps to do the right thing with comments. - (set-syntax-table emacs-lisp-mode-syntax-table)) - fresh-buffer)) - -(defvar elisp-refs--highlighting-buffer - nil - "A temporary buffer used for highlighting. -Since `elisp-refs--syntax-highlight' is a hot function, we -don't want to create lots of temporary buffers.") - -(defun elisp-refs--syntax-highlight (str) - "Apply font-lock properties to a string STR of Emacs lisp code." - ;; Ensure we have a highlighting buffer to work with. - (unless (and elisp-refs--highlighting-buffer - (buffer-live-p elisp-refs--highlighting-buffer)) - (setq elisp-refs--highlighting-buffer - (generate-new-buffer " *refs-highlighting*")) - (with-current-buffer elisp-refs--highlighting-buffer - (delay-mode-hooks (emacs-lisp-mode)))) - - (with-current-buffer elisp-refs--highlighting-buffer - (erase-buffer) - (insert str) - (if (fboundp 'font-lock-ensure) - (font-lock-ensure) - (with-no-warnings - (font-lock-fontify-buffer))) - (buffer-string))) - -(defun elisp-refs--replace-tabs (string) - "Replace tabs in STRING with spaces." - ;; This is important for unindenting, as we may unindent by less - ;; than one whole tab. - (s-replace "\t" (s-repeat tab-width " ") string)) - -(defun elisp-refs--lines (string) - "Return a list of all the lines in STRING. -'a\nb' -> ('a\n' 'b')" - (let ((lines nil)) - (while (> (length string) 0) - (let ((index (s-index-of "\n" string))) - (if index - (progn - (push (substring string 0 (1+ index)) lines) - (setq string (substring string (1+ index)))) - (push string lines) - (setq string "")))) - (nreverse lines))) - -(defun elisp-refs--map-lines (string fn) - "Execute FN for each line in string, and join the result together." - (let ((result nil)) - (dolist (line (elisp-refs--lines string)) - (push (funcall fn line) result)) - (apply #'concat (nreverse result)))) - -(defun elisp-refs--unindent-rigidly (string) - "Given an indented STRING, unindent rigidly until -at least one line has no indent. - -STRING should have a 'elisp-refs-start-pos property. The returned -string will have this property updated to reflect the unindent." - (let* ((lines (s-lines string)) - ;; Get the leading whitespace for each line. - (indents (--map (car (s-match (rx bos (+ whitespace)) it)) - lines)) - (min-indent (-min (--map (length it) indents)))) - (propertize - (elisp-refs--map-lines - string - (lambda (line) (substring line min-indent))) - 'elisp-refs-unindented min-indent))) - -(defun elisp-refs--containing-lines (buffer start-pos end-pos) - "Return a string, all the lines in BUFFER that are between -START-POS and END-POS (inclusive). - -For the characters that are between START-POS and END-POS, -propertize them." - (let (expanded-start-pos expanded-end-pos) - (with-current-buffer buffer - ;; Expand START-POS and END-POS to line boundaries. - (goto-char start-pos) - (beginning-of-line) - (setq expanded-start-pos (point)) - (goto-char end-pos) - (end-of-line) - (setq expanded-end-pos (point)) - - ;; Extract the rest of the line before and after the section we're interested in. - (let* ((before-match (buffer-substring expanded-start-pos start-pos)) - (after-match (buffer-substring end-pos expanded-end-pos)) - ;; Concat the extra text with the actual match, ensuring we - ;; highlight the match as code, but highlight the rest as as - ;; comments. - (text (concat - (propertize before-match - 'face 'font-lock-comment-face) - (elisp-refs--syntax-highlight (buffer-substring start-pos end-pos)) - (propertize after-match - 'face 'font-lock-comment-face)))) - (-> text - (elisp-refs--replace-tabs) - (elisp-refs--unindent-rigidly) - (propertize 'elisp-refs-start-pos expanded-start-pos - 'elisp-refs-path elisp-refs--path)))))) - -(defun elisp-refs--find-file (button) - "Open the file referenced by BUTTON." - (find-file (button-get button 'path)) - (goto-char (point-min))) - -(define-button-type 'elisp-refs-path-button - 'action 'elisp-refs--find-file - 'follow-link t - 'help-echo "Open file") - -(defun elisp-refs--path-button (path) - "Return a button that navigates to PATH." - (with-temp-buffer - (insert-text-button - (abbreviate-file-name path) - :type 'elisp-refs-path-button - 'path path) - (buffer-string))) - -(defun elisp-refs--describe (button) - "Show *Help* for the symbol referenced by BUTTON." - (let ((symbol (button-get button 'symbol)) - (kind (button-get button 'kind))) - (cond ((eq kind 'symbol) - (describe-symbol symbol)) - ((eq kind 'variable) - (describe-variable symbol)) - (t - ;; Emacs uses `describe-function' for functions, macros and - ;; special forms. - (describe-function symbol))))) - -(define-button-type 'elisp-refs-describe-button - 'action 'elisp-refs--describe - 'follow-link t - 'help-echo "Describe") - -(defun elisp-refs--describe-button (symbol kind) - "Return a button that shows *Help* for SYMBOL. -KIND should be 'function, 'macro, 'variable, 'special or 'symbol." - (with-temp-buffer - (insert (symbol-name kind) " ") - (insert-text-button - (symbol-name symbol) - :type 'elisp-refs-describe-button - 'symbol symbol - 'kind kind) - (buffer-string))) - -(defun elisp-refs--pluralize (number thing) - "Human-friendly description of NUMBER occurrences of THING." - (format "%s %s%s" - (elisp-refs--format-int number) - thing - (if (equal number 1) "" "s"))) - -(defun elisp-refs--format-count (symbol ref-count file-count - searched-file-count prefix) - (let* ((file-str (if (zerop file-count) - "" - (format " in %s" (elisp-refs--pluralize file-count "file")))) - (found-str (format "Found %s to %s%s." - (elisp-refs--pluralize ref-count "reference") - symbol - file-str)) - (searched-str (if prefix - (format "Searched %s in %s." - (elisp-refs--pluralize searched-file-count "loaded file") - (elisp-refs--path-button (file-name-as-directory prefix))) - (format "Searched all %s loaded in Emacs." - (elisp-refs--pluralize searched-file-count "file"))))) - (s-word-wrap 70 (format "%s %s" found-str searched-str)))) - -;; TODO: if we have multiple matches on one line, we repeatedly show -;; that line. That's slightly confusing. -(defun elisp-refs--show-results (symbol description results - searched-file-count prefix) - "Given a RESULTS list where each element takes the form \(forms . buffer\), -render a friendly results buffer." - (let ((buf (get-buffer-create (format "*refs: %s*" symbol)))) - (switch-to-buffer buf) - (let ((inhibit-read-only t)) - (erase-buffer) - (save-excursion - ;; Insert the header. - (insert - (elisp-refs--format-count - description - (-sum (--map (length (car it)) results)) - (length results) - searched-file-count - prefix) - "\n\n") - ;; Insert the results. - (--each results - (-let* (((forms . buf) it) - (path (with-current-buffer buf elisp-refs--path))) - (insert - (propertize "File: " 'face 'bold) - (elisp-refs--path-button path) "\n") - (--each forms - (-let [(_ start-pos end-pos) it] - (insert (elisp-refs--containing-lines buf start-pos end-pos) - "\n"))) - (insert "\n"))) - ;; Prepare the buffer for the user. - (elisp-refs-mode))) - ;; Cleanup buffers created when highlighting results. - (when elisp-refs--highlighting-buffer - (kill-buffer elisp-refs--highlighting-buffer)))) - -(defun elisp-refs--loaded-bufs () - "Return a list of open buffers, one for each path in `load-path'." - (mapcar #'elisp-refs--contents-buffer (elisp-refs--loaded-paths))) - -(defun elisp-refs--search-1 (bufs match-fn) - "Call MATCH-FN on each buffer in BUFS, reporting progress -and accumulating results. - -BUFS should be disposable: we make no effort to preserve their -state during searching. - -MATCH-FN should return a list where each element takes the form: -\(form start-pos end-pos)." - (let* (;; Our benchmark suggests we spend a lot of time in GC, and - ;; performance improves if we GC less frequently. - (gc-cons-percentage 0.8) - (total-bufs (length bufs))) - (let ((searched 0) - (forms-and-bufs nil)) - (dolist (buf bufs) - (let* ((matching-forms (funcall match-fn buf))) - ;; If there were any matches in this buffer, push the - ;; matches along with the buffer into our results - ;; list. - (when matching-forms - (push (cons matching-forms buf) forms-and-bufs)) - ;; Give feedback to the user on our progress, because - ;; searching takes several seconds. - (when (and (zerop (mod searched 10)) - elisp-refs-verbose) - (message "Searched %s/%s files" searched total-bufs)) - (cl-incf searched))) - (when elisp-refs-verbose - (message "Searched %s/%s files" total-bufs total-bufs)) - forms-and-bufs))) - -(defun elisp-refs--search (symbol description match-fn &optional path-prefix) - "Find references to SYMBOL in all loaded files; call MATCH-FN on each buffer. -When PATH-PREFIX, limit to loaded files whose path starts with that prefix. - -Display the results in a hyperlinked buffer. - -MATCH-FN should return a list where each element takes the form: -\(form start-pos end-pos)." - (let* ((loaded-paths (elisp-refs--loaded-paths)) - (matching-paths (if path-prefix - (--filter (s-starts-with? path-prefix it) loaded-paths) - loaded-paths)) - (loaded-src-bufs (mapcar #'elisp-refs--contents-buffer matching-paths))) - ;; Use unwind-protect to ensure we always cleanup temporary - ;; buffers, even if the user hits C-g. - (unwind-protect - (progn - (let ((forms-and-bufs - (elisp-refs--search-1 loaded-src-bufs match-fn))) - (elisp-refs--show-results symbol description forms-and-bufs - (length loaded-src-bufs) path-prefix))) - ;; Clean up temporary buffers. - (--each loaded-src-bufs (kill-buffer it))))) - -(defun elisp-refs--completing-read-symbol (prompt &optional filter) - "Read an interned symbol from the minibuffer, -defaulting to the symbol at point. PROMPT is the string to prompt -with. - -If FILTER is given, only offer symbols where (FILTER sym) returns -t." - (let ((filter (or filter (lambda (_) t)))) - (read - (completing-read prompt - (elisp-refs--filter-obarray filter) - nil nil nil nil - (-if-let (sym (thing-at-point 'symbol)) - (when (funcall filter (read sym)) - sym)))))) - -;;; Commands - -;;;###autoload -(defun elisp-refs-function (symbol &optional path-prefix) - "Display all the references to function SYMBOL, in all loaded -elisp files. - -If called with a prefix, prompt for a directory to limit the search. - -This searches for functions, not macros. For that, see -`elisp-refs-macro'." - (interactive - (list (elisp-refs--completing-read-symbol "Function: " #'functionp) - (when current-prefix-arg - (read-directory-name "Limit search to loaded files in: ")))) - (when (not (functionp symbol)) - (if (macrop symbol) - (user-error "%s is a macro. Did you mean elisp-refs-macro?" - symbol) - (user-error "%s is not a function. Did you mean elisp-refs-symbol?" - symbol))) - (elisp-refs--search symbol - (elisp-refs--describe-button symbol 'function) - (lambda (buf) - (elisp-refs--read-and-find buf symbol #'elisp-refs--function-p)) - path-prefix)) - -;;;###autoload -(defun elisp-refs-macro (symbol &optional path-prefix) - "Display all the references to macro SYMBOL, in all loaded -elisp files. - -If called with a prefix, prompt for a directory to limit the search. - -This searches for macros, not functions. For that, see -`elisp-refs-function'." - (interactive - (list (elisp-refs--completing-read-symbol "Macro: " #'macrop) - (when current-prefix-arg - (read-directory-name "Limit search to loaded files in: ")))) - (when (not (macrop symbol)) - (if (functionp symbol) - (user-error "%s is a function. Did you mean elisp-refs-function?" - symbol) - (user-error "%s is not a function. Did you mean elisp-refs-symbol?" - symbol))) - (elisp-refs--search symbol - (elisp-refs--describe-button symbol 'macro) - (lambda (buf) - (elisp-refs--read-and-find buf symbol #'elisp-refs--macro-p)) - path-prefix)) - -;;;###autoload -(defun elisp-refs-special (symbol &optional path-prefix) - "Display all the references to special form SYMBOL, in all loaded -elisp files. - -If called with a prefix, prompt for a directory to limit the search." - (interactive - (list (elisp-refs--completing-read-symbol "Special form: " #'special-form-p) - (when current-prefix-arg - (read-directory-name "Limit search to loaded files in: ")))) - (elisp-refs--search symbol - (elisp-refs--describe-button symbol 'special-form) - (lambda (buf) - (elisp-refs--read-and-find buf symbol #'elisp-refs--special-p)) - path-prefix)) - -;;;###autoload -(defun elisp-refs-variable (symbol &optional path-prefix) - "Display all the references to variable SYMBOL, in all loaded -elisp files. - -If called with a prefix, prompt for a directory to limit the search." - (interactive - ;; This is awkward. We don't want to just offer defvar variables, - ;; because then we can't search for code which uses `let' to bind - ;; symbols. There doesn't seem to be a good way to only offer - ;; variables that have been bound at some point. - (list (elisp-refs--completing-read-symbol "Variable: " ) - (when current-prefix-arg - (read-directory-name "Limit search to loaded files in: ")))) - (elisp-refs--search symbol - (elisp-refs--describe-button symbol 'variable) - (lambda (buf) - (elisp-refs--read-and-find buf symbol #'elisp-refs--variable-p)) - path-prefix)) - -;;;###autoload -(defun elisp-refs-symbol (symbol &optional path-prefix) - "Display all the references to SYMBOL in all loaded elisp files. - -If called with a prefix, prompt for a directory to limit the -search." - (interactive - (list (elisp-refs--completing-read-symbol "Symbol: " ) - (when current-prefix-arg - (read-directory-name "Limit search to loaded files in: ")))) - (elisp-refs--search symbol - (elisp-refs--describe-button symbol 'symbol) - (lambda (buf) - (elisp-refs--read-and-find-symbol buf symbol)) - path-prefix)) - -;;; Mode - -(defvar elisp-refs-mode-map - (let ((map (make-sparse-keymap))) - ;; TODO: it would be nice for TAB to navigate to file buttons too, - ;; like *Help* does. - (set-keymap-parent map special-mode-map) - (define-key map (kbd "") #'elisp-refs-next-match) - (define-key map (kbd "") #'elisp-refs-prev-match) - (define-key map (kbd "n") #'elisp-refs-next-match) - (define-key map (kbd "p") #'elisp-refs-prev-match) - (define-key map (kbd "RET") #'elisp-refs-visit-match) - map) - "Keymap for `elisp-refs-mode'.") - -(define-derived-mode elisp-refs-mode special-mode "Refs" - "Major mode for refs results buffers.") - -(defun elisp--refs-visit-match (open-fn) - "Go to the search result at point. -Open file with function OPEN_FN. `find-file` or `find-file-other-window`" - (interactive) - (let* ((path (get-text-property (point) 'elisp-refs-path)) - (pos (get-text-property (point) 'elisp-refs-start-pos)) - (unindent (get-text-property (point) 'elisp-refs-unindented)) - (column-offset (current-column)) - (line-offset -1)) - (when (null path) - (user-error "No match here")) - - ;; If point is not on the first line of the match, work out how - ;; far away the first line is. - (save-excursion - (while (equal pos (get-text-property (point) 'elisp-refs-start-pos)) - (forward-line -1) - (cl-incf line-offset))) - - (funcall open-fn path) - (goto-char pos) - ;; Move point so we're on the same char in the buffer that we were - ;; on in the results buffer. - (forward-line line-offset) - (beginning-of-line) - (let ((target-offset (+ column-offset unindent)) - (i 0)) - (while (< i target-offset) - (if (looking-at "\t") - (cl-incf i tab-width) - (cl-incf i)) - (forward-char 1))))) - -(defun elisp-refs-visit-match () - "Goto the search result at point." - (interactive) - (elisp--refs-visit-match #'find-file)) - -(defun elisp-refs-visit-match-other-window () - "Goto the search result at point, opening in another window." - (interactive) - (elisp--refs-visit-match #'find-file-other-window)) - - -(defun elisp-refs--move-to-match (direction) - "Move point one match forwards. -If DIRECTION is -1, moves backwards instead." - (let* ((start-pos (point)) - (match-pos (get-text-property start-pos 'elisp-refs-start-pos)) - current-match-pos) - (condition-case _err - (progn - ;; Move forward/backwards until we're on the next/previous match. - (catch 'done - (while t - (setq current-match-pos - (get-text-property (point) 'elisp-refs-start-pos)) - (when (and current-match-pos - (not (equal match-pos current-match-pos))) - (throw 'done nil)) - (forward-char direction))) - ;; Move to the beginning of that match. - (while (equal (get-text-property (point) 'elisp-refs-start-pos) - (get-text-property (1- (point)) 'elisp-refs-start-pos)) - (forward-char -1)) - ;; Move forward until we're on the first char of match within that - ;; line. - (while (or - (looking-at " ") - (eq (get-text-property (point) 'face) - 'font-lock-comment-face)) - (forward-char 1))) - ;; If we're at the last result, don't move point. - (end-of-buffer - (progn - (goto-char start-pos) - (signal 'end-of-buffer nil)))))) - -(defun elisp-refs-prev-match () - "Move to the previous search result in the Refs buffer." - (interactive) - (elisp-refs--move-to-match -1)) - -(defun elisp-refs-next-match () - "Move to the next search result in the Refs buffer." - (interactive) - (elisp-refs--move-to-match 1)) - -(provide 'elisp-refs) -;;; elisp-refs.el ends here diff --git a/.config/emacs/lisp/libs/elisp-refs.elc b/.config/emacs/lisp/libs/elisp-refs.elc deleted file mode 100644 index 168e116..0000000 Binary files a/.config/emacs/lisp/libs/elisp-refs.elc and /dev/null differ diff --git a/.config/emacs/lisp/libs/f.el b/.config/emacs/lisp/libs/f.el deleted file mode 100644 index 1ab08d7..0000000 --- a/.config/emacs/lisp/libs/f.el +++ /dev/null @@ -1,799 +0,0 @@ -;;; f.el --- Modern API for working with files and directories -*- lexical-binding: t; -*- - -;; Copyright (C) 2013 Johan Andersson - -;; Author: Johan Andersson -;; Maintainer: Lucien Cartier-Tilet -;; Version: 0.21.0 -;; Package-Requires: ((emacs "24.1") (s "1.7.0") (dash "2.2.0")) -;; Keywords: files, directories -;; Homepage: http://github.com/rejeep/f.el - -;; This file is NOT part of GNU Emacs. - -;;; License: - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;;; Commentary: -;; -;; Much inspired by magnar's excellent s.el and dash.el, f.el is a -;; modern API for working with files and directories in Emacs. - -;;; Code: - - - -(require 's) -(require 'dash) -(when (version<= "28.1" emacs-version) - (when (< emacs-major-version 29) - (require 'f-shortdoc nil t))) - -(put 'f-guard-error 'error-conditions '(error f-guard-error)) -(put 'f-guard-error 'error-message "Destructive operation outside sandbox") - -(defvar f--guard-paths nil - "List of allowed paths to modify when guarded. - -Do not modify this variable.") - -(defmacro f--destructive (path &rest body) - "If PATH is allowed to be modified, yield BODY. - -If PATH is not allowed to be modified, throw error." - (declare (indent 1)) - `(if f--guard-paths - (if (--any? (or (f-same-p it ,path) - (f-ancestor-of-p it ,path)) f--guard-paths) - (progn ,@body) - (signal 'f-guard-error (list ,path f--guard-paths))) - ,@body)) - - -;;;; Paths - -(defun f-join (&rest args) - "Join ARGS to a single path. - -Be aware if one of the arguments is an absolute path, `f-join' -will discard all the preceeding arguments and make this absolute -path the new root of the generated path." - (let (path - (relative (f-relative-p (car args)))) - (mapc - (lambda (arg) - (setq path (cond ((not path) arg) - ((f-absolute-p arg) - (progn - (setq relative nil) - arg)) - (t (f-expand arg path))))) - args) - (if relative (f-relative path) path))) - -(defun f-split (path) - "Split PATH and return list containing parts." - (let ((parts (split-string path (f-path-separator) 'omit-nulls))) - (if (string= (s-left 1 path) (f-path-separator)) - (push (f-path-separator) parts) - parts))) - -(defun f-expand (path &optional dir) - "Expand PATH relative to DIR (or `default-directory'). -PATH and DIR can be either a directory names or directory file -names. Return a directory name if PATH is a directory name, and -a directory file name otherwise. File name handlers are -ignored." - (let (file-name-handler-alist) - (expand-file-name path dir))) - -(defun f-filename (path) - "Return the name of PATH." - (file-name-nondirectory (directory-file-name path))) - -(defalias 'f-parent 'f-dirname) - -(defun f-dirname (path) - "Return the parent directory to PATH." - (let ((parent (file-name-directory - (directory-file-name (f-expand path default-directory))))) - (unless (f-same-p path parent) - (if (f-relative-p path) - (f-relative parent) - (directory-file-name parent))))) - -(defun f-common-parent (paths) - "Return the deepest common parent directory of PATHS." - (cond - ((not paths) nil) - ((not (cdr paths)) (f-parent (car paths))) - (:otherwise - (let* ((paths (-map 'f-split paths)) - (common (caar paths)) - (re nil)) - (while (and (not (null (car paths))) (--all? (equal (car it) common) paths)) - (setq paths (-map 'cdr paths)) - (push common re) - (setq common (caar paths))) - (cond - ((null re) "") - ((and (= (length re) 1) (f-root-p (car re))) - (f-root)) - (:otherwise - (concat (apply 'f-join (nreverse re)) "/"))))))) - -(defalias 'f-ext 'file-name-extension) - -(defalias 'f-no-ext 'file-name-sans-extension) - -(defun f-swap-ext (path ext) - "Return PATH but with EXT as the new extension. -EXT must not be nil or empty." - (if (s-blank-p ext) - (error "Extension cannot be empty or nil") - (concat (f-no-ext path) "." ext))) - -(defun f-base (path) - "Return the name of PATH, excluding the extension of file." - (f-no-ext (f-filename path))) - -(defalias 'f-relative 'file-relative-name) - -(defalias 'f-short 'abbreviate-file-name) -(defalias 'f-abbrev 'abbreviate-file-name) - -(defun f-long (path) - "Return long version of PATH." - (f-expand path)) - -(defalias 'f-canonical 'file-truename) - -(defun f-slash (path) - "Append slash to PATH unless one already. - -Some functions, such as `call-process' requires there to be an -ending slash." - (if (f-dir-p path) - (file-name-as-directory path) - path)) - -(defun f-full (path) - "Return absolute path to PATH, with ending slash." - (f-slash (f-long path))) - -(defun f--uniquify (paths) - "Helper for `f-uniquify' and `f-uniquify-alist'." - (let* ((files-length (length paths)) - (uniq-filenames (--map (cons it (f-filename it)) paths)) - (uniq-filenames-next (-group-by 'cdr uniq-filenames))) - (while (/= files-length (length uniq-filenames-next)) - (setq uniq-filenames-next - (-group-by 'cdr - (--mapcat - (let ((conf-files (cdr it))) - (if (> (length conf-files) 1) - (--map (cons - (car it) - (concat - (f-filename (s-chop-suffix (cdr it) - (car it))) - (f-path-separator) (cdr it))) - conf-files) - conf-files)) - uniq-filenames-next)))) - uniq-filenames-next)) - -(defun f-uniquify (files) - "Return unique suffixes of FILES. - -This function expects no duplicate paths." - (-map 'car (f--uniquify files))) - -(defun f-uniquify-alist (files) - "Return alist mapping FILES to unique suffixes of FILES. - -This function expects no duplicate paths." - (-map 'cadr (f--uniquify files))) - - -;;;; I/O - -(defun f-read-bytes (path &optional beg end) - "Read binary data from PATH. - -Return the binary data as unibyte string. The optional second -and third arguments BEG and END specify what portion of the file -to read." - (with-temp-buffer - (set-buffer-multibyte nil) - (setq buffer-file-coding-system 'binary) - (insert-file-contents-literally path nil beg end) - (buffer-substring-no-properties (point-min) (point-max)))) - -(defalias 'f-read 'f-read-text) -(defun f-read-text (path &optional coding) - "Read text with PATH, using CODING. - -CODING defaults to `utf-8'. - -Return the decoded text as multibyte string." - (decode-coding-string (f-read-bytes path) (or coding 'utf-8))) - -(defalias 'f-write 'f-write-text) -(defun f-write-text (text coding path) - "Write TEXT with CODING to PATH. - -TEXT is a multibyte string. CODING is a coding system to encode -TEXT with. PATH is a file name to write to." - (f-write-bytes (encode-coding-string text coding) path)) - -(defun f-unibyte-string-p (s) - "Determine whether S is a unibyte string." - (not (multibyte-string-p s))) - -(defun f-write-bytes (data path) - "Write binary DATA to PATH. - -DATA is a unibyte string. PATH is a file name to write to." - (f--write-bytes data path nil)) - -(defalias 'f-append 'f-append-text) -(defun f-append-text (text coding path) - "Append TEXT with CODING to PATH. - -If PATH does not exist, it is created." - (f-append-bytes (encode-coding-string text coding) path)) - -(defun f-append-bytes (data path) - "Append binary DATA to PATH. - -If PATH does not exist, it is created." - (f--write-bytes data path :append)) - -(defun f--write-bytes (data filename append) - "Write binary DATA to FILENAME. -If APPEND is non-nil, append the DATA to the existing contents." - (f--destructive filename - (unless (f-unibyte-string-p data) - (signal 'wrong-type-argument (list 'f-unibyte-string-p data))) - (let ((coding-system-for-write 'binary) - (write-region-annotate-functions nil) - (write-region-post-annotation-function nil)) - (write-region data nil filename append :silent) - nil))) - - -;;;; Destructive - -(defun f-mkdir (&rest dirs) - "Create directories DIRS. - -DIRS should be a successive list of directories forming together -a full path. The easiest way to call this function with a fully -formed path is using `f-split' alongside it: - - (apply #\\='f-mkdir (f-split \"path/to/file\")) - -Although it works sometimes, it is not recommended to use fully -formed paths in the function. In this case, it is recommended to -use `f-mkdir-full-path' instead." - (let (path) - (-each - dirs - (lambda (dir) - (setq path (f-expand dir path)) - (unless (f-directory-p path) - (f--destructive path (make-directory path))))))) - -(defun f-mkdir-full-path (dir) - "Create DIR from a full path. - -This function is similar to `f-mkdir' except it can accept a full -path instead of requiring several successive directory names." - (apply #'f-mkdir (f-split dir))) - -(defun f-delete (path &optional force) - "Delete PATH, which can be file or directory. - -If FORCE is t, a directory will be deleted recursively." - (f--destructive path - (if (or (f-file-p path) (f-symlink-p path)) - (delete-file path) - (delete-directory path force)))) - -(defun f-symlink (source path) - "Create a symlink to SOURCE from PATH." - (f--destructive path (make-symbolic-link source path))) - -(defun f-move (from to) - "Move or rename FROM to TO. -If TO is a directory name, move FROM into TO." - (f--destructive to (rename-file from to t))) - -(defun f-copy (from to) - "Copy file or directory FROM to TO. -If FROM names a directory and TO is a directory name, copy FROM -into TO as a subdirectory." - (f--destructive to - (if (f-file-p from) - (copy-file from to) - ;; The behavior of `copy-directory' differs between Emacs 23 and - ;; 24 in that in Emacs 23, the contents of `from' is copied to - ;; `to', while in Emacs 24 the directory `from' is copied to - ;; `to'. We want the Emacs 24 behavior. - (if (> emacs-major-version 23) - (copy-directory from to) - (if (f-dir-p to) - (progn - (apply 'f-mkdir (f-split to)) - (let ((new-to (f-expand (f-filename from) to))) - (copy-directory from new-to))) - (copy-directory from to)))))) - -(defun f-copy-contents (from to) - "Copy contents in directory FROM, to directory TO." - (unless (f-exists-p to) - (error "Cannot copy contents to non existing directory %s" to)) - (unless (f-dir-p from) - (error "Cannot copy contents as %s is a file" from)) - (--each (f-entries from) - (f-copy it (file-name-as-directory to)))) - -(defun f-touch (path) - "Update PATH last modification date or create if it does not exist." - (f--destructive path - (if (f-file-p path) - (set-file-times path) - (f-write-bytes "" path)))) - - -;;;; Predicates - -(defalias 'f-exists-p 'file-exists-p) -(defalias 'f-exists? 'file-exists-p) - -(defalias 'f-directory-p 'file-directory-p) -(defalias 'f-directory? 'file-directory-p) -(defalias 'f-dir-p 'file-directory-p) -(defalias 'f-dir? 'file-directory-p) - - -(defalias 'f-file-p 'file-regular-p) -(defalias 'f-file? 'file-regular-p) - -(defun f-symlink-p (path) - "Return t if PATH is symlink, false otherwise." - (not (not (file-symlink-p path)))) - -(defalias 'f-symlink? 'f-symlink-p) - -(defalias 'f-readable-p 'file-readable-p) -(defalias 'f-readable? 'file-readable-p) - -(defalias 'f-writable-p 'file-writable-p) -(defalias 'f-writable? 'file-writable-p) - -(defalias 'f-executable-p 'file-executable-p) -(defalias 'f-executable? 'file-executable-p) - -(defalias 'f-absolute-p 'file-name-absolute-p) -(defalias 'f-absolute? 'file-name-absolute-p) - -(defun f-relative-p (path) - "Return t if PATH is relative, false otherwise." - (not (f-absolute-p path))) - -(defalias 'f-relative? 'f-relative-p) - -(defun f-root-p (path) - "Return t if PATH is root directory, false otherwise." - (not (f-parent path))) - -(defalias 'f-root? 'f-root-p) - -(defun f-ext-p (path &optional ext) - "Return t if extension of PATH is EXT, false otherwise. - -If EXT is nil or omitted, return t if PATH has any extension, -false otherwise. - -The extension, in a file name, is the part that follows the last -'.', excluding version numbers and backup suffixes." - (if ext - (string= (f-ext path) ext) - (not (eq (f-ext path) nil)))) - -(defalias 'f-ext? 'f-ext-p) - -(defalias 'f-equal-p 'f-same-p) -(defalias 'f-equal? 'f-same-p) - -(defun f-same-p (path-a path-b) - "Return t if PATH-A and PATH-B are references to same file." - (equal - (f-canonical (directory-file-name (f-expand path-a))) - (f-canonical (directory-file-name (f-expand path-b))))) - -(defalias 'f-same? 'f-same-p) - -(defun f-parent-of-p (path-a path-b) - "Return t if PATH-A is parent of PATH-B." - (--when-let (f-parent path-b) - (f-same-p path-a it))) - -(defalias 'f-parent-of? 'f-parent-of-p) - -(defun f-child-of-p (path-a path-b) - "Return t if PATH-A is child of PATH-B." - (--when-let (f-parent path-a) - (f-same-p it path-b))) - -(defalias 'f-child-of? 'f-child-of-p) - -(defun f-ancestor-of-p (path-a path-b) - "Return t if PATH-A is ancestor of PATH-B." - (unless (f-same-p path-a path-b) - (string-prefix-p (f-full path-a) - (f-full path-b)))) - -(defalias 'f-ancestor-of? 'f-ancestor-of-p) - -(defun f-descendant-of-p (path-a path-b) - "Return t if PATH-A is desendant of PATH-B." - (unless (f-same-p path-a path-b) - (let ((path-a (f-split (f-full path-a))) - (path-b (f-split (f-full path-b))) - (parent-p t)) - (while (and path-b parent-p) - (if (string= (car path-a) (car path-b)) - (setq path-a (cdr path-a) - path-b (cdr path-b)) - (setq parent-p nil))) - parent-p))) - -(defalias 'f-descendant-of? 'f-descendant-of-p) - -(defun f-hidden-p (path &optional behavior) - "Return t if PATH is hidden, nil otherwise. - -BEHAVIOR controls when a path should be considered as hidden -depending on its value. Beware, if PATH begins with \"./\", the -current dir \".\" will not be considered as hidden. - -When BEHAVIOR is nil, it will only check if the path begins with -a dot, as in .a/b/c, and return t if there is one. This is the -old behavior of f.el left as default for backward-compatibility -purposes. - -When BEHAVIOR is ANY, return t if any of the elements of PATH is -hidden, nil otherwise. - -When BEHAVIOR is LAST, return t only if the last element of PATH -is hidden, nil otherwise. - -TODO: Hidden directories and files on Windows are marked -differently than on *NIX systems. This should be properly -implemented." - (let ((split-path (f-split path)) - (check-hidden (lambda (elt) - (and (string= (substring elt 0 1) ".") - (not (member elt '("." ".."))))))) - (pcase behavior - ('any (-any check-hidden split-path)) - ('last (apply check-hidden (last split-path))) - (otherwise (if (null otherwise) - (funcall check-hidden (car split-path)) - (error "Invalid value %S for argument BEHAVIOR" otherwise)))))) - -(defalias 'f-hidden? 'f-hidden-p) - -(defun f-empty-p (path) - "If PATH is a file, return t if the file in PATH is empty, nil otherwise. -If PATH is directory, return t if directory has no files, nil otherwise." - (if (f-directory-p path) - (equal (f-files path nil t) nil) - (= (f-size path) 0))) - -(defalias 'f-empty? 'f-empty-p) - - -;;;; Stats - -(defun f-size (path) - "Return size of PATH. - -If PATH is a file, return size of that file. If PATH is -directory, return sum of all files in PATH." - (if (f-directory-p path) - (-sum (-map 'f-size (f-files path nil t))) - (nth 7 (file-attributes path)))) - -(defun f-depth (path) - "Return the depth of PATH. - -At first, PATH is expanded with `f-expand'. Then the full path is used to -detect the depth. -'/' will be zero depth, '/usr' will be one depth. And so on." - (- (length (f-split (f-expand path))) 1)) - -;; For Emacs 28 and below, forward-declare ‘current-time-list’, which was -;; introduced in Emacs 29. -(defvar current-time-list) - -(defun f--get-time (path timestamp-p fn) - "Helper function, get time-related information for PATH. -Helper for `f-change-time', `f-modification-time', -`f-access-time'. It is meant to be called internally, avoid -calling it manually unless you have to. - -If TIMESTAMP-P is non-nil, return the date requested as a -timestamp. If the value is \\='seconds, return the timestamp as -a timestamp with a one-second precision. Otherwise, the -timestamp is returned in a (TICKS . HZ) format, see -`current-time' if using Emacs 29 or newer. - -Otherwise, if TIMESTAMP-P is nil, return the default style of -`current-time'. - -FN is the function specified by the caller function to retrieve -the correct data from PATH." - (let* ((current-time-list (not timestamp-p)) - (date (apply fn (list (file-attributes path)))) - (emacs29-or-newer-p (version<= "29" emacs-version))) - (cond - ((and (eq timestamp-p 'seconds) emacs29-or-newer-p) - (/ (car date) (cdr date))) - ((or (and (not (eq timestamp-p 'seconds)) emacs29-or-newer-p) - (and (not timestamp-p) (not emacs29-or-newer-p))) - date) - ((and (eq timestamp-p 'seconds) (not emacs29-or-newer-p)) - (+ (* (nth 0 date) (expt 2 16)) - (nth 1 date))) - ((and timestamp-p (not emacs29-or-newer-p)) - `(,(+ (* (nth 0 date) (expt 2 16) 1000) - (* (nth 1 date) 1000) - (nth 3 date)) - . 1000))))) - -(defun f-change-time (path &optional timestamp-p) - "Return the last status change time of PATH. - -The status change time (ctime) of PATH in the same format as -`current-time'. For details on TIMESTAMP-P and the format of the -returned value, see `f--get-time'." - (f--get-time path - timestamp-p - (if (fboundp 'file-attribute-status-change-time) - #'file-attribute-status-change-time - (lambda (f) (nth 6 f))))) - -(defun f-modification-time (path &optional timestamp-p) - "Return the last modification time of PATH. -The modification time (mtime) of PATH in the same format as -`current-time'. For details on TIMESTAMP-P and the format of the -returned value, see `f--get-time'." - (f--get-time path - timestamp-p - (if (fboundp 'file-attribute-modification-time) - #'file-attribute-modification-time - (lambda (f) (nth 5 f))))) - -(defun f-access-time (path &optional timestamp-p) - "Return the last access time of PATH. -The access time (atime) of PATH is in the same format as -`current-time'. For details on TIMESTAMP-P and the format of the -returned value, see `f--get-time'." - (f--get-time path - timestamp-p - (if (fboundp 'file-attribute-access-time) - #'file-attribute-access-time - (lambda (f) (nth 4 f))))) - -(defun f--three-way-compare (a b) - "Three way comparison. - -Return -1 if A < B. -Return 0 if A = B. -Return 1 if A > B." - (cond ((< a b) -1) - ((= a b) 0) - ((> a b) 1))) - -;; TODO: How to properly test this function? -(defun f--date-compare (file other method) - "Three-way comparison of the date of FILE and OTHER. - -This function can return three values: -* 1 means FILE is newer than OTHER -* 0 means FILE and NEWER share the same date -* -1 means FILE is older than OTHER - -The statistics used for the date comparison depends on METHOD. -When METHOD is null, compare their modification time. Otherwise, -compare their change time when METHOD is \\='change, or compare -their last access time when METHOD is \\='access." - (let* ((fn-method (cond - ((eq 'change method) #'f-change-time) - ((eq 'access method) #'f-access-time) - ((null method) #'f-modification-time) - (t (error "Unknown method %S" method)))) - (date-file (apply fn-method (list file))) - (date-other (apply fn-method (list other))) - (dates (-zip-pair date-file date-other))) - (-reduce-from (lambda (acc elt) - (if (= acc 0) - (f--three-way-compare (car elt) (cdr elt)) - acc)) - 0 - dates))) - -(defun f-older-p (file other &optional method) - "Compare if FILE is older than OTHER. - -For more info on METHOD, see `f--date-compare'." - (< (f--date-compare file other method) 0)) - -(defalias 'f-older? #'f-older-p) - -(defun f-newer-p (file other &optional method) - "Compare if FILE is newer than OTHER. - -For more info on METHOD, see `f--date-compare'." - (> (f--date-compare file other method) 0)) - -(defalias 'f-newer? #'f-newer-p) - -(defun f-same-time-p (file other &optional method) - "Check if FILE and OTHER share the same access or modification time. - -For more info on METHOD, see `f--date-compare'." - (= (f--date-compare file other method) 0)) - -(defalias 'f-same-time? #'f-same-time-p) - - -;;;; Misc - -(defun f-this-file () - "Return path to this file." - (cond - (load-in-progress load-file-name) - ((and (boundp 'byte-compile-current-file) byte-compile-current-file) - byte-compile-current-file) - (:else (buffer-file-name)))) - -(defvar f--path-separator nil - "A variable to cache result of `f-path-separator'.") - -(defun f-path-separator () - "Return path separator." - (or f--path-separator - (setq f--path-separator (substring (f-join "x" "y") 1 2)))) - -(defun f-glob (pattern &optional path) - "Find PATTERN in PATH." - (file-expand-wildcards - (f-join (or path default-directory) pattern))) - -(defun f--collect-entries (path recursive) - (let (result - (entries - (-reject - (lambda (file) - (member (f-filename file) '("." ".."))) - (directory-files path t)))) - (cond (recursive - (mapc - (lambda (entry) - (if (f-file-p entry) - (setq result (cons entry result)) - (when (f-directory-p entry) - (setq result (cons entry result)) - (if (f-readable-p entry) - (setq result (append result (f--collect-entries entry recursive))) - result)))) - entries)) - (t (setq result entries))) - result)) - -(defmacro f--entries (path body &optional recursive) - "Anaphoric version of `f-entries'." - `(f-entries - ,path - (lambda (path) - (let ((it path)) - ,body)) - ,recursive)) - -(defun f-entries (path &optional fn recursive) - "Find all files and directories in PATH. - -FN - called for each found file and directory. If FN returns a thruthy -value, file or directory will be included. -RECURSIVE - Search for files and directories recursive." - (let ((entries (f--collect-entries path recursive))) - (if fn (-select fn entries) entries))) - -(defmacro f--directories (path body &optional recursive) - "Anaphoric version of `f-directories'." - `(f-directories - ,path - (lambda (path) - (let ((it path)) - ,body)) - ,recursive)) - -(defun f-directories (path &optional fn recursive) - "Find all directories in PATH. See `f-entries'." - (let ((directories (-select 'f-directory-p (f--collect-entries path recursive)))) - (if fn (-select fn directories) directories))) - -(defmacro f--files (path body &optional recursive) - "Anaphoric version of `f-files'." - `(f-files - ,path - (lambda (path) - (let ((it path)) - ,body)) - ,recursive)) - -(defun f-files (path &optional fn recursive) - "Find all files in PATH. See `f-entries'." - (let ((files (-select 'f-file-p (f--collect-entries path recursive)))) - (if fn (-select fn files) files))) - -(defmacro f--traverse-upwards (body &optional path) - "Anaphoric version of `f-traverse-upwards'." - `(f-traverse-upwards - (lambda (dir) - (let ((it dir)) - ,body)) - ,path)) - -(defun f-traverse-upwards (fn &optional path) - "Traverse up as long as FN return nil, starting at PATH. - -If FN returns a non-nil value, the path sent as argument to FN is -returned. If no function callback return a non-nil value, nil is -returned." - (unless path - (setq path default-directory)) - (when (f-relative-p path) - (setq path (f-expand path))) - (if (funcall fn path) - path - (unless (f-root-p path) - (f-traverse-upwards fn (f-parent path))))) - -(defun f-root () - "Return absolute root." - (f-traverse-upwards 'f-root-p)) - -(defmacro f-with-sandbox (path-or-paths &rest body) - "Only allow PATH-OR-PATHS and descendants to be modified in BODY." - (declare (indent 1)) - `(let ((paths (if (listp ,path-or-paths) - ,path-or-paths - (list ,path-or-paths)))) - (unwind-protect - (let ((f--guard-paths paths)) - ,@body) - (setq f--guard-paths nil)))) - -(provide 'f) - -;;; f.el ends here diff --git a/.config/emacs/lisp/libs/f.elc b/.config/emacs/lisp/libs/f.elc deleted file mode 100644 index b2f72b0..0000000 Binary files a/.config/emacs/lisp/libs/f.elc and /dev/null differ diff --git a/.config/emacs/lisp/libs/ht.el b/.config/emacs/lisp/libs/ht.el deleted file mode 100644 index a85f9ff..0000000 --- a/.config/emacs/lisp/libs/ht.el +++ /dev/null @@ -1,354 +0,0 @@ -;;; ht.el --- The missing hash table library for Emacs -*- lexical-binding: t; -*- - -;; Copyright (C) 2013 Wilfred Hughes - -;; Author: Wilfred Hughes -;; Version: 2.4 -;; Keywords: hash table, hash map, hash -;; Package-Requires: ((dash "2.12.0")) - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; The missing hash table library for Emacs. -;; -;; See documentation at https://github.com/Wilfred/ht.el - -;;; Code: - -(require 'dash) -(require 'gv) -(eval-when-compile - (require 'inline)) - -(defmacro ht (&rest pairs) - "Create a hash table with the key-value pairs given. -Keys are compared with `equal'. - -\(fn (KEY-1 VALUE-1) (KEY-2 VALUE-2) ...)" - (let* ((table-symbol (make-symbol "ht-temp")) - (assignments - (mapcar - (lambda (pair) `(ht-set! ,table-symbol ,@pair)) - pairs))) - `(let ((,table-symbol (ht-create))) - ,@assignments - ,table-symbol))) - -(define-inline ht-set! (table key value) - "Associate KEY in TABLE with VALUE." - (inline-quote - (prog1 nil - (puthash ,key ,value ,table)))) - -(defalias 'ht-set 'ht-set!) - -(define-inline ht-create (&optional test) - "Create an empty hash table. - -TEST indicates the function used to compare the hash -keys. Default is `equal'. It can be `eq', `eql', `equal' or a -user-supplied test created via `define-hash-table-test'." - (declare (side-effect-free t)) - (inline-quote (make-hash-table :test (or ,test 'equal)))) - -(defun ht<-alist (alist &optional test) - "Create a hash table with initial values according to ALIST. - -TEST indicates the function used to compare the hash -keys. Default is `equal'. It can be `eq', `eql', `equal' or a -user-supplied test created via `define-hash-table-test'." - (declare (side-effect-free t)) - (let ((h (ht-create test))) - ;; the first key-value pair in an alist gets precedence, so we - ;; start from the end of the list: - (dolist (pair (reverse alist) h) - (let ((key (car pair)) - (value (cdr pair))) - (ht-set! h key value))))) - -(defalias 'ht-from-alist 'ht<-alist) - -(defun ht<-plist (plist &optional test) - "Create a hash table with initial values according to PLIST. - -TEST indicates the function used to compare the hash -keys. Default is `equal'. It can be `eq', `eql', `equal' or a -user-supplied test created via `define-hash-table-test'." - (declare (side-effect-free t)) - (let ((h (ht-create test))) - (dolist (pair (nreverse (-partition 2 plist)) h) - (let ((key (car pair)) - (value (cadr pair))) - (ht-set! h key value))))) - -(defalias 'ht-from-plist 'ht<-plist) - -(define-inline ht-get (table key &optional default) - "Look up KEY in TABLE, and return the matching value. -If KEY isn't present, return DEFAULT (nil if not specified)." - (declare (side-effect-free t)) - (inline-quote - (gethash ,key ,table ,default))) - -;; Don't use `ht-set!' here, gv setter was assumed to return the value -;; to be set. -(gv-define-setter ht-get (value table key) `(puthash ,key ,value ,table)) - -(define-inline ht-get* (table &rest keys) - "Look up KEYS in nested hash tables, starting with TABLE. -The lookup for each key should return another hash table, except -for the final key, which may return any value." - (declare (side-effect-free t)) - (inline-letevals (table keys) - (inline-quote - (progn - (while ,keys - (setf ,table (ht-get ,table (pop ,keys)))) - ,table)))) - -(put 'ht-get* 'compiler-macro - (lambda (_ table &rest keys) - (--reduce-from `(ht-get ,acc ,it) table keys))) - -(defun ht-update! (table from-table) - "Update TABLE according to every key-value pair in FROM-TABLE." - (maphash - (lambda (key value) (puthash key value table)) - from-table) - nil) - -(defalias 'ht-update 'ht-update!) - -(define-inline ht-update-with! (table key updater &optional default) - "Update the value of KEY in TABLE with UPDATER. -If the value does not exist, do nothing, unless DEFAULT is -non-nil, in which case act as if the value is DEFAULT. - -UPDATER receives one argument, the value, and its return value -becomes the new value of KEY." - (inline-quote - (let* ((not-found-symbol (make-symbol "ht--not-found")) - (v (gethash ,key ,table - (or ,default not-found-symbol)))) - (unless (eq v not-found-symbol) - (prog1 nil - (puthash ,key (funcall ,updater v) ,table)))))) - -(defun ht-merge (&rest tables) - "Crete a new table that includes all the key-value pairs from TABLES. -If multiple tables have the same key, the value in the last -table is used." - (let ((merged (ht-create))) - (mapc (lambda (table) (ht-update! merged table)) tables) - merged)) - -(define-inline ht-remove! (table key) - "Remove KEY from TABLE." - (inline-quote (remhash ,key ,table))) - -(defalias 'ht-remove 'ht-remove!) - -(define-inline ht-clear! (table) - "Remove all keys from TABLE." - (inline-quote - (prog1 nil - (clrhash ,table)))) - -(defalias 'ht-clear 'ht-clear!) - -(defun ht-map (function table) - "Apply FUNCTION to each key-value pair of TABLE, and make a list of the results. -FUNCTION is called with two arguments, KEY and VALUE." - (let (results) - (maphash - (lambda (key value) - (push (funcall function key value) results)) - table) - results)) - -(defmacro ht-amap (form table) - "Anaphoric version of `ht-map'. -For every key-value pair in TABLE, evaluate FORM with the -variables KEY and VALUE bound. If you don't use both of -these variables, then use `ht-map' to avoid warnings." - `(ht-map (lambda (key value) ,form) ,table)) - -(defun ht-keys (table) - "Return a list of all the keys in TABLE." - (declare (side-effect-free t)) - (ht-map (lambda (key _value) key) table)) - -(defun ht-values (table) - "Return a list of all the values in TABLE." - (declare (side-effect-free t)) - (ht-map (lambda (_key value) value) table)) - -(defun ht-items (table) - "Return a list of two-element lists \\='(key value) from TABLE." - (declare (side-effect-free t)) - (ht-amap (list key value) table)) - -(defalias 'ht-each 'maphash - "Apply FUNCTION to each key-value pair of TABLE. -Returns nil, used for side-effects only.") - -(defmacro ht-aeach (form table) - "Anaphoric version of `ht-each'. -For every key-value pair in TABLE, evaluate FORM with the -variables key and value bound." - `(ht-each (lambda (key value) ,form) ,table)) - -(defun ht-select-keys (table keys) - "Return a copy of TABLE with only the specified KEYS." - (declare (side-effect-free t)) - (let ((not-found-symbol (make-symbol "ht--not-found")) - result) - (setq result (make-hash-table :test (hash-table-test table))) - (dolist (key keys result) - (if (not (equal (gethash key table not-found-symbol) not-found-symbol)) - (puthash key (gethash key table) result))))) - -(defun ht->plist (table) - "Return a flat list \\='(key1 value1 key2 value2...) from TABLE. - -Note that hash tables are unordered, so this cannot be an exact -inverse of `ht<-plist'. The following is not guaranteed: - -\(let ((data \\='(a b c d))) - (equalp data - (ht->plist (ht<-plist data))))" - (declare (side-effect-free t)) - (apply 'append (ht-items table))) - -(defalias 'ht-to-plist 'ht->plist) - -(define-inline ht-copy (table) - "Return a shallow copy of TABLE (keys and values are shared)." - (declare (side-effect-free t)) - (inline-quote (copy-hash-table ,table))) - -(defun ht->alist (table) - "Return a list of two-element lists \\='(key . value) from TABLE. - -Note that hash tables are unordered, so this cannot be an exact -inverse of `ht<-alist'. The following is not guaranteed: - -\(let ((data \\='((a . b) (c . d)))) - (equalp data - (ht->alist (ht<-alist data))))" - (declare (side-effect-free t)) - (ht-amap (cons key value) table)) - -(defalias 'ht-to-alist 'ht->alist) - -(defalias 'ht? 'hash-table-p) - -(defalias 'ht-p 'hash-table-p) - -(define-inline ht-contains? (table key) - "Return \\='t if TABLE contains KEY." - (declare (side-effect-free t)) - (inline-quote - (let ((not-found-symbol (make-symbol "ht--not-found"))) - (not (eq (ht-get ,table ,key not-found-symbol) not-found-symbol))))) - -(defalias 'ht-contains-p 'ht-contains?) - -(define-inline ht-size (table) - "Return the actual number of entries in TABLE." - (declare (side-effect-free t)) - (inline-quote - (hash-table-count ,table))) - -(define-inline ht-empty? (table) - "Return true if the actual number of entries in TABLE is zero." - (declare (side-effect-free t)) - (inline-quote - (zerop (ht-size ,table)))) - -(defalias 'ht-empty-p 'ht-empty?) - -(defun ht-select (function table) - "Return a hash table containing all entries in TABLE for which -FUNCTION returns a truthy value. - -FUNCTION is called with two arguments, KEY and VALUE." - (let ((results (ht-create))) - (ht-each - (lambda (key value) - (when (funcall function key value) - (ht-set! results key value))) - table) - results)) - -(defun ht-reject (function table) - "Return a hash table containing all entries in TABLE for which -FUNCTION returns a falsy value. - -FUNCTION is called with two arguments, KEY and VALUE." - (let ((results (ht-create))) - (ht-each - (lambda (key value) - (unless (funcall function key value) - (ht-set! results key value))) - table) - results)) - -(defun ht-reject! (function table) - "Delete entries from TABLE for which FUNCTION returns non-nil. - -FUNCTION is called with two arguments, KEY and VALUE." - (ht-each - (lambda (key value) - (when (funcall function key value) - (remhash key table))) - table) - nil) - -(defalias 'ht-delete-if 'ht-reject!) - -(defun ht-find (function table) - "Return (key, value) from TABLE for which FUNCTION returns a truthy value. -Return nil otherwise. - -FUNCTION is called with two arguments, KEY and VALUE." - (catch 'break - (ht-each - (lambda (key value) - (when (funcall function key value) - (throw 'break (list key value)))) - table))) - -(defun ht-equal? (table1 table2) - "Return t if TABLE1 and TABLE2 have the same keys and values. -Does not compare equality predicates." - (declare (side-effect-free t)) - (let ((keys1 (ht-keys table1)) - (keys2 (ht-keys table2)) - (sentinel (make-symbol "ht-sentinel"))) - (and (equal (length keys1) (length keys2)) - (--all? - (if (ht-p (ht-get table1 it)) - (ht-equal-p (ht-get table1 it) - (ht-get table2 it)) - (equal (ht-get table1 it) - (ht-get table2 it sentinel))) - keys1)))) - -(defalias 'ht-equal-p 'ht-equal?) - -(provide 'ht) -;;; ht.el ends here diff --git a/.config/emacs/lisp/libs/ht.elc b/.config/emacs/lisp/libs/ht.elc deleted file mode 100644 index 74a6a61..0000000 Binary files a/.config/emacs/lisp/libs/ht.elc and /dev/null differ diff --git a/.config/emacs/lisp/libs/llama.el b/.config/emacs/lisp/libs/llama.el deleted file mode 100644 index 4bddfe6..0000000 --- a/.config/emacs/lisp/libs/llama.el +++ /dev/null @@ -1,572 +0,0 @@ -;;; llama.el --- Compact syntax for short lambda -*- lexical-binding:t -*- - -;; Copyright (C) 2020-2026 Jonas Bernoulli - -;; Author: Jonas Bernoulli -;; Homepage: https://github.com/tarsius/llama -;; Keywords: extensions - -;; Package-Version: 1.0.5 -;; Package-Requires: ( -;; (emacs "26.1") -;; (compat "31.0")) - -;; SPDX-License-Identifier: GPL-3.0-or-later - -;; This file is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation, either version 3 of the License, -;; or (at your option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this file. If not, see . - -;;; Commentary: - -;; This package implements a macro named `##', which provides a compact way -;; to write short `lambda' expressions. - -;; The signature of the macro is (## FN &rest BODY) and it expands to a -;; `lambda' expression, which calls the function FN with the arguments BODY -;; and returns the value of that. The arguments of the `lambda' expression -;; are derived from symbols found in BODY. - -;; Each symbol from `%1' through `%9', which appears in an unquoted part -;; of BODY, specifies a mandatory argument. Each symbol from `&1' through -;; `&9', which appears in an unquoted part of BODY, specifies an optional -;; argument. The symbol `&*' specifies extra (`&rest') arguments. - -;; The shorter symbol `%' can be used instead of `%1', but using both in -;; the same expression is not allowed. Likewise `&' can be used instead -;; of `&1'. These shorthands are not recognized in function position. - -;; To support binding forms that use a vector as VARLIST (such as `-let' -;; from the `dash' package), argument symbols are also detected inside of -;; vectors. - -;; The space between `##' and FN can be omitted because `##' is read-syntax -;; for the symbol whose name is the empty string. If you prefer you can -;; place a space there anyway, and if you prefer to not use this somewhat -;; magical symbol at all, you can instead use the alternative name `llama'. - -;; Instead of: -;; -;; (lambda (a &optional _ c &rest d) -;; (foo a (bar c) d)) -;; -;; you can use this macro and write: -;; -;; (##foo %1 (bar &3) &*) -;; -;; which expands to: -;; -;; (lambda (%1 &optional _&2 &3 &rest &*) -;; (foo %1 (bar &3) &*)) - -;; Unused trailing arguments and mandatory unused arguments at the border -;; between mandatory and optional arguments are also supported: -;; -;; (##list %1 _%3 &5 _&6) -;; -;; becomes: -;; -;; (lambda (%1 _%2 _%3 &optional _&4 &5 _&6) -;; (list %1 &5)) -;; -;; Note how `_%3' and `_&6' are removed from the body, because their names -;; begin with an underscore. Also note that `_&4' is optional, unlike the -;; explicitly specified `_%3'. - -;; Consider enabling `llama-fontify-mode' to highlight `##' and its -;; special arguments. - -;;; Code: - -(require 'compat) - -;;;###autoload -(defmacro llama (fn &rest body) - "Expand to a `lambda' expression that wraps around FN and BODY. - -This macro provides a compact way to write short `lambda' expressions. -It expands to a `lambda' expression, which calls the function FN with -arguments BODY and returns its value. The arguments of the `lambda' -expression are derived from symbols found in BODY. - -Each symbol from `%1' through `%9', which appears in an unquoted part -of BODY, specifies a mandatory argument. Each symbol from `&1' through -`&9', which appears in an unquoted part of BODY, specifies an optional -argument. The symbol `&*' specifies extra (`&rest') arguments. - -The shorter symbol `%' can be used instead of `%1', but using both in -the same expression is not allowed. Likewise `&' can be used instead -of `&1'. These shorthands are not recognized in function position. - -To support binding forms that use a vector as VARLIST (such as `-let' -from the `dash' package), argument symbols are also detected inside of -vectors. - -The space between `##' and FN can be omitted because `##' is read-syntax -for the symbol whose name is the empty string. If you prefer you can -place a space there anyway, and if you prefer to not use this somewhat -magical symbol at all, you can instead use the alternative name `llama'. - -Instead of: - - (lambda (a &optional _ c &rest d) - (foo a (bar c) d)) - -you can use this macro and write: - - (##foo %1 (bar &3) &*) - -which expands to: - - (lambda (%1 &optional _&2 &3 &rest &*) - (foo %1 (bar &3) &*)) - -Unused trailing arguments and mandatory unused arguments at the border -between mandatory and optional arguments are also supported: - - (##list %1 _%3 &5 _&6) - -becomes: - - (lambda (%1 _%2 _%3 &optional _&4 &5 _&6) - (list %1 &5)) - -Note how `_%3' and `_&6' are removed from the body, because their names -begin with an underscore. Also note that `_&4' is optional, unlike the -explicitly specified `_%3'. - -Consider enabling `llama-fontify-mode' to highlight `##' and its -special arguments." - (cond ((symbolp fn)) - ((and (eq (car-safe fn) backquote-backquote-symbol) - (not body)) - (setq body (cdr fn)) - (setq fn backquote-backquote-symbol)) - ((signal 'wrong-type-argument - (list 'symbolp backquote-backquote-symbol fn)))) - (let* ((args (make-vector 10 nil)) - (body (cdr (llama--collect (cons fn body) args))) - (rest (aref args 0)) - (args (nreverse (cdr (append args nil)))) - (args (progn (while (and args (null (car args))) - (setq args (cdr args))) - args)) - (pos (length args)) - (opt nil) - (args (mapcar - (lambda (arg) - (if arg - (setq opt (string-match-p "\\`_?&" (symbol-name arg))) - (setq arg (intern (format "_%c%s" (if opt ?& ?%) pos)))) - (setq pos (1- pos)) - arg) - args)) - (opt nil) - (args (mapcar - (lambda (symbol) - (cond - ((string-match-p "\\`_?%" (symbol-name symbol)) - (when opt - (error "`%s' cannot follow optional arguments" symbol)) - (list symbol)) - (opt - (list symbol)) - ((setq opt t) - (list '&optional symbol)))) - (nreverse args)))) - `(lambda - (,@(apply #'nconc args) - ,@(and rest (list '&rest rest))) - (,fn ,@body)))) - -(defalias (intern "") 'llama) -(defalias '\#\# 'llama) - -(defconst llama--unused-argument (make-symbol "llama--unused-argument")) - -(defun llama--collect (expr args &optional fnpos backquoted unquote) - (cond - ((memq (car-safe expr) (list (intern "") 'llama 'quote)) expr) - ((and backquoted (symbolp expr)) expr) - ((and backquoted - (memq (car-safe expr) - (list backquote-unquote-symbol - backquote-splice-symbol))) - (list (car expr) - (llama--collect (cadr expr) args nil nil t))) - ((memq (car-safe expr) - (list backquote-backquote-symbol - backquote-splice-symbol)) - (list (car expr) - (llama--collect (cadr expr) args nil t))) - ((symbolp expr) - (let ((name (symbol-name expr))) - (save-match-data - (cond - ((string-match "\\`\\(_\\)?[%&]\\([1-9*]\\)?\\'" name) - (let* ((pos (match-string 2 name)) - (pos (cond ((equal pos "*") 0) - ((not pos) 1) - ((string-to-number pos)))) - (sym (aref args pos))) - (unless (and fnpos (not unquote) (memq expr '(% &))) - (when (and sym (not (equal expr sym))) - (error "`%s' and `%s' are mutually exclusive" sym expr)) - (aset args pos expr))) - (if (match-string 1 name) - llama--unused-argument - expr)) - (expr))))) - ((or (listp expr) - (vectorp expr)) - (let* ((vectorp (vectorp expr)) - (expr (if vectorp (append expr ()) expr)) - (fnpos (and (not vectorp) - (not backquoted) - (ignore-errors (length expr)))) ;proper-list-p - (ret ())) - (catch t - (while t - (let ((elt (llama--collect (car expr) args fnpos backquoted))) - (unless (eq elt llama--unused-argument) - (push elt ret))) - (setq fnpos nil) - (setq expr (cdr expr)) - (unless (and expr - (listp expr) - (not (eq (car expr) backquote-unquote-symbol))) - (throw t nil)))) - (setq ret (nreverse ret)) - (when expr - (setcdr (last ret) (llama--collect expr args nil backquoted))) - (if vectorp (vconcat ret) ret))) - (expr))) - -;;; Completion - -(define-advice elisp--expect-function-p (:around (fn pos) llama) - "Support function completion directly following `##'." - (or (and (eq (char-before pos) ?#) - (eq (char-before (- pos 1)) ?#)) - (and (eq (char-before pos) ?\s) - (eq (char-before (- pos 1)) ?#) - (eq (char-before (- pos 2)) ?#)) - (funcall fn pos))) - -(define-advice all-completions (:around (fn str table &rest rest) llama) - "Remove empty symbol from completion results if originating from `llama'. - -`##' is the notation for the symbol whose name is the empty string. - (intern \"\") => ## - (symbol-name \\='##) => \"\" - -The `llama' package uses `##' as the name of a macro, which allows -it to be used akin to syntax, without actually being new syntax. -\(`describe-function' won't let you select `##', but because that is an -alias for `llama', you can access the documentation under that name.) - -This advice prevents the empty string from being offered as a completion -candidate when `obarray' or a completion table that internally uses -that is used as TABLE." - (let ((result (apply fn str table rest))) - (if (and (eq obarray table) (equal str "")) - (delete "" result) - result))) - -;;; Fontification - -(defgroup llama () - "Compact syntax for short lambda." - :group 'extensions - :group 'faces - :group 'lisp) - -(defface llama-\#\#-macro '((t :inherit font-lock-function-call-face)) - "Face used for the name of the `##' macro.") - -(defface llama-llama-macro '((t :inherit font-lock-keyword-face)) - "Face used for the name of the `llama' macro.") - -(defface llama-mandatory-argument '((t :inherit font-lock-variable-use-face)) - "Face used for mandatory arguments `%1' through `%9' and `%'.") - -(defface llama-optional-argument '((t :inherit font-lock-type-face)) - "Face used for optional arguments `&1' through `&9', `&' and `&*'.") - -(defface llama-deleted-argument - `((((supports :box t)) - :box ( :line-width ,(if (>= emacs-major-version 28) (cons -1 -1) -1) - :color "red" - :style nil)) - (((supports :underline t)) - :underline "red") - (t - :inherit font-lock-warning-face)) - "Face used for deleted arguments `_%1'...`_%9', `_&1'...`_&9' and `_&*'. -This face is used in addition to one of llama's other argument faces. -Unlike implicit unused arguments (which do not appear in the function -body), these arguments are deleted from the function body during macro -expansion, and the looks of this face should hint at that.") - -(defconst llama-font-lock-keywords-28 - '(("(\\(##\\)" 1 'llama-\#\#-macro) - ("(\\(llama\\)\\_>" 1 'llama-llama-macro) - ("\\_<\\(?:_?%[1-9]?\\)\\_>" - 0 (llama--maybe-face 'llama-mandatory-argument)) - ("\\_<\\(?:_?&[1-9*]?\\)\\_>" - 0 (llama--maybe-face 'llama-optional-argument)) - ("\\_<\\(?:_\\(?:%[1-9]?\\|&[1-9*]?\\)\\)\\_>" - 0 'llama-deleted-argument prepend))) - -(defconst llama-font-lock-keywords-29 - `(("\\_<\\(&[1-9*]?\\)\\_>" 1 'default) - (,(apply-partially #'llama--match-and-fontify "(\\(##\\)") - 1 'llama-\#\#-macro) - (,(apply-partially #'llama--match-and-fontify "(\\(llama\\_>\\)") - 1 'llama-llama-macro))) - -(defvar llama-font-lock-keywords - (if (fboundp 'read-positioning-symbols) - llama-font-lock-keywords-29 - llama-font-lock-keywords-28)) - -(defun llama--maybe-face (face) - (and (not (and (member (match-string 0) '("%" "&")) - (and-let* ((beg (ignore-errors - (scan-lists (match-beginning 0) -1 1)))) - (string-match-p "\\`\\(##\\|llama\\_>\\)?[\s\t\n\r]*\\'" - (buffer-substring-no-properties - (1+ beg) (match-beginning 0)))))) - face)) - -(defun llama--match-and-fontify (re end) - (static-if (fboundp 'bare-symbol) - (and (re-search-forward re end t) - (prog1 t - (save-excursion - (goto-char (match-beginning 0)) - (when-let* - ((_(save-match-data (not (nth 8 (syntax-ppss))))) - (expr (ignore-errors - (read-positioning-symbols (current-buffer))))) - (put-text-property (match-beginning 0) (point) - 'font-lock-multiline t) - (llama--fontify (cdr expr) nil nil t))))) - (progn re end nil))) ; Silence compiler. - -(defun llama--fontify (expr &optional fnpos backquoted top) - (static-if (fboundp 'bare-symbol) - (cond - ((null expr) expr) - ((eq (car-safe expr) 'quote)) - ((eq (ignore-errors (bare-symbol (car-safe expr))) 'quote)) - ((and (memq (ignore-errors (bare-symbol (car-safe expr))) - (list (intern "") 'llama)) - (not top))) - ((and backquoted (symbol-with-pos-p expr))) - ((and backquoted - (memq (car-safe expr) - (list backquote-unquote-symbol - backquote-splice-symbol))) - (llama--fontify expr)) - ((symbol-with-pos-p expr) - (save-match-data - (when-let* - ((name (symbol-name (bare-symbol expr))) - (face (cond - ((and (string-match - "\\_<\\(?:\\(_\\)?%\\([1-9]\\)?\\)\\_>" name) - (or (not fnpos) (match-end 2))) - 'llama-mandatory-argument) - ((and (string-match - "\\_<\\(?:\\(_\\)?&\\([1-9*]\\)?\\)\\_>" name) - (or (not fnpos) (match-end 2))) - 'llama-optional-argument)))) - (when (match-end 1) - (setq face (list 'llama-deleted-argument face))) - (let ((beg (symbol-with-pos-pos expr))) - (put-text-property - beg (save-excursion (goto-char beg) (forward-symbol 1)) - 'face face))))) - ((or (listp expr) - (vectorp expr)) - (let* ((vectorp (vectorp expr)) - (expr (if vectorp (append expr ()) expr)) - (fnpos (and (not vectorp) - (not backquoted) - (ignore-errors (length expr))))) - (catch t - (while t - (cond ((eq (car expr) backquote-backquote-symbol) - (setq expr (cdr expr)) - (llama--fontify (car expr) t t)) - ((llama--fontify (car expr) fnpos backquoted))) - (setq fnpos nil) - (setq expr (cdr expr)) - (unless (and expr - (listp expr) - (not (eq (car expr) backquote-unquote-symbol))) - (throw t nil)))) - (when expr - (llama--fontify expr fnpos)))))) - (and expr fnpos backquoted top nil)) ; Silence compiler. - -(defvar llama-fontify-mode-lighter nil) - -;;;###autoload -(define-minor-mode llama-fontify-mode - "In Emacs Lisp mode, highlight the `##' macro and its special arguments." - :lighter llama-fontify-mode-lighter - :global t - (cond - (llama-fontify-mode - (advice-add 'lisp--el-match-keyword :override - #'lisp--el-match-keyword@llama '((depth . -80))) - (advice-add 'elisp-mode-syntax-propertize :override - #'elisp-mode-syntax-propertize@llama) - (add-hook 'emacs-lisp-mode-hook #'llama--add-font-lock-keywords)) - (t - (advice-remove 'lisp--el-match-keyword - #'lisp--el-match-keyword@llama) - (advice-remove 'elisp-mode-syntax-propertize - #'elisp-mode-syntax-propertize@llama) - (remove-hook 'emacs-lisp-mode-hook #'llama--add-font-lock-keywords))) - (dolist (buffer (buffer-list)) - (with-current-buffer buffer - (when (derived-mode-p 'emacs-lisp-mode) - (if llama-fontify-mode - (font-lock-add-keywords nil llama-font-lock-keywords) - (font-lock-remove-keywords nil llama-font-lock-keywords)) - (font-lock-flush))))) - -(defun llama--add-font-lock-keywords () - (font-lock-add-keywords nil llama-font-lock-keywords)) - -(defun lisp--el-match-keyword@llama (limit) - "Highlight symbols following \"(##\" the same as if they followed \"(\"." - (catch 'found - (while (re-search-forward - (concat "(\\(?:## ?\\)?\\(" - (static-if (get 'lisp-mode-symbol 'rx-definition) ;>= 29.1 - (rx lisp-mode-symbol) - lisp-mode-symbol-regexp) - "\\)\\_>") - limit t) - (let ((sym (intern-soft (match-string 1)))) - (when (and (or (special-form-p sym) - (macrop sym) - (and (bound-and-true-p morlock-mode) - ;; Same as in advice of `morlock' package. - (get sym 'morlock-font-lock-keyword))) - (not (get sym 'no-font-lock-keyword)) - (static-if (fboundp 'lisp--el-funcall-position-p) ;>= 28.1 - (lisp--el-funcall-position-p (match-beginning 0)) - (not (lisp--el-non-funcall-position-p - (match-beginning 0))))) - (throw 'found t)))))) - -(defun elisp-mode-syntax-propertize@llama (start end) - ;; Synced with Emacs up to 6b9510d94f814cacf43793dce76250b5f7e6f64a. - "Highlight `##' as the symbol which it is." - (goto-char start) - (let ((case-fold-search nil)) - (funcall - (syntax-propertize-rules - ;; Empty symbol. - ;; {{ Comment out to prevent the `##' from becoming part of - ;; the following symbol when there is no space in between. - ;; ("##" (0 (unless (nth 8 (syntax-ppss)) - ;; (string-to-syntax "_")))) - ;; }} - ;; {{ As for other symbols, use `font-lock-constant-face' in - ;; docstrings and comments. - ("##" (0 (when (nth 8 (syntax-ppss)) - (string-to-syntax "_")))) - ;; }} - ;; {{ Preserve this part, even though it is absent from - ;; this function in 29.1; backporting it by association. - ;; Prevent the @ from becoming part of a following symbol. - (",@" (0 (unless (nth 8 (syntax-ppss)) - (string-to-syntax "'")))) - ;; }} - ;; Unicode character names. (The longest name is 88 characters - ;; long.) - ("\\?\\\\N{[-A-Za-z0-9 ]\\{,100\\}}" - (0 (unless (nth 8 (syntax-ppss)) - (string-to-syntax "_")))) - ((rx "#" (or (seq (group-n 1 "&" (+ digit)) ?\") ; Bool-vector. - (seq (group-n 1 "s") "(") ; Record. - (seq (group-n 1 (+ "^")) "["))) ; Char-table. - (1 (unless (save-excursion (nth 8 (syntax-ppss (match-beginning 0)))) - (string-to-syntax "'"))))) - start end))) - -;;; Partial applications - -(defun llama--left-apply-partially (fn &rest args) - "Return a function that is a partial application of FN to ARGS. - -ARGS is a list of the first N arguments to pass to FN. The result -is a new function which does the same as FN, except that the first N -arguments are fixed at the values with which this function was called. - -See also `llama--right-apply-partially', which instead fixes the last -N arguments. - -These functions are intended to be used using the names `partial' and -`rpartial'. To be able to use these shorthands in a file, you must set -the file-local value of `read-symbols-shorthands', which was added in -Emacs 28.1. For an example see the end of file \"llama.el\". - -This is an alternative to `apply-partially', whose name is too long." - (declare (pure t) (side-effect-free error-free)) - (lambda (&rest args2) - (apply fn (append args args2)))) - -(defun llama--right-apply-partially (fn &rest args) - "Return a function that is a right partial application of FN to ARGS. - -ARGS is a list of the last N arguments to pass to FN. The result -is a new function which does the same as FN, except that the last N -arguments are fixed at the values with which this function was called. - -See also `llama--left-apply-partially', which instead fixes the first -N arguments. - -These functions are intended to be used using the names `rpartial' and -`partial'. To be able to use these shorthands in a file, you must set -the file-local value of `read-symbols-shorthands', which was added in -Emacs 28.1. For an example see the end of file \"llama.el\"." - (declare (pure t) (side-effect-free error-free)) - (lambda (&rest args2) - (apply fn (append args2 args)))) - -;; An example of how one would use these functions: -;; -;; (list (funcall (partial (lambda (a b) (list a b)) 'fixed) 'after) -;; (funcall (rpartial (lambda (a b) (list a b)) 'fixed) 'before)) - -;; An example of the configuration that is necessary to enable this: -;; -;; Local Variables: -;; indent-tabs-mode: nil -;; read-symbol-shorthands: ( -;; ("partial" . "llama--left-apply-partially") -;; ("rpartial" . "llama--right-apply-partially")) -;; End: -;; -;; Do not set `read-symbol-shorthands' in the ".dir-locals.el" -;; file, because that does not work for uncompiled libraries. - -(provide 'llama) - -;;; llama.el ends here diff --git a/.config/emacs/lisp/libs/llama.elc b/.config/emacs/lisp/libs/llama.elc deleted file mode 100644 index 5dacade..0000000 Binary files a/.config/emacs/lisp/libs/llama.elc and /dev/null differ diff --git a/.config/emacs/lisp/libs/s.el b/.config/emacs/lisp/libs/s.el deleted file mode 100644 index cae199b..0000000 --- a/.config/emacs/lisp/libs/s.el +++ /dev/null @@ -1,792 +0,0 @@ -;;; s.el --- The long lost Emacs string manipulation library. -*- lexical-binding: t -*- - -;; Copyright (C) 2012-2022 Magnar Sveen - -;; Author: Magnar Sveen -;; Maintainer: Jason Milkins -;; Version: 1.13.1 -;; Keywords: strings - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; The long lost Emacs string manipulation library. -;; -;; See documentation on https://github.com/magnars/s.el#functions - -;;; Code: - -;; Silence byte-compiler -(defvar ucs-normalize-combining-chars) ; Defined in `ucs-normalize' -(autoload 'slot-value "eieio") - -(defun s-trim-left (s) - "Remove whitespace at the beginning of S." - (declare (pure t) (side-effect-free t)) - (save-match-data - (if (string-match "\\`[ \t\n\r]+" s) - (replace-match "" t t s) - s))) - -(defun s-trim-right (s) - "Remove whitespace at the end of S." - (declare (pure t) (side-effect-free t)) - (save-match-data - (if (string-match "[ \t\n\r]+\\'" s) - (replace-match "" t t s) - s))) - -(defun s-trim (s) - "Remove whitespace at the beginning and end of S." - (declare (pure t) (side-effect-free t)) - (s-trim-left (s-trim-right s))) - -(defun s-collapse-whitespace (s) - "Convert all adjacent whitespace characters to a single space." - (declare (pure t) (side-effect-free t)) - (replace-regexp-in-string "[ \t\n\r]+" " " s)) - -(defun s-unindent (s &optional bol) - "Unindent S which has BOL (beginning of line) indicators. -BOL will default to pipe. You can optionally supply your own." - (declare (pure t) (side-effect-free t)) - (let ((case-fold-search nil) - (bol (or bol "|"))) - (s-replace-regexp (concat "^[[:space:]]*" (regexp-quote bol)) "" s))) - -(defun s-split (separator s &optional omit-nulls) - "Split S into substrings bounded by matches for regexp SEPARATOR. -If OMIT-NULLS is non-nil, zero-length substrings are omitted. - -This is a simple wrapper around the built-in `split-string'." - (declare (side-effect-free t)) - (save-match-data - (split-string s separator omit-nulls))) - -(defun s-split-up-to (separator s n &optional omit-nulls) - "Split S up to N times into substrings bounded by matches for regexp SEPARATOR. - -If OMIT-NULLS is non-nil, zero-length substrings are omitted. - -See also `s-split'." - (declare (side-effect-free t)) - (save-match-data - (let ((op 0) - (r nil)) - (with-temp-buffer - (insert s) - (setq op (goto-char (point-min))) - (while (and (re-search-forward separator nil t) - (< 0 n)) - (let ((sub (buffer-substring op (match-beginning 0)))) - (unless (and omit-nulls - (equal sub "")) - (push sub r))) - (setq op (goto-char (match-end 0))) - (setq n (1- n))) - (let ((sub (buffer-substring op (point-max)))) - (unless (and omit-nulls - (equal sub "")) - (push sub r)))) - (nreverse r)))) - -(defun s-lines (s) - "Splits S into a list of strings on newline characters." - (declare (pure t) (side-effect-free t)) - (s-split "\\(\r\n\\|[\n\r]\\)" s)) - -(defun s-join (separator strings) - "Join all the strings in STRINGS with SEPARATOR in between." - (declare (pure t) (side-effect-free t)) - (mapconcat 'identity strings separator)) - -(defun s-concat (&rest strings) - "Join all the string arguments into one string." - (declare (pure t) (side-effect-free t)) - (apply 'concat strings)) - -(defun s-prepend (prefix s) - "Concatenate PREFIX and S." - (declare (pure t) (side-effect-free t)) - (concat prefix s)) - -(defun s-append (suffix s) - "Concatenate S and SUFFIX." - (declare (pure t) (side-effect-free t)) - (concat s suffix)) - -(defun s-splice (needle n s) - "Splice NEEDLE into S at position N. -0 is the beginning of the string, -1 is the end." - (if (< n 0) - (let ((left (substring s 0 (+ 1 n (length s)))) - (right (s-right (- -1 n) s))) - (concat left needle right)) - (let ((left (s-left n s)) - (right (substring s n (length s)))) - (concat left needle right)))) - - -(defun s-repeat (num s) - "Make a string of S repeated NUM times." - (declare (pure t) (side-effect-free t)) - (let (ss) - (while (> num 0) - (setq ss (cons s ss)) - (setq num (1- num))) - (apply 'concat ss))) - -(defun s-chop-suffix (suffix s) - "Remove SUFFIX if it is at end of S." - (declare (pure t) (side-effect-free t)) - (let ((pos (- (length suffix)))) - (if (and (>= (length s) (length suffix)) - (string= suffix (substring s pos))) - (substring s 0 pos) - s))) - -(defun s-chop-suffixes (suffixes s) - "Remove SUFFIXES one by one in order, if they are at the end of S." - (declare (pure t) (side-effect-free t)) - (while suffixes - (setq s (s-chop-suffix (car suffixes) s)) - (setq suffixes (cdr suffixes))) - s) - -(defun s-chop-prefix (prefix s) - "Remove PREFIX if it is at the start of S." - (declare (pure t) (side-effect-free t)) - (let ((pos (length prefix))) - (if (and (>= (length s) (length prefix)) - (string= prefix (substring s 0 pos))) - (substring s pos) - s))) - -(defun s-chop-prefixes (prefixes s) - "Remove PREFIXES one by one in order, if they are at the start of S." - (declare (pure t) (side-effect-free t)) - (while prefixes - (setq s (s-chop-prefix (car prefixes) s)) - (setq prefixes (cdr prefixes))) - s) - -(defun s-shared-start (s1 s2) - "Returns the longest prefix S1 and S2 have in common." - (declare (pure t) (side-effect-free t)) - (let ((cmp (compare-strings s1 0 (length s1) s2 0 (length s2)))) - (if (eq cmp t) s1 (substring s1 0 (1- (abs cmp)))))) - -(defun s-shared-end (s1 s2) - "Returns the longest suffix S1 and S2 have in common." - (declare (pure t) (side-effect-free t)) - (let* ((l1 (length s1)) - (l2 (length s2)) - (search-length (min l1 l2)) - (i 0)) - (while (and (< i search-length) - (= (aref s1 (- l1 i 1)) (aref s2 (- l2 i 1)))) - (setq i (1+ i))) - ;; If I is 0, then it means that there's no common suffix between - ;; S1 and S2. - ;; - ;; However, since (substring s (- 0)) will return the whole - ;; string, `s-shared-end' should simply return the empty string - ;; when I is 0. - (if (zerop i) - "" - (substring s1 (- i))))) - -(defun s-chomp (s) - "Remove one trailing `\\n`, `\\r` or `\\r\\n` from S." - (declare (pure t) (side-effect-free t)) - (s-chop-suffixes '("\n" "\r") s)) - -(defun s-truncate (len s &optional ellipsis) - "If S is longer than LEN, cut it down and add ELLIPSIS to the end. - -The resulting string, including ellipsis, will be LEN characters -long. - -When not specified, ELLIPSIS defaults to ‘...’." - (declare (pure t) (side-effect-free t)) - (unless ellipsis - (setq ellipsis "...")) - (if (> (length s) len) - (format "%s%s" (substring s 0 (- len (length ellipsis))) ellipsis) - s)) - -(defun s-word-wrap (len s) - "If S is longer than LEN, wrap the words with newlines." - (declare (side-effect-free t)) - (save-match-data - (with-temp-buffer - (insert s) - (let ((fill-column len)) - (fill-region (point-min) (point-max))) - (buffer-substring (point-min) (point-max))))) - -(defun s-center (len s) - "If S is shorter than LEN, pad it with spaces so it is centered." - (declare (pure t) (side-effect-free t)) - (let ((extra (max 0 (- len (length s))))) - (concat - (make-string (ceiling extra 2) ?\s) - s - (make-string (floor extra 2) ?\s)))) - -(defun s-pad-left (len padding s) - "If S is shorter than LEN, pad it with PADDING on the left." - (declare (pure t) (side-effect-free t)) - (let ((extra (max 0 (- len (length s))))) - (concat (make-string extra (string-to-char padding)) - s))) - -(defun s-pad-right (len padding s) - "If S is shorter than LEN, pad it with PADDING on the right." - (declare (pure t) (side-effect-free t)) - (let ((extra (max 0 (- len (length s))))) - (concat s - (make-string extra (string-to-char padding))))) - -(defun s-left (len s) - "Returns up to the LEN first chars of S." - (declare (pure t) (side-effect-free t)) - (if (> (length s) len) - (substring s 0 len) - s)) - -(defun s-right (len s) - "Returns up to the LEN last chars of S." - (declare (pure t) (side-effect-free t)) - (let ((l (length s))) - (if (> l len) - (substring s (- l len) l) - s))) - -(defun s-chop-left (len s) - "Remove the first LEN chars from S." - (let ((l (length s))) - (if (> l len) - (substring s len l) - ""))) - -(defun s-chop-right (len s) - "Remove the last LEN chars from S." - (let ((l (length s))) - (if (> l len) - (substring s 0 (- l len)) - ""))) - -(defun s-ends-with? (suffix s &optional ignore-case) - "Does S end with SUFFIX? - -If IGNORE-CASE is non-nil, the comparison is done without paying -attention to case differences. - -Alias: `s-suffix?'" - (declare (pure t) (side-effect-free t)) - (let ((start-pos (- (length s) (length suffix)))) - (and (>= start-pos 0) - (eq t (compare-strings suffix nil nil - s start-pos nil ignore-case))))) - -(defun s-starts-with? (prefix s &optional ignore-case) - "Does S start with PREFIX? - -If IGNORE-CASE is non-nil, the comparison is done without paying -attention to case differences. - -Alias: `s-prefix?'. This is a simple wrapper around the built-in -`string-prefix-p'." - (declare (pure t) (side-effect-free t)) - (string-prefix-p prefix s ignore-case)) - -(defun s--truthy? (val) - (declare (pure t) (side-effect-free t)) - (not (null val))) - -(defun s-contains? (needle s &optional ignore-case) - "Does S contain NEEDLE? - -If IGNORE-CASE is non-nil, the comparison is done without paying -attention to case differences." - (declare (pure t) (side-effect-free t)) - (let ((case-fold-search ignore-case)) - (s--truthy? (string-match-p (regexp-quote needle) s)))) - -(defun s-equals? (s1 s2) - "Is S1 equal to S2? - -This is a simple wrapper around the built-in `string-equal'." - (declare (pure t) (side-effect-free t)) - (string-equal s1 s2)) - -(defun s-less? (s1 s2) - "Is S1 less than S2? - -This is a simple wrapper around the built-in `string-lessp'." - (declare (pure t) (side-effect-free t)) - (string-lessp s1 s2)) - -(defun s-matches? (regexp s &optional start) - "Does REGEXP match S? -If START is non-nil the search starts at that index. - -This is a simple wrapper around the built-in `string-match-p'." - (declare (side-effect-free t)) - (s--truthy? (string-match-p regexp s start))) - -(defun s-blank? (s) - "Is S nil or the empty string?" - (declare (pure t) (side-effect-free t)) - (or (null s) (string= "" s))) - -(defun s-blank-str? (s) - "Is S nil or the empty string or string only contains whitespace?" - (declare (pure t) (side-effect-free t)) - (or (s-blank? s) (s-blank? (s-trim s)))) - -(defun s-present? (s) - "Is S anything but nil or the empty string?" - (declare (pure t) (side-effect-free t)) - (not (s-blank? s))) - -(defun s-presence (s) - "Return S if it's `s-present?', otherwise return nil." - (declare (pure t) (side-effect-free t)) - (and (s-present? s) s)) - -(defun s-lowercase? (s) - "Are all the letters in S in lower case?" - (declare (side-effect-free t)) - (let ((case-fold-search nil)) - (not (string-match-p "[[:upper:]]" s)))) - -(defun s-uppercase? (s) - "Are all the letters in S in upper case?" - (declare (side-effect-free t)) - (let ((case-fold-search nil)) - (not (string-match-p "[[:lower:]]" s)))) - -(defun s-mixedcase? (s) - "Are there both lower case and upper case letters in S?" - (let ((case-fold-search nil)) - (s--truthy? - (and (string-match-p "[[:lower:]]" s) - (string-match-p "[[:upper:]]" s))))) - -(defun s-capitalized? (s) - "In S, is the first letter upper case, and all other letters lower case?" - (declare (side-effect-free t)) - (let ((case-fold-search nil)) - (s--truthy? - (string-match-p "^[[:upper:]][^[:upper:]]*$" s)))) - -(defun s-numeric? (s) - "Is S a number?" - (declare (pure t) (side-effect-free t)) - (s--truthy? - (string-match-p "^[0-9]+$" s))) - -(defun s-replace (old new s) - "Replaces OLD with NEW in S." - (declare (pure t) (side-effect-free t)) - (replace-regexp-in-string (regexp-quote old) new s t t)) - -(defalias 's-replace-regexp 'replace-regexp-in-string) - -(defun s--aget (alist key) - "Get the value of KEY in ALIST." - (declare (pure t) (side-effect-free t)) - (cdr (assoc-string key alist))) - -(defun s-replace-all (replacements s) - "REPLACEMENTS is a list of cons-cells. Each `car` is replaced with `cdr` in S." - (declare (pure t) (side-effect-free t)) - (let ((case-fold-search nil)) - (replace-regexp-in-string (regexp-opt (mapcar 'car replacements)) - (lambda (it) (s--aget replacements it)) - s t t))) - -(defun s-downcase (s) - "Convert S to lower case. - -This is a simple wrapper around the built-in `downcase'." - (declare (side-effect-free t)) - (downcase s)) - -(defun s-upcase (s) - "Convert S to upper case. - -This is a simple wrapper around the built-in `upcase'." - (declare (side-effect-free t)) - (upcase s)) - -(defun s-capitalize (s) - "Convert S first word's first character to upper and the rest to lower case." - (declare (side-effect-free t)) - (concat (upcase (substring s 0 1)) (downcase (substring s 1)))) - -(defun s-titleize (s) - "Convert in S each word's first character to upper and the rest to lower case. - -This is a simple wrapper around the built-in `capitalize'." - (declare (side-effect-free t)) - (capitalize s)) - -(defmacro s-with (s form &rest more) - "Threads S through the forms. Inserts S as the last item -in the first form, making a list of it if it is not a list -already. If there are more forms, inserts the first form as the -last item in second form, etc." - (declare (debug (form &rest [&or (function &rest form) fboundp]))) - (if (null more) - (if (listp form) - `(,(car form) ,@(cdr form) ,s) - (list form s)) - `(s-with (s-with ,s ,form) ,@more))) - -(put 's-with 'lisp-indent-function 1) - -(defun s-index-of (needle s &optional ignore-case) - "Returns first index of NEEDLE in S, or nil. - -If IGNORE-CASE is non-nil, the comparison is done without paying -attention to case differences." - (declare (pure t) (side-effect-free t)) - (let ((case-fold-search ignore-case)) - (string-match-p (regexp-quote needle) s))) - -(defun s-reverse (s) - "Return the reverse of S." - (declare (pure t) (side-effect-free t)) - (save-match-data - (if (multibyte-string-p s) - (let ((input (string-to-list s)) - output) - (require 'ucs-normalize) - (while input - ;; Handle entire grapheme cluster as a single unit - (let ((grapheme (list (pop input)))) - (while (memql (car input) ucs-normalize-combining-chars) - (push (pop input) grapheme)) - (setq output (nconc (nreverse grapheme) output)))) - (concat output)) - (concat (nreverse (string-to-list s)))))) - -(defun s-match-strings-all (regex string) - "Return a list of matches for REGEX in STRING. - -Each element itself is a list of matches, as per -`match-string'. Multiple matches at the same position will be -ignored after the first." - (declare (side-effect-free t)) - (save-match-data - (let ((all-strings ()) - (i 0)) - (while (and (< i (length string)) - (string-match regex string i)) - (setq i (1+ (match-beginning 0))) - (let (strings - (num-matches (/ (length (match-data)) 2)) - (match 0)) - (while (/= match num-matches) - (push (match-string match string) strings) - (setq match (1+ match))) - (push (nreverse strings) all-strings))) - (nreverse all-strings)))) - -(defun s-matched-positions-all (regexp string &optional subexp-depth) - "Return a list of matched positions for REGEXP in STRING. -SUBEXP-DEPTH is 0 by default." - (declare (side-effect-free t)) - (if (null subexp-depth) - (setq subexp-depth 0)) - (save-match-data - (let ((pos 0) result) - (while (and (string-match regexp string pos) - (< pos (length string))) - (push (cons (match-beginning subexp-depth) (match-end subexp-depth)) result) - (setq pos (match-end 0))) - (nreverse result)))) - -(defun s-match (regexp s &optional start) - "When the given expression matches the string, this function returns a list -of the whole matching string and a string for each matched subexpressions. -Subexpressions that didn't match are represented by nil elements -in the list, except that non-matching subexpressions at the end -of REGEXP might not appear at all in the list. That is, the -returned list can be shorter than the number of subexpressions in -REGEXP plus one. If REGEXP did not match the returned value is -an empty list (nil). - -When START is non-nil the search will start at that index." - (declare (side-effect-free t)) - (save-match-data - (if (string-match regexp s start) - (let ((match-data-list (match-data)) - result) - (while match-data-list - (let* ((beg (car match-data-list)) - (end (cadr match-data-list)) - (subs (if (and beg end) (substring s beg end) nil))) - (setq result (cons subs result)) - (setq match-data-list - (cddr match-data-list)))) - (nreverse result))))) - -(defun s-slice-at (regexp s) - "Slices S up at every index matching REGEXP." - (declare (side-effect-free t)) - (if (s-blank? s) - (list s) - (let (ss) - (while (not (s-blank? s)) - (save-match-data - (let ((i (string-match regexp s 1))) - (if i - (setq ss (cons (substring s 0 i) ss) - s (substring s i)) - (setq ss (cons s ss) - s ""))))) - (nreverse ss)))) - -(defun s-split-words (s) - "Split S into list of words." - (declare (side-effect-free t)) - (s-split - "[^[:word:]0-9]+" - (let ((case-fold-search nil)) - (replace-regexp-in-string - "\\([[:lower:]]\\)\\([[:upper:]]\\)" "\\1 \\2" - (replace-regexp-in-string "\\([[:upper:]]\\)\\([[:upper:]][0-9[:lower:]]\\)" "\\1 \\2" s))) - t)) - -(defun s--mapcar-head (fn-head fn-rest list) - "Like MAPCAR, but applies a different function to the first element." - (if list - (cons (funcall fn-head (car list)) (mapcar fn-rest (cdr list))))) - -(defun s-lower-camel-case (s) - "Convert S to lowerCamelCase." - (declare (side-effect-free t)) - (s-join "" (s--mapcar-head 'downcase 'capitalize (s-split-words s)))) - -(defun s-upper-camel-case (s) - "Convert S to UpperCamelCase." - (declare (side-effect-free t)) - (s-join "" (mapcar 'capitalize (s-split-words s)))) - -(defun s-snake-case (s) - "Convert S to snake_case." - (declare (side-effect-free t)) - (s-join "_" (mapcar 'downcase (s-split-words s)))) - -(defun s-dashed-words (s) - "Convert S to dashed-words." - (declare (side-effect-free t)) - (s-join "-" (mapcar 'downcase (s-split-words s)))) - -(defun s-spaced-words (s) - "Convert S to spaced words." - (declare (side-effect-free t)) - (s-join " " (s-split-words s))) - -(defun s-capitalized-words (s) - "Convert S to Capitalized words." - (declare (side-effect-free t)) - (let ((words (s-split-words s))) - (s-join " " (cons (capitalize (car words)) (mapcar 'downcase (cdr words)))))) - -(defun s-titleized-words (s) - "Convert S to Titleized Words." - (declare (side-effect-free t)) - (s-join " " (mapcar 's-titleize (s-split-words s)))) - -(defun s-word-initials (s) - "Convert S to its initials." - (declare (side-effect-free t)) - (s-join "" (mapcar (lambda (ss) (substring ss 0 1)) - (s-split-words s)))) - -;; Errors for s-format -(progn - (put 's-format-resolve - 'error-conditions - '(error s-format s-format-resolve)) - (put 's-format-resolve - 'error-message - "Cannot resolve a template to values")) - -(defun s-format (template replacer &optional extra) - "Format TEMPLATE with the function REPLACER. - -REPLACER takes an argument of the format variable and optionally -an extra argument which is the EXTRA value from the call to -`s-format'. - -Several standard `s-format' helper functions are recognized and -adapted for this: - - (s-format \"${name}\" \\='gethash hash-table) - (s-format \"${name}\" \\='aget alist) - (s-format \"$0\" \\='elt sequence) - -The REPLACER function may be used to do any other kind of -transformation." - (let ((saved-match-data (match-data))) - (unwind-protect - (replace-regexp-in-string - "\\$\\({\\([^}]+\\)}\\|[0-9]+\\)" - (lambda (md) - (let ((var - (let ((m (match-string 2 md))) - (if m m - (string-to-number (match-string 1 md))))) - (replacer-match-data (match-data))) - (unwind-protect - (let ((v - (cond - ((eq replacer 'gethash) - (funcall replacer var extra)) - ((eq replacer 'aget) - (funcall 's--aget extra var)) - ((eq replacer 'elt) - (funcall replacer extra var)) - ((eq replacer 'oref) - (funcall #'slot-value extra (intern var))) - (t - (set-match-data saved-match-data) - (if extra - (funcall replacer var extra) - (funcall replacer var)))))) - (if v (format "%s" v) (signal 's-format-resolve md))) - (set-match-data replacer-match-data)))) - template - ;; Need literal to make sure it works - t t) - (set-match-data saved-match-data)))) - -(defvar s-lex-value-as-lisp nil - "If `t' interpolate lisp values as lisp. - -`s-lex-format' inserts values with (format \"%S\").") - -(defun s-lex-fmt|expand (fmt) - "Expand FMT into lisp." - (declare (side-effect-free t)) - (list 's-format fmt (quote 'aget) - (append '(list) - (mapcar - (lambda (matches) - (list - 'cons - (cadr matches) - `(format - (if s-lex-value-as-lisp "%S" "%s") - ,(intern (cadr matches))))) - (s-match-strings-all "${\\([^}]+\\)}" fmt))))) - -(defmacro s-lex-format (format-str) - "`s-format` with the current environment. - -FORMAT-STR may use the `s-format' variable reference to refer to -any variable: - - (let ((x 1)) - (s-lex-format \"x is: ${x}\")) - -The values of the variables are interpolated with \"%s\" unless -the variable `s-lex-value-as-lisp' is `t' and then they are -interpolated with \"%S\"." - (declare (debug (form))) - (s-lex-fmt|expand format-str)) - -(defun s-count-matches (regexp s &optional start end) - "Count occurrences of `regexp' in `s'. - -`start', inclusive, and `end', exclusive, delimit the part of `s' to -match. `start' and `end' are both indexed starting at 1; the initial -character in `s' is index 1. - -This function starts looking for the next match from the end of the -previous match. Hence, it ignores matches that overlap a previously -found match. To count overlapping matches, use -`s-count-matches-all'." - (declare (side-effect-free t)) - (save-match-data - (with-temp-buffer - (insert s) - (goto-char (point-min)) - (count-matches regexp (or start 1) (or end (point-max)))))) - -(defun s-count-matches-all (regexp s &optional start end) - "Count occurrences of `regexp' in `s'. - -`start', inclusive, and `end', exclusive, delimit the part of `s' to -match. `start' and `end' are both indexed starting at 1; the initial -character in `s' is index 1. - -This function starts looking for the next match from the second -character of the previous match. Hence, it counts matches that -overlap a previously found match. To ignore matches that overlap a -previously found match, use `s-count-matches'." - (declare (side-effect-free t)) - (let* ((anchored-regexp (format "^%s" regexp)) - (match-count 0) - (i 0) - (narrowed-s (substring s (if start (1- start) 0) - (when end (1- end))))) - (save-match-data - (while (< i (length narrowed-s)) - (when (s-matches? anchored-regexp (substring narrowed-s i)) - (setq match-count (1+ match-count))) - (setq i (1+ i)))) - match-count)) - -(defun s-wrap (s prefix &optional suffix) - "Wrap string S with PREFIX and optionally SUFFIX. - -Return string S with PREFIX prepended. If SUFFIX is present, it -is appended, otherwise PREFIX is used as both prefix and -suffix." - (declare (pure t) (side-effect-free t)) - (concat prefix s (or suffix prefix))) - - -;;; Aliases - -(defalias 's-blank-p 's-blank?) -(defalias 's-blank-str-p 's-blank-str?) -(defalias 's-capitalized-p 's-capitalized?) -(defalias 's-contains-p 's-contains?) -(defalias 's-ends-with-p 's-ends-with?) -(defalias 's-equals-p 's-equals?) -(defalias 's-less-p 's-less?) -(defalias 's-lowercase-p 's-lowercase?) -(defalias 's-matches-p 's-matches?) -(defalias 's-mixedcase-p 's-mixedcase?) -(defalias 's-numeric-p 's-numeric?) -(defalias 's-prefix-p 's-starts-with?) -(defalias 's-prefix? 's-starts-with?) -(defalias 's-present-p 's-present?) -(defalias 's-starts-with-p 's-starts-with?) -(defalias 's-suffix-p 's-ends-with?) -(defalias 's-suffix? 's-ends-with?) -(defalias 's-uppercase-p 's-uppercase?) - - -(provide 's) -;;; s.el ends here diff --git a/.config/emacs/lisp/libs/s.elc b/.config/emacs/lisp/libs/s.elc deleted file mode 100644 index 16489e9..0000000 Binary files a/.config/emacs/lisp/libs/s.elc and /dev/null differ diff --git a/.config/emacs/lisp/libs/transient.el b/.config/emacs/lisp/libs/transient.el deleted file mode 100644 index a313d90..0000000 --- a/.config/emacs/lisp/libs/transient.el +++ /dev/null @@ -1,5497 +0,0 @@ -;;; transient.el --- Transient commands -*- lexical-binding:t -*- - -;; Copyright (C) 2018-2026 Free Software Foundation, Inc. - -;; Author: Jonas Bernoulli -;; Homepage: https://github.com/magit/transient -;; Keywords: extensions - -;; Package-Version: 0.12.0 -;; Package-Requires: ( -;; (emacs "28.1") -;; (compat "30.1") -;; (cond-let "0.2") -;; (seq "2.24")) - -;; SPDX-License-Identifier: GPL-3.0-or-later - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation, either version 3 of the License, -;; or (at your option) any later version. -;; -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; Transient is the library used to implement the keyboard-driven menus -;; in Magit. It is distributed as a separate package, so that it can be -;; used to implement similar menus in other packages. - -;;; Code: - -(defconst transient-version "0.12.0") - -(require 'cl-lib) -(require 'compat) -(require 'cond-let) -(require 'eieio) -(require 'edmacro) -(require 'format-spec) -(require 'pcase) -(require 'pp) - -(eval-and-compile - (when (and (featurep 'seq) - (not (fboundp 'seq-keep))) - (unload-feature 'seq 'force))) -(require 'seq) -(unless (fboundp 'seq-keep) - (display-warning 'transient (substitute-command-keys "\ -Transient requires `seq' >= 2.24, -but due to bad defaults, Emacs's package manager, refuses to -upgrade this and other built-in packages to higher releases -from GNU Elpa, when a package specifies that this is needed. - -To fix this, you have to add this to your init file: - - (setq package-install-upgrade-built-in t) - -Then evaluate that expression by placing the cursor after it -and typing \\[eval-last-sexp]. - -Once you have done that, you have to explicitly upgrade `seq': - - \\[package-upgrade] seq \\`RET' - -Then you also must make sure the updated version is loaded, -by evaluating this form: - - (progn (unload-feature 'seq t) (require 'seq)) - -Until you do this, you will get random errors about `seq-keep' -being undefined while using Transient. - -If you don't use the `package' package manager but still get -this warning, then your chosen package manager likely has a -similar defect.") :emergency)) - -(eval-when-compile (require 'subr-x)) - -(declare-function info "info" (&optional file-or-node buffer)) -(declare-function Man-find-section "man" (section)) -(declare-function Man-next-section "man" (n)) -(declare-function Man-getpage-in-background "man" (topic)) - -(defvar Man-notify-method) -(defvar pp-default-function) ; since Emacs 29.1 - -(static-if (< emacs-major-version 30) - (progn - (defun internal--build-binding@backport-e680827e814 (fn binding prev-var) - "Backport not warning about `_' not being left unused. -Backport fix for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=69108, -from Emacs commit e680827e814e155cf79175d87ff7c6ee3a08b69a." - (let ((binding (funcall fn binding prev-var))) - (if (eq (car binding) '_) - (cons (make-symbol "s") (cdr binding)) - binding))) - (advice-add 'internal--build-binding :around - #'internal--build-binding@backport-e680827e814))) - -(defvar transient-common-command-prefix) - -(defmacro transient--with-emergency-exit (id &rest body) - (declare (indent defun)) - (unless (keywordp id) - (setq body (cons id body)) - (setq id nil)) - `(condition-case err - (let ((debugger #'transient--exit-and-debug)) - ,(macroexp-progn body)) - ((debug error) - (transient--emergency-exit ,id) - (signal (car err) (cdr err))))) - -(defun transient--exit-and-debug (&rest args) - (transient--emergency-exit :debugger) - (apply #'debug args)) - -;;; Options - -(defgroup transient nil - "Transient commands." - :group 'extensions) - -(defcustom transient-show-popup t - "Whether and when to show transient's menu in a buffer. - -\\\ -- If t (the default), then show the buffer as soon as a transient - prefix command is invoked. - -- If nil, then do not show the buffer unless the user explicitly - requests it, by pressing \\[transient-show] or a prefix key. - -- If a number, then delay displaying the buffer and instead show - a brief one-line summary. If zero or negative, then suppress - even showing that summary and display the pressed key only. - - Show the buffer once the user explicitly requests it by pressing - \\[transient-show] or a prefix key. Unless zero, then also show the buffer - after that many seconds of inactivity (using the absolute value)." - :package-version '(transient . "0.1.0") - :group 'transient - :type '(choice (const :tag "Instantly" t) - (const :tag "On demand" nil) - (const :tag "On demand (no summary)" 0) - (number :tag "After delay" 1))) - -(defcustom transient-enable-popup-navigation 'verbose - "Whether navigation commands are enabled in the menu buffer. - -If the value is `verbose' (the default), additionally show brief -documentation about the command under point in the echo area. - -While a transient is active transient's menu buffer is not the -current buffer, making it necessary to use dedicated commands to -act on that buffer itself. If this is non-nil, then the following -bindings are available: - -\\\ -- \\[transient-backward-button] moves the cursor to the previous suffix. -- \\[transient-forward-button] moves the cursor to the next suffix. -- \\[transient-push-button] invokes the suffix the cursor is on. -\\\ -- \\`' and \\`' invoke the clicked on suffix. -\\\ -- \\[transient-isearch-backward]\ - and \\[transient-isearch-forward] start isearch in the menu buffer. - -\\`' and \\`' are bound in `transient-push-button'. -All other bindings are in `transient-popup-navigation-map'. - -By default \\`M-RET' is bound to `transient-push-button', instead of -\\`RET', because if a transient allows the invocation of non-suffixes, -then it is likely, that you would want \\`RET' to do what it would do -if no transient were active." - :package-version '(transient . "0.7.8") - :group 'transient - :type '(choice (const :tag "Enable navigation and echo summary" verbose) - (const :tag "Enable navigation commands" t) - (const :tag "Disable navigation commands" nil))) - -(defcustom transient-display-buffer-action - '(display-buffer-in-side-window - (side . bottom) - (dedicated . t) - (inhibit-same-window . t)) - "The action used to display transient's menu buffer. - -The transient menu buffer is displayed in a window using - - (display-buffer BUFFER transient-display-buffer-action) - -The value of this option has the form (FUNCTION . ALIST), -where FUNCTION is a function or a list of functions. Each such -function should accept two arguments: a buffer to display and an -alist of the same form as ALIST. See info node `(elisp)Choosing -Window' for details. - -The default is: - - (display-buffer-in-side-window - (side . bottom) - (dedicated . t) - (inhibit-same-window . t)) - -This displays the window at the bottom of the selected frame. -For alternatives see info node `(elisp)Display Action Functions' -and info node `(elisp)Buffer Display Action Alists'. - -When you switch to a different ACTION, you should keep the ALIST -entries for `dedicated' and `inhibit-same-window' in most cases. -Do not drop them because you are unsure whether they are needed; -if you are unsure, then keep them. - -Note that the buffer that was current before the transient buffer -is shown should remain the current buffer. Many suffix commands -act on the thing at point, if appropriate, and if the transient -buffer became the current buffer, then that would change what is -at point. To that effect `inhibit-same-window' ensures that the -selected window is not used to show the transient buffer. - -The use of a horizontal split to display the menu window can lead -to incompatibilities and is thus discouraged. Transient tries to -mitigate such issue but cannot proactively deal with all possible -configurations and combinations of third-party packages. - -It may be possible to display the window in another frame, but -whether that works in practice depends on the window-manager. -If the window manager selects the new window (Emacs frame), -then that unfortunately changes which buffer is current. - -If you change the value of this option, then you might also -want to change the value of `transient-mode-line-format'." - :package-version '(transient . "0.7.5") - :group 'transient - :type '(cons (choice function (repeat :tag "Functions" function)) - alist)) - -(defcustom transient-minimal-frame-width 83 - "Minimal width of dedicated frame used to display transient menu. - -This is only used if the transient menu is actually displayed in a -dedicated frame (see `transient-display-buffer-action'). The value -is in characters." - :package-version '(transient . "0.8.1") - :group 'transient - :type 'natnum) - -(defcustom transient-mode-line-format 'line - "The mode-line format for transient's menu buffer. - -If nil, then the buffer has no mode-line. If the buffer is not -displayed right above the echo area, then this probably is not -a good value. - -If `line' (the default) or a natural number, then the buffer has no -mode-line, but a line is drawn in its place. If a number is used, -that specifies the thickness of the line. On termcap frames we -cannot draw lines, so there `line' and numbers are synonyms for nil. - -The color of the line is used to indicate if non-suffixes are -allowed and whether they exit the transient. The foreground -color of `transient-key-noop' (if non-suffixes are disallowed), -`transient-key-stay' (if allowed and transient stays active), or -`transient-key-exit' (if allowed and they exit the transient) is -used to draw the line. - -Otherwise this can be any mode-line format. -See `mode-line-format' for details." - :package-version '(transient . "0.2.0") - :group 'transient - :type '(choice (const :tag "Hide mode-line" nil) - (const :tag "Substitute thin line" line) - (number :tag "Substitute line with thickness") - (const :tag "Name of prefix command" - ("%e" mode-line-front-space - mode-line-buffer-identification)) - (sexp :tag "Custom mode-line format"))) - -(defcustom transient-show-common-commands nil - "Whether to permanently show common suffix commands in transient menus. - -By default these commands are only temporarily shown after typing their -shared prefix key \ -\\\\[transient-common-command-prefix], \ -while a transient menu is active. When the value -of this option is non-nil, then these commands are permanently shown. -To toggle the value for the current Emacs session only type \ -\\\\[transient-toggle-common] while -any transient menu is active." - :package-version '(transient . "0.1.0") - :group 'transient - :type 'boolean) - -(defcustom transient-show-during-minibuffer-read nil - "Whether to show the transient menu while reading in the minibuffer. - -This is only relevant to commands that do not close the menu, such as -commands that set infix arguments. If a command exits the menu, and -uses the minibuffer, then the menu is always closed before the -minibuffer is entered, irrespective of the value of this option. - -When nil (the default), hide the menu while the minibuffer is in use. -When t, keep showing the menu, but allow for the menu window to be -resized, to ensure that completion candidates can be displayed. - -When `fixed', keep showing the menu and prevent it from being resized, -which may make it impossible to display the completion candidates. If -that ever happens for you, consider using t or an integer, as described -below. - -If the value is `fixed' and the menu window uses the full height of its -frame, then the former is ignored and resizing is allowed anyway. This -is necessary because individual menus may use unusual display actions -different from what `transient-display-buffer-action' specifies (likely -to display that menu in a side-window). - -When using a third-party mode, which automatically resizes windows -\(e.g., by calling `balance-windows' on `post-command-hook'), then -`fixed' (or nil) is likely a better choice than t. - -The value can also be an integer, in which case the behavior depends on -whether at least that many lines are left to display windows other than -the menu window. If that is the case, display the menu and preserve the -size of that window. Otherwise, allow resizing the menu window if the -number is positive, or hide the menu if it is negative." - :package-version '(transient . "0.8.0") - :group 'transient - :type '(choice - (const :tag "Hide menu" nil) - (const :tag "Show menu and preserve size" fixed) - (const :tag "Show menu and allow resizing" t) - (natnum :tag "Show menu, allow resizing if less than N lines left" - :format "\n %t: %v" - :value 20) - (integer :tag "Show menu, except if less than N lines left" - :format "\n %t: %v" - :value -20))) - -(defcustom transient-show-docstring-format "%s" - "How to display suffix docstrings. - -The command `transient-toggle-docstrings' toggles between showing suffix -descriptions as usual, and instead or additionally displaying the suffix -docstrings. The format specified here controls how that is done. %c is -the description and %s is the docstring. Use \"%-14c %s\" or similar to -display both. - -This command is not bound by default, see its docstring for instructions." - :package-version '(transient . "0.8.4") - :group 'transient - :type 'string) - -(defcustom transient-read-with-initial-input nil - "Whether to use the last history element as initial minibuffer input." - :package-version '(transient . "0.2.0") - :group 'transient - :type 'boolean) - -(defcustom transient-highlight-mismatched-keys nil - "Whether to highlight keys that do not match their argument. - -This is mostly intended for authors of transient menus and disabled by -default. - -This only affects infix arguments that represent command-line arguments. -When this option is non-nil, then the key binding for infix argument are -highlighted when only a long argument \(e.g., \"--verbose\") is specified -but no shorthand (e.g., \"-v\"). In the rare case that a short-hand is -specified but does not match the key binding, then it is highlighted -differently. - -The highlighting is done using `transient-mismatched-key' -and `transient-nonstandard-key'." - :package-version '(transient . "0.1.0") - :group 'transient - :type 'boolean) - -(defcustom transient-highlight-higher-levels nil - "Whether to highlight suffixes on higher levels. - -This is primarily intended for package authors. - -When non-nil then highlight the description of suffixes whose -level is above 4, the default of `transient-default-level'. -Assuming you have set that variable to 7, this highlights all -suffixes that won't be available to users without them making -the same customization." - :package-version '(transient . "0.3.6") - :group 'transient - :type 'boolean) - -(defcustom transient-substitute-key-function nil - "Function used to modify key bindings. - -This function is called with one argument, the prefix object, -and must return a key binding description, either the existing -key description it finds in the `key' slot, or a substitution. - -This is intended to let users replace certain prefix keys. It -could also be used to make other substitutions, but that is -discouraged. - -For example, \"=\" is hard to reach using my custom keyboard -layout, so I substitute \"(\" for that, which is easy to reach -using a layout optimized for Lisp. - - (setq transient-substitute-key-function - (lambda (obj) - (let ((key (oref obj key))) - (if (string-match \"\\\\`\\\\(=\\\\)[a-zA-Z]\" key) - (replace-match \"(\" t t key 1) - key)))))" - :package-version '(transient . "0.1.0") - :group 'transient - :type '(choice (const :tag "Transform no keys (nil)" nil) function)) - -(defcustom transient-semantic-coloring t - "Whether to use colors to indicate transient behavior. - -If non-nil, then the key binding of each suffix is colorized to -indicate whether it exits the transient state or not, and the -line that is drawn below transient's menu buffer is used to -indicate the behavior of non-suffix commands." - :package-version '(transient . "0.5.0") - :group 'transient - :type 'boolean) - -(defcustom transient-detect-key-conflicts nil - "Whether to detect key binding conflicts. - -Conflicts are detected when a transient prefix command is invoked -and results in an error, which prevents the transient from being -used." - :package-version '(transient . "0.1.0") - :group 'transient - :type 'boolean) - -(defcustom transient-error-on-insert-failure nil - "Whether to signal an error when failing to insert a suffix. - -When `transient-insert-suffix' and `transient-append-suffix' fail -to insert a suffix into an existing prefix, they usually just show -a warning. If this is non-nil, they signal an error instead." - :package-version '(transient . "0.8.8") - :group 'transient - :type 'boolean) - -(defcustom transient-align-variable-pitch nil - "Whether to align columns pixel-wise in the menu buffer. - -If this is non-nil, then columns are aligned pixel-wise to -support variable-pitch fonts. Keys are not aligned, so you -should use a fixed-pitch font for the `transient-key' face. -Other key faces inherit from that face unless a theme is -used that breaks that relationship. - -This option is intended for users who use a variable-pitch -font for the `default' face. - -See also `transient-force-fixed-pitch'." - :package-version '(transient . "0.4.0") - :group 'transient - :type 'boolean) - -(defcustom transient-force-fixed-pitch nil - "Whether to force use of monospaced font in the menu buffer. - -Even if you use a proportional font for the `default' face, -you might still want to use a monospaced font in transient's -menu buffer. Setting this option to t causes `default' to -be remapped to `fixed-pitch' in that buffer. - -See also `transient-align-variable-pitch'." - :package-version '(transient . "0.2.0") - :group 'transient - :type 'boolean) - -(defcustom transient-force-single-column nil - "Whether to force use of a single column to display suffixes. - -This might be useful for users with low vision who use large -text and might otherwise have to scroll in two dimensions." - :package-version '(transient . "0.3.6") - :group 'transient - :type 'boolean) - -(defconst transient--max-level 7) -(defconst transient--default-child-level 1) -(defconst transient--default-prefix-level 4) - -(defcustom transient-default-level transient--default-prefix-level - "Control what suffix levels are made available by default. - -Each suffix command is placed on a level and each prefix command -has a level, which controls which suffix commands are available. -Integers between 1 and 7 (inclusive) are valid levels. - -The levels of individual transients and/or their individual -suffixes can be changed individually, by invoking the prefix and -then pressing \\\\[transient-set-level]. - -The default level for both transients and their suffixes is 4. -This option only controls the default for transients. The default -suffix level is always 4. The author of a transient should place -certain suffixes on a higher level if they expect that it won't be -of use to most users, and they should place very important suffixes -on a lower level so that they remain available even if the user -lowers the transient level. - -\(Magit currently places nearly all suffixes on level 4 and lower -levels are not used at all yet. So for the time being you should -not set a lower level here and using a higher level might not -give you as many additional suffixes as you hoped.)" - :package-version '(transient . "0.1.0") - :group 'transient - :type '(choice (const :tag "1 - fewest suffixes" 1) - (const 2) - (const 3) - (const :tag "4 - default" 4) - (const 5) - (const 6) - (const :tag "7 - most suffixes" 7))) - -(defcustom transient-levels-file - (locate-user-emacs-file "transient/levels.el") - "File used to save levels of transients and their suffixes." - :package-version '(transient . "0.1.0") - :group 'transient - :type 'file) - -(defcustom transient-values-file - (locate-user-emacs-file "transient/values.el") - "File used to save values of transients." - :package-version '(transient . "0.1.0") - :group 'transient - :type 'file) - -(defcustom transient-history-file - (locate-user-emacs-file "transient/history.el") - "File used to save history of transients and their infixes." - :package-version '(transient . "0.1.0") - :group 'transient - :type 'file) - -(defcustom transient-history-limit 10 - "Number of history elements to keep when saving to file." - :package-version '(transient . "0.1.0") - :group 'transient - :type 'integer) - -(defcustom transient-save-history t - "Whether to save history of transient commands when exiting Emacs." - :package-version '(transient . "0.1.0") - :group 'transient - :type 'boolean) - -;;; Faces - -(defgroup transient-faces nil - "Faces used by Transient." - :group 'transient) - -(defface transient-heading '((t :inherit font-lock-keyword-face)) - "Face used for headings." - :group 'transient-faces) - -(defface transient-argument '((t :inherit font-lock-string-face :weight bold)) - "Face used for enabled arguments." - :group 'transient-faces) - -(defface transient-inactive-argument '((t :inherit shadow)) - "Face used for inactive arguments." - :group 'transient-faces) - -(defface transient-inapt-argument '((t :inherit shadow :weight bold)) - "Face used for inapt arguments with a (currently ignored) value. -Depending on the type this is used for the argument and/or value." - :group 'transient-faces) - -(defface transient-value '((t :inherit font-lock-string-face :weight bold)) - "Face used for values." - :group 'transient-faces) - -(defface transient-inactive-value '((t :inherit shadow)) - "Face used for inactive values." - :group 'transient-faces) - -(defface transient-unreachable '((t :inherit shadow)) - "Face used for suffixes unreachable from the current prefix sequence." - :group 'transient-faces) - -(defface transient-inapt-suffix '((t :inherit shadow :slant italic)) - "Face used for suffixes that are inapt at this time." - :group 'transient-faces) - -(defface transient-active-infix '((t :inherit highlight)) - "Face used for the infix for which the value is being read." - :group 'transient-faces) - -(defface transient-enabled-suffix - '((t :background "green" :foreground "black" :weight bold)) - "Face used for enabled levels while editing suffix levels. -See info node `(transient)Enabling and Disabling Suffixes'." - :group 'transient-faces) - -(defface transient-disabled-suffix - '((t :background "red" :foreground "black" :weight bold)) - "Face used for disabled levels while editing suffix levels. -See info node `(transient)Enabling and Disabling Suffixes'." - :group 'transient-faces) - -(defface transient-higher-level - (let* ((color (face-attribute 'shadow :foreground t t)) - (color (if (eq color 'unspecified) "grey60" color))) - `((t :box (:line-width (-1 . -1) :color ,color)))) - "Face optionally used to highlight suffixes on higher levels. -See also option `transient-highlight-higher-levels'." - :group 'transient-faces) - -(defface transient-delimiter '((t :inherit shadow)) - "Face used for delimiters and separators. -This includes the parentheses around values and the pipe -character used to separate possible values from each other." - :group 'transient-faces) - -(defface transient-key '((t :inherit font-lock-builtin-face)) - "Face used for keys." - :group 'transient-faces) - -(defface transient-key-stay - `((((class color) (background light)) - :inherit transient-key - :foreground "#22aa22") - (((class color) (background dark)) - :inherit transient-key - :foreground "#ddffdd")) - "Face used for keys of suffixes that don't exit the menu." - :group 'transient-faces) - -(defface transient-key-noop - `((((class color) (background light)) - :inherit transient-key - :foreground "grey80") - (((class color) (background dark)) - :inherit transient-key - :foreground "grey30")) - "Face used for keys of suffixes that currently cannot be invoked." - :group 'transient-faces) - -(defface transient-key-return - `((((class color) (background light)) - :inherit transient-key - :foreground "#aaaa11") - (((class color) (background dark)) - :inherit transient-key - :foreground "#ffffcc")) - "Face used for keys of suffixes that return to the parent menu." - :group 'transient-faces) - -(defface transient-key-recurse - `((((class color) (background light)) - :inherit transient-key - :foreground "#2266ff") - (((class color) (background dark)) - :inherit transient-key - :foreground "#2299ff")) - "Face used for keys of sub-menus whose suffixes return to the parent menu." - :group 'transient-faces) - -(defface transient-key-stack - `((((class color) (background light)) - :inherit transient-key - :foreground "#dd4488") - (((class color) (background dark)) - :inherit transient-key - :foreground "#ff6699")) - "Face used for keys of sub-menus that exit the parent menu." - :group 'transient-faces) - -(defface transient-key-exit - `((((class color) (background light)) - :inherit transient-key - :foreground "#aa2222") - (((class color) (background dark)) - :inherit transient-key - :foreground "#ffdddd")) - "Face used for keys of suffixes that exit the menu." - :group 'transient-faces) - -(defface transient-unreachable-key - '((t :inherit (shadow transient-key) :weight normal)) - "Face used for keys unreachable from the current prefix sequence." - :group 'transient-faces) - -(defface transient-nonstandard-key - `((t :box (:line-width (-1 . -1) :color "cyan"))) - "Face optionally used to highlight keys conflicting with short-argument. -See also option `transient-highlight-mismatched-keys'." - :group 'transient-faces) - -(defface transient-mismatched-key - `((t :box (:line-width (-1 . -1) :color "magenta"))) - "Face optionally used to highlight keys without a short-argument. -See also option `transient-highlight-mismatched-keys'." - :group 'transient-faces) - -;;; Persistence - -(defun transient--read-file-contents (file) - (with-demoted-errors "Transient error: %S" - (and (file-exists-p file) - (with-temp-buffer - (insert-file-contents file) - (read (current-buffer)))))) - -(defun transient--pp-to-file (value file) - (when (or value (file-exists-p file)) - (make-directory (file-name-directory file) t) - (setq value (cl-sort (copy-sequence value) #'string< :key #'car)) - (with-temp-file file - (let ((print-level nil) - (print-length nil) - (pp-default-function 'pp-28) - (fill-column 999)) - (pp value (current-buffer)))))) - -(defvar transient-values - (transient--read-file-contents transient-values-file) - "Values of transient commands. -The value of this variable persists between Emacs sessions -and you usually should not change it manually.") - -(defun transient-save-values () - (transient--pp-to-file transient-values transient-values-file)) - -(defvar transient-levels - (transient--read-file-contents transient-levels-file) - "Levels of transient commands. -The value of this variable persists between Emacs sessions -and you usually should not change it manually.") - -(defun transient-save-levels () - (transient--pp-to-file transient-levels transient-levels-file)) - -(defvar transient-history - (transient--read-file-contents transient-history-file) - "History of transient commands and infix arguments. -The value of this variable persists between Emacs sessions -\(unless `transient-save-history' is nil) and you usually -should not change it manually.") - -(defun transient-save-history () - (setq transient-history - (cl-sort (mapcar (pcase-lambda (`(,key . ,val)) - (cons key (seq-take (delete-dups val) - transient-history-limit))) - transient-history) - #'string< :key #'car)) - (transient--pp-to-file transient-history transient-history-file)) - -(defun transient-maybe-save-history () - "Save the value of `transient-history'. -If `transient-save-history' is nil, then do nothing." - (when transient-save-history - (with-demoted-errors "Error saving transient history: %S" - (transient-save-history)))) - -(unless noninteractive - (add-hook 'kill-emacs-hook #'transient-maybe-save-history)) - -;;; Classes -;;;; Prefix - -(defclass transient-prefix () - ((prototype :initarg :prototype) - (command :initarg :command) - (level :initarg :level) - (init-value :initarg :init-value) - (value) (default-value :initarg :value) - (return :initarg :return :initform nil) - (scope :initarg :scope :initform nil) - (history :initarg :history :initform nil) - (history-pos :initarg :history-pos :initform 0) - (history-key :initarg :history-key :initform nil) - (show-help :initarg :show-help :initform nil) - (info-manual :initarg :info-manual :initform nil) - (man-page :initarg :man-page :initform nil) - (transient-suffix :initarg :transient-suffix :initform nil) - (transient-non-suffix :initarg :transient-non-suffix :initform nil) - (transient-switch-frame :initarg :transient-switch-frame) - (refresh-suffixes :initarg :refresh-suffixes :initform nil) - (remember-value :initarg :remember-value :initform nil) - (environment :initarg :environment :initform nil) - (incompatible :initarg :incompatible :initform nil) - (suffix-description :initarg :suffix-description) - (display-action :initarg :display-action :initform nil) - (mode-line-format :initarg :mode-line-format) - (variable-pitch :initarg :variable-pitch :initform nil) - (column-widths :initarg :column-widths :initform nil) - (unwind-suffix :documentation "Internal use." :initform nil)) - "Transient prefix command. - -Each transient prefix command consists of a command, which is -stored in a symbol's function slot and an object, which is -stored in the `transient--prefix' property of the same symbol. - -When a transient prefix command is invoked, then a clone of that -object is stored in the global variable `transient--prefix' and -the prototype is stored in the clone's `prototype' slot.") - -;;;; Suffix - -(defclass transient-child () - ((parent - :initarg :parent - :initform nil - :documentation "The parent group object.") - (level - :initarg :level - :initform nil - :documentation "Enable if level of prefix is equal or greater.") - (inactive - :initform nil) - (if - :initarg :if - :initform nil - :documentation "Enable if predicate returns non-nil.") - (if-not - :initarg :if-not - :initform nil - :documentation "Enable if predicate returns nil.") - (if-non-nil - :initarg :if-non-nil - :initform nil - :documentation "Enable if variable's value is non-nil.") - (if-nil - :initarg :if-nil - :initform nil - :documentation "Enable if variable's value is nil.") - (if-mode - :initarg :if-mode - :initform nil - :documentation "Enable if major-mode matches value.") - (if-not-mode - :initarg :if-not-mode - :initform nil - :documentation "Enable if major-mode does not match value.") - (if-derived - :initarg :if-derived - :initform nil - :documentation "Enable if major-mode derives from value.") - (if-not-derived - :initarg :if-not-derived - :initform nil - :documentation "Enable if major-mode does not derive from value.") - (inapt - :initform nil) - (inapt-face - :initarg :inapt-face - :initform 'transient-inapt-suffix) - (inapt-if - :initarg :inapt-if - :initform nil - :documentation "Inapt if predicate returns non-nil.") - (inapt-if-not - :initarg :inapt-if-not - :initform nil - :documentation "Inapt if predicate returns nil.") - (inapt-if-non-nil - :initarg :inapt-if-non-nil - :initform nil - :documentation "Inapt if variable's value is non-nil.") - (inapt-if-nil - :initarg :inapt-if-nil - :initform nil - :documentation "Inapt if variable's value is nil.") - (inapt-if-mode - :initarg :inapt-if-mode - :initform nil - :documentation "Inapt if major-mode matches value.") - (inapt-if-not-mode - :initarg :inapt-if-not-mode - :initform nil - :documentation "Inapt if major-mode does not match value.") - (inapt-if-derived - :initarg :inapt-if-derived - :initform nil - :documentation "Inapt if major-mode derives from value.") - (inapt-if-not-derived - :initarg :inapt-if-not-derived - :initform nil - :documentation "Inapt if major-mode does not derive from value.") - (advice - :initarg :advice - :initform nil - :documentation "Advise applied to the command body.") - (advice* - :initarg :advice* - :initform nil - :documentation "Advise applied to the command body and interactive spec.")) - "Abstract superclass for group and suffix classes. - -It is undefined which predicates are used if more than one `if*' -predicate slots or more than one `inapt-if*' slots are non-nil." - :abstract t) - -(defclass transient-suffix (transient-child) - ((definition :allocation :class :initform nil) - (key :initarg :key) - (command :initarg :command) - (transient :initarg :transient) - (format :initarg :format :initform " %k %d") - (description :initarg :description :initform nil) - (face :initarg :face :initform nil) - (show-help :initarg :show-help :initform nil) - (summary :initarg :summary :initform nil)) - "Superclass for suffix command.") - -(defclass transient-information (transient-suffix) - ((format :initform " %k %d") - (key :initform " ")) - "Display-only information, aligned with suffix keys. -Technically a suffix object with no associated command.") - -(defclass transient-information* (transient-information) - ((format :initform " %d")) - "Display-only information, aligned with suffix descriptions. -Technically a suffix object with no associated command.") - -(defclass transient-infix (transient-suffix) - ((transient :initform t) - (argument :initarg :argument) - (shortarg :initarg :shortarg) - (value :initform nil) - (init-value :initarg :init-value) - (unsavable :initarg :unsavable :initform nil) - (multi-value :initarg :multi-value :initform nil) - (always-read :initarg :always-read :initform nil) - (allow-empty :initarg :allow-empty :initform nil) - (history-key :initarg :history-key :initform nil) - (reader :initarg :reader :initform nil) - (prompt :initarg :prompt :initform nil) - (choices :initarg :choices :initform nil) - (format :initform " %k %d (%v)")) - "Transient infix command." - :abstract t) - -(defclass transient-argument (transient-infix) () - "Abstract superclass for infix arguments." - :abstract t) - -(defclass transient-switch (transient-argument) () - "Class used for command-line argument that can be turned on and off.") - -(defclass transient-option (transient-argument) () - "Class used for command-line argument that can take a value.") - -(defclass transient-variable (transient-infix) - ((variable :initarg :variable) - (format :initform " %k %d %v")) - "Abstract superclass for infix commands that set a variable." - :abstract t) - -(defclass transient-switches (transient-argument) - ((argument-format :initarg :argument-format) - (argument-regexp :initarg :argument-regexp)) - "Class used for sets of mutually exclusive command-line switches.") - -(defclass transient-files (transient-option) () - ((key :initform "--") - (argument :initform "--") - (multi-value :initform rest) - (reader :initform transient-read-files)) - "Class used for the \"--\" argument or similar. -All remaining arguments are treated as files. -They become the value of this argument.") - -(defclass transient-value-preset (transient-suffix) - ((transient :initform t) - (set :initarg := :initform nil)) - "Class used by the `transient-preset' suffix command.") - -(defclass transient-describe-target (transient-suffix) - ((transient :initform #'transient--do-suspend) - (helper :initarg :helper :initform nil) - (target :initarg := :initform nil)) - "Class used by the `transient-describe' suffix command.") - -;;;; Group - -(defclass transient-group (transient-child) - ((suffixes :initarg :suffixes :initform nil) - (hide :initarg :hide :initform nil) - (description :initarg :description :initform nil) - (pad-keys :initarg :pad-keys :initform nil) - (info-format :initarg :info-format :initform nil) - (setup-children :initarg :setup-children)) - "Abstract superclass of all group classes." - :abstract t) - -(defclass transient-column (transient-group) () - "Group class that displays each element on a separate line.") - -(defclass transient-row (transient-group) () - "Group class that displays all elements on a single line.") - -(defclass transient-columns (transient-group) () - "Group class that displays elements organized in columns. -Direct elements have to be groups whose elements have to be -commands or strings. Each subgroup represents a column. -This class takes care of inserting the subgroups' elements.") - -(defclass transient-subgroups (transient-group) () - "Group class that wraps other groups. - -Direct elements have to be groups whose elements have to be -commands or strings. This group inserts an empty line between -subgroups. The subgroups are responsible for displaying their -elements themselves.") - -;;; Define - -(defmacro transient-define-prefix (name arglist &rest args) - "Define NAME as a transient prefix command. - -ARGLIST are the arguments that command takes. -DOCSTRING is the documentation string and is optional. - -These arguments can optionally be followed by key-value pairs. -Each key has to be a keyword symbol, either `:class' or a keyword -argument supported by the constructor of that class. The -`transient-prefix' class is used if the class is not specified -explicitly. - -GROUPs add key bindings for infix and suffix commands and specify -how these bindings are presented in the menu buffer. At least -one GROUP has to be specified. See info node `(transient)Binding -Suffix and Infix Commands'. - -The BODY is optional. If it is omitted, then ARGLIST is also -ignored and the function definition becomes: - - (lambda () - (interactive) - (transient-setup \\='NAME)) - -If BODY is specified, then it must begin with an `interactive' -form that matches ARGLIST, and it must call `transient-setup'. -It may however call that function only when some condition is -satisfied; that is one of the reason why you might want to use -an explicit BODY. - -All transients have a (possibly nil) value, which is exported -when suffix commands are called, so that they can consume that -value. For some transients it might be necessary to have a sort -of secondary value, called a scope. Such a scope would usually -be set in the commands `interactive' form and has to be passed -to the setup function: - - (transient-setup \\='NAME nil nil :scope SCOPE) - -\(fn NAME ARGLIST [DOCSTRING] [KEYWORD VALUE]... GROUP... [BODY...])" - (declare (debug ( &define name lambda-list - [&optional lambda-doc] - [&rest keywordp sexp] - [&rest vectorp] - [&optional ("interactive" interactive) def-body])) - (indent defun) - (doc-string 3)) - (pcase-let - ((`(,class ,slots ,groups ,docstr ,body ,interactive-only) - (transient--expand-define-args args arglist 'transient-define-prefix))) - `(progn - (defalias ',name - ,(if body - `(lambda ,arglist ,@body) - `(lambda () - (interactive) - (transient-setup ',name)))) - (put ',name 'interactive-only ,interactive-only) - (put ',name 'function-documentation ,docstr) - (put ',name 'transient--prefix - (,(or class 'transient-prefix) :command ',name ,@slots)) - (transient--set-layout - ',name - (list ,@(mapcan (lambda (s) (transient--parse-child name s)) groups)))))) - -(defmacro transient-define-group (name &rest groups) - "Define one or more groups and store them in symbol NAME. - -Groups defined using this macro, can be used inside the -definition of transient prefix commands, by using the symbol -NAME where a group vector is expected. GROUPS has the same -form as for `transient-define-prefix'." - (declare (debug (&define name [&rest vectorp])) - (indent defun)) - `(transient--set-layout - ',name - (list ,@(mapcan (lambda (s) (transient--parse-child name s)) groups)))) - -(defmacro transient-define-suffix (name arglist &rest args) - "Define NAME as a transient suffix command. - -ARGLIST are the arguments that the command takes. -DOCSTRING is the documentation string and is optional. - -These arguments can optionally be followed by key-value pairs. -Each key has to be a keyword symbol, either `:class' or a -keyword argument supported by the constructor of that class. -The `transient-suffix' class is used if the class is not -specified explicitly. - -The BODY must begin with an `interactive' form that matches -ARGLIST. The infix arguments are usually accessed by using -`transient-args' inside `interactive'. - -\(fn NAME ARGLIST [DOCSTRING] [KEYWORD VALUE]... [BODY...])" - (declare (debug ( &define name lambda-list - [&optional lambda-doc] - [&rest keywordp sexp] - [&optional ("interactive" interactive) def-body])) - (indent defun) - (doc-string 3)) - (pcase-let - ((`(,class ,slots ,_ ,docstr ,body ,interactive-only) - (transient--expand-define-args args arglist 'transient-define-suffix))) - `(progn - (defalias ',name - ,(if (and (not body) class (oref-default class definition)) - `(oref-default ',class definition) - `(lambda ,arglist ,@body))) - (put ',name 'interactive-only ,interactive-only) - (put ',name 'function-documentation ,docstr) - (put ',name 'transient--suffix - (,(or class 'transient-suffix) :command ',name ,@slots))))) - -(defmacro transient-augment-suffix (name &rest args) - "Augment existing command NAME with a new transient suffix object. -Similar to `transient-define-suffix' but define a suffix object only. -\n\(fn NAME [KEYWORD VALUE]...)" - (declare (debug (&define name [&rest keywordp sexp])) - (indent defun)) - (pcase-let - ((`(,class ,slots) - (transient--expand-define-args args nil 'transient-augment-suffix t))) - `(put ',name 'transient--suffix - (,(or class 'transient-suffix) :command ',name ,@slots)))) - -(defmacro transient-define-infix (name arglist &rest args) - "Define NAME as a transient infix command. - -ARGLIST is always ignored and reserved for future use. -DOCSTRING is the documentation string and is optional. - -At least one key-value pair is required. All transient infix -commands are equal to each other (but not eq). It is meaning- -less to define an infix command, without providing at least one -keyword argument (usually `:argument' or `:variable', depending -on the class). The suffix class defaults to `transient-switch' -and can be set using the `:class' keyword. - -The function definitions is always: - - (lambda () - (interactive) - (let ((obj (transient-suffix-object))) - (transient-infix-set obj (transient-infix-read obj))) - (transient--show)) - -`transient-infix-read' and `transient-infix-set' are generic -functions. Different infix commands behave differently because -the concrete methods are different for different infix command -classes. In rare case the above command function might not be -suitable, even if you define your own infix command class. In -that case you have to use `transient-define-suffix' to define -the infix command and use t as the value of the `:transient' -keyword. - -\(fn NAME ARGLIST [DOCSTRING] KEYWORD VALUE [KEYWORD VALUE]...)" - (declare (debug ( &define name lambda-list - [&optional lambda-doc] - keywordp sexp - [&rest keywordp sexp])) - (indent defun) - (doc-string 3)) - (pcase-let - ((`(,class ,slots ,_ ,docstr ,_ ,interactive-only) - (transient--expand-define-args args arglist 'transient-define-infix t))) - `(progn - (defalias ',name #'transient--default-infix-command) - (put ',name 'interactive-only ,interactive-only) - (put ',name 'completion-predicate #'transient--suffix-only) - (put ',name 'function-documentation ,docstr) - (put ',name 'transient--suffix - (,(or class 'transient-switch) :command ',name ,@slots))))) - -(defalias 'transient-define-argument #'transient-define-infix - "Define NAME as a transient infix command. - -Only use this alias to define an infix command that actually -sets an infix argument. To define a infix command that, for -example, sets a variable, use `transient-define-infix' instead. - -\(fn NAME ARGLIST [DOCSTRING] [KEYWORD VALUE]...)") - -(defun transient--default-infix-command () - ;; Most infix commands are but an alias for this command. - "Cannot show any documentation for this transient infix command. - -When you request help for an infix command using `transient-help', that -usually shows the respective man-page and tries to jump to the location -where the respective argument is being described. - -If no man-page is specified for the containing transient menu, then the -docstring is displayed instead, if any. - -If the infix command doesn't have a docstring, as is the case here, then -this docstring is displayed instead, because technically infix commands -are aliases for `transient--default-infix-command'. - -`describe-function' also shows the docstring of the infix command, -falling back to that of the same aliased command." - (interactive) - (let ((obj (transient-suffix-object))) - (transient-infix-set obj (transient-infix-read obj))) - (transient--show)) -(put 'transient--default-infix-command 'interactive-only t) -(put 'transient--default-infix-command 'completion-predicate - #'transient--suffix-only) - -(define-advice find-function-advised-original - (:around (fn func) transient-default-infix) - "Return nil instead of `transient--default-infix-command'. -When using `find-function' to jump to the definition of a transient -infix command/argument, then we want to actually jump to that, not to -the definition of `transient--default-infix-command', which all infix -commands are aliases for." - (let ((val (funcall fn func))) - (and val (not (eq val 'transient--default-infix-command)) val))) - -(eval-and-compile ;transient--expand-define-args - (defun transient--expand-define-args (args &optional arglist form nobody) - ;; ARGLIST and FORM are only optional for backward compatibility. - ;; This is necessary because "emoji.el" from Emacs 29 calls this - ;; function directly, with just one argument. - (declare (advertised-calling-convention - (args arglist form &optional nobody) "0.7.1")) - (unless (listp arglist) - (error "Mandatory ARGLIST is missing")) - (let (class keys suffixes docstr declare (interactive-only t)) - (when (stringp (car args)) - (setq docstr (pop args))) - (while (keywordp (car args)) - (let ((k (pop args)) - (v (pop args))) - (if (eq k :class) - (setq class v) - (push k keys) - (push v keys)))) - (while-let* - ((arg (car args)) - (arg (cond - ;; Inline group definition. - ((vectorp arg) - (pop args)) - ;; Quoted include, as one would expect. - ((eq (car-safe arg) 'quote) - (cadr (pop args))) - ;; Unquoted include, for compatibility. - ((and arg (symbolp arg)) - (pop args))))) - (push arg suffixes)) - (when (eq (car-safe (car args)) 'declare) - (setq declare (car args)) - (setq args (cdr args)) - (when-let ((int (assq 'interactive-only declare))) - (setq interactive-only (cadr int)) - (delq int declare)) - (unless (cdr declare) - (setq declare nil))) - (cond - ((not args)) - (nobody - (error "%s: No function body allowed" form)) - ((not (eq (car-safe (nth (if declare 1 0) args)) 'interactive)) - (error "%s: Interactive form missing" form))) - (list (if (eq (car-safe class) 'quote) - (cadr class) - class) - (nreverse keys) - (nreverse suffixes) - docstr - (if declare (cons declare args) args) - interactive-only)))) - -(defun transient--parse-child (prefix spec) - (cl-typecase spec - (null (error "Invalid transient--parse-child spec: %s" spec)) - (symbol (list `',spec)) - (vector (and$ (transient--parse-group prefix spec) (list $))) - (list (and$ (transient--parse-suffix prefix spec) (list $))) - (string (list spec)) - (t (error "Invalid transient--parse-child spec: %s" spec)))) - -(defun transient--parse-group (prefix spec) - (let (class args) - (setq spec (append spec nil)) - (when (integerp (car spec)) - (setq args (plist-put args :level (pop spec)))) - (when (stringp (car spec)) - (setq args (plist-put args :description (pop spec)))) - (while (keywordp (car spec)) - (let* ((key (pop spec)) - (val (if spec (pop spec) (error "No value for `%s'" key)))) - (cond ((eq key :class) - (setq class val)) - ((or (symbolp val) - (and (listp val) - (not (memq (car val) (list 'lambda (intern "")))))) - (setq args (plist-put args key (macroexp-quote val)))) - ((setq args (plist-put args key val)))))) - (unless (or spec class (not (plist-get args :setup-children))) - (message "WARNING: %s: When %s is used, %s must also be specified" - 'transient-define-prefix :setup-children :class)) - (list 'vector - (list 'quote - (cond (class) - ((cl-typep (car spec) - '(or vector (and symbol (not null)))) - 'transient-columns) - ('transient-column))) - (and args (cons 'list args)) - (cons 'list - (mapcan (lambda (s) (transient--parse-child prefix s)) spec))))) - -(defun transient--parse-suffix (prefix spec) - (let (class args) - (cl-flet ((use (prop value) - (setq args (plist-put args prop value)))) - (pcase (car spec) - ((cl-type integer) - (use :level (pop spec)))) - (pcase (car spec) - ((cl-type (or string vector)) - (use :key (pop spec)))) - (pcase (car spec) - ((guard (or (stringp (car spec)) - (and (eq (car-safe (car spec)) 'lambda) - (not (commandp (car spec)))))) - (use :description (pop spec))) - ((and (cl-type (and symbol (not keyword) (not command))) - (guard (commandp (cadr spec)))) - (use :description (macroexp-quote (pop spec))))) - (pcase (car spec) - ((or :info :info* :cons)) - ((and (cl-type keyword) invalid) - (error "Need command, argument, `:info', `:info*' or `:cons'; got `%s'" - invalid)) - ((cl-type symbol) - (use :command (macroexp-quote (pop spec)))) - ;; During macro-expansion this is expected to be a `lambda' - ;; expression (i.e., source code). When this is called from a - ;; `:setup-children' function, it may also be a function object - ;; (a.k.a a function value). However, we never treat a string - ;; as a command, so we have to check for that explicitly. - ((cl-type (and command (not string))) - (let ((cmd (pop spec)) - (sym (intern - (format - "transient:%s:%s:%d" prefix - (replace-regexp-in-string (plist-get args :key) " " "") - (prog1 gensym-counter (cl-incf gensym-counter)))))) - (use :command - `(prog1 ',sym - (put ',sym 'interactive-only t) - (put ',sym 'completion-predicate #'transient--suffix-only) - (defalias ',sym ,cmd))))) - ((cl-type (or string (and list (not null)))) - (let ((arg (pop spec))) - (cl-typecase arg - (list - (use :shortarg (car arg)) - (use :argument (cadr arg)) - (setq arg (cadr arg))) - (string - (when-let ((shortarg (transient--derive-shortarg arg))) - (use :shortarg shortarg)) - (use :argument arg))) - (use :command - (let ((sym (intern (format "transient:%s:%s" prefix arg)))) - `(prog1 ',sym - (put ',sym 'interactive-only t) - (put ',sym 'completion-predicate #'transient--suffix-only) - (defalias ',sym #'transient--default-infix-command)))) - (pcase (car spec) - ((cl-type (and (not null) (not keyword))) - (setq class 'transient-option) - (use :reader (macroexp-quote (pop spec)))) - ((guard (string-suffix-p "=" arg)) - (setq class 'transient-option)) - (_ (setq class 'transient-switch))))) - (invalid - (error "Need command, argument, `:info' or `:info*'; got %s" invalid))) - (while (keywordp (car spec)) - (let* ((key (pop spec)) - (val (if spec (pop spec) (error "No value for `%s'" key)))) - (pcase key - (:class (setq class val)) - (:info (setq class 'transient-information) - (use :description val)) - (:info* (setq class 'transient-information*) - (use :description val)) - (:cons - (setq class 'transient-cons-option) - (use :command - (let ((sym (intern (format "transient:%s:%s" prefix val)))) - `(prog1 ',sym - (put ',sym 'interactive-only t) - (put ',sym 'completion-predicate #'transient--suffix-only) - (defalias ',sym #'transient--default-infix-command)))) - (use :argument val)) - ((guard (eq (car-safe val) '\,)) - (use key (cadr val))) - ((guard (or (symbolp val) - (and (listp val) - (not (memq (car val) (list 'lambda (intern ""))))))) - (use key (macroexp-quote val))) - (_ (use key val))))) - (when spec - (error "Need keyword, got %S" (car spec))) - (cond-let - ([key (plist-get args :key)] - (when (string-match "\\`\\({p}\\)" key) - (use :key - (replace-match transient-common-command-prefix t t key 1)))) - ([shortarg (plist-get args :shortarg)] - (use :key shortarg)))) - (list 'cons - (macroexp-quote (or class 'transient-suffix)) - (cons 'list args)))) - -(defun transient--derive-shortarg (arg) - (save-match-data - (and (string-match "\\`\\(-[a-zA-Z]\\)\\(\\'\\|=\\)" arg) - (match-string 1 arg)))) - -(defun transient-command-completion-not-suffix-only-p (symbol _buffer) - "Say whether SYMBOL should be offered as a completion. -If the value of SYMBOL's `completion-predicate' property is -`transient--suffix-only', then return nil, otherwise return t. -This is the case when a command should only ever be used as a -suffix of a transient prefix command (as opposed to bindings -in regular keymaps or by using `execute-extended-command')." - (not (eq (get symbol 'completion-predicate) 'transient--suffix-only))) - -(defalias 'transient--suffix-only #'ignore - "Ignore ARGUMENTS, do nothing, and return nil. -See also `transient-command-completion-not-suffix-only-p'. -Only use this alias as the value of the `completion-predicate' -symbol property.") - -(unless read-extended-command-predicate - (setq read-extended-command-predicate - #'transient-command-completion-not-suffix-only-p)) - -(defun transient--set-layout (prefix layout) - (put prefix 'transient--layout (vector 2 nil layout))) - -(defun transient--get-layout (prefix) - (cond-let - [[layout (or (get prefix 'transient--layout) - ;; Migrate unparsed legacy group definition. - (condition-case-unless-debug err - (and-let* ((value (symbol-value prefix))) - (transient--set-layout - prefix - (if (and (listp value) - (or (listp (car value)) - (vectorp (car value)))) - (transient-parse-suffixes prefix value) - (list (transient-parse-suffix prefix value))))) - (error - (message "Not a legacy group definition: %s: %S" prefix err) - nil)))]] - ((not layout) - (error "Not a transient prefix command or group definition: %s" prefix)) - ((vectorp layout) - (let ((version (aref layout 0))) - (if (= version 2) - layout - (error "Unsupported layout version %s for %s" version prefix)))) - (t - ;; Upgrade from version 1. - (transient--set-layout - prefix - (named-let upgrade ((spec layout)) - (cond ((vectorp spec) - (pcase-let ((`[,level ,class ,args ,children] spec)) - (when level - (setq args (plist-put args :level level))) - (vector class args (mapcar #'upgrade children)))) - ((and (listp spec) - (length= spec 3) - (or (null (car spec)) - (natnump (car spec))) - (symbolp (cadr spec))) - (pcase-let ((`(,level ,class ,args) spec)) - (when level - (setq args (plist-put args :level level))) - (cons class args))) - ((listp spec) - (mapcar #'upgrade spec)) - (t spec))))))) - -(defun transient--get-children (prefix) - (aref (transient--get-layout prefix) 2)) - -(defun transient-parse-suffix (prefix suffix) - "Parse SUFFIX, to be added to PREFIX. -PREFIX is a prefix command symbol or object. -SUFFIX is a suffix command or a group specification (of - the same forms as expected by `transient-define-prefix'). -Intended for use in a group's `:setup-children' function." - (when (cl-typep prefix 'transient-prefix) - (setq prefix (oref prefix command))) - (eval (car (transient--parse-child prefix suffix)) t)) - -(defun transient-parse-suffixes (prefix suffixes) - "Parse SUFFIXES, to be added to PREFIX. -PREFIX is a prefix command symbol or object. -SUFFIXES is a list of suffix command or a group specification - (of the same forms as expected by `transient-define-prefix'). -Intended for use in a group's `:setup-children' function." - (when (cl-typep prefix 'transient-prefix) - (setq prefix (oref prefix command))) - (mapcar (apply-partially #'transient-parse-suffix prefix) suffixes)) - -;;; Edit - -(defun transient--insert-suffix (prefix loc suffix action &optional keep-other) - (pcase-let* ((suf (cl-etypecase suffix - (vector (eval (transient--parse-group prefix suffix) t)) - (list (eval (transient--parse-suffix prefix suffix) t)) - (string suffix) - (symbol suffix))) - (`(,elt ,group) (transient--locate-child prefix loc))) - (cond - ((not elt) - (funcall (if transient-error-on-insert-failure #'error #'message) - "Cannot insert %S into %s; %s not found" - suffix prefix loc)) - ((or (and (vectorp suffix) (not (vectorp elt))) - (and (listp suffix) (vectorp elt)) - (and (stringp suffix) (vectorp elt))) - (funcall (if transient-error-on-insert-failure #'error #'message) - "Cannot place %S into %s at %s; %s" - suffix prefix loc - "suffixes and groups cannot be siblings")) - (t - (when-let* ((_(not (eq keep-other 'always))) - (bindingp (listp suf)) - (key (transient--suffix-key suf)) - (conflict (car (transient--locate-child prefix key))) - (conflictp - (and (not (and (eq action 'replace) - (eq conflict elt))) - (or (not keep-other) - (eq (plist-get (transient--suffix-props suf) - :command) - (plist-get (transient--suffix-props conflict) - :command))) - (equal (transient--suffix-predicate suf) - (transient--suffix-predicate conflict))))) - (transient-remove-suffix prefix key) - (let ((eg (transient--locate-child prefix loc))) - (setq elt (car eg) group (cadr eg)))) - (let ((mem (memq elt (aref group 2)))) - (pcase-exhaustive action - ('insert (setcdr mem (cons elt (cdr mem))) - (setcar mem suf)) - ('append (setcdr mem (cons suf (cdr mem)))) - ('replace (setcar mem suf)))))))) - -;;;###autoload -(defun transient-insert-suffix (prefix loc suffix &optional keep-other) - "Insert a SUFFIX into PREFIX before LOC. -PREFIX is a prefix command, a symbol. -SUFFIX is a suffix command or a group specification (of - the same forms as expected by `transient-define-prefix'). -LOC is a command, a key vector, a key description (a string - as returned by `key-description'), or a coordination list - (whose last element may also be a command or key). -Remove a conflicting binding unless optional KEEP-OTHER is - non-nil. When the conflict appears to be a false-positive, - non-nil KEEP-OTHER may be ignored, which can be prevented - by using `always'. -See info node `(transient)Modifying Existing Transients'." - (declare (indent defun)) - (transient--insert-suffix prefix loc suffix 'insert keep-other)) - -;;;###autoload -(defun transient-append-suffix (prefix loc suffix &optional keep-other) - "Insert a SUFFIX into PREFIX after LOC. -PREFIX is a prefix command, a symbol. -SUFFIX is a suffix command or a group specification (of - the same forms as expected by `transient-define-prefix'). -LOC is a command, a key vector, a key description (a string - as returned by `key-description'), or a coordination list - (whose last element may also be a command or key). -Remove a conflicting binding unless optional KEEP-OTHER is - non-nil. When the conflict appears to be a false-positive, - non-nil KEEP-OTHER may be ignored, which can be prevented - by using `always'. -See info node `(transient)Modifying Existing Transients'." - (declare (indent defun)) - (transient--insert-suffix prefix loc suffix 'append keep-other)) - -;;;###autoload -(defun transient-replace-suffix (prefix loc suffix) - "Replace the suffix at LOC in PREFIX with SUFFIX. -PREFIX is a prefix command, a symbol. -SUFFIX is a suffix command or a group specification (of - the same forms as expected by `transient-define-prefix'). -LOC is a command, a key vector, a key description (a string - as returned by `key-description'), or a coordination list - (whose last element may also be a command or key). -See info node `(transient)Modifying Existing Transients'." - (declare (indent defun)) - (transient--insert-suffix prefix loc suffix 'replace)) - -;;;###autoload -(defun transient-inline-group (prefix group) - "Inline the included GROUP into PREFIX. -Replace the symbol GROUP with its expanded layout in the -layout of PREFIX." - (declare (indent defun)) - (cl-assert (symbolp group)) - (pcase-let ((`(,suffix ,parent) (transient--locate-child prefix group))) - (when suffix - (let* ((siblings (aref parent 2)) - (pos (cl-position group siblings))) - (aset parent 2 - (nconc (seq-take siblings pos) - (transient--get-children group) - (seq-drop siblings (1+ pos)))))))) - -;;;###autoload -(defun transient-remove-suffix (prefix loc) - "Remove the suffix or group at LOC in PREFIX. -PREFIX is a prefix command, a symbol. -LOC is a command, a key vector, a key description (a string - as returned by `key-description'), or a coordination list - (whose last element may also be a command or key). -See info node `(transient)Modifying Existing Transients'." - (declare (indent defun)) - (pcase-let ((`(,suffix ,group) (transient--locate-child prefix loc))) - (when suffix - (aset group 2 (delq suffix (aref group 2)))))) - -(defun transient-suffix-put (prefix loc prop value) - "Edit the suffix at LOC in PREFIX, setting PROP to VALUE. -PREFIX is a prefix command, a symbol. -SUFFIX is a suffix command or a group specification (of - the same forms as expected by `transient-define-prefix'). -LOC is a command, a key vector, a key description (a string - as returned by `key-description'), or a coordination list - (whose last element may also be a command or key). -See info node `(transient)Modifying Existing Transients'." - (let ((child (transient-get-suffix prefix loc))) - (if (vectorp child) - (aset child 1 (plist-put (aref child 1) prop value)) - (setcdr child (plist-put (transient--suffix-props child) prop value))))) - -(defalias 'transient--suffix-props #'cdr) - -(defun transient-get-suffix (prefix loc) - "Return the suffix or group at LOC in PREFIX. -PREFIX is a prefix command, a symbol. -LOC is a command, a key vector, a key description (a string - as returned by `key-description'), or a coordination list - (whose last element may also be a command or key). -See info node `(transient)Modifying Existing Transients'." - (or (car (transient--locate-child prefix loc)) - (error "%s not found in %s" loc prefix))) - -(defun transient--locate-child (group loc) - (when (symbolp group) - (setq group (transient--get-layout group))) - (when (vectorp loc) - (setq loc (append loc nil))) - (cond-let - ((atom loc) - (seq-some (lambda (child) - (transient--match-child group loc child)) - (aref group 2))) - ([match (transient--nth (pop loc) (aref group 2))] - (cond (loc (transient--locate-child - match (cond ((or (stringp (car loc)) - (symbolp (car loc))) - (car loc)) - ((symbolp match) - (vconcat (cons 0 loc))) - ((vconcat loc))))) - ((list match group)))))) - -(defun transient--match-child (group loc child) - (cl-etypecase child - (string nil) - (symbol (cond-let - ((symbolp loc) - (and (eq child loc) - (list child group))) - ([include (transient--get-layout child)] - (transient--locate-child include loc)))) - (vector (seq-some (lambda (subgroup) - (transient--locate-child subgroup loc)) - (aref group 2))) - (list (and (if (symbolp loc) - (eq (plist-get (transient--suffix-props child) :command) - loc) - (equal (kbd (transient--suffix-key child)) - (kbd loc))) - (list child group))))) - -(defun transient--nth (n list) - (nth (if (< n 0) (- (length list) (abs n)) n) list)) - -(defun transient--suffix-key (spec) - (let ((props (transient--suffix-props spec))) - (or (plist-get props :key) - (transient--command-key - (plist-get props :command))))) - -(defun transient--command-key (cmd) - (and-let* ((obj (transient--suffix-prototype cmd))) - (cond ((slot-boundp obj 'key) - (oref obj key)) - ((slot-exists-p obj 'shortarg) - (if (slot-boundp obj 'shortarg) - (oref obj shortarg) - (transient--derive-shortarg (oref obj argument))))))) - -(defun transient-set-default-level (command level) - "Set the default level of suffix COMMAND to LEVEL. - -The default level is shadowed if the binding of the suffix in a -prefix menu specifies a level, and also if the user changes the -level of such a binding. - -The default level can only be set for commands that were defined -using `transient-define-suffix', `transient-define-infix' or -`transient-define-argument'." - (if-let ((proto (transient--suffix-prototype command))) - (oset proto level level) - (user-error "Cannot set level for `%s'; no prototype object exists" - command))) - -;;; Variables - -(defvar transient-current-prefix nil - "The transient from which this suffix command was invoked. -This is an object representing that transient, use -`transient-current-command' to get the respective command.") - -(defvar transient-current-command nil - "The transient from which this suffix command was invoked. -This is a symbol representing that transient, use -`transient-current-prefix' to get the respective object.") - -(defvar transient-current-suffixes nil - "The suffixes of the transient from which this suffix command was invoked. -This is a list of objects. Usually it is sufficient to instead -use the function `transient-args', which returns a list of -values. In complex cases it might be necessary to use this -variable instead.") - -(defvar transient-exit-hook nil - "Hook run after exiting a transient menu. -Unlike `transient-post-exit-hook', this runs even if another transient -menu becomes active at the same time. ") - -(defvar transient-post-exit-hook nil - "Hook run after exiting all transient menus. -Unlike `transient-exit-hook', this does not run if another transient -menu becomes active at the same time.") - -(defvar transient-setup-buffer-hook nil - "Hook run when setting up the transient buffer. -That buffer is current and empty when this hook runs.") - -(defvar transient--prefix nil) -(defvar transient--layout nil) -(defvar transient--suffixes nil) - -(defconst transient--stay t "Do not exit the transient.") -(defconst transient--exit nil "Do exit the transient.") - -(defvar transient--exitp nil "Whether to exit the transient.") -(defvar transient--showp nil "Whether to show the transient menu buffer.") -(defvar transient--helpp nil "Whether help-mode is active.") -(defvar transient--docsp nil "Whether docstring-mode is active.") -(defvar transient--editp nil "Whether edit-mode is active.") - -(defvar transient--refreshp nil - "Whether to refresh the transient completely.") - -(defvar transient--all-levels-p nil - "Whether temporary display of suffixes on all levels is active.") - -(defvar transient--timer nil) - -(defvar transient--stack nil) - -(defvar transient--minibuffer-depth 0) - -(defvar transient--buffer-name " *transient*" - "Name of the transient buffer.") - -(defvar transient--buffer nil - "The transient menu buffer.") - -(defvar transient--window nil - "The window used to display transient's menu buffer.") - -(defvar transient--original-window nil - "The window that was selected before the transient was invoked. -Usually it remains selected while the transient is active.") - -(defvar transient--original-buffer nil - "The buffer that was current before the transient was invoked. -Usually it remains current while the transient is active.") - -(defvar transient--restore-winconf nil - "Window configuration to restore after exiting help.") - -(defvar transient--shadowed-buffer nil - "The buffer that is temporarily shadowed by the transient buffer. -This is bound while the suffix predicate is being evaluated and while -drawing in the transient buffer.") - -(defvar transient--pending-suffix nil - "The suffix that is currently being processed. -This is bound while the suffix predicate is being evaluated, -and while functions that return faces are being evaluated.") - -(defvar transient--current-suffix nil - "The suffix currently being invoked using a mouse event. -Do not use this; instead use function `transient-suffix-object'.") - -(defvar transient--pending-group nil - "The group that is currently being processed. -This is bound while the suffixes are drawn in the transient buffer.") - -(defvar transient--debug nil - "Whether to put debug information into *Messages*.") - -(defvar transient--history nil) - -(defvar transient--scroll-commands - '(transient-scroll-up - transient-scroll-down - mwheel-scroll - scroll-bar-toolkit-scroll)) - -(defvar transient--quit-commands - '(transient-quit-one - transient-quit-all)) - -;;; Identities - -(defun transient-active-prefix (&optional prefixes) - "Return the active transient object. - -Return nil if there is no active transient, if the transient buffer -isn't shown, and while the active transient is suspended (e.g., while -the minibuffer is in use). - -Unlike `transient-current-prefix', which is only ever non-nil in code -that is run directly by a command that is invoked while a transient -is current, this function is also suitable for use in asynchronous -code, such as timers and callbacks (this function's main use-case). - -If optional PREFIXES is non-nil, it must be a prefix command symbol -or a list of symbols, in which case the active transient object is -only returned if it matches one of PREFIXES." - (and transient--showp - transient--prefix - (or (not prefixes) - (memq (oref transient--prefix command) (ensure-list prefixes))) - (or (memq 'transient--pre-command pre-command-hook) - (and (memq t pre-command-hook) - (memq 'transient--pre-command - (default-value 'pre-command-hook)))) - transient--prefix)) - -(defun transient-prefix-object () - "Return the current prefix as an object. - -While a transient is being setup or refreshed (which involves -preparing its suffixes) the variable `transient--prefix' can be -used to access the prefix object. Thus this is what has to be -used in suffix methods such as `transient-format-description', -and in object-specific functions that are stored in suffix slots -such as `description'. - -When a suffix command is invoked (i.e., in its `interactive' form -and function body) then the variable `transient-current-prefix' -has to be used instead. - -Two distinct variables are needed, because any prefix may itself -be used as a suffix of another prefix, and such sub-prefixes have -to be able to tell themselves apart from the prefix they were -invoked from. - -Regular suffix commands, which are not prefixes, do not have to -concern themselves with this distinction, so they can use this -function instead. In the context of a plain suffix, it always -returns the value of the appropriate variable." - (or transient--prefix transient-current-prefix)) - -(defun transient-suffix-object (&optional command) - "Return the object associated with the current suffix command. - -Each suffix commands is associated with an object, which holds -additional information about the suffix, such as its value (in -the case of an infix command, which is a kind of suffix command). - -This function is intended to be called by infix commands, which -are usually aliases of `transient--default-infix-command', which -is defined like this: - - (defun transient--default-infix-command () - (interactive) - (let ((obj (transient-suffix-object))) - (transient-infix-set obj (transient-infix-read obj))) - (transient--show)) - -\(User input is read outside of `interactive' to prevent the -command from being added to `command-history'. See #23.) - -Such commands need to be able to access their associated object -to guide how `transient-infix-read' reads the new value and to -store the read value. Other suffix commands (including non-infix -commands) may also need the object to guide their behavior. - -This function attempts to return the object associated with the -current suffix command even if the suffix command was not invoked -from a transient. (For some suffix command that is a valid thing -to do, for others it is not.) In that case nil may be returned, -if the command was not defined using one of the macros intended -to define such commands. - -The optional argument COMMAND is intended for internal use. If -you are contemplating using it in your own code, then you should -probably use this instead: - - (get COMMAND \\='transient--suffix)" - (when command - (cl-check-type command command)) - (cond-let* - (transient--pending-suffix) - (transient--current-suffix) - ((or transient--prefix - transient-current-prefix) - (let ((suffixes - (cl-remove-if-not - (lambda (obj) - (eq (oref obj command) - (or command - (if (eq this-command 'transient-set-level) - ;; This is how it can look up for which - ;; command it is setting the level. - this-original-command - this-command)))) - (or transient--suffixes - transient-current-suffixes)))) - (cond - ((length= suffixes 1) - (car suffixes)) - ((cl-find-if (lambda (obj) - (equal (listify-key-sequence (kbd (oref obj key))) - (listify-key-sequence (this-command-keys)))) - suffixes)) - ;; COMMAND is only provided if `this-command' is meaningless, in - ;; which case `this-command-keys' is also meaningless, making it - ;; impossible to disambiguate bindings for the same command. - (command (car suffixes)) - ;; If COMMAND is nil, then failure to disambiguate likely means - ;; that there is a bug somewhere. - ((length> suffixes 1) - (error "BUG: Cannot unambiguously determine suffix object")) - ;; It is legimate to use this function as a predicate of sorts. - ;; `transient--pre-command' and `transient-help' are examples. - (t nil)))) - ([obj (transient--suffix-prototype (or command this-command))] - [obj (clone obj)] - (transient-init-scope obj) - (transient-init-value obj) - obj))) - -(defun transient--suffix-prototype (command) - (or (get command 'transient--suffix) - (seq-some (lambda (cmd) (get cmd 'transient--suffix)) - (function-alias-p command)))) - -;;; Keymaps - -(defvar-keymap transient-base-map - :doc "Parent of other keymaps used by Transient. - -This is the parent keymap of all the keymaps that are used in -all transients: `transient-map' (which in turn is the parent -of the transient-specific keymaps), `transient-edit-map' and -`transient-sticky-map'. - -If you change a binding here, then you might also have to edit -`transient-sticky-map' and `transient-common-commands'. While -the latter isn't a proper transient prefix command, it can be -edited using the same functions as used for transients. - -If you add a new command here, then you must also add a binding -to `transient-predicate-map'." - "ESC ESC ESC" #'transient-quit-all - "C-g" #'transient-quit-one - "C-q" #'transient-quit-all - "C-z" #'transient-suspend - "C-v" #'transient-scroll-up - "C-M-v" #'transient-scroll-down - "" #'transient-scroll-up - "" #'transient-scroll-down) - -(defvar-keymap transient-map - :doc "Top-level keymap used by all transients. - -If you add a new command here, then you must also add a binding -to `transient-predicate-map'. See also `transient-base-map'." - :parent transient-base-map - "C-u" #'universal-argument - "C--" #'negative-argument - "C-t" #'transient-show - "?" #'transient-help - "C-h" #'transient-help - "C-x 5 5" #'other-frame-prefix - "C-x 4 4" #'other-window-prefix - ;; These have additional bindings in transient-common-commands. - "C-M-p" #'transient-history-prev - "C-M-n" #'transient-history-next) - -(defvar-keymap transient-edit-map - :doc "Keymap that is active while a transient in is in \"edit mode\"." - :parent transient-base-map - "?" #'transient-help - "C-h" #'transient-help) - -(defvar-keymap transient-sticky-map - :doc "Keymap that is active while an incomplete key sequence is active." - :parent transient-base-map - "C-g" #'transient-quit-seq) - -(defvar transient-common-commands - [:hide (lambda () - (defvar transient--redisplay-key) - (and (not (equal (vconcat transient--redisplay-key) - (read-kbd-macro transient-common-command-prefix))) - (not transient-show-common-commands))) - ["Value commands" - ("{p} s " "Set" transient-set) - ("{p} C-s" "Save" transient-save) - ("{p} C-k" "Reset" transient-reset) - ("{p} p " "Previous value" transient-history-prev) - ("{p} n " "Next value" transient-history-next)] - ["Sticky commands" - ;; Like `transient-sticky-map' except that - ;; "C-g" has to be bound to a different command. - ("C-g" "Quit prefix or transient" transient-quit-one) - ("C-q" "Quit transient stack" transient-quit-all) - ("C-z" "Suspend transient stack" transient-suspend)] - ["Customize" - ("{p} t" transient-toggle-common) - ("{p} l" "Show/hide suffixes" transient-set-level) - ("{p} a" transient-toggle-level-limit)]] - "Commands available in all transient menus. - -The same functions, that are used to change bindings in transient prefix -commands and transient groups (defined using `transient-define-group'), -should be used to modify these bindings as well. The actual layout is -stored in the symbol's `transient--layout' property. The variable value -is only used when customizing `transient-common-command-prefix', which -resets the value of `transient--layout' based on the values of that -option and this variable.") - -(defun transient--init-common-commands () - (transient--set-layout - 'transient-common-commands - (list (eval (car (transient--parse-child 'transient-common-commands - transient-common-commands)) - t))) - (defvar transient-common-command-prefix) - (defvar transient--docstr-hint-1) - (defvar transient--docstr-hint-2) - (setq transient--docstr-hint-1 - (define-keymap transient-common-command-prefix - 'transient-common-command-prefix)) - (setq transient--docstr-hint-2 - (define-keymap (concat transient-common-command-prefix " t") - 'transient-toggle-common))) - -(defcustom transient-common-command-prefix "C-x" - "The prefix key used for most commands common to all menus. - -Some shared commands are available in all transient menus, most of -which share a common prefix specified by this option. By default the -bindings for these shared commands are only shown after pressing that -prefix key and before following that up with a valid key binding. - -For historic reasons \\`C-x' is used by default, but users are -encouraged to pick another key, preferably one that is not commonly used -in Emacs but is still convenient to them. See info node `(transient) -Common Suffix Commands'." - :type 'key - :initialize (lambda (symbol exp) - (custom-initialize-default symbol exp) - (transient--init-common-commands)) - :set (lambda (symbol value) - (set-default symbol value) - (transient--init-common-commands))) - -(defvar-keymap transient-popup-navigation-map - :doc "One of the keymaps used when menu navigation is enabled. -See `transient-enable-popup-navigation'." - "" #'transient-noop - "" #'transient-backward-button - "" #'transient-forward-button - "C-r" #'transient-isearch-backward - "C-s" #'transient-isearch-forward - "M-RET" #'transient-push-button) - -(defvar-keymap transient-button-map - :doc "One of the keymaps used when menu navigation is enabled. -See `transient-enable-popup-navigation'." - "" #'transient-push-button - "" #'transient-push-button) - -(defvar-keymap transient-resume-mode-map - :doc "Keymap for `transient-resume-mode'. - -This keymap remaps every command that would usually just quit the -documentation buffer to `transient-resume', which additionally -resumes the suspended transient." - " " #'transient-resume - " " #'transient-resume - " " #'transient-resume) - -(defvar-keymap transient-predicate-map - :doc "Base keymap used to map common commands to their transient behavior. - -The \"transient behavior\" of a command controls, among other -things, whether invoking the command causes the transient to be -exited or not, and whether infix arguments are exported before -doing so. - -Each \"key\" is a command that is common to all transients and -that is bound in `transient-map', `transient-edit-map', -`transient-sticky-map' and/or `transient-common-command'. - -Each binding is a \"pre-command\", a function that controls the -transient behavior of the respective command. - -For transient commands that are bound in individual transients, -the transient behavior is specified using the `:transient' slot -of the corresponding object." - "" #'transient--do-suspend - "" #'transient--do-stay - "" #'transient--do-stay - "" #'transient--do-stay - "" #'transient--do-stay - "" #'transient--do-stay - "" #'transient--do-stay - "" #'transient--do-minus - "" #'transient--do-stay - "" #'transient--do-stay - "" #'transient--do-stay - "" #'transient--do-quit-all - "" #'transient--do-quit-all - "" #'transient--do-quit-one - "" #'transient--do-stay - "" #'transient--do-stay - "" #'transient--do-stay - "" #'transient--do-call - "" #'transient--do-exit - "" #'transient--do-call - "" #'transient--do-exit - "" #'transient--do-call - "" #'transient--do-stay - "" #'transient--do-stay - "" #'transient--do-stay - "" #'transient--do-stay - "" #'transient--do-stay - "" #'transient--do-stay - "" #'transient--do-noop - "" #'transient--do-move - "" #'transient--do-push-button - "" #'transient--do-move - "" #'transient--do-move - "" #'transient--do-move - "" #'transient--do-move - "" #'transient--do-stay - "" #'transient--do-stay - ;; If a valid but incomplete prefix sequence is followed by - ;; an unbound key, then Emacs calls the `undefined' command - ;; but does not set `this-command', `this-original-command' - ;; or `real-this-command' accordingly. Instead they are nil. - "" #'transient--do-warn - ;; Bound to the `mouse-movement' event, this command is similar - ;; to `ignore'. - "" #'transient--do-noop) - -(defvar transient--transient-map nil) -(defvar transient--predicate-map nil) -(defvar transient--redisplay-map nil) -(defvar transient--redisplay-key nil) - -(defun transient--push-keymap (var) - (let ((map (symbol-value var))) - (transient--debug " push %s%s" var (if map "" " VOID")) - (when map - (with-demoted-errors "transient--push-keymap: %S" - (internal-push-keymap map 'overriding-terminal-local-map))))) - -(defun transient--pop-keymap (var) - (let ((map (symbol-value var))) - (when map - (transient--debug " pop %s" var) - (with-demoted-errors "transient--pop-keymap: %S" - (internal-pop-keymap map 'overriding-terminal-local-map))))) - -(defun transient--make-transient-map () - (let ((map (make-sparse-keymap))) - (cond (transient--editp - (keymap-set map (concat transient-common-command-prefix " l") - #'transient-set-level) - (set-keymap-parent map transient-edit-map)) - ((set-keymap-parent map transient-map))) - (dolist (obj transient--suffixes) - (let ((key (oref obj key))) - (when (vectorp key) - (setq key (key-description key)) - (oset obj key key)) - (when transient-substitute-key-function - (setq key (save-match-data - (funcall transient-substitute-key-function obj))) - (oset obj key key)) - (let* ((kbd (kbd key)) - (cmd (oref obj command)) - (alt (transient--lookup-key map kbd))) - (cond ((not alt) - (define-key map kbd cmd)) - ((eq alt cmd)) - ((oref obj inactive)) - ((oref obj inapt)) - ((and-let* ((alt (transient-suffix-object alt))) - (or (oref alt inactive) - (oref alt inapt))) - (define-key map kbd cmd)) - (transient-detect-key-conflicts - (error "Cannot bind %S to %s and also %s" - (string-trim key) cmd alt)) - ((define-key map kbd cmd)))))) - (when$ (keymap-lookup map "-") (keymap-set map "" $)) - (when$ (keymap-lookup map "=") (keymap-set map "" $)) - (when$ (keymap-lookup map "+") (keymap-set map "" $)) - (when transient-enable-popup-navigation - ;; `transient--make-redisplay-map' maps only over bindings that are - ;; directly in the base keymap, so that cannot be a composed keymap. - (set-keymap-parent - map (make-composed-keymap - (keymap-parent map) - transient-popup-navigation-map))) - map)) - -(defun transient--make-predicate-map () - (let ((default (transient--resolve-pre-command - (oref transient--prefix transient-suffix))) - (return (and transient--stack (oref transient--prefix return))) - (map (make-sparse-keymap))) - (set-keymap-parent map transient-predicate-map) - (when (or (and (slot-boundp transient--prefix 'transient-switch-frame) - (transient--resolve-pre-command - (not (oref transient--prefix transient-switch-frame)))) - (memq (transient--resolve-pre-command - (oref transient--prefix transient-non-suffix)) - '(nil transient--do-warn transient--do-noop))) - (define-key map [handle-switch-frame] #'transient--do-suspend)) - (dolist (obj transient--suffixes) - (let* ((cmd (oref obj command)) - (id (vector cmd)) - (kind (cond ((get cmd 'transient--prefix) 'prefix) - ((cl-typep obj 'transient-infix) 'infix) - (t 'suffix))) - (pre (cond - ((oref obj inactive) nil) - ((oref obj inapt) #'transient--do-warn-inapt) - ((slot-boundp obj 'transient) - (pcase (list kind - (transient--resolve-pre-command - (oref obj transient) nil t) - return) - (`(prefix t ,_) #'transient--do-recurse) - (`(prefix nil ,_) #'transient--do-stack) - (`(infix t ,_) #'transient--do-stay) - (`(suffix t ,_) #'transient--do-call) - ('(suffix nil t) #'transient--do-return) - (`(,_ nil ,_) #'transient--do-exit) - (`(,_ ,do ,_) do))) - ((not (lookup-key transient-predicate-map id)) - (pcase (list kind default return) - (`(prefix ,(or 'transient--do-stay 'transient--do-call) ,_) - #'transient--do-recurse) - (`(prefix t ,_) #'transient--do-recurse) - (`(prefix ,_ ,_) #'transient--do-stack) - (`(infix ,_ ,_) #'transient--do-stay) - (`(suffix t ,_) #'transient--do-call) - ('(suffix nil t) #'transient--do-return) - (`(suffix nil nil) #'transient--do-exit) - (`(suffix ,do ,_) do)))))) - (when pre - (if-let ((alt (lookup-key map id))) - (unless (eq alt pre) - (define-key map (vconcat (oref obj key) id) pre)) - (define-key map id pre))))) - map)) - -(defun transient--make-redisplay-map () - (setq transient--redisplay-key - (pcase this-command - ('transient-update - (setq transient--showp t) - (let ((keys (listify-key-sequence (this-single-command-raw-keys)))) - (setq unread-command-events (mapcar (lambda (key) (cons t key)) keys)) - keys)) - ('transient-quit-seq - (setq unread-command-events - (butlast (listify-key-sequence - (this-single-command-raw-keys)) - 2)) - (butlast transient--redisplay-key)) - (_ nil))) - (let ((topmap (make-sparse-keymap)) - (submap (make-sparse-keymap))) - (when transient--redisplay-key - (define-key topmap (vconcat transient--redisplay-key) submap) - (set-keymap-parent submap transient-sticky-map)) - (map-keymap-internal - (lambda (key def) - (when (and (not (eq key ?\e)) - (listp def) - (keymapp def)) - (define-key topmap (vconcat transient--redisplay-key (list key)) - #'transient-update))) - (if transient--redisplay-key - (let ((key (vconcat transient--redisplay-key))) - (or (lookup-key transient--transient-map key) - (and-let* ((regular (lookup-key local-function-key-map key))) - (lookup-key transient--transient-map (vconcat regular))))) - transient--transient-map)) - topmap)) - -;;; Setup - -(defun transient-setup (&optional name layout edit &rest params) - "Setup the transient specified by NAME. - -This function is called by transient prefix commands to setup the -transient. In that case NAME is mandatory, LAYOUT and EDIT must -be nil and PARAMS may be (but usually is not) used to set, e.g., -the \"scope\" of the transient (see `transient-define-prefix'). - -This function is also called internally, in which case LAYOUT and -EDIT may be non-nil." - (transient--debug 'setup) - (transient--with-emergency-exit :setup - (cond - ((not name) - ;; Switching between regular and edit mode. - (transient--pop-keymap 'transient--transient-map) - (transient--pop-keymap 'transient--redisplay-map) - (setq name (oref transient--prefix command)) - (setq params (list :scope (oref transient--prefix scope)))) - (transient--prefix - ;; Invoked as a ":transient-non-suffix 'transient--do-{stay,call}" - ;; of an outer prefix. Unlike the usual `transient--do-stack', - ;; these predicates fail to clean up after the outer prefix. - (transient--pop-keymap 'transient--transient-map) - (transient--pop-keymap 'transient--redisplay-map)) - ((not (or layout ; resuming parent/suspended prefix - transient-current-command)) ; entering child prefix - (transient--stack-zap)) ; replace suspended prefix, if any - (edit - ;; Returning from help to edit. - (setq transient--editp t))) - (transient--env-apply - (lambda () - (transient--init-transient name layout params) - (transient--history-init transient--prefix) - (setq transient--original-window (selected-window)) - (setq transient--original-buffer (current-buffer)) - (setq transient--minibuffer-depth (minibuffer-depth)) - (transient--redisplay)) - (get name 'transient--prefix)) - (transient--suspend-text-conversion-style) - (transient--setup-transient) - (transient--suspend-which-key-mode))) - -(cl-defgeneric transient-setup-children (group children) - "Setup the CHILDREN of GROUP. -If the value of the `setup-children' slot is non-nil, then call -that function with CHILDREN as the only argument and return the -value. Otherwise return CHILDREN as is.") - -(cl-defmethod transient-setup-children ((group transient-group) children) - (if (slot-boundp group 'setup-children) - (funcall (oref group setup-children) children) - children)) - -(defun transient--env-apply (fn &optional prefix) - (if-let ((env (oref (or prefix transient--prefix) environment))) - (funcall env fn) - (funcall fn))) - -(defun transient--init-transient (&optional name layout params) - (unless name - ;; Re-init. - (if (eq transient--refreshp 'updated-value) - ;; Preserve the prefix value this once, because the - ;; invoked suffix indicates that it has updated that. - (setq transient--refreshp (oref transient--prefix refresh-suffixes)) - ;; Otherwise update the prefix value from suffix values. - (oset transient--prefix value (transient--get-extended-value)))) - (transient--init-objects name layout params) - (transient--init-keymaps)) - -(defun transient--init-keymaps () - (setq transient--predicate-map (transient--make-predicate-map)) - (setq transient--transient-map (transient--make-transient-map)) - (setq transient--redisplay-map (transient--make-redisplay-map))) - -(defun transient--init-objects (&optional name layout params) - (if name - (setq transient--prefix (transient--init-prefix name params)) - (setq name (oref transient--prefix command))) - (setq transient--refreshp (oref transient--prefix refresh-suffixes)) - (cond ((and (not transient--refreshp) layout) - (setq transient--layout layout) - (setq transient--suffixes (transient--flatten-suffixes layout))) - (t - (setq transient--suffixes nil) - (setq transient--layout (transient--init-suffixes name)) - (setq transient--suffixes (nreverse transient--suffixes)))) - (slot-makeunbound transient--prefix 'value)) - -(defun transient--init-prefix (name &optional params) - (let ((obj (let ((proto (get name 'transient--prefix))) - (apply #'clone proto - :prototype proto - :level (or (alist-get t (alist-get name transient-levels)) - transient-default-level) - params)))) - (transient-init-value obj) - (transient-init-return obj) - (transient-init-scope obj) - obj)) - -(defun transient--init-suffixes (name) - (let ((levels (alist-get name transient-levels))) - (mapcan (lambda (c) (transient--init-child levels c nil)) - (append (transient--get-children name) - (and (not transient--editp) - (transient--get-children 'transient-common-commands)))))) - -(defun transient--flatten-suffixes (layout) - (named-let flatten ((def layout)) - (cond ((stringp def) nil) - ((cl-typep def 'transient-information) nil) - ((listp def) (mapcan #'flatten def)) - ((cl-typep def 'transient-group) - (mapcan #'flatten (oref def suffixes))) - ((cl-typep def 'transient-suffix) - (list def))))) - -(defun transient--init-child (levels spec parent) - (cl-etypecase spec - (symbol (mapcan (lambda (c) (transient--init-child levels c parent)) - (transient--get-children spec))) - (vector (transient--init-group levels spec parent)) - (list (transient--init-suffix levels spec parent)) - (string (list spec)))) - -(defun transient--init-group (levels spec parent) - (pcase-let* ((`[,class ,args ,children] spec) - (level (or (plist-get args :level) - transient--default-child-level))) - (and-let* ((_(transient--use-level-p level)) - (obj (apply class :parent parent :level level args)) - (_(transient--use-suffix-p obj)) - (_(prog1 t - (when (transient--inapt-suffix-p obj) - (oset obj inapt t)))) - (suffixes (mapcan (lambda (c) (transient--init-child levels c obj)) - (transient-setup-children obj children)))) - (progn - (oset obj suffixes suffixes) - (list obj))))) - -(defun transient--init-suffix (levels spec parent) - (let* ((class (car spec)) - (args (cdr spec)) - (cmd (plist-get args :command)) - (_ (transient--load-command-if-autoload cmd)) - (key (plist-get args :key)) - (key (and key (kbd key))) - (proto (and cmd (transient--suffix-prototype cmd))) - (level (or (alist-get (cons cmd key) levels nil nil #'equal) - (alist-get cmd levels) - (plist-get args :level) - (and proto (oref proto level)) - transient--default-child-level)) - (args (plist-put (copy-sequence args) :level level)) - (obj (if (child-of-class-p class 'transient-information) - (apply class :parent parent args) - (unless (and cmd (symbolp cmd)) - (error "BUG: Non-symbolic suffix command: %s" cmd)) - (if proto - (apply #'clone proto :parent parent args) - (apply class :command cmd :parent parent args)))) - (active (and (transient--use-level-p level) - (transient--use-suffix-p obj))) - (inapt (and active (transient--inapt-suffix-p obj))) - (active (and active (not inapt)))) - (cond (inapt - (oset obj inapt t)) - ((not active) - (oset obj inactive t))) - (cond ((not cmd)) - ((commandp cmd)) - ((or (cl-typep obj 'transient-switch) - (cl-typep obj 'transient-option)) - ;; As a temporary special case, if the package was compiled - ;; with an older version of Transient, then we must define - ;; "anonymous" switch and option commands here. - (defalias cmd #'transient--default-infix-command)) - (active - (error "Suffix command %s is not defined or autoloaded" cmd))) - (cond ((not (cl-typep obj 'transient-information)) - (transient--init-suffix-key obj) - (transient-init-scope obj) - (transient-init-value obj) - (push obj transient--suffixes))) - (list obj))) - -(cl-defmethod transient--init-suffix-key ((obj transient-suffix)) - (unless (slot-boundp obj 'key) - (error "No key for %s" (oref obj command)))) - -(cl-defmethod transient--init-suffix-key ((obj transient-argument)) - (if (transient-switches--eieio-childp obj) - (cl-call-next-method obj) - (when-let* ((_(not (slot-boundp obj 'shortarg))) - (argument (oref obj argument)) - (_(stringp argument)) - (shortarg (transient--derive-shortarg argument))) - (oset obj shortarg shortarg)) - (unless (slot-boundp obj 'key) - (if (slot-boundp obj 'shortarg) - (oset obj key (oref obj shortarg)) - (error "No key for %s" (oref obj command)))))) - -(defun transient--use-level-p (level &optional edit) - (or transient--all-levels-p - (and transient--editp (not edit)) - (and (>= level 1) - (<= level (oref transient--prefix level))))) - -(defun transient--use-suffix-p (obj) - (let ((transient--shadowed-buffer (current-buffer)) - (transient--pending-suffix obj)) - (transient--do-suffix-p - (oref obj if) - (oref obj if-not) - (oref obj if-nil) - (oref obj if-non-nil) - (oref obj if-mode) - (oref obj if-not-mode) - (oref obj if-derived) - (oref obj if-not-derived) - t))) - -(defun transient--inapt-suffix-p (obj) - (or (and$ (oref obj parent) - (oref $ inapt)) - (let ((transient--shadowed-buffer (current-buffer)) - (transient--pending-suffix obj)) - (transient--do-suffix-p - (oref obj inapt-if) - (oref obj inapt-if-not) - (oref obj inapt-if-nil) - (oref obj inapt-if-non-nil) - (oref obj inapt-if-mode) - (oref obj inapt-if-not-mode) - (oref obj inapt-if-derived) - (oref obj inapt-if-not-derived) - nil)))) - -(defun transient--do-suffix-p - (if if-not if-nil if-non-nil if-mode if-not-mode if-derived if-not-derived - default) - (cond - (if (funcall if)) - (if-not (not (funcall if-not))) - (if-non-nil (symbol-value if-non-nil)) - (if-nil (not (symbol-value if-nil))) - (if-mode (if (atom if-mode) - (eq major-mode if-mode) - (memq major-mode if-mode))) - (if-not-mode (not (if (atom if-not-mode) - (eq major-mode if-not-mode) - (memq major-mode if-not-mode)))) - (if-derived (if (or (atom if-derived) - (>= emacs-major-version 30)) - (derived-mode-p if-derived) - (apply #'derived-mode-p if-derived))) - (if-not-derived (not (if (or (atom if-not-derived) - (>= emacs-major-version 30)) - (derived-mode-p if-not-derived) - (apply #'derived-mode-p if-not-derived)))) - (default))) - -(defun transient--suffix-predicate (spec) - (let ((props (transient--suffix-props spec))) - (seq-some (lambda (prop) - (and$ (plist-get props prop) - (list prop $))) - '( :if :if-not - :if-nil :if-non-nil - :if-mode :if-not-mode - :if-derived :if-not-derived - :inapt-if :inapt-if-not - :inapt-if-nil :inapt-if-non-nil - :inapt-if-mode :inapt-if-not-mode - :inapt-if-derived :inapt-if-not-derived)))) - -(defun transient--load-command-if-autoload (cmd) - (when-let* ((_(symbolp cmd)) - (fn (symbol-function cmd)) - (_(autoloadp fn))) - (transient--debug " autoload %s" cmd) - (autoload-do-load fn))) - -;;; Flow-Control - -(defun transient--setup-transient () - (transient--debug 'setup-transient) - (transient--push-keymap 'transient--transient-map) - (transient--push-keymap 'transient--redisplay-map) - (add-hook 'pre-command-hook #'transient--pre-command 99) - (add-hook 'post-command-hook #'transient--post-command) - (advice-add 'recursive-edit :around #'transient--recursive-edit) - (transient--quit-kludge 'enable) - (when transient--exitp - ;; This prefix command was invoked as the suffix of another. - ;; Prevent `transient--post-command' from removing the hooks - ;; that we just added. - (setq transient--exitp 'replace))) - -(defun transient--refresh-transient () - (transient--debug 'refresh-transient) - (transient--pop-keymap 'transient--predicate-map) - (transient--pop-keymap 'transient--transient-map) - (transient--pop-keymap 'transient--redisplay-map) - (transient--init-transient) - (transient--push-keymap 'transient--transient-map) - (transient--push-keymap 'transient--redisplay-map) - (transient--redisplay)) - -(defun transient--pre-command () - (transient--debug 'pre-command) - (transient--with-emergency-exit :pre-command - ;; The use of `overriding-terminal-local-map' does not prevent the - ;; lookup of command remappings in the overridden maps, which can - ;; lead to a suffix being remapped to a non-suffix. We have to undo - ;; the remapping in that case. However, remapping a non-suffix to - ;; another should remain possible. - (when (and (transient--get-pre-command this-original-command nil 'suffix) - (not (transient--get-pre-command this-command nil 'suffix))) - (setq this-command this-original-command)) - (cond - ((memq this-command '(transient-update transient-quit-seq)) - (transient--pop-keymap 'transient--redisplay-map)) - ((and transient--helpp - (not (memq this-command transient--quit-commands))) - (cond - ((transient-help) - (transient--do-suspend) - (setq this-command 'transient-suspend) - (transient--pre-exit)) - ((not (transient--edebug-command-p)) - (setq this-command 'transient-undefined)))) - ((and transient--editp - (transient-suffix-object) - (not (memq this-command - (cons 'transient-help transient--quit-commands)))) - (setq this-command 'transient-set-level) - (transient--wrap-command)) - (t - (setq transient--exitp nil) - (let ((exitp (eq (transient--call-pre-command) transient--exit))) - (transient--wrap-command) - (when exitp - (transient--maybe-set-value 'exit) - (transient--pre-exit))))))) - -(defun transient--pre-exit () - (transient--debug 'pre-exit) - (transient--delete-window) - (transient--timer-cancel) - (transient--pop-keymap 'transient--transient-map) - (transient--pop-keymap 'transient--redisplay-map) - (unless transient--showp - (let ((message-log-max nil)) - (message ""))) - (setq transient--transient-map nil) - (setq transient--predicate-map nil) - (setq transient--redisplay-map nil) - (setq transient--redisplay-key nil) - (setq transient--helpp nil) - (unless (eq transient--docsp 'permanent) - (setq transient--docsp nil)) - (setq transient--editp nil) - (setq transient--prefix nil) - (setq transient--layout nil) - (setq transient--suffixes nil) - (setq transient--original-window nil) - (setq transient--original-buffer nil) - (setq transient--window nil)) - -(defun transient--export () - (setq transient-current-prefix transient--prefix) - (setq transient-current-command (oref transient--prefix command)) - (setq transient-current-suffixes transient--suffixes) - (unless (transient--maybe-set-value 'export) - (transient--history-push transient--prefix))) - -(defun transient--suspend-override (&optional nohide) - (transient--debug 'suspend-override) - (transient--timer-cancel) - (let ((show (transient--preserve-window-p nohide))) - (cond ((not show) - (transient--delete-window)) - ((and transient--prefix transient--redisplay-key) - (setq transient--redisplay-key nil) - (when transient--showp - (if-let ((win (minibuffer-selected-window))) - (with-selected-window win - (transient--show)) - (transient--show))))) - (when (and (window-live-p transient--window) - (and show - (or (not (eq show 'fixed)) - (window-full-height-p transient--window)))) - (set-window-parameter transient--window 'window-preserved-size - (list (window-buffer transient--window) nil nil)))) - (transient--pop-keymap 'transient--transient-map) - (transient--pop-keymap 'transient--redisplay-map) - (remove-hook 'pre-command-hook #'transient--pre-command) - (remove-hook 'post-command-hook #'transient--post-command)) - -(defun transient--resume-override (&optional _ignore) - (transient--debug 'resume-override) - (when (window-live-p transient--window) - (transient--fit-window-to-buffer transient--window)) - (transient--push-keymap 'transient--transient-map) - (transient--push-keymap 'transient--redisplay-map) - (add-hook 'pre-command-hook #'transient--pre-command) - (add-hook 'post-command-hook #'transient--post-command)) - -(defun transient--recursive-edit (fn) - (transient--debug 'recursive-edit) - (if (not transient--prefix) - (funcall fn) - (transient--suspend-override (bound-and-true-p edebug-active)) - (funcall fn) ; Already unwind protected. - (cond ((memq this-command '(top-level abort-recursive-edit)) - (setq transient--exitp t) - (transient--post-exit this-command) - (transient--delete-window)) - (transient--prefix - (transient--resume-override))))) - -(defmacro transient--with-suspended-override (&rest body) - (let ((depth (make-symbol "depth")) - (setup (make-symbol "setup")) - (exit (make-symbol "exit"))) - `(if (and transient--transient-map - (memq transient--transient-map - overriding-terminal-local-map)) - (let ((,depth (1+ (minibuffer-depth))) ,setup ,exit) - (setq ,setup - (lambda () "@transient--with-suspended-override" - (transient--debug 'minibuffer-setup) - (remove-hook 'minibuffer-setup-hook ,setup) - (transient--suspend-override))) - (setq ,exit - (lambda () "@transient--with-suspended-override" - (transient--debug 'minibuffer-exit) - (when (= (minibuffer-depth) ,depth) - (transient--resume-override)))) - (unwind-protect - (progn - (add-hook 'minibuffer-setup-hook ,setup) - (add-hook 'minibuffer-exit-hook ,exit) - ,@body) - (remove-hook 'minibuffer-setup-hook ,setup) - (remove-hook 'minibuffer-exit-hook ,exit))) - ,@body))) - -(defun transient--wrap-command () - (transient--load-command-if-autoload this-command) - (static-if (>= emacs-major-version 30) - (letrec - ((command this-command) - (suffix (transient-suffix-object this-command)) - (prefix transient--prefix) - (advice - (lambda (fn &rest args) - (interactive - (lambda (spec) - (let ((abort t)) - (unwind-protect - (prog1 (let ((debugger #'transient--exit-and-debug)) - (if-let* ((obj suffix) - (grp (oref obj parent)) - (adv (or (oref obj advice*) - (oref grp advice*)))) - (funcall - adv #'advice-eval-interactive-spec spec) - (advice-eval-interactive-spec spec))) - (setq abort nil)) - (when abort - (when-let ((unwind (oref prefix unwind-suffix))) - (transient--debug 'unwind-interactive) - (funcall unwind command)) - (when (symbolp command) - (remove-function (symbol-function command) advice)) - (oset prefix unwind-suffix nil)))))) - (unwind-protect - (let ((debugger #'transient--exit-and-debug)) - (if-let* ((obj suffix) - (grp (oref obj parent)) - (adv (or (oref obj advice) - (oref obj advice*) - (oref grp advice) - (oref grp advice*)))) - (apply adv fn args) - (apply fn args))) - (when-let ((unwind (oref prefix unwind-suffix))) - (transient--debug 'unwind-command) - (funcall unwind command)) - (when (symbolp command) - (remove-function (symbol-function command) advice)) - (oset prefix unwind-suffix nil))))) - (add-function :around (if (symbolp this-command) - (symbol-function this-command) - this-command) - advice '((depth . -99))) - (cl-assert - (>= emacs-major-version 30) nil - "Emacs was downgraded, making it necessary to recompile Transient")) - ;; (< emacs-major-version 30) - (let* ((command this-command) - (suffix (transient-suffix-object this-command)) - (prefix transient--prefix) - (advice nil) - (advice-interactive - (lambda (spec) - (let ((abort t)) - (unwind-protect - (prog1 (let ((debugger #'transient--exit-and-debug)) - (if-let* ((obj suffix) - (grp (oref obj parent)) - (adv (or (oref obj advice*) - (oref grp advice*)))) - (funcall - adv #'advice-eval-interactive-spec spec) - (advice-eval-interactive-spec spec))) - (setq abort nil)) - (when abort - (when-let ((unwind (oref prefix unwind-suffix))) - (transient--debug 'unwind-interactive) - (funcall unwind command)) - (when (symbolp command) - (remove-function (symbol-function command) advice)) - (oset prefix unwind-suffix nil)))))) - (advice-body - (lambda (fn &rest args) - (unwind-protect - (let ((debugger #'transient--exit-and-debug)) - (if-let* ((obj suffix) - (grp (oref obj parent)) - (adv (or (oref obj advice) - (oref obj advice*) - (oref grp advice) - (oref grp advice*)))) - (apply adv fn args) - (apply fn args))) - (when-let ((unwind (oref prefix unwind-suffix))) - (transient--debug 'unwind-command) - (funcall unwind command)) - (when (symbolp command) - (remove-function (symbol-function command) advice)) - (oset prefix unwind-suffix nil))))) - (setq advice `(lambda (fn &rest args) - (interactive ,advice-interactive) - (apply ',advice-body fn args))) - (add-function :around (if (symbolp this-command) - (symbol-function this-command) - this-command) - advice '((depth . -99)))))) - -(defun transient--premature-post-command () - (and (equal (this-command-keys-vector) []) - (= (minibuffer-depth) - (1+ transient--minibuffer-depth)) - (progn - (transient--debug 'premature-post-command) - (transient--suspend-override) - (oset (or transient--prefix transient-current-prefix) - unwind-suffix - (if transient--exitp - #'transient--post-exit - #'transient--resume-override)) - t))) - -(defun transient--post-command () - (unless (transient--premature-post-command) - (transient--debug 'post-command) - (transient--with-emergency-exit :post-command - (cond (transient--exitp (transient--post-exit)) - ;; If `this-command' is the current transient prefix, then we - ;; have already taken care of updating the transient buffer... - ((and (eq this-command (oref transient--prefix command)) - ;; ... but if `prefix-arg' is non-nil, then the values - ;; of `this-command' and `real-this-command' are untrue - ;; because `prefix-command-preserve-state' changes them. - ;; We cannot use `current-prefix-arg' because it is set - ;; too late (in `command-execute'), and if it were set - ;; earlier, then we likely still would not be able to - ;; rely on it, and `prefix-command-preserve-state-hook' - ;; would have to be used to record that a universal - ;; argument is in effect. - (not prefix-arg))) - (transient--refreshp - (transient--env-apply #'transient--refresh-transient)) - ((let ((old transient--redisplay-map) - (new (transient--make-redisplay-map))) - (unless (equal old new) - (transient--pop-keymap 'transient--redisplay-map) - (setq transient--redisplay-map new) - (transient--push-keymap 'transient--redisplay-map)) - (transient--env-apply #'transient--redisplay))))) - (setq transient-current-prefix nil) - (setq transient-current-command nil) - (setq transient-current-suffixes nil) - (setq transient--current-suffix nil))) - -(defun transient--post-exit (&optional command) - (transient--debug 'post-exit) - (unless (and (eq transient--exitp 'replace) - (or transient--prefix - ;; The current command could act as a prefix, - ;; but decided not to call `transient-setup', - ;; or it is prevented from doing so because it - ;; uses the minibuffer and the user aborted - ;; that. - (prog1 nil - (if (let ((obj (transient-suffix-object command))) - (and (slot-boundp obj 'transient) - (oref obj transient))) - ;; This sub-prefix is a transient suffix; - ;; go back to outer prefix, by calling - ;; `transient--stack-pop' further down. - (setq transient--exitp nil) - (transient--stack-zap))))) - (remove-hook 'pre-command-hook #'transient--pre-command) - (remove-hook 'post-command-hook #'transient--post-command) - (advice-remove 'recursive-edit #'transient--recursive-edit)) - (let ((replace (eq transient--exitp 'replace)) - (resume (and transient--stack - (not (memq transient--exitp '(replace suspend)))))) - (unless (or resume replace) - (setq transient--showp nil)) - (setq transient--exitp nil) - (setq transient--helpp nil) - (setq transient--editp nil) - (setq transient--all-levels-p nil) - (setq transient--minibuffer-depth 0) - (run-hooks 'transient-exit-hook) - (when command - (setq transient-current-prefix nil) - (setq transient-current-command nil) - (setq transient-current-suffixes nil) - (setq transient--current-suffix nil)) - (cond (resume (transient--stack-pop)) - ((not replace) - (transient--quit-kludge 'disable) - (run-hooks 'transient-post-exit-hook))))) - -(defun transient--stack-push () - (transient--debug 'stack-push) - (push (list (oref transient--prefix command) - transient--layout - transient--editp - :value (transient--get-extended-value) - :return (oref transient--prefix return) - :scope (oref transient--prefix scope)) - transient--stack)) - -(defun transient--stack-pop () - (transient--debug 'stack-pop) - (and transient--stack - (prog1 t (apply #'transient-setup (pop transient--stack))))) - -(defun transient--stack-zap () - (transient--debug 'stack-zap) - (setq transient--stack nil)) - -(defun transient--redisplay () - (if (or (eq transient-show-popup t) - transient--showp) - (unless - (or (memq this-command transient--scroll-commands) - (and (or (memq this-command '(mouse-drag-region - mouse-set-region)) - (equal (key-description (this-command-keys-vector)) - "")) - (and (eq (current-buffer) transient--buffer)))) - (transient--show)) - (when (and (numberp transient-show-popup) - (not (zerop transient-show-popup)) - (not transient--timer)) - (transient--timer-start)) - (transient--show-hint))) - -(defun transient--timer-start () - (setq transient--timer - (run-at-time (abs transient-show-popup) nil - (lambda () - (transient--timer-cancel) - (transient--show) - (let ((message-log-max nil)) - (message "")))))) - -(defun transient--timer-cancel () - (when transient--timer - (cancel-timer transient--timer) - (setq transient--timer nil))) - -(defun transient--debug (arg &rest args) - (when transient--debug - (let ((inhibit-message (not (eq transient--debug 'message)))) - (if (symbolp arg) - (message "-- %-22s (cmd: %s, event: %S, exit: %s%s)" - arg - (cond ((and (symbolp this-command) this-command)) - ((fboundp 'help-fns-function-name) - (help-fns-function-name this-command)) - ((byte-code-function-p this-command) - "#[...]") - (this-command)) - (key-description (this-command-keys-vector)) - transient--exitp - (cond ((keywordp (car args)) - (format ", from: %s" - (substring (symbol-name (car args)) 1))) - ((stringp (car args)) - (concat ", " (apply #'format args))) - ((functionp (car args)) - (concat ", " (apply (car args) (cdr args)))) - (""))) - (apply #'message arg args))))) - -(defun transient--emergency-exit (&optional id) - "Exit the current transient command after an error occurred. -When no transient is active (i.e., when `transient--prefix' is -nil) then only reset `inhibit-quit'. Optional ID is a keyword -identifying the exit." - (transient--debug 'emergency-exit id) - (transient--quit-kludge 'disable) - (when transient--prefix - (setq transient--stack nil) - (setq transient--exitp t) - (transient--pre-exit) - (transient--post-exit this-command))) - -(defun transient--quit-kludge (action) - (static-if (boundp 'redisplay-can-quit) ;Emacs 31 - action - (pcase-exhaustive action - ('enable - (add-function - :around command-error-function - (let (unreadp) - (lambda (orig data context fn) - (cond ((not (eq (car data) 'quit)) - (funcall orig data context fn) - (setq unreadp nil)) - (unreadp - (remove-function command-error-function "inhibit-quit") - (funcall orig data context fn)) - (t - (push ?\C-g unread-command-events) - (setq unreadp t))))) - '((name . "inhibit-quit")))) - ('disable - (remove-function command-error-function "inhibit-quit"))))) - -;;; Pre-Commands - -(defun transient--call-pre-command () - (if-let ((fn (transient--get-pre-command this-command - (this-command-keys-vector)))) - (let ((action (funcall fn))) - (when (eq action transient--exit) - (setq transient--exitp (or transient--exitp t))) - action) - (if (let ((keys (this-command-keys-vector))) - (eq (aref keys (1- (length keys))) ?\C-g)) - (setq this-command 'transient-noop) - (unless (transient--edebug-command-p) - (setq this-command 'transient-undefined))) - transient--stay)) - -(defun transient--get-pre-command (&optional cmd key enforce-type) - (or (and (not (eq enforce-type 'non-suffix)) - (symbolp cmd) - (or (and key - (let ((def (lookup-key transient--predicate-map - (vconcat key (list cmd))))) - (and (symbolp def) def))) - (lookup-key transient--predicate-map (vector cmd)))) - (and (not (eq enforce-type 'suffix)) - (transient--resolve-pre-command - (oref transient--prefix transient-non-suffix) - t)))) - -(defun transient--resolve-pre-command (pre &optional resolve-boolean correct) - (setq pre (cond ((booleanp pre) - (if resolve-boolean - (if pre #'transient--do-stay #'transient--do-warn) - pre)) - ((string-match-p "--do-" (symbol-name pre)) pre) - ((let ((sym (intern (format "transient--do-%s" pre)))) - (if (functionp sym) sym pre))))) - (cond ((not correct) pre) - ((and (eq pre 'transient--do-return) - (not transient--stack)) - 'transient--do-exit) - (pre))) - -(defun transient--do-stay () - "Call the command without exporting variables and stay transient." - transient--stay) - -(defun transient--do-noop () - "Call `transient-noop' and stay transient." - (setq this-command 'transient-noop) - transient--stay) - -(defun transient--do-warn () - "Call `transient-undefined' and stay transient." - (setq this-command 'transient-undefined) - transient--stay) - -(defun transient--do-warn-inapt () - "Call `transient-inapt' and stay transient." - (setq this-command 'transient-inapt) - transient--stay) - -(defun transient--do-call () - "Call the command after exporting variables and stay transient." - (transient--export) - transient--stay) - -(defun transient--do-return () - "Call the command after exporting variables and return to parent prefix. -If there is no parent prefix, then behave like `transient--do-exit'." - (if (not transient--stack) - (transient--do-exit) - (transient--export) - transient--exit)) - -(defun transient--do-exit () - "Call the command after exporting variables and exit the transient." - (transient--export) - (transient--stack-zap) - transient--exit) - -(defun transient--do-leave () - "Call the command without exporting variables and exit the transient." - (transient--stack-zap) - transient--exit) - -(defun transient--do-push-button () - "Call the command represented by the activated button. -Use that command's pre-command to determine transient behavior." - (if (and (mouse-event-p last-command-event) - (not (eq (posn-window (event-start last-command-event)) - transient--window))) - transient--stay - (with-selected-window transient--window - (let ((pos (if (mouse-event-p last-command-event) - (posn-point (event-start last-command-event)) - (point)))) - (setq this-command (get-text-property pos 'command)) - (setq transient--current-suffix (get-text-property pos 'suffix)))) - (transient--call-pre-command))) - -(defun transient--do-recurse () - "Call the transient prefix command, preparing for return to outer transient. -If there is no parent prefix, then just call the command." - (transient--do-stack)) - -(defun transient--do-stack () - "Call the transient prefix command, stacking the active transient. -Push the active transient to the transient stack." - (transient--export) - (transient--stack-push) - (setq transient--exitp 'replace) - transient--exit) - -(defun transient--do-replace () - "Call the transient prefix command, replacing the active transient. -Do not push the active transient to the transient stack." - (transient--export) - (setq transient--exitp 'replace) - transient--exit) - -(defun transient--do-suspend () - "Suspend the active transient, saving the transient stack." - ;; Export so that `transient-describe' instances can use - ;; `transient-suffix-object' to get their respective object. - (transient--export) - (transient--stack-push) - (setq transient--exitp 'suspend) - transient--exit) - -(defun transient--do-quit-one () - "If active, quit help or edit mode, else exit the active transient." - (cond (transient--helpp - (setq transient--helpp nil) - transient--stay) - (transient--editp - (setq transient--editp nil) - (transient-setup) - transient--stay) - (prefix-arg - transient--stay) - (transient--exit))) - -(defun transient--do-quit-all () - "Exit all transients without saving the transient stack." - (transient--stack-zap) - transient--exit) - -(defun transient--do-move () - "Call the command if `transient-enable-popup-navigation' is non-nil. -In that case behave like `transient--do-stay', otherwise similar -to `transient--do-warn'." - (unless transient-enable-popup-navigation - (setq this-command 'transient-inhibit-move)) - transient--stay) - -(defun transient--do-minus () - "Call `negative-argument' or pivot to `transient-update'. -If `negative-argument' is invoked using \"-\" then preserve the -prefix argument and pivot to `transient-update'." - (when (equal (this-command-keys) "-") - (setq this-command 'transient-update)) - transient--stay) - -(put 'transient--do-stay 'transient-face 'transient-key-stay) -(put 'transient--do-noop 'transient-face 'transient-key-noop) -(put 'transient--do-warn 'transient-face 'transient-key-noop) -(put 'transient--do-warn-inapt 'transient-face 'transient-key-noop) -(put 'transient--do-call 'transient-face 'transient-key-stay) -(put 'transient--do-return 'transient-face 'transient-key-return) -(put 'transient--do-exit 'transient-face 'transient-key-exit) -(put 'transient--do-leave 'transient-face 'transient-key-exit) - -(put 'transient--do-recurse 'transient-face 'transient-key-recurse) -(put 'transient--do-stack 'transient-face 'transient-key-stack) -(put 'transient--do-replace 'transient-face 'transient-key-exit) -(put 'transient--do-suspend 'transient-face 'transient-key-exit) - -(put 'transient--do-quit-one 'transient-face 'transient-key-return) -(put 'transient--do-quit-all 'transient-face 'transient-key-exit) -(put 'transient--do-move 'transient-face 'transient-key-stay) -(put 'transient--do-minus 'transient-face 'transient-key-stay) - -;;; Commands -;;;; Noop - -(defun transient-noop () - "Do nothing at all." - (interactive)) - -(defun transient-undefined () - "Warn the user that the pressed key is not bound to any suffix." - (interactive) - (transient--invalid "Unbound suffix")) - -(defun transient-inapt () - "Warn the user that the invoked command is inapt." - (interactive) - (transient--invalid "Inapt command")) - -(defun transient--invalid (msg) - (ding) - (message "%s: `%s' (Use `%s' to abort, `%s' for help)%s" - msg - (propertize (key-description (this-single-command-keys)) - 'face 'font-lock-warning-face) - (propertize "C-g" 'face 'transient-key) - (propertize "?" 'face 'transient-key) - ;; `this-command' is `transient-undefined' or `transient-inapt'. - ;; Show the command (`this-original-command') the user actually - ;; tried to invoke. - (if-let ((cmd (or (ignore-errors (symbol-name this-original-command)) - (ignore-errors (symbol-name this-command))))) - (format " [%s]" (propertize cmd 'face 'font-lock-warning-face)) - "")) - (unless (and transient--transient-map - (memq transient--transient-map overriding-terminal-local-map)) - (let ((transient--prefix (or transient--prefix 'sic))) - (transient--emergency-exit)) - (view-lossage) - (other-window 1) - (display-warning 'transient "Inconsistent transient state detected. -This should never happen. -Please open an issue and post the shown command log." :error))) - -(defun transient-inhibit-move () - "Warn the user that menu navigation is disabled." - (interactive) - (message "To enable use of `%s', please customize `%s'" - this-original-command - 'transient-enable-popup-navigation)) - -;;;; Core - -(defun transient-quit-all () - "Exit all transients without saving the transient stack." - (interactive)) - -(defun transient-quit-one () - "Exit the current transients, returning to outer transient, if any." - (interactive)) - -(defun transient-quit-seq () - "Abort the current incomplete key sequence." - (interactive)) - -(defun transient-update () - "Redraw the transient's state in the menu buffer." - (interactive) - (setq prefix-arg current-prefix-arg)) - -(defun transient-show () - "Show the transient's state in the menu buffer." - (interactive) - (setq transient--showp t)) - -(defun transient-push-button () - "Invoke the suffix command represented by this button." - (interactive)) - -;;;; Suspend - -(defun transient-suspend () - "Suspend the current transient. -It can later be resumed using `transient-resume', while no other -transient is active." - (interactive)) - -(define-minor-mode transient-resume-mode - "Auxiliary minor-mode used to resume a transient after viewing help.") - -(defun transient-resume () - "Resume a previously suspended stack of transients." - (interactive) - (cond (transient--stack - (let ((winconf transient--restore-winconf)) - (kill-local-variable 'transient--restore-winconf) - (when transient-resume-mode - (transient-resume-mode -1) - (quit-window)) - (when winconf - (set-window-configuration winconf))) - (transient--stack-pop)) - (transient-resume-mode - (kill-local-variable 'transient--restore-winconf) - (transient-resume-mode -1) - (quit-window)) - (t - (message "No suspended transient command")))) - -;;;; Help - -(defun transient-help (&optional interactivep) - "Show help for the active transient or one of its suffixes. -\n(fn)" - (interactive (list t)) - (cond - (interactivep - (setq transient--helpp t)) - ((lookup-key transient--transient-map - (this-single-command-raw-keys)) - (setq transient--helpp nil) - (with-demoted-errors "transient-help: %S" - (transient--display-help #'transient-show-help - (if (eq this-original-command 'transient-help) - transient--prefix - (or (transient-suffix-object) - this-original-command))))))) - -(transient-define-suffix transient-describe () - "From a transient menu, describe something in another buffer. - -This command can be bound multiple times to describe different targets. -Each binding must specify the thing it describes, be setting the value -of its `target' slot, using the keyword argument `:='. - -The `helper' slot specifies the low-level function used to describe the -target, and can be omitted, in which case `transient--describe-function' -is used for a symbol, `transient--show-manual' is used for a string -beginning with a parenthesis, and `transient--show-manpage' is used for -any other string. - -For example: - [(\"e\" \"about emacs\" transient-describe := \"(emacs)\") - (\"g\" \"about git\" transient-describe := \"git\")]" - :class 'transient-describe-target - (interactive) - (with-slots (helper target) (transient-suffix-object) - (transient--display-help helper target))) - -;;;; Level - -(defun transient-set-level (&optional command level) - "Set the level of the transient or one of its suffix commands." - (interactive - (let ((command this-original-command) - (prefix (oref transient--prefix command))) - (and (or (not (eq command 'transient-set-level)) - (and transient--editp - (setq command prefix))) - (list command - (let ((keys (this-single-command-raw-keys))) - (and (lookup-key transient--transient-map keys) - (progn - (transient--show) - (string-to-number - (transient--read-number-N - (format "Set level for `%s': " command) - nil nil (not (eq command prefix))))))))))) - (cond - ((not command) - (setq transient--editp t) - (transient-setup)) - (level - (let* ((prefix (oref transient--prefix command)) - (alist (alist-get prefix transient-levels)) - (akey command)) - (cond ((eq command prefix) - (oset transient--prefix level level) - (setq akey t)) - (t - (oset (transient-suffix-object command) level level) - (when (cdr (cl-remove-if-not (lambda (obj) - (eq (oref obj command) command)) - transient--suffixes)) - (setq akey (cons command (this-command-keys)))))) - (setf (alist-get akey alist) level) - (setf (alist-get prefix transient-levels) alist)) - (transient-save-levels) - (transient--show)) - (t - (transient-undefined)))) - -(transient-define-suffix transient-toggle-level-limit () - "Toggle whether to temporarily display suffixes on all levels." - :description - (lambda () - (cond - (transient--all-levels-p - (format "Hide suffix %s" - (propertize - (format "levels > %s" (oref (transient-prefix-object) level)) - 'face 'transient-higher-level))) - ("Show all suffix levels"))) - :transient t - (interactive) - (setq transient--all-levels-p (not transient--all-levels-p)) - (setq transient--refreshp t)) - -;;;; Value - -(defun transient-set () - "Set active transient's value for this Emacs session." - (interactive) - (transient-set-value (transient-prefix-object))) - -(defalias 'transient-set-and-exit #'transient-set - "Set active transient's value for this Emacs session and exit.") - -(defun transient-save () - "Save active transient's value for this and future Emacs sessions." - (interactive) - (transient-save-value (transient-prefix-object))) - -(defalias 'transient-save-and-exit #'transient-save - "Save active transient's value for this and future Emacs sessions and exit.") - -(defun transient-reset () - "Clear the set and saved values of the active transient." - (interactive) - (transient-reset-value (transient-prefix-object))) - -(defun transient-history-next () - "Switch to the next value used for the active transient." - (interactive) - (let* ((obj transient--prefix) - (pos (1- (oref obj history-pos))) - (hst (oref obj history))) - (if (< pos 0) - (user-error "End of history") - (oset obj history-pos pos) - (oset obj value (nth pos hst)) - (mapc #'transient-init-value transient--suffixes)))) - -(defun transient-history-prev () - "Switch to the previous value used for the active transient." - (interactive) - (let* ((obj transient--prefix) - (pos (1+ (oref obj history-pos))) - (hst (oref obj history)) - (len (length hst))) - (if (> pos (1- len)) - (user-error "End of history") - (oset obj history-pos pos) - (oset obj value (nth pos hst)) - (mapc #'transient-init-value transient--suffixes)))) - -(transient-define-suffix transient-preset () - "Put this preset into action." - :class transient-value-preset - (interactive) - (transient-prefix-set (oref (transient-suffix-object) set))) - -;;;; Auxiliary - -(transient-define-suffix transient-toggle-common () - "Toggle whether common commands are permanently shown." - :transient t - :description (lambda () - (if transient-show-common-commands - "Hide common commands" - "Show common permanently")) - (interactive) - (setq transient-show-common-commands (not transient-show-common-commands))) - -(transient-define-suffix transient-toggle-docstrings (&optional permanent) - "Toggle whether to show docstrings instead of suffix descriptions. - -By default this is only enabled temporarily for the current transient -menu invocation. With a prefix argument, enable this until explicitly -disabled again. - -Infix arguments are not affected by this, because otherwise many menus -would likely become unreadable. To make this command available in all -menus, bind it in `transient-map'. `transient-show-docstring-format' -controls how the docstrings are displayed and whether descriptions are -also displayed." - :transient t - (interactive (list current-prefix-arg)) - (setq transient--docsp (if permanent 'permanent (not transient--docsp)))) - -(defun transient-toggle-debug () - "Toggle debugging statements for transient commands." - (interactive) - (setq transient--debug (not transient--debug)) - (message "Debugging transient %s" - (if transient--debug "enabled" "disabled"))) - -(defun transient-copy-menu-text () - "Copy the contents of the menu buffer to the kill ring. -To make this available in all menus, bind it in `transient-map'" - (interactive) - (transient--show) - (with-current-buffer (get-buffer transient--buffer-name) - (copy-region-as-kill (point-min) (point-max)))) - -(transient-define-suffix transient-echo-arguments (arguments) - "Show the transient's active ARGUMENTS in the echo area. -Intended for use in prefixes used for demonstration purposes, -such as when suggesting a new feature or reporting an issue." - :transient t - :description "Echo arguments" - :key "x" - (interactive (list (transient-args transient-current-command))) - (if (seq-every-p #'stringp arguments) - (message "%s: %s" (key-description (this-command-keys)) - (mapconcat (lambda (arg) - (propertize (if (string-match-p " " arg) - (format "%S" arg) - arg) - 'face 'transient-argument)) - arguments " ")) - (message "%s: %S" (key-description (this-command-keys)) arguments))) - -;;; Value -;;;; Init - -(cl-defgeneric transient-init-value (obj) - "Set the initial value of the prefix or suffix object OBJ. - -This function is called for all prefix and suffix commands. - -Third-party subclasses of `transient-infix' must implement a primary -method.") - -(cl-defmethod transient-init-value :around ((obj transient-prefix)) - "If bound, use the value returned by OBJ' `init-value' function. -If the value of OBJ's `init-value' is non-nil, call that function to -determine the value. Otherwise call the primary method according to -OBJ's class." - (if (slot-boundp obj 'init-value) - (funcall (oref obj init-value) obj) - (cl-call-next-method obj))) - -(cl-defmethod transient-init-value :around ((obj transient-infix)) - "If bound, use the value returned by OBJ's `init-value' function. -If the value of OBJ's `init-value' is non-nil, call that function to -determine the value. Otherwise call the primary method according to -OBJ's class." - (if (slot-boundp obj 'init-value) - (funcall (oref obj init-value) obj) - (cl-call-next-method obj))) - -(cl-defmethod transient-init-value ((obj transient-prefix)) - "Set OBJ's initial value to the set, saved or default value. -Use `transient-default-value' to determine the default value." - (if (slot-boundp obj 'value) - ;; Already set because the live object is cloned from - ;; the prototype, were the set (if any) value is stored. - (oref obj value) - (oset obj value - (if-let ((saved (assq (oref obj command) transient-values))) - (cdr saved) - (transient-default-value obj))))) - -(cl-defmethod transient-init-value ((obj transient-suffix)) - "Non-infix suffixes usually don't have a value. -Call `transient-default-value' but because that is a noop for -`transient-suffix', this function is effectively also a noop." - (let ((value (transient-default-value obj))) - (unless (eq value eieio--unbound) - (oset obj value value)))) - -(cl-defmethod transient-init-value ((obj transient-argument)) - "Extract OBJ's value from the value of the prefix object." - (oset obj value - (let ((value (oref transient--prefix value)) - (argument (and (slot-boundp obj 'argument) - (oref obj argument))) - (multi-value (oref obj multi-value)) - (case-fold-search nil) - (regexp (if (slot-exists-p obj 'argument-regexp) - (oref obj argument-regexp) - (format "\\`%s\\(.*\\)" (oref obj argument))))) - (if (memq multi-value '(t rest)) - (cdr (assoc argument value)) - (let ((match (lambda (v) - (and (stringp v) - (string-match regexp v) - (match-string 1 v))))) - (if multi-value - (delq nil (mapcar match value)) - (cl-some match value))))))) - -(cl-defmethod transient-init-value ((obj transient-switch)) - "Extract OBJ's value from the value of the prefix object." - (oset obj value - (car (member (oref obj argument) - (oref transient--prefix value))))) - -;;;; Default - -(cl-defgeneric transient-default-value (obj) - "Return the default value.") - -(cl-defmethod transient-default-value ((obj transient-prefix)) - "Return the default value as specified by the `default-value' slot. -If the value of the `default-value' slot is a function, call it to -determine the value. If the slot's value isn't a function, return -that. If the slot is unbound, return nil." - (if-let ((default (and (slot-boundp obj 'default-value) - (oref obj default-value)))) - (if (functionp default) - (funcall default) - default) - nil)) - -(cl-defmethod transient-default-value ((_ transient-suffix)) - "Return `eieio--unbound' to indicate that there is no default value. -Doing so causes `transient-init-value' to skip setting the `value' slot." - eieio--unbound) - -;;;; Read - -(cl-defgeneric transient-infix-read (obj) - "Determine the new value of the infix object OBJ. - -This function merely determines the value; `transient-infix-set' -is used to actually store the new value in the object. - -For most infix classes this is done by reading a value from the -user using the reader specified by the `reader' slot (using the -method for `transient-infix', described below). - -For some infix classes the value is changed without reading -anything in the minibuffer, i.e., the mere act of invoking the -infix command determines what the new value should be, based -on the previous value.") - -(cl-defmethod transient-infix-read :around ((obj transient-infix)) - "Refresh the transient buffer and call the next method. - -Also wrap `cl-call-next-method' with two macros: -- `transient--with-suspended-override' allows use of minibuffer. -- `transient--with-emergency-exit' arranges for the transient to - be exited in case of an error." - (transient--show) - (transient--with-emergency-exit :infix-read - (transient--with-suspended-override - (cl-call-next-method obj)))) - -(cl-defmethod transient-infix-read ((obj transient-infix)) - "Read a value while taking care of history. - -This method is suitable for a wide variety of infix commands, -including but not limited to inline arguments and variables. - -If you do not use this method for your own infix class, then -you should likely replicate a lot of the behavior of this -method. If you fail to do so, then users might not appreciate -the lack of history, for example. - -Only for very simple classes that toggle or cycle through a very -limited number of possible values should you replace this with a -simple method that does not handle history. (E.g., for a command -line switch the only possible values are \"use it\" and \"don't use -it\", in which case it is pointless to preserve history.)" - (with-slots (value multi-value always-read allow-empty choices) obj - (if (and value - (not multi-value) - (not always-read) - transient--prefix) - (oset obj value nil) - (let* ((enable-recursive-minibuffers t) - (reader (oref obj reader)) - (choices (if (functionp choices) (funcall choices) choices)) - (prompt (transient-prompt obj)) - (value (if multi-value (string-join value ",") value)) - (history-key (or (oref obj history-key) - (oref obj command))) - (transient--history (alist-get history-key transient-history)) - (transient--history (if (or (null value) - (eq value (car transient--history))) - transient--history - (cons value transient--history))) - (initial-input (and transient-read-with-initial-input - (car transient--history))) - (history (if initial-input - (cons 'transient--history 1) - 'transient--history)) - (value - (cond - (reader (funcall reader prompt initial-input history)) - (multi-value - (completing-read-multiple prompt choices nil nil - initial-input history)) - (choices - (completing-read prompt choices nil t initial-input history)) - ((read-string prompt initial-input history))))) - (cond ((and (equal value "") (not allow-empty)) - (setq value nil)) - ((and (equal value "\"\"") allow-empty) - (setq value ""))) - (when value - (when (and (bound-and-true-p ivy-mode) - (stringp (car transient--history))) - (set-text-properties 0 (length (car transient--history)) nil - (car transient--history))) - (setf (alist-get history-key transient-history) - (delete-dups transient--history))) - value)))) - -(cl-defmethod transient-infix-read ((obj transient-switch)) - "Toggle the switch on or off." - (if (oref obj value) nil (oref obj argument))) - -(cl-defmethod transient-infix-read ((obj transient-switches)) - "Cycle through the mutually exclusive switches. -The last value is \"don't use any of these switches\"." - (let ((choices (mapcar (apply-partially #'format (oref obj argument-format)) - (oref obj choices)))) - (if-let ((value (oref obj value))) - (cadr (member value choices)) - (car choices)))) - -(cl-defmethod transient-infix-read ((command symbol)) - "Elsewhere use the reader of the infix command COMMAND. -Use this if you want to share an infix's history with a regular -stand-alone command." - (if-let ((obj (transient--suffix-prototype command))) - (cl-letf (((symbol-function #'transient--show) #'ignore)) - (transient-infix-read obj)) - (error "Not a suffix command: `%s'" command))) - -;;;; Readers - -(defun transient-read-file (prompt _initial-input _history) - "Read a file." - (file-local-name (expand-file-name (read-file-name prompt)))) - -(defun transient-read-existing-file (prompt _initial-input _history) - "Read an existing file." - (file-local-name (expand-file-name (read-file-name prompt nil nil t)))) - -(defun transient-read-directory (prompt _initial-input _history) - "Read a directory." - (file-local-name (expand-file-name (read-directory-name prompt)))) - -(defun transient-read-existing-directory (prompt _initial-input _history) - "Read an existing directory." - (file-local-name (expand-file-name (read-directory-name prompt nil nil t)))) - -(defun transient-read-number-N0 (prompt initial-input history) - "Read a natural number (including zero) and return it as a string." - (transient--read-number-N prompt initial-input history t)) - -(defun transient-read-number-N+ (prompt initial-input history) - "Read a natural number (excluding zero) and return it as a string." - (transient--read-number-N prompt initial-input history nil)) - -(defun transient--read-number-N (prompt initial-input history include-zero) - (save-match-data - (cl-block nil - (while t - (let ((str (read-from-minibuffer prompt initial-input nil nil history))) - (when (or (string-equal str "") - (string-match-p (if include-zero - "\\`\\(0\\|[1-9][0-9]*\\)\\'" - "\\`[1-9][0-9]*\\'") - str)) - (cl-return str))) - (message "Please enter a natural number (%s zero)." - (if include-zero "including" "excluding")) - (sit-for 1))))) - -(defun transient-read-date (prompt default-time _history) - "Read a date using `org-read-date' (which see)." - (require 'org) - (when (fboundp 'org-read-date) - (org-read-date 'with-time nil nil prompt default-time))) - -;;;; Prompt - -(cl-defgeneric transient-prompt (obj) - "Return the prompt to be used to read infix object OBJ's value.") - -(cl-defmethod transient-prompt ((obj transient-infix)) - "Return the prompt to be used to read infix object OBJ's value. - -This implementation should be suitable for almost all infix -commands. - -If the value of OBJ's `prompt' slot is non-nil, then it must be -a string or a function. If it is a string, then use that. If -it is a function, then call that with OBJ as the only argument. -That function must return a string, which is then used as the -prompt. - -Otherwise, if the value of either the `argument' or `variable' -slot of OBJ is a string, then base the prompt on that (preferring -the former), appending either \"=\" (if it appears to be a -command-line option) or \": \". - -Finally fall through to using \"(BUG: no prompt): \" as the -prompt." - (cond-let - ([prompt (oref obj prompt)] - (let ((prompt (if (functionp prompt) - (funcall prompt obj) - prompt))) - (if (stringp prompt) - prompt - "[BUG: invalid prompt]: "))) - ([name (or (and (slot-boundp obj 'argument) (oref obj argument)) - (and (slot-boundp obj 'variable) (oref obj variable)))] - (if (and (stringp name) - (string-suffix-p "=" name)) - name - (format "%s: " name))) - ("[BUG: no prompt]: "))) - -;;;; Set - -(cl-defgeneric transient-infix-set (obj value) - "Set the value of infix object OBJ to VALUE.") - -(cl-defmethod transient-infix-set ((obj transient-infix) value) - "Set the value of infix object OBJ to VALUE." - (oset obj value value)) - -(cl-defmethod transient-infix-set :after ((obj transient-argument) value) - "Unset incompatible infix arguments." - (when-let* ((_ value) - (val (transient-infix-value obj)) - (arg (if (slot-boundp obj 'argument) - (oref obj argument) - (oref obj argument-format))) - (spec (oref transient--prefix incompatible)) - (filter (lambda (x rule) - (and (member x rule) - (remove x rule)))) - (incomp (nconc - (mapcan (apply-partially filter arg) spec) - (and (not (equal val arg)) - (mapcan (apply-partially filter val) spec))))) - (dolist (obj transient--suffixes) - (when-let* ((_(cl-typep obj 'transient-argument)) - (val (transient-infix-value obj)) - (arg (if (slot-boundp obj 'argument) - (oref obj argument) - (oref obj argument-format))) - (_(if (equal val arg) - (member arg incomp) - (or (member val incomp) - (member arg incomp))))) - (transient-infix-set obj nil))))) - -(defun transient-prefix-set (value) - "Set the value of the active transient prefix to VALUE. -Intended for use by transient suffix commands." - (oset transient--prefix value value) - (setq transient--refreshp 'updated-value)) - -(cl-defgeneric transient-set-value (obj) - "Persist the value of the transient prefix OBJ. -Only intended for use by `transient-set'. -See also `transient-prefix-set'.") - -(cl-defmethod transient-set-value ((obj transient-prefix)) - (let ((value (transient--get-savable-value))) - (oset (oref obj prototype) value value) - (transient--history-push obj value))) - -(defun transient--maybe-set-value (event) - "Maybe set the value, subject to EVENT and the `remember-value' slot." - (let* ((event (if (and (eq event 'exit) - (memq this-command transient--quit-commands)) - 'quit - event)) - (spec (oref transient--prefix remember-value)) - (spec (cond ((listp spec) spec) - ((memq spec '(export exit quit)) - (list spec)) - ((boundp spec) - (symbol-value spec))))) - (and (memq event spec) - (prog1 t - (if (memq 'save spec) - (transient-save-value transient--prefix) - (transient-set-value transient--prefix)))))) - -;;;; Save - -(cl-defgeneric transient-save-value (obj) - "Save the value of the transient prefix OBJ.") - -(cl-defmethod transient-save-value ((obj transient-prefix)) - (let ((value (transient--get-savable-value))) - (oset (oref obj prototype) value value) - (setf (alist-get (oref obj command) transient-values) value) - (transient-save-values) - (transient--history-push obj value))) - -;;;; Reset - -(cl-defgeneric transient-reset-value (obj) - "Clear the set and saved values of the transient prefix OBJ.") - -(cl-defmethod transient-reset-value ((obj transient-prefix)) - (let ((value (transient-default-value obj))) - (oset obj value value) - (oset (oref obj prototype) value value) - (setf (alist-get (oref obj command) transient-values nil 'remove) nil) - (transient-save-values) - (transient--history-push obj value)) - (mapc #'transient-init-value transient--suffixes)) - -;;;; Get - -(defun transient-args (prefix) - "Return the value of the transient prefix command PREFIX. - -If the current command was invoked from the transient prefix command -PREFIX, then return the active infix arguments. If the current command -was not invoked from PREFIX, then return the set, saved or default value -for PREFIX. - -PREFIX may also be a list of prefixes. If no prefix is active, the -fallback value of the first of these prefixes is used. - -The generic function `transient-prefix-value' is used to determine the -returned value. - -This function is intended to be used by suffix commands, whether they -are invoked from a menu or not. It is not intended to be used when -setting up a menu and its suffixes, in which case `transient-get-value' -should be used." - (when (listp prefix) - (setq prefix (car (or (memq transient-current-command prefix) prefix)))) - (if-let ((obj (get prefix 'transient--prefix))) - ;; This OBJ is only used for dispatch purposes; see below. - (transient-prefix-value obj) - (error "Not a transient prefix: %s" prefix))) - -(cl-defgeneric transient-prefix-value (obj) - "Return a list of the values of the suffixes of the specified prefix. - -OBJ is a prototype object and is only used to select the appropriate -method of this generic function. Transient itself only provides one -such method, which should be suitable for most prefixes. - -This function is only intended to be used by `transient-args'. It is -not defined as an internal function because third-party packages may -define their own methods. That does not mean that it would be a good -idea to call it for any other purpose.") - -(cl-defmethod transient-prefix-value ((obj transient-prefix)) - "Return a list of the values of the suffixes of the specified prefix. - -OBJ is a prototype object. This method does not return the value of -that object. Instead it extracts the name of the respective command -from the object and uses that to collect the current values from the -suffixes of the prefix from which the current command was invoked. -If the current command was not invoked from the identified prefix, -then this method returns the set, save or default value, as described -for `transient-args'. - -This method uses `transient-suffixes' (which see) to determine the -suffix objects and then extracts the value(s) from those objects." - (mapcan (lambda (obj) - (and (not (oref obj inactive)) - (not (oref obj inapt)) - (transient--get-wrapped-value obj))) - (transient-suffixes (oref obj command)))) - -(defun transient-suffixes (prefix) - "Return the suffix objects of the transient prefix command PREFIX. - -If PREFIX is not the current prefix, initialize the suffixes so that -they can be returned. That does not cause the menu to be displayed." - (if (eq transient-current-command prefix) - transient-current-suffixes - (let ((transient--prefix (transient--init-prefix prefix))) - (transient--flatten-suffixes - (transient--init-suffixes prefix))))) - -(defun transient-get-value () - "Return the value of the extant prefix. - -This function is intended to be used when setting up a menu and its -suffixes. It is not intended to be used when a suffix command is -invoked, whether from a menu or not, in which case `transient-args' -should be used." - (transient--with-emergency-exit :get-value - (mapcan (lambda (obj) - (and (not (oref obj inactive)) - (not (oref obj inapt)) - (transient--get-wrapped-value obj))) - transient--suffixes))) - -(defun transient--get-extended-value () - "Return the extended value of the extant prefix. - -Unlike `transient-get-value' also include the values of inactive and -inapt arguments. This function is mainly intended for internal use. -It is used to preserve the full value when a menu is being refreshed, -including the presently ineffective parts." - (transient--with-emergency-exit :get-value - (mapcan #'transient--get-wrapped-value transient--suffixes))) - -(defun transient--get-savable-value () - "Return the value of the extant prefix, excluding unsavable parts. - -This function is only intended for internal use. It is used to save -the value." - (transient--with-emergency-exit :get-savable-value - (mapcan (lambda (obj) - (and (not (and (slot-exists-p obj 'unsavable) - (oref obj unsavable))) - (transient--get-wrapped-value obj))) - (or transient--suffixes transient-current-suffixes)))) - -(defun transient--get-wrapped-value (obj) - "Return a list of the value(s) of suffix object OBJ. - -Internally a suffix only ever has one value, stored in its `value' -slot, but callers of `transient-args' wish to treat the values of -certain suffixes as multiple values. That translation is handled -here. The object's `multi-value' slot specifies whether and how -to interpret the `value' as multiple values." - (and-let* ((value (transient-infix-value obj))) - (pcase-exhaustive (and (slot-exists-p obj 'multi-value) - (oref obj multi-value)) - ('nil (list value)) - ((or 't 'rest) (list value)) - ('repeat value)))) - -(cl-defgeneric transient-infix-value (obj) - "Return the value of the suffix object OBJ. - -By default this function is involved when determining the prefix's -overall value, returned by `transient-args' (which see), so that -the invoked suffix command can use that. - -Currently most values are strings, but that is not set in stone. -Nil is not a value, it means \"no value\". - -Usually only infixes have a value, but see the method for -`transient-suffix'.") - -(cl-defmethod transient-infix-value ((_ transient-suffix)) - "Return nil, which means \"no value\". - -Infix arguments contribute the transient's value while suffix -commands consume it. This function is called for suffixes anyway -because a command that both contributes to the transient's value -and also consumes it is not completely unconceivable. - -If you define such a command, then you must define a derived -class and implement this function because this default method -does nothing." nil) - -(cl-defmethod transient-infix-value ((obj transient-infix)) - "Return the value of OBJ's `value' slot." - (oref obj value)) - -(cl-defmethod transient-infix-value ((obj transient-option)) - "Return ARGUMENT and VALUE as a unit or nil if the latter is nil." - (and-let* ((value (oref obj value))) - (let ((arg (oref obj argument))) - (pcase-exhaustive (oref obj multi-value) - ('nil (concat arg value)) - ((or 't 'rest) (cons arg value)) - ('repeat (mapcar (lambda (v) (concat arg v)) value)))))) - -(cl-defmethod transient-infix-value ((_ transient-variable)) - "Return nil, which means \"no value\". - -Setting the value of a variable is done by, well, setting the -value of the variable. I.e., this is a side-effect and does -not contribute to the value of the transient." - nil) - -;;;; Utilities - -(defun transient-arg-value (arg args) - "Return the value of ARG as it appears in ARGS. - -For a switch return a boolean. For an option return the value as -a string, using the empty string for the empty value, or nil if -the option does not appear in ARGS. - -Append \"=\ to ARG to indicate that it is an option." - (save-match-data - (cond-let - ((member arg args) t) - ([_(string-suffix-p "=" arg)] - [match (let ((case-fold-search nil) - (re (format "\\`%s\\(?:=\\(.+\\)\\)?\\'" - (substring arg 0 -1)))) - (cl-find-if (lambda (a) - (and (stringp a) - (string-match re a))) - args))] - (match-string 1 match))))) - -;;; Return - -(defun transient-init-return (obj) - (when-let* ((_ transient--stack) - (command (oref obj command)) - (suffix-obj (transient-suffix-object command)) - (_(memq (if (slot-boundp suffix-obj 'transient) - (oref suffix-obj transient) - (oref transient-current-prefix transient-suffix)) - (list t 'recurse #'transient--do-recurse)))) - (oset obj return t))) - -;;; Scope -;;;; Init - -(cl-defgeneric transient-init-scope (obj) - "Set the scope of the prefix or suffix object OBJ. - -The scope is actually a property of the transient prefix, not of -individual suffixes. However it is possible to invoke a suffix -command directly instead of from a transient. In that case, if -the suffix expects a scope, then it has to determine that itself -and store it in its `scope' slot. - -This function is called for all prefix and suffix commands, but -unless a concrete method is implemented, this falls through to -a default implementation, which is a noop.") - -(cl-defmethod transient-init-scope ((_ transient-prefix)) - "Noop." nil) - -(cl-defmethod transient-init-scope ((_ transient-suffix)) - "Noop." nil) - -;;;; Get - -(defun transient-scope (&optional prefixes classes) - "Return the scope of the active or current transient prefix command. - -If optional PREFIXES and CLASSES are both nil, return the scope of -the prefix currently being setup, making this variation useful, e.g., -in `:if*' predicates. If no prefix is being setup, but the current -command was invoked from some prefix, then return the scope of that. - -If PREFIXES is non-nil, it must be a prefix command or a list of such -commands. If CLASSES is non-nil, it must be a prefix class or a list -of such classes. When this function is called from the body or the -`interactive' form of a suffix command, PREFIXES and/or CLASSES should -be non-nil. If either is non-nil, try the following in order: - -- If the current suffix command was invoked from a prefix, which - appears in PREFIXES, return the scope of that prefix. - -- If the current suffix command was invoked from a prefix, and its - class derives from one of the CLASSES, return the scope of that - prefix. - -- If a prefix is being setup and it appears in PREFIXES, return its - scope. - -- If a prefix is being setup and its class derives from one of the - CLASSES, return its scope. - -- Finally try to return the default scope of the first command in - PREFIXES. This only works if that slot is set in the respective - class definition or using its `transient-init-scope' method. - -If no prefix matches, return nil." - (cond-let - ((or prefixes classes) - (let* ((prefixes (ensure-list prefixes)) - (type (if (symbolp classes) classes (cons 'or classes))) - (match (lambda (obj) - (and obj - (or (memq (oref obj command) prefixes) - (cl-typep obj type)) - obj)))) - (cond-let - ([obj (or (funcall match transient-current-prefix) - (funcall match transient--prefix))] - (oref obj scope)) - ((get (car prefixes) 'transient--prefix) - (oref (transient--init-prefix (car prefixes)) scope))))) - ([obj (transient-prefix-object)] - (oref obj scope)))) - -;;; History - -(cl-defgeneric transient--history-key (obj) - "Return OBJ's history key.") - -(cl-defmethod transient--history-key ((obj transient-prefix)) - "If the value of the `history-key' slot is non-nil, return that. -Otherwise return the value of the `command' slot." - (or (oref obj history-key) - (oref obj command))) - -(cl-defgeneric transient--history-push (obj value) - "Push VALUE to OBJ's entry in `transient-history'.") - -(cl-defmethod transient--history-push - ((obj transient-prefix) - &optional (value (transient--get-savable-value))) - (let ((key (transient--history-key obj))) - (setf (alist-get key transient-history) - (cons value (delete value (alist-get key transient-history)))))) - -(cl-defgeneric transient--history-init (obj) - "Initialize OBJ's `history' slot. -This is the transient-wide history; many individual infixes also -have a history of their own.") - -(cl-defmethod transient--history-init ((obj transient-prefix)) - "Initialize OBJ's `history' slot from the variable `transient-history'." - (oset obj history - (let ((val (transient--get-extended-value))) - (cons val (delete val (alist-get (transient--history-key obj) - transient-history)))))) - -;;; Display - -(defun transient--show-hint () - (let ((message-log-max nil)) - (message "%s" (transient--format-hint)))) - -(defun transient--show () - (transient--timer-cancel) - (setq transient--showp t) - (let ((transient--shadowed-buffer (current-buffer)) - (setup (not (get-buffer transient--buffer-name))) - (focus nil)) - (setq transient--buffer (get-buffer-create transient--buffer-name)) - (with-current-buffer transient--buffer - (when transient-enable-popup-navigation - (setq focus (or (button-get (point) 'command) - (and (not (bobp)) - (button-get (1- (point)) 'command)) - (transient--heading-at-point)))) - (erase-buffer) - (transient--insert-menu setup)) - (unless (window-live-p transient--window) - (setq transient--window - (display-buffer transient--buffer - (transient--display-action))) - (with-selected-window transient--window - (set-window-parameter nil 'prev--no-other-window - (window-parameter nil 'no-other-window)))) - (when (window-live-p transient--window) - (with-selected-window transient--window - (set-window-parameter nil 'no-other-window t) - (goto-char (point-min)) - (when transient-enable-popup-navigation - (transient--goto-button focus)) - (transient--fit-window-to-buffer transient--window))))) - -(defun transient--display-action () - (let ((action - (cond ((oref transient--prefix display-action)) - ((memq 'display-buffer-full-frame - (ensure-list (car transient-display-buffer-action))) - (user-error "%s disallowed in %s" - 'display-buffer-full-frame - 'transient-display-buffer-action)) - (transient-display-buffer-action)))) - (when (and (assq 'pop-up-frame-parameters (cdr action)) - (fboundp 'buffer-line-statistics)) ; Emacs >= 28.1 - (setq action (copy-tree action)) - (pcase-let ((`(,height ,width) - (buffer-line-statistics transient--buffer)) - (params (assq 'pop-up-frame-parameters (cdr action)))) - (setf (alist-get 'height params) height) - (setf (alist-get 'width params) - (max width (or transient-minimal-frame-width 0))))) - action)) - -(defun transient--fit-window-to-buffer (window) - (set-window-parameter window 'window-preserved-size nil) - (let ((fit-window-to-buffer-horizontally t) - (window-resize-pixelwise t) - (window-size-fixed nil)) - (cond ((not (window-parent window)) - (fit-frame-to-buffer (window-frame window) nil nil nil - transient-minimal-frame-width)) - ((eq (car (window-parameter window 'quit-restore)) 'other) - ;; Grow but never shrink window that previously displayed - ;; another buffer and is going to display that again. - (fit-window-to-buffer window nil (window-height window))) - ((fit-window-to-buffer window nil 1)))) - (set-window-parameter window 'window-preserved-size - (list (window-buffer window) - (window-body-width window t) - (window-body-height window t)))) - -;;; Delete - -(defun transient--delete-window () - (when (window-live-p transient--window) - (let ((win transient--window) - (remain-in-minibuffer-window - (and (minibuffer-selected-window) - (selected-window)))) - (cond - ((eq (car (window-parameter win 'quit-restore)) 'other) - ;; Window used to display another buffer. - (set-window-parameter win 'no-other-window - (window-parameter win 'prev--no-other-window)) - (set-window-parameter win 'prev--no-other-window nil)) - ((with-demoted-errors "Error while exiting transient: %S" - (if (window-parent win) - (delete-window win) - (delete-frame (window-frame win) t))))) - (when remain-in-minibuffer-window - (select-window remain-in-minibuffer-window)))) - (when (buffer-live-p transient--buffer) - (kill-buffer transient--buffer)) - (setq transient--buffer nil)) - -(defun transient--preserve-window-p (&optional nohide) - (let ((show (if nohide 'fixed transient-show-during-minibuffer-read))) - (when (and (integerp show) - (window-live-p transient--window) - (< (frame-height (window-frame transient--window)) - (+ (abs show) - (window-height transient--window)))) - (setq show (natnump show))) - show)) - -;;; Format - -(defun transient--format-hint () - (if (and transient-show-popup (<= transient-show-popup 0)) - (format "%s-" (key-description (this-command-keys))) - (format - "%s- [%s] %s" - (key-description (this-command-keys)) - (oref transient--prefix command) - (mapconcat - #'identity - (sort - (mapcan - (lambda (suffix) - (let ((key (kbd (oref suffix key)))) - ;; Don't list any common commands. - (and (not (memq (oref suffix command) - `(,(lookup-key transient-map key) - ,(lookup-key transient-sticky-map key) - ;; From transient-common-commands: - transient-set - transient-save - transient-history-prev - transient-history-next - transient-quit-one - transient-toggle-common - transient-set-level))) - (list (propertize (oref suffix key) 'face 'transient-key))))) - transient--suffixes) - #'string<) - (propertize "|" 'face 'transient-delimiter))))) - -(defun transient--insert-menu (setup) - (when setup - (when transient-force-fixed-pitch - (transient--force-fixed-pitch)) - (when (bound-and-true-p tab-line-format) - (setq tab-line-format nil)) - (setq header-line-format nil) - (setq mode-line-format - (let ((format (transient--mode-line-format))) - (if (or (natnump format) (eq format 'line)) nil format))) - (setq mode-line-buffer-identification - (symbol-name (oref transient--prefix command))) - (if transient-enable-popup-navigation - (setq-local cursor-in-non-selected-windows 'box) - (setq cursor-type nil)) - (setq display-line-numbers nil) - (setq show-trailing-whitespace nil) - (run-hooks 'transient-setup-buffer-hook)) - (transient--insert-groups) - (when (or transient--helpp transient--editp) - (transient--insert-help)) - (when-let ((line (transient--separator-line))) - (insert line))) - -(defun transient--mode-line-format () - (if (slot-boundp transient--prefix 'mode-line-format) - (oref transient--prefix mode-line-format) - transient-mode-line-format)) - -(defun transient--separator-line () - (and-let* ((format (transient--mode-line-format)) - (height (cond ((not window-system) nil) - ((natnump format) format) - ((eq format 'line) 1))) - (face `(:background ,(transient--prefix-color) :extend t))) - (concat (propertize "__" 'face face 'display `(space :height (,height))) - (propertize "\n" 'face face 'line-height t)))) - -(defun transient--prefix-color () - (or (face-foreground (transient--key-face nil nil 'non-suffix) nil t) - "#gray60")) - -(defmacro transient-with-shadowed-buffer (&rest body) - "While in the transient buffer, temporarily make the shadowed buffer current." - (declare (indent 0) (debug t)) - `(with-current-buffer (or transient--shadowed-buffer (current-buffer)) - ,@body)) - -(defun transient--insert-groups () - (let ((groups (mapcan (lambda (group) - (let ((hide (oref group hide))) - (and (not (and (functionp hide) - (transient-with-shadowed-buffer - (funcall hide)))) - (list group)))) - transient--layout))) - (while-let ((group (pop groups))) - (transient--insert-group group) - (when groups - (insert ?\n))))) - -(defun transient--active-suffixes (group) - (seq-remove (lambda (suffix) - (and (cl-typep suffix 'transient-suffix) - (oref suffix inactive))) - (oref group suffixes))) - -(defvar transient--max-group-level 1) - -(cl-defgeneric transient--insert-group (group) - "Format GROUP and its elements and insert the result.") - -(cl-defmethod transient--insert-group :around ((group transient-group) - &optional _) - "Insert GROUP's description, if any." - (when-let ((desc (transient-with-shadowed-buffer - (transient-format-description group)))) - (insert desc ?\n)) - (let ((transient--max-group-level - (max (oref group level) transient--max-group-level)) - (transient--pending-group group)) - (cl-call-next-method group))) - -(cl-defmethod transient--insert-group ((group transient-row)) - (transient--maybe-pad-keys group) - (dolist (suffix (transient--active-suffixes group)) - (insert (transient-with-shadowed-buffer (transient-format suffix))) - (insert " ")) - (insert ?\n)) - -(cl-defmethod transient--insert-group ((group transient-column) - &optional skip-empty) - (transient--maybe-pad-keys group) - (dolist (suffix (transient--active-suffixes group)) - (let ((str (transient-with-shadowed-buffer (transient-format suffix)))) - (unless (and (not skip-empty) (equal str "")) - (insert str) - (unless (string-match-p ".\n\\'" str) - (insert ?\n)))))) - -(cl-defmethod transient--insert-group ((group transient-columns)) - (if (or transient-force-single-column transient--docsp) - (dolist (group (oref group suffixes)) - (transient--insert-group group t)) - (let* ((columns - (mapcar - (lambda (column) - (transient--maybe-pad-keys column group) - (transient-with-shadowed-buffer - `(,@(and-let* ((desc (transient-format-description column))) - (list desc)) - ,@(let ((transient--pending-group column)) - (mapcar #'transient-format - (transient--active-suffixes column)))))) - (oref group suffixes))) - (stops (transient--column-stops columns))) - (dolist (row (apply #'transient--mapn #'list columns)) - (let ((stops stops)) - (dolist (cell row) - (let ((stop (pop stops))) - (when cell - (transient--align-to stop) - (insert cell))))) - (insert ?\n))))) - -(cl-defmethod transient--insert-group ((group transient-subgroups)) - (let ((subgroups (oref group suffixes))) - (while-let ((subgroup (pop subgroups))) - (transient--maybe-pad-keys subgroup group) - (transient--insert-group subgroup) - (when subgroups - (insert ?\n))))) - -(cl-defgeneric transient-format (obj) - "Format and return OBJ for display. - -When this function is called, then the current buffer is some -temporary buffer. If you need the buffer from which the prefix -command was invoked to be current, then do so by temporarily -making `transient--original-buffer' current.") - -(cl-defmethod transient-format ((arg string)) - "Return the string ARG after applying the `transient-heading' face." - (propertize arg 'face 'transient-heading)) - -(cl-defmethod transient-format ((_ null)) - "Return a string containing just the newline character." - "\n") - -(cl-defmethod transient-format ((arg integer)) - "Return a string containing just the ARG character." - (char-to-string arg)) - -(cl-defmethod transient-format :around ((obj transient-suffix)) - "Add additional formatting if appropriate. -When reading user input for this infix, then highlight it. -When edit-mode is enabled, then prepend the level information. -When `transient-enable-popup-navigation' is non-nil then format -as a button." - (let ((str (cl-call-next-method obj))) - (when (and (cl-typep obj 'transient-infix) - (eq (oref obj command) this-original-command) - (active-minibuffer-window)) - (setq str (transient--add-face str 'transient-active-infix))) - (when transient--editp - (setq str (concat (let ((level (oref obj level))) - (propertize (format " %s " level) - 'face (if (transient--use-level-p level t) - 'transient-enabled-suffix - 'transient-disabled-suffix))) - str))) - (when (and transient-enable-popup-navigation - (slot-boundp obj 'command)) - (setq str (make-text-button str nil - 'type 'transient - 'suffix obj - 'command (oref obj command)))) - str)) - -(cl-defmethod transient-format ((obj transient-infix)) - "Return a string generated using OBJ's `format'. -%k is formatted using `transient-format-key'. -%d is formatted using `transient-format-description'. -%v is formatted using `transient-format-value'." - (format-spec (oref obj format) - `((?k . ,(transient-format-key obj)) - (?d . ,(transient-format-description obj)) - (?v . ,(transient-format-value obj))))) - -(cl-defmethod transient-format ((obj transient-suffix)) - "Return a string generated using OBJ's `format'. -%k is formatted using `transient-format-key'. -%d is formatted using `transient-format-description'." - (format-spec (oref obj format) - `((?k . ,(transient-format-key obj)) - (?d . ,(transient-format-description obj))))) - -(cl-defgeneric transient-format-key (obj) - "Format OBJ's `key' for display and return the result.") - -(cl-defmethod transient-format-key ((obj transient-suffix)) - "Format OBJ's `key' for display and return the result." - (let ((key (if (slot-boundp obj 'key) (oref obj key) "")) - (cmd (and (slot-boundp obj 'command) (oref obj command)))) - (when-let ((width (oref transient--pending-group pad-keys))) - (setq key (truncate-string-to-width key width nil ?\s))) - (if transient--redisplay-key - (let ((len (length transient--redisplay-key)) - (seq (cl-coerce (edmacro-parse-keys key t) 'list))) - (cond - ((member (seq-take seq len) - (list transient--redisplay-key - (thread-last transient--redisplay-key - (cl-substitute ?- 'kp-subtract) - (cl-substitute ?= 'kp-equal) - (cl-substitute ?+ 'kp-add)))) - (let ((pre (key-description (vconcat (seq-take seq len)))) - (suf (key-description (vconcat (seq-drop seq len))))) - (setq pre (string-replace "RET" "C-m" pre)) - (setq pre (string-replace "TAB" "C-i" pre)) - (setq suf (string-replace "RET" "C-m" suf)) - (setq suf (string-replace "TAB" "C-i" suf)) - ;; We use e.g., "-k" instead of the more correct "- k", - ;; because the former is prettier. If we did that in - ;; the definition, then we want to drop the space that - ;; is reinserted above. False-positives are possible - ;; for silly bindings like "-C-c C-c". - (unless (string-search " " key) - (setq pre (string-replace " " "" pre)) - (setq suf (string-replace " " "" suf))) - (concat (propertize pre 'face 'transient-unreachable-key) - (and (string-prefix-p (concat pre " ") key) " ") - (propertize suf 'face (transient--key-face cmd key)) - (save-excursion - (and (string-match " +\\'" key) - (propertize (match-string 0 key) - 'face 'fixed-pitch)))))) - ((transient--lookup-key transient-sticky-map (kbd key)) - (propertize key 'face (transient--key-face cmd key))) - (t - (propertize key 'face 'transient-unreachable-key)))) - (propertize key 'face (transient--key-face cmd key))))) - -(cl-defmethod transient-format-key :around ((obj transient-argument)) - "Handle `transient-highlight-mismatched-keys'." - (let ((key (cl-call-next-method obj))) - (cond - ((not transient-highlight-mismatched-keys) key) - ((not (slot-boundp obj 'shortarg)) - (transient--add-face key 'transient-nonstandard-key)) - ((not (string-equal key (oref obj shortarg))) - (transient--add-face key 'transient-mismatched-key)) - (key)))) - -(cl-defgeneric transient-format-description (obj) - "Format OBJ's `description' for display and return the result.") - -(cl-defmethod transient-format-description ((obj transient-suffix)) - "The `description' slot may be a function, in which case that is -called inside the correct buffer (see `transient--insert-group') -and its value is returned to the caller." - (transient--get-description obj)) - -(cl-defmethod transient-format-description ((obj transient-value-preset)) - (pcase-let* (((eieio description key set) obj) - (value (transient--get-extended-value)) - (active (seq-set-equal-p set value))) - (format - "%s %s" - (propertize (or description (format "Preset %s" key)) - 'face (and active 'transient-argument)) - (format (propertize "(%s)" 'face 'transient-delimiter) - (mapconcat (lambda (arg) - (propertize - arg 'face (cond (active 'transient-argument) - ((member arg value) - '((:weight demibold) - transient-inactive-argument)) - ('transient-inactive-argument)))) - set " "))))) - -(cl-defmethod transient-format-description ((obj transient-group)) - "Format the description by calling the next method. -If the result doesn't use the `face' property at all, then apply the -face `transient-heading' to the complete string." - (and-let* ((desc (transient--get-description obj))) - (cond ((oref obj inapt) - (propertize desc 'face 'transient-inapt-suffix)) - ((text-property-not-all 0 (length desc) 'face nil desc) - desc) - ((propertize desc 'face 'transient-heading))))) - -(cl-defmethod transient-format-description :around ((obj transient-suffix)) - "Format the description by calling the next method. -If the result is nil, then use \"(BUG: no description)\" as the -description. If the OBJ's `key' is currently unreachable, then -apply the face `transient-unreachable' to the complete string." - (let ((desc (or (cl-call-next-method obj) - (and (slot-boundp transient--prefix 'suffix-description) - (funcall (oref transient--prefix suffix-description) - obj))))) - (when-let* ((_ transient--docsp) - (_(slot-boundp obj 'command)) - (cmd (oref obj command)) - (_(not (memq 'transient--default-infix-command - (function-alias-p cmd)))) - (docstr (ignore-errors (documentation cmd))) - (docstr (string-trim - (substring docstr 0 (string-match "\\.?\n" docstr)))) - (_(not (equal docstr "")))) - (setq desc (format-spec transient-show-docstring-format - `((?c . ,desc) - (?s . ,docstr))))) - (if desc - (when-let ((face (transient--get-face obj 'face))) - (setq desc (transient--add-face desc face t))) - (setq desc (propertize "(BUG: no description)" 'face 'error))) - (when (cond (transient--all-levels-p - (> (oref obj level) transient--default-prefix-level)) - (transient-highlight-higher-levels - (> (max (oref obj level) transient--max-group-level) - transient--default-prefix-level))) - (setq desc (transient--add-face desc 'transient-higher-level))) - (when-let ((inapt-face (and (oref obj inapt) - (transient--get-face obj 'inapt-face)))) - (setq desc (transient--add-face desc inapt-face))) - (when (and (slot-boundp obj 'key) - (transient--key-unreachable-p obj)) - (setq desc (transient--add-face desc 'transient-unreachable))) - desc)) - -(cl-defgeneric transient-format-value (obj) - "Format OBJ's value for display and return the result.") - -(cl-defmethod transient-format-value ((obj transient-suffix)) - (propertize (oref obj argument) - 'face (if (oref obj value) - (if (oref obj inapt) - 'transient-inapt-argument - 'transient-argument) - 'transient-inactive-argument))) - -(cl-defmethod transient-format-value ((obj transient-option)) - (let ((argument (prin1-to-string (oref obj argument) t))) - (if-let ((value (oref obj value))) - (let* ((inapt (oref obj inapt)) - (aface (if inapt 'transient-inapt-argument 'transient-argument)) - (vface (if inapt 'transient-inapt-argument 'transient-value))) - (pcase-exhaustive (oref obj multi-value) - ('nil - (concat (propertize argument 'face aface) - (propertize value 'face vface))) - ((or 't 'rest) - (concat (propertize (if (string-suffix-p " " argument) - argument - (concat argument " ")) - 'face aface) - (propertize (mapconcat #'prin1-to-string value " ") - 'face vface))) - ('repeat - (mapconcat (lambda (value) - (concat (propertize argument 'face aface) - (propertize value 'face vface))) - value " ")))) - (propertize argument 'face 'transient-inactive-argument)))) - -(cl-defmethod transient-format-value ((obj transient-switches)) - (with-slots (value argument-format choices) obj - (format (propertize argument-format - 'face (if value - 'transient-argument - 'transient-inactive-argument)) - (format - (propertize "[%s]" 'face 'transient-delimiter) - (mapconcat - (lambda (choice) - (propertize choice 'face - (if (equal (format argument-format choice) value) - (if (oref obj inapt) - 'transient-inapt-argument - 'transient-value) - 'transient-inactive-value))) - choices - (propertize "|" 'face 'transient-delimiter)))))) - -(cl-defmethod transient--get-description ((obj transient-child)) - (cond-let* [[desc (oref obj description)]] - ((functionp desc) - (condition-case nil - (funcall desc obj) - (wrong-number-of-arguments (funcall desc)))) - (desc))) - -(cl-defmethod transient--get-face ((obj transient-suffix) slot) - (cond-let* ((not (slot-boundp obj slot)) nil) - [[face (slot-value obj slot)]] - ((facep face) face) - ((functionp face) - (let ((transient--pending-suffix obj)) - (condition-case nil - (funcall face obj) - (wrong-number-of-arguments (funcall face))))))) - -(defun transient--add-face (string face &optional append beg end) - (let ((str (copy-sequence string))) - (add-face-text-property (or beg 0) (or end (length str)) face append str) - str)) - -(defun transient--key-face (cmd key &optional enforce-type) - (or (and transient-semantic-coloring - (not transient--helpp) - (not transient--editp) - (get (transient--get-pre-command cmd key enforce-type) - 'transient-face)) - (if cmd 'transient-key 'transient-key-noop))) - -(defun transient--key-unreachable-p (obj) - (and transient--redisplay-key - (let ((key (oref obj key))) - (not (or (equal (seq-take (cl-coerce (edmacro-parse-keys key t) 'list) - (length transient--redisplay-key)) - transient--redisplay-key) - (transient--lookup-key transient-sticky-map (kbd key))))))) - -(defun transient--lookup-key (keymap key) - (let ((val (lookup-key keymap key))) - (and val (not (integerp val)) val))) - -(defun transient--maybe-pad-keys (group &optional parent) - (when-let ((pad (or (oref group pad-keys) - (and parent (oref parent pad-keys))))) - (oset group pad-keys - (apply #'max - (if (integerp pad) pad 0) - (seq-keep (lambda (suffix) - (and (eieio-object-p suffix) - (slot-boundp suffix 'key) - (length (oref suffix key)))) - (oref group suffixes)))))) - -(defun transient--pixel-width (string) - (save-window-excursion - (with-temp-buffer - (insert string) - (set-window-dedicated-p nil nil) - (set-window-buffer nil (current-buffer)) - (car (window-text-pixel-size - nil (line-beginning-position) (point)))))) - -(defun transient--column-stops (columns) - (let* ((var-pitch (or transient-align-variable-pitch - (oref transient--prefix variable-pitch))) - (char-width (and var-pitch (transient--pixel-width " ")))) - (transient--seq-reductions-from - (apply-partially #'+ (* 2 (if var-pitch char-width 1))) - (transient--mapn - (lambda (cells min) - (apply #'max - (if min (if var-pitch (* min char-width) min) 0) - (mapcar (if var-pitch #'transient--pixel-width #'length) cells))) - columns - (oref transient--prefix column-widths)) - 0))) - -(defun transient--align-to (stop) - (unless (zerop stop) - (insert (if (or transient-align-variable-pitch - (oref transient--prefix variable-pitch)) - (propertize " " 'display `(space :align-to (,stop))) - (make-string (max 0 (- stop (current-column))) ?\s))))) - -(defun transient-command-summary-or-name (obj) - "Return the summary or name of the command represented by OBJ. - -If the command has a doc-string, then return the first line of -that, else its name. - -Intended to be temporarily used as the `:suffix-description' of -a prefix command, while porting a regular keymap to a transient." - (let ((command (oref obj command))) - (if-let ((doc (documentation command))) - (propertize (car (split-string doc "\n")) 'face 'font-lock-doc-face) - (propertize (symbol-name command) 'face 'font-lock-function-name-face)))) - -;;; Help - -(cl-defgeneric transient-show-help (obj) - "Show documentation for the command represented by OBJ.") - -(cl-defmethod transient-show-help ((obj transient-prefix)) - "Call `show-help' if non-nil, else show `info-manual', -if non-nil, else show the `man-page' if non-nil, else use -`describe-function'." - (with-slots (show-help info-manual man-page command) obj - (cond (show-help (funcall show-help obj)) - (info-manual (transient--show-manual info-manual)) - (man-page (transient--show-manpage man-page)) - ((transient--describe-function command))))) - -(cl-defmethod transient-show-help ((obj transient-suffix)) - "Call `show-help' if non-nil, else use `describe-function'. -Also used to dispatch showing documentation for the current -prefix. If the suffix is a sub-prefix, then also call the -prefix method." - (cond-let - ((eq this-command 'transient-help) - (transient-show-help transient--prefix)) - ([prefix (get (oref obj command) 'transient--prefix)] - [_(not (eq (oref transient--prefix command) this-command))] - (transient-show-help prefix)) - ([show-help (oref obj show-help)] - (funcall show-help obj)) - ((transient--describe-function this-command)))) - -(cl-defmethod transient-show-help ((obj transient-infix)) - "Call `show-help' if non-nil, else show the `man-page' -if non-nil, else use `describe-function'. When showing the -manpage, then try to jump to the correct location." - (cond-let - ([show-help (oref obj show-help)] - (funcall show-help obj)) - ([man-page (oref transient--prefix man-page)] - [argument (and (slot-boundp obj 'argument) - (oref obj argument))] - (transient--show-manpage man-page argument)) - ((transient--describe-function this-command)))) - -;; `cl-generic-generalizers' doesn't support `command' et al. -(cl-defmethod transient-show-help (cmd) - "Show the command doc-string." - (transient--describe-function cmd)) - -(defmacro transient-with-help-window (&rest body) - "Evaluate BODY, send output to *Help* buffer, and display it in a window. -Select the help window, and make the help buffer current and return it." - (declare (indent 0)) - `(let ((buffer nil) - (help-window-select t)) - (with-help-window (help-buffer) - ,@body - (setq buffer (current-buffer))) - (set-buffer buffer))) - -(defun transient--display-help (helper target) - (let ((winconf (current-window-configuration))) - (funcall (cond (helper) - ((symbolp target) #'transient--describe-function) - ((stringp target) - (if (string-prefix-p "(" target) - #'transient--show-manual - #'transient--show-manpage)) - ((error "Unknown how to show help for %S" target))) - target) - (setq-local transient--restore-winconf winconf)) - (fit-window-to-buffer nil (frame-height) (window-height)) - (transient-resume-mode) - (message (substitute-command-keys "Type \\`q' to resume transient command."))) - -(defun transient--describe-function (fn) - (let* ((buffer nil) - (help-window-select t) - (temp-buffer-window-setup-hook - (cons (lambda () (setq buffer (current-buffer))) - temp-buffer-window-setup-hook))) - (describe-function fn) - (set-buffer buffer))) - -(defun transient--show-manual (manual) - (info manual)) - -(defun transient--show-manpage (manpage &optional argument) - (require 'man) - (let* ((Man-notify-method 'meek) - (buf (Man-getpage-in-background manpage)) - (proc (get-buffer-process buf))) - (while (and proc (eq (process-status proc) 'run)) - (accept-process-output proc)) - (switch-to-buffer buf) - (when argument - (transient--goto-argument-description argument)))) - -(defun transient--goto-argument-description (arg) - (goto-char (point-min)) - (let ((case-fold-search nil) - ;; This matches preceding/proceeding options. Options - ;; such as "-a", "-S[]", and "--grep=" - ;; are matched by this regex without the shy group. - ;; The ". " in the shy group is for options such as - ;; "-m parent-number", and the "-[^[:space:]]+ " is - ;; for options such as "--mainline parent-number" - (others "-\\(?:. \\|-[^[:space:]]+ \\)?[^[:space:]]+")) - (when (re-search-forward - (if (equal arg "--") - ;; Special case. - "^[\t\s]+\\(--\\(?: \\|$\\)\\|\\[--\\]\\)" - ;; Should start with whitespace and may have - ;; any number of options before and/or after. - (format - "^[\t\s]+\\(?:%s, \\)*?\\(?1:%s\\)%s\\(?:, %s\\)*$" - others - ;; Options don't necessarily end in an "=" - ;; (e.g., "--gpg-sign[=]") - (string-remove-suffix "=" arg) - ;; Simple options don't end in an "=". Splitting this - ;; into 2 cases should make getting false positives - ;; less likely. - (if (string-suffix-p "=" arg) - ;; "[^[:space:]]*[^.[:space:]]" matches the option - ;; value, which is usually after the option name - ;; and either '=' or '[='. The value can't end in - ;; a period, as that means it's being used at the - ;; end of a sentence. The space is for options - ;; such as '--mainline parent-number'. - "\\(?: \\|\\[?=\\)[^[:space:]]*[^.[:space:]]" - ;; Either this doesn't match anything (e.g., "-a"), - ;; or the option is followed by a value delimited - ;; by a "[", "<", or ":". A space might appear - ;; before this value, as in "-f ". The - ;; space alternative is for options such as - ;; "-m parent-number". - "\\(?:\\(?: \\| ?[\\[<:]\\)[^[:space:]]*[^.[:space:]]\\)?") - others)) - nil t) - (goto-char (match-beginning 1))))) - -(defun transient--insert-help () - (unless (looking-back "\n\n" 2) - (insert "\n")) - (when transient--helpp - (insert - (format - (propertize "\ -Type a %s to show help for that suffix command, or %s to show manual. -Type %s to exit help.\n" - 'face 'transient-heading) - (propertize "" 'face 'transient-key) - (propertize "?" 'face 'transient-key) - (propertize "C-g" 'face 'transient-key)))) - (when transient--editp - (unless transient--helpp - (insert - (format - (propertize "\ -Type %s and then %s to put the respective suffix command on level %s. -Type %s and then %s to display suffixes up to level %s in this menu. -Type %s and then %s to describe the respective suffix command.\n" - 'face 'transient-heading) - (propertize "" 'face 'transient-key) - (propertize "" 'face 'transient-key) - (propertize " N " 'face 'transient-enabled-suffix) - (propertize (concat transient-common-command-prefix " l") - 'face 'transient-key) - (propertize "" 'face 'transient-key) - (propertize " N " 'face 'transient-enabled-suffix) - (propertize "C-h" 'face 'transient-key) - (propertize "" 'face 'transient-key)))) - (with-slots (level) transient--prefix - (insert - (format - (propertize " -The current level of this menu is %s, so - commands on levels %s are displayed, and - commands on levels %s and %s are not displayed.\n" - 'face 'transient-heading) - (propertize (format " %s " level) 'face 'transient-enabled-suffix) - (propertize (format " 1..%s " level) 'face 'transient-enabled-suffix) - (propertize (format " >= %s " (1+ level)) - 'face 'transient-disabled-suffix) - (propertize " 0 " 'face 'transient-disabled-suffix)))))) - -(cl-defgeneric transient-show-summary (obj &optional return) - "Show brief summary about the command at point in the echo area. - -If OBJ's `summary' slot is a string, use that. If it is a function, -call that with OBJ as the only argument and use the returned string. -If `summary' is or returns something other than a string or nil, -show no summary. If `summary' is or returns nil, use the first line -of the documentation string, if any. - -If RETURN is non-nil, return the summary instead of showing it. -This is used when a tooltip is needed.") - -(cl-defmethod transient-show-summary ((obj transient-suffix) &optional return) - (with-slots (command summary) obj - (when-let* - ((doc (cond ((functionp summary) - (funcall summary obj)) - (summary) - ((documentation command) - (car (split-string (documentation command) "\n"))))) - (_(stringp doc)) - (_(not (equal doc - (car (split-string (documentation - 'transient--default-infix-command) - "\n")))))) - (when (string-suffix-p "." doc) - (setq doc (substring doc 0 -1))) - (if return - doc - (let ((message-log-max nil)) - (message "%s" doc)))))) - -;;; Menu Navigation - -(defun transient-scroll-up (&optional arg) - "Scroll text of transient's menu window upward ARG lines. -If ARG is nil scroll near full screen. This is a wrapper -around `scroll-up-command' (which see)." - (interactive "^P") - (with-selected-window transient--window - (scroll-up-command arg))) - -(defun transient-scroll-down (&optional arg) - "Scroll text of transient's menu window down ARG lines. -If ARG is nil scroll near full screen. This is a wrapper -around `scroll-down-command' (which see)." - (interactive "^P") - (with-selected-window transient--window - (scroll-down-command arg))) - -(defun transient-backward-button (n) - "Move to the previous button in transient's menu buffer. -See `backward-button' for information about N." - (interactive "p") - (with-selected-window transient--window - (backward-button n t) - (when (eq transient-enable-popup-navigation 'verbose) - (transient-show-summary (get-text-property (point) 'suffix))))) - -(defun transient-forward-button (n) - "Move to the next button in transient's menu buffer. -See `forward-button' for information about N." - (interactive "p") - (with-selected-window transient--window - (forward-button n t) - (when (eq transient-enable-popup-navigation 'verbose) - (transient-show-summary (get-text-property (point) 'suffix))))) - -(define-button-type 'transient - 'face nil - 'keymap transient-button-map - 'help-echo (lambda (win buf pos) - (with-selected-window win - (with-current-buffer buf - (transient-show-summary - (get-text-property pos 'suffix) t))))) - -(defun transient--goto-button (command) - (cond - ((stringp command) - (when (re-search-forward (concat "^" (regexp-quote command)) nil t) - (goto-char (match-beginning 0)))) - (command - (cl-flet ((found () - (and$ (button-at (point)) - (eq (button-get $ 'command) command)))) - (while (and (ignore-errors (forward-button 1)) - (not (found)))) - (unless (found) - (goto-char (point-min)) - (ignore-errors (forward-button 1)) - (unless (found) - (goto-char (point-min)))))))) - -(defun transient--heading-at-point () - (and (eq (get-text-property (point) 'face) 'transient-heading) - (let ((beg (line-beginning-position))) - (buffer-substring-no-properties - beg (next-single-property-change - beg 'face nil (line-end-position)))))) - -;;; Compatibility -;;;; Menu Isearch - -(defvar-keymap transient--isearch-mode-map - :parent isearch-mode-map - "" #'transient-isearch-exit - " " #'transient-isearch-exit - " " #'transient-isearch-cancel - " " #'transient-isearch-abort) - -(defun transient-isearch-backward (&optional regexp-p) - "Do incremental search backward. -With a prefix argument, do an incremental regular expression -search instead." - (interactive "P") - (transient--isearch-setup) - (let ((isearch-mode-map transient--isearch-mode-map)) - (isearch-mode nil regexp-p))) - -(defun transient-isearch-forward (&optional regexp-p) - "Do incremental search forward. -With a prefix argument, do an incremental regular expression -search instead." - (interactive "P") - (transient--isearch-setup) - (let ((isearch-mode-map transient--isearch-mode-map)) - (isearch-mode t regexp-p))) - -(defun transient-isearch-exit () - "Like `isearch-exit' but adapted for `transient'." - (interactive) - (isearch-exit) - (transient--isearch-exit)) - -(defun transient-isearch-cancel () - "Like `isearch-cancel' but adapted for `transient'." - (interactive) - (condition-case nil (isearch-cancel) (quit)) - (transient--isearch-exit)) - -(defun transient-isearch-abort () - "Like `isearch-abort' but adapted for `transient'." - (interactive) - (let ((around (lambda (fn) - (condition-case nil (funcall fn) (quit)) - (transient--isearch-exit)))) - (advice-add 'isearch-cancel :around around) - (unwind-protect - (isearch-abort) - (advice-remove 'isearch-cancel around)))) - -(defun transient--isearch-setup () - (select-window transient--window) - (transient--suspend-override t)) - -(defun transient--isearch-exit () - (select-window transient--original-window) - (transient--resume-override)) - -;;;; Edebug - -(defun transient--edebug-command-p () - (and (bound-and-true-p edebug-active) - (or (memq this-command '(top-level abort-recursive-edit)) - (string-prefix-p "edebug" (symbol-name this-command))))) - -;;;; Miscellaneous - -(cl-pushnew (list nil (concat "^\\s-*(" - (eval-when-compile - (regexp-opt - '("transient-define-prefix" - "transient-define-suffix" - "transient-define-infix" - "transient-define-argument") - t)) - "\\s-+\\(" lisp-mode-symbol-regexp "\\)") - 2) - lisp-imenu-generic-expression :test #'equal) - -(defun transient--suspend-text-conversion-style () - (static-if (boundp 'overriding-text-conversion-style) ; since Emacs 30.1 - (when text-conversion-style - (letrec ((suspended overriding-text-conversion-style) - (fn (lambda () - (setq overriding-text-conversion-style nil) - (remove-hook 'transient-exit-hook fn)))) - (setq overriding-text-conversion-style suspended) - (add-hook 'transient-exit-hook fn))))) - -(declare-function which-key-mode "ext:which-key" (&optional arg)) - -(defun transient--suspend-which-key-mode () - (when (bound-and-true-p which-key-mode) - (which-key-mode -1) - (add-hook 'transient-exit-hook #'transient--resume-which-key-mode))) - -(defun transient--resume-which-key-mode () - (unless transient--prefix - (which-key-mode 1) - (remove-hook 'transient-exit-hook #'transient--resume-which-key-mode))) - -(defun transient-bind-q-to-quit () - "Modify some keymaps to bind \\`q' to the appropriate quit command. - -\\`C-g' is the default binding for such commands now, but Transient's -predecessor Magit-Popup used \\`q' instead. If you would like to get -that binding back, then call this function in your init file like so: - - (with-eval-after-load \\='transient - (transient-bind-q-to-quit)) - -Individual transients may already bind \\`q' to something else -and such a binding would shadow the quit binding. If that is the -case then \\`Q' is bound to whatever \\`q' would have been bound -to, by setting `transient-substitute-key-function' to a function -that does that. Of course \\`Q' may already be bound to something -else, so that function binds \\`M-q' to that command instead. -Of course \\`M-q' may already be bound to something else, but -we stop there." - (keymap-set transient-base-map "q" #'transient-quit-one) - (keymap-set transient-sticky-map "q" #'transient-quit-seq) - (setq transient-substitute-key-function - #'transient-rebind-quit-commands)) - -(defun transient-rebind-quit-commands (obj) - "See `transient-bind-q-to-quit'." - (let ((key (oref obj key))) - (cond ((string-equal key "q") "Q") - ((string-equal key "Q") "M-q") - (key)))) - -(defun transient--force-fixed-pitch () - (require 'face-remap) - (face-remap-reset-base 'default) - (face-remap-add-relative 'default 'fixed-pitch)) - -(defun transient--seq-reductions-from (function sequence initial-value) - (let ((acc (list initial-value))) - (seq-doseq (elt sequence) - (push (funcall function (car acc) elt) acc)) - (nreverse acc))) - -(defun transient--mapn (function &rest lists) - "Apply FUNCTION to elements of LISTS. -Like `cl-mapcar' but while that stops when the shortest list -is exhausted, continue until the longest list is, using nil -as stand-in for elements of exhausted lists." - (let (result) - (while (catch 'more (mapc (lambda (l) (and l (throw 'more t))) lists) nil) - (push (apply function (mapcar #'car-safe lists)) result) - (setq lists (mapcar #'cdr lists))) - (nreverse result))) - -;;; Font-Lock - -(defconst transient-font-lock-keywords - (eval-when-compile - `((,(concat "(" - (regexp-opt (list "transient-define-prefix" - "transient-define-group" - "transient-define-infix" - "transient-define-argument" - "transient-define-suffix") - t) - "\\_>[ \t'(]*" - "\\(\\(?:\\sw\\|\\s_\\)+\\)?") - (1 'font-lock-keyword-face) - (2 'font-lock-function-name-face nil t))))) - -(font-lock-add-keywords 'emacs-lisp-mode transient-font-lock-keywords) - -;;; Auxiliary Classes -;;;; `transient-lisp-variable' - -(defclass transient-lisp-variable (transient-variable) - ((reader :initform #'transient-lisp-variable--reader) - (always-read :initform t) - (set-value :initarg :set-value :initform #'set)) - "[Experimental] Class used for Lisp variables.") - -(cl-defmethod transient-init-value ((obj transient-lisp-variable)) - (oset obj value (symbol-value (oref obj variable)))) - -(cl-defmethod transient-infix-set ((obj transient-lisp-variable) value) - (funcall (oref obj set-value) - (oref obj variable) - (oset obj value value))) - -(cl-defmethod transient-format-description ((obj transient-lisp-variable)) - (or (cl-call-next-method obj) - (symbol-name (oref obj variable)))) - -(cl-defmethod transient-format-value ((obj transient-lisp-variable)) - (propertize (prin1-to-string (oref obj value)) - 'face 'transient-value)) - -(cl-defmethod transient-prompt ((obj transient-lisp-variable)) - (if (and (slot-boundp obj 'prompt) - (oref obj prompt)) - (cl-call-next-method obj) - (format "Set %s: " (oref obj variable)))) - -(defun transient-lisp-variable--reader (prompt initial-input _history) - (read--expression prompt initial-input)) - -;;;; `transient-cons-option' - -(defclass transient-cons-option (transient-option) - ((format :initform " %k %d: %v")) - "[Experimental] Class used for unencoded key-value pairs.") - -(cl-defmethod transient-infix-value ((obj transient-cons-option)) - "Return ARGUMENT and VALUE as a cons-cell or nil if the latter is nil." - (and$ (oref obj value) - (cons (oref obj argument) $))) - -(cl-defmethod transient-format-description ((obj transient-cons-option)) - (or (oref obj description) - (let ((description (prin1-to-string (oref obj argument) t))) - (if (string-prefix-p ":" description) - (substring description 1) - description)))) - -(cl-defmethod transient-format-value ((obj transient-cons-option)) - (let ((value (oref obj value))) - (propertize (prin1-to-string value t) 'face - (if value 'transient-value 'transient-inactive-value)))) - -;;; _ -(provide 'transient) -;; Local Variables: -;; checkdoc-symbol-words: ("command-line" "edit-mode" "help-mode") -;; indent-tabs-mode: nil -;; lisp-indent-local-overrides: ( -;; (cond . 0) -;; (interactive . 0)) -;; read-symbol-shorthands: ( -;; ("and$" . "cond-let--and$") -;; ("and-let" . "cond-let--and-let") -;; ("if-let" . "cond-let--if-let") -;; ("when$" . "cond-let--when$") -;; ("when-let" . "cond-let--when-let") -;; ("while-let" . "cond-let--while-let")) -;; End: -;;; transient.el ends here diff --git a/.config/emacs/lisp/libs/transient.elc b/.config/emacs/lisp/libs/transient.elc deleted file mode 100644 index 6d0fce3..0000000 Binary files a/.config/emacs/lisp/libs/transient.elc and /dev/null differ diff --git a/.config/emacs/lisp/libs/with-editor.el b/.config/emacs/lisp/libs/with-editor.el deleted file mode 100644 index 34866e0..0000000 --- a/.config/emacs/lisp/libs/with-editor.el +++ /dev/null @@ -1,998 +0,0 @@ -;;; with-editor.el --- Use the Emacsclient as $EDITOR -*- lexical-binding:t -*- - -;; Copyright (C) 2014-2026 The Magit Project Contributors - -;; Author: Jonas Bernoulli -;; Homepage: https://github.com/magit/with-editor -;; Keywords: processes terminals - -;; Package-Version: 3.4.8 -;; Package-Requires: ((emacs "26.1") (compat "30.1")) - -;; SPDX-License-Identifier: GPL-3.0-or-later - -;; This file is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation, either version 3 of the License, -;; or (at your option) any later version. -;; -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this file. If not, see . - -;;; Commentary: - -;; This library makes it possible to reliably use the Emacsclient as -;; the `$EDITOR' of child processes. It makes sure that they know how -;; to call home. For remote processes a substitute is provided, which -;; communicates with Emacs on standard output/input instead of using a -;; socket as the Emacsclient does. - -;; It provides the commands `with-editor-async-shell-command' and -;; `with-editor-shell-command', which are intended as replacements -;; for `async-shell-command' and `shell-command'. They automatically -;; export `$EDITOR' making sure the executed command uses the current -;; Emacs instance as "the editor". With a prefix argument these -;; commands prompt for an alternative environment variable such as -;; `$GIT_EDITOR'. To always use these variants add this to your init -;; file: -;; -;; (keymap-global-set " " -;; #'with-editor-async-shell-command) -;; (keymap-global-set " " -;; #'with-editor-shell-command) - -;; Alternatively use the global `shell-command-with-editor-mode', -;; which always sets `$EDITOR' for all Emacs commands which ultimately -;; use `shell-command' to asynchronously run some shell command. - -;; The command `with-editor-export-editor' exports `$EDITOR' or -;; another such environment variable in `shell-mode', `eshell-mode', -;; `term-mode' and `vterm-mode' buffers. Use this Emacs command -;; before executing a shell command which needs the editor set, or -;; always arrange for the current Emacs instance to be used as editor -;; by adding it to the appropriate mode hooks: -;; -;; (add-hook 'shell-mode-hook #'with-editor-export-editor) -;; (add-hook 'eshell-mode-hook #'with-editor-export-editor) -;; (add-hook 'term-exec-hook #'with-editor-export-editor) -;; (add-hook 'vterm-mode-hook #'with-editor-export-editor) - -;; Some variants of this function exist, these two forms are -;; equivalent: -;; -;; (add-hook 'shell-mode-hook -;; (apply-partially #'with-editor-export-editor "GIT_EDITOR")) -;; (add-hook 'shell-mode-hook #'with-editor-export-git-editor) - -;; This library can also be used by other packages which need to use -;; the current Emacs instance as editor. In fact this library was -;; written for Magit and its `git-commit-mode' and `git-rebase-mode'. -;; Consult `git-rebase.el' and the related code in `magit-sequence.el' -;; for a simple example. - -;;; Code: - -(require 'cl-lib) -(require 'compat) -(require 'server) -(require 'shell) -(eval-when-compile (require 'subr-x)) - -(declare-function dired-get-filename "dired" - (&optional localp no-error-if-not-filep)) -(declare-function term-emulate-terminal "term" (proc str)) -(defvar eshell-preoutput-filter-functions) -(defvar git-commit-post-finish-hook) -(defvar vterm--process) -(defvar warning-minimum-level) -(defvar warning-minimum-log-level) - -;;; Options - -(defgroup with-editor nil - "Use the Emacsclient as $EDITOR." - :group 'external - :group 'server) - -(defun with-editor-locate-emacsclient () - "Search for a suitable Emacsclient executable." - (or (with-editor-locate-emacsclient-1 - (with-editor-emacsclient-path) - (length (split-string emacs-version "\\."))) - (prog1 nil (display-warning 'with-editor "\ -Cannot determine a suitable Emacsclient - -Determining an Emacsclient executable suitable for the -current Emacs instance failed. For more information -please see https://github.com/magit/magit/wiki/Emacsclient.")))) - -(defvar with-editor-emacsclient-program-suffixes - (list "-snapshot" ".emacs-snapshot") - "Suffixes to append to append when looking for a Emacsclient executables.") - -(defun with-editor-locate-emacsclient-1 (path depth) - (let* ((version-lst (cl-subseq (split-string emacs-version "\\.") 0 depth)) - (version-reg (concat "^" (string-join version-lst "\\.")))) - (or (locate-file - (cond ((equal (downcase invocation-name) "remacs") - "remacsclient") - ((bound-and-true-p emacsclient-program-name)) - ("emacsclient")) - path - (mapcan (lambda (v) (cl-mapcar (lambda (e) (concat v e)) exec-suffixes)) - (nconc (and (boundp 'debian-emacs-flavor) - (list (format ".%s" debian-emacs-flavor))) - (cl-mapcon (lambda (v) - (setq v (string-join (reverse v) ".")) - (list v - (concat "-" v) - (concat ".emacs" v))) - (reverse version-lst)) - (cons "" with-editor-emacsclient-program-suffixes))) - (lambda (exec) - (ignore-errors - (string-match-p version-reg - (with-editor-emacsclient-version exec))))) - (and (> depth 1) - (with-editor-locate-emacsclient-1 path (1- depth)))))) - -(defun with-editor-emacsclient-version (exec) - (let ((default-directory (file-name-directory exec))) - (ignore-errors - (cadr (split-string (car (process-lines exec "--version"))))))) - -(defun with-editor-emacsclient-path () - (let ((path exec-path)) - (when invocation-directory - (push (directory-file-name invocation-directory) path) - (let* ((linkname (expand-file-name invocation-name invocation-directory)) - (truename (file-chase-links linkname))) - (unless (equal truename linkname) - (push (directory-file-name (file-name-directory truename)) path))) - (when (eq system-type 'darwin) - (let ((dir (expand-file-name "bin" invocation-directory))) - (when (file-directory-p dir) - (push dir path))) - (cond - ((string-search "Cellar" invocation-directory) - (let ((dir (expand-file-name "../../../bin" invocation-directory))) - (when (file-directory-p dir) - (push dir path)))) - ((string-search "Emacs.app" invocation-directory) - (let ((dir (expand-file-name "../../../../bin" invocation-directory))) - (when (file-directory-p dir) - (push dir path))))))) - (cl-remove-duplicates path :test #'equal))) - -(defcustom with-editor-emacsclient-executable (with-editor-locate-emacsclient) - "The Emacsclient executable used by the `with-editor' macro." - :group 'with-editor - :type '(choice (string :tag "Executable") - (const :tag "Don't use Emacsclient" nil))) - -(defcustom with-editor-sleeping-editor "\ -sh -c '\ -printf \"\\nWITH-EDITOR: $$ OPEN $0\\037$1\\037 IN $(pwd)\\n\"; \ -sleep 604800 & sleep=$!; \ -trap \"kill $sleep; exit 0\" USR1; \ -trap \"kill $sleep; exit 1\" USR2; \ -wait $sleep'" - "The sleeping editor, used when the Emacsclient cannot be used. - -This fallback is used for asynchronous processes started inside -the macro `with-editor', when the process runs on a remote machine -or for local processes when `with-editor-emacsclient-executable' -is nil (i.e., when no suitable Emacsclient was found, or the user -decided not to use it). - -Where the latter uses a socket to communicate with Emacs' server, -this substitute prints edit requests to its standard output on -which a process filter listens for such requests. As such it is -not a complete substitute for a proper Emacsclient, it can only -be used as $EDITOR of child process of the current Emacs instance. - -Some shells do not execute traps immediately when waiting for a -child process, but by default we do use such a blocking child -process. - -If you use such a shell (e.g., `csh' on FreeBSD, but not Debian), -then you have to edit this option. You can either replace \"sh\" -with \"bash\" (and install that), or you can use the older, less -performant implementation: - - \"sh -c '\\ - echo -e \\\"\\nWITH-EDITOR: $$ OPEN $0$1 IN $(pwd)\\n\\\"; \\ - trap \\\"exit 0\\\" USR1; \\ - trap \\\"exit 1\" USR2; \\ - while true; do sleep 1; done'\" - -Note that the two unit separator characters () right after $0 -and $1 are required. Normally $0 is the file name and $1 is -missing or else gets ignored. But if $0 has the form \"+N[:N]\", -then it is treated as a position in the file and $1 is expected -to be the file. - -Also note that using this alternative implementation leads to a -delay of up to a second. The delay can be shortened by replacing -\"sleep 1\" with \"sleep 0.01\", or if your implementation does -not support floats, then by using \"nanosleep\" instead." - :package-version '(with-editor . "2.8.0") - :group 'with-editor - :type 'string) - -(defcustom with-editor-finish-query-functions nil - "List of functions called to query before finishing session. - -The buffer in question is current while the functions are called. -If any of them returns nil, then the session is not finished and -the buffer is not killed. The user should then fix the issue and -try again. The functions are called with one argument. If it is -non-nil then that indicates that the user used a prefix argument -to force finishing the session despite issues. Functions should -usually honor that and return non-nil." - :group 'with-editor - :type 'hook) -(put 'with-editor-finish-query-functions 'permanent-local t) - -(defcustom with-editor-cancel-query-functions nil - "List of functions called to query before canceling session. - -The buffer in question is current while the functions are called. -If any of them returns nil, then the session is not canceled and -the buffer is not killed. The user should then fix the issue and -try again. The functions are called with one argument. If it is -non-nil then that indicates that the user used a prefix argument -to force canceling the session despite issues. Functions should -usually honor that and return non-nil." - :group 'with-editor - :type 'hook) -(put 'with-editor-cancel-query-functions 'permanent-local t) - -(defcustom with-editor-mode-lighter " WE" - "The mode-line lighter of the With-Editor mode." - :group 'with-editor - :type '(choice (const :tag "No lighter" "") string)) - -(defvar with-editor-server-window-alist nil - "Alist of filename patterns vs corresponding `server-window'. - -Each element looks like (REGEXP . FUNCTION). Files matching -REGEXP are selected using FUNCTION instead of the default in -`server-window'. - -Note that when a package adds an entry here then it probably -has a reason to disrespect `server-window' and it likely is -not a good idea to change such entries.") - -(defvar with-editor-file-name-history-exclude nil - "List of regexps for filenames `server-visit' should not remember. -When a filename matches any of the regexps, then `server-visit' -does not add it to the variable `file-name-history', which is -used when reading a filename in the minibuffer.") - -(defcustom with-editor-shell-command-use-emacsclient t - "Whether to use the emacsclient when running shell commands. - -This affects `with-editor-async-shell-command' and, if the input -ends with \"&\" `with-editor-shell-command' . - -If `shell-command-with-editor-mode' is enabled, then it also -affects `shell-command-async' and, if the input ends with \"&\" -`shell-command'. - -This is a temporary kludge that lets you choose between two -possible defects, the ones described in the issues #23 and #40. - -When t, then use the emacsclient. This has the disadvantage that -`with-editor-mode' won't be enabled because we don't know whether -this package was involved at all in the call to the emacsclient, -and when it is not, then we really should. The problem is that -the emacsclient doesn't pass along any environment variables to -the server. This will hopefully be fixed in Emacs eventually. - -When nil, then use the sleeping editor. Because in this case we -know that this package is involved, we can enable the mode. But -this makes it necessary that you invoke $EDITOR in shell scripts -like so: - - eval \"$EDITOR\" file - -And some tools that do not handle $EDITOR properly also break." - :package-version '(with-editor . "2.7.1") - :group 'with-editor - :type 'boolean) - -;;; Mode Commands - -(defvar with-editor-pre-finish-hook nil) -(defvar with-editor-pre-cancel-hook nil) -(defvar with-editor-post-finish-hook nil) -(defvar with-editor-post-finish-hook-1 nil) -(defvar with-editor-post-cancel-hook nil) -(defvar with-editor-post-cancel-hook-1 nil) -(defvar with-editor-cancel-alist nil) -(put 'with-editor-pre-finish-hook 'permanent-local t) -(put 'with-editor-pre-cancel-hook 'permanent-local t) -(put 'with-editor-post-finish-hook 'permanent-local t) -(put 'with-editor-post-cancel-hook 'permanent-local t) - -(defvar-local with-editor-show-usage t) -(defvar-local with-editor-cancel-message nil) -(defvar-local with-editor-previous-winconf nil) -(put 'with-editor-cancel-message 'permanent-local t) -(put 'with-editor-previous-winconf 'permanent-local t) - -(defvar-local with-editor--pid nil "For internal use.") -(put 'with-editor--pid 'permanent-local t) - -(defun with-editor-finish (force) - "Finish the current edit session." - (interactive "P") - (when (run-hook-with-args-until-failure - 'with-editor-finish-query-functions force) - (let ((post-finish-hook with-editor-post-finish-hook) - (post-commit-hook (bound-and-true-p git-commit-post-finish-hook)) - (dir default-directory)) - (run-hooks 'with-editor-pre-finish-hook) - (with-editor-return nil) - (accept-process-output nil 0.1) - (with-temp-buffer - (setq default-directory dir) - (setq-local with-editor-post-finish-hook post-finish-hook) - (when post-commit-hook - (setq-local git-commit-post-finish-hook post-commit-hook)) - (run-hooks 'with-editor-post-finish-hook))))) - -(defun with-editor-cancel (force) - "Cancel the current edit session." - (interactive "P") - (when (run-hook-with-args-until-failure - 'with-editor-cancel-query-functions force) - (let ((message with-editor-cancel-message)) - (when (functionp message) - (setq message (funcall message))) - (let ((post-cancel-hook with-editor-post-cancel-hook) - (with-editor-cancel-alist nil) - (dir default-directory)) - (run-hooks 'with-editor-pre-cancel-hook) - (with-editor-return t) - (accept-process-output nil 0.1) - (with-temp-buffer - (setq default-directory dir) - (setq-local with-editor-post-cancel-hook post-cancel-hook) - (run-hooks 'with-editor-post-cancel-hook))) - (message (or message "Canceled by user"))))) - -(defun with-editor-return (cancel) - (let ((winconf with-editor-previous-winconf) - (clients server-buffer-clients) - (dir default-directory) - (pid with-editor--pid)) - (remove-hook 'kill-buffer-query-functions - #'with-editor-kill-buffer-noop t) - (cond (cancel - (save-buffer) - (if clients - (let ((buf (current-buffer))) - (dolist (client clients) - (message "client %S" client) - (ignore-errors - (server-send-string client "-error Canceled by user")) - (delete-process client)) - (when (buffer-live-p buf) - (kill-buffer buf))) - ;; Fallback for when emacs was used as $EDITOR - ;; instead of emacsclient or the sleeping editor. - ;; See https://github.com/magit/magit/issues/2258. - (ignore-errors (delete-file buffer-file-name)) - (kill-buffer))) - (t - (save-buffer) - (if clients - ;; Don't use `server-edit' because we do not want to - ;; show another buffer belonging to another client. - ;; See https://github.com/magit/magit/issues/2197. - (server-done) - (kill-buffer)))) - (when pid - (let ((default-directory dir)) - (process-file "kill" nil nil nil - "-s" (if cancel "USR2" "USR1") pid))) - (when (and winconf (eq (window-configuration-frame winconf) - (selected-frame))) - (set-window-configuration winconf)))) - -;;; Mode - -(defvar-keymap with-editor-mode-map - "C-c C-c" #'with-editor-finish - " " #'with-editor-finish - " " #'with-editor-finish - " " #'with-editor-finish - "C-c C-k" #'with-editor-cancel - " " #'with-editor-cancel - " " #'with-editor-cancel - " " #'with-editor-cancel - " " #'with-editor-cancel) - -(define-minor-mode with-editor-mode - "Edit a file as the $EDITOR of an external process." - :lighter with-editor-mode-lighter - ;; Protect the user from enabling or disabling the mode interactively. - ;; Manually enabling the mode is dangerous because canceling the buffer - ;; deletes the visited file. The mode must not be disabled manually, - ;; either `with-editor-finish' or `with-editor-cancel' must be used. - :interactive nil ; >= 28.1 - (when (called-interactively-p 'any) ; < 28.1 - (setq with-editor-mode (not with-editor-mode)) - (user-error "With-Editor mode is not intended for interactive use")) - ;; The buffer must also not be killed using regular kill commands. - (add-hook 'kill-buffer-query-functions - #'with-editor-kill-buffer-noop nil t) - ;; `server-execute' displays a message which is not - ;; correct when using this mode. - (when with-editor-show-usage - (with-editor-usage-message))) - -(put 'with-editor-mode 'permanent-local t) - -(defun with-editor-kill-buffer-noop () - ;; We started doing this in response to #64, but it is not safe - ;; to do so, because the client has already been killed, causing - ;; `with-editor-return' (called by `with-editor-cancel') to delete - ;; the file, see #66. The reason we delete the file in the first - ;; place are https://github.com/magit/magit/issues/2258 and - ;; https://github.com/magit/magit/issues/2248. - ;; (if (memq this-command '(save-buffers-kill-terminal - ;; save-buffers-kill-emacs)) - ;; (let ((with-editor-cancel-query-functions nil)) - ;; (with-editor-cancel nil) - ;; t) - ;; ...) - ;; So go back to always doing this instead: - (user-error (substitute-command-keys (format "\ -Don't kill this buffer %S. Instead cancel using \\[with-editor-cancel]" - (current-buffer))))) - -(defvar-local with-editor-usage-message "\ -Type \\[with-editor-finish] to finish, \ -or \\[with-editor-cancel] to cancel") - -(defun with-editor-usage-message () - ;; Run after `server-execute', which is run using - ;; a timer which starts immediately. - (let ((buffer (current-buffer))) - (run-with-timer - 0.05 nil - (lambda () - (with-current-buffer buffer - (message (substitute-command-keys with-editor-usage-message))))))) - -;;; Wrappers - -(defvar with-editor--envvar nil "For internal use.") - -(defmacro with-editor (&rest body) - "Use the Emacsclient as $EDITOR while evaluating BODY. -Modify the `process-environment' for processes started in BODY, -instructing them to use the Emacsclient as $EDITOR. If optional -ENVVAR is a literal string then bind that environment variable -instead. -\n(fn [ENVVAR] BODY...)" - (declare (indent defun) (debug (body))) - `(let ((with-editor--envvar ,(if (stringp (car body)) - (pop body) - '(or with-editor--envvar "EDITOR"))) - (process-environment process-environment)) - (with-editor--setup) - ,@body)) - -(defmacro with-editor* (envvar &rest body) - "Use the Emacsclient as the editor while evaluating BODY. -Modify the `process-environment' for processes started in BODY, -instructing them to use the Emacsclient as editor. ENVVAR is the -environment variable that is exported to do so, it is evaluated -at run-time. -\n(fn ENVVAR BODY...)" - (declare (indent defun) (debug (sexp body))) - `(let ((with-editor--envvar ,envvar) - (process-environment process-environment)) - (with-editor--setup) - ,@body)) - -(defun with-editor--setup () - (if (or (not with-editor-emacsclient-executable) - (file-remote-p default-directory)) - (push (concat with-editor--envvar "=" with-editor-sleeping-editor) - process-environment) - ;; Make sure server-use-tcp's value is valid. - (unless (featurep 'make-network-process '(:family local)) - (setq server-use-tcp t)) - ;; Make sure the server is running. - (unless (process-live-p server-process) - (when (server-running-p server-name) - (setq server-name (format "server%s" (emacs-pid))) - (when (server-running-p server-name) - (server-force-delete server-name))) - (server-start)) - ;; Tell $EDITOR to use the Emacsclient. - (push (concat with-editor--envvar "=" - ;; Quoting is the right thing to do. Applications that - ;; fail because of that, are the ones that need fixing, - ;; e.g., by using 'eval "$EDITOR" file'. See #121. - (shell-quote-argument - ;; If users set the executable manually, they might - ;; begin the path with "~", which would get quoted. - (if (string-prefix-p "~" with-editor-emacsclient-executable) - (concat (expand-file-name "~") - (substring with-editor-emacsclient-executable 1)) - with-editor-emacsclient-executable)) - ;; Tell the process where the server file is. - (and (not server-use-tcp) - (concat " --socket-name=" - (shell-quote-argument - (expand-file-name server-name - server-socket-dir))))) - process-environment) - (when server-use-tcp - (push (concat "EMACS_SERVER_FILE=" - (expand-file-name server-name server-auth-dir)) - process-environment)) - ;; As last resort fallback to the sleeping editor. - (push (concat "ALTERNATE_EDITOR=" with-editor-sleeping-editor) - process-environment))) - -(defun with-editor-server-window () - (or (and buffer-file-name - (cdr (cl-find-if (lambda (cons) - (string-match-p (car cons) buffer-file-name)) - with-editor-server-window-alist))) - server-window)) - -(define-advice server-switch-buffer - (:around (fn &optional next-buffer &rest args) - with-editor-server-window-alist) - "Honor `with-editor-server-window-alist' (which see)." - (let ((server-window (with-current-buffer - (or next-buffer (current-buffer)) - (when with-editor-mode - (setq with-editor-previous-winconf - (current-window-configuration))) - (with-editor-server-window)))) - (apply fn next-buffer args))) - -(define-advice start-file-process - (:around (fn name buffer program &rest program-args) - with-editor-process-filter) - "When called inside a `with-editor' form and the Emacsclient -cannot be used, then give the process the filter function -`with-editor-process-filter'. To avoid overriding the filter -being added here you should use `with-editor-set-process-filter' -instead of `set-process-filter' inside `with-editor' forms. - -When the `default-directory' is located on a remote machine, -then also manipulate PROGRAM and PROGRAM-ARGS in order to set -the appropriate editor environment variable." - (if (not with-editor--envvar) - (apply fn name buffer program program-args) - (when (file-remote-p default-directory) - (unless (equal program "env") - (push program program-args) - (setq program "env")) - (push (concat with-editor--envvar "=" with-editor-sleeping-editor) - program-args)) - (let ((process (apply fn name buffer program program-args))) - (set-process-filter process #'with-editor-process-filter) - (process-put process 'default-dir default-directory) - process))) - -(advice-add #'make-process :around - #'make-process@with-editor-process-filter) -(cl-defun make-process@with-editor-process-filter - (fn &rest keys &key name buffer command coding noquery stop - connection-type filter sentinel stderr file-handler - &allow-other-keys) - "When called inside a `with-editor' form and the Emacsclient -cannot be used, then give the process the filter function -`with-editor-process-filter'. To avoid overriding the filter -being added here you should use `with-editor-set-process-filter' -instead of `set-process-filter' inside `with-editor' forms. - -When the `default-directory' is located on a remote machine and -FILE-HANDLER is non-nil, then also manipulate COMMAND in order -to set the appropriate editor environment variable." - (if (or (not file-handler) (not with-editor--envvar)) - (apply fn keys) - (when (file-remote-p default-directory) - (unless (equal (car command) "env") - (push "env" command)) - (push (concat with-editor--envvar "=" with-editor-sleeping-editor) - (cdr command))) - (let* ((filter (if filter - (lambda (process output) - (funcall filter process output) - (with-editor-process-filter process output t)) - #'with-editor-process-filter)) - (process (funcall fn - :name name - :buffer buffer - :command command - :coding coding - :noquery noquery - :stop stop - :connection-type connection-type - :filter filter - :sentinel sentinel - :stderr stderr - :file-handler file-handler))) - (process-put process 'default-dir default-directory) - process))) - -(defun with-editor-set-process-filter (process filter) - "Like `set-process-filter' but keep `with-editor-process-filter'. -Give PROCESS the new FILTER but keep `with-editor-process-filter' -if that was added earlier by the advised `start-file-process'. - -Do so by wrapping the two filter functions using a lambda, which -becomes the actual filter. It calls FILTER first, which may or -may not insert the text into the PROCESS's buffer. Then it calls -`with-editor-process-filter', passing t as NO-STANDARD-FILTER." - (set-process-filter - process - (if (eq (process-filter process) 'with-editor-process-filter) - `(lambda (proc str) - (,filter proc str) - (with-editor-process-filter proc str t)) - filter))) - -(defvar with-editor-filter-visit-hook nil) - -(defconst with-editor-sleeping-editor-regexp "^\ -WITH-EDITOR: \\([0-9]+\\) \ -OPEN \\([^]+?\\)\ -\\(?:\\([^]*\\)\\)?\ -\\(?: IN \\([^\r]+?\\)\\)?\r?$") - -(defvar with-editor--max-incomplete-length 1000) - -(defun with-editor-sleeping-editor-filter (process string) - (when-let ((incomplete (and process (process-get process 'incomplete)))) - (setq string (concat incomplete string))) - (save-match-data - (cond - ((and process (not (string-suffix-p "\n" string))) - (let ((length (length string))) - (when (> length with-editor--max-incomplete-length) - (setq string - (substring string - (- length with-editor--max-incomplete-length))))) - (process-put process 'incomplete string) - nil) - ((string-match with-editor-sleeping-editor-regexp string) - (when process - (process-put process 'incomplete nil)) - (let ((pid (match-string 1 string)) - (arg0 (match-string 2 string)) - (arg1 (match-string 3 string)) - (dir (match-string 4 string)) - file line column) - (cond ((string-match "\\`\\+\\([0-9]+\\)\\(?::\\([0-9]+\\)\\)?\\'" arg0) - (setq file arg1) - (setq line (string-to-number (match-string 1 arg0))) - (setq column (match-string 2 arg0)) - (setq column (and column (string-to-number column)))) - ((setq file arg0))) - (unless (file-name-absolute-p file) - (setq file (expand-file-name file dir))) - (when default-directory - (setq file (concat (file-remote-p default-directory) file))) - (with-current-buffer (find-file-noselect file) - (with-editor-mode 1) - (setq with-editor--pid pid) - (setq with-editor-previous-winconf - (current-window-configuration)) - (when line - (let ((pos (save-excursion - (save-restriction - (goto-char (point-min)) - (forward-line (1- line)) - (when column - (move-to-column column)) - (point))))) - (when (and (buffer-narrowed-p) - widen-automatically - (not (<= (point-min) pos (point-max)))) - (widen)) - (goto-char pos))) - (run-hooks 'with-editor-filter-visit-hook) - (funcall (or (with-editor-server-window) #'switch-to-buffer) - (current-buffer)) - (kill-local-variable 'server-window))) - nil) - (t string)))) - -(defun with-editor-process-filter - (process string &optional no-default-filter) - "Listen for edit requests by child processes." - (let ((default-directory (process-get process 'default-dir))) - (with-editor-sleeping-editor-filter process string)) - (unless no-default-filter - (internal-default-process-filter process string))) - -(define-advice server-visit-files - (:after (files _proc &optional _nowait) - with-editor-file-name-history-exclude) - "Prevent certain files from being added to `file-name-history'. -Files matching a regexp in `with-editor-file-name-history-exclude' -are prevented from being added to that list." - (pcase-dolist (`(,file . ,_) files) - (when (cl-find-if (lambda (regexp) - (string-match-p regexp file)) - with-editor-file-name-history-exclude) - (setq file-name-history - (delete (abbreviate-file-name file) file-name-history))))) - -;;; Augmentations - -;;;###autoload -(cl-defun with-editor-export-editor (&optional (envvar "EDITOR")) - "Teach subsequent commands to use current Emacs instance as editor. - -Set and export the environment variable ENVVAR, by default -\"EDITOR\". The value is automatically generated to teach -commands to use the current Emacs instance as \"the editor\". - -This works in `shell-mode', `term-mode', `eshell-mode' and -`vterm'." - (interactive (list (with-editor-read-envvar))) - (cond - ((derived-mode-p 'comint-mode 'term-mode) - (when-let ((process (get-buffer-process (current-buffer)))) - (goto-char (process-mark process)) - (process-send-string - process (format " export %s=%s\n" envvar - (shell-quote-argument with-editor-sleeping-editor))) - (while (accept-process-output process 1 nil t)) - (if (derived-mode-p 'term-mode) - (with-editor-set-process-filter process #'with-editor-emulate-terminal) - (add-hook 'comint-output-filter-functions #'with-editor-output-filter - nil t)))) - ((derived-mode-p 'eshell-mode) - (add-to-list 'eshell-preoutput-filter-functions - #'with-editor-output-filter) - (setenv envvar with-editor-sleeping-editor)) - ((and (derived-mode-p 'vterm-mode) - (fboundp 'vterm-send-return) - (fboundp 'vterm-send-string)) - (if with-editor-emacsclient-executable - (let ((with-editor--envvar envvar) - (process-environment process-environment)) - (with-editor--setup) - (while (accept-process-output vterm--process 1 nil t)) - (when-let ((v (getenv envvar))) - (vterm-send-string (format " export %s=%S" envvar v)) - (vterm-send-return)) - (when-let ((v (getenv "EMACS_SERVER_FILE"))) - (vterm-send-string (format " export EMACS_SERVER_FILE=%S" v)) - (vterm-send-return)) - (vterm-send-string " clear") - (vterm-send-return)) - (error "Cannot use sleeping editor in this buffer"))) - (t - (error "Cannot export environment variables in this buffer"))) - (message "Successfully exported %s" envvar)) - -;;;###autoload -(defun with-editor-export-git-editor () - "Like `with-editor-export-editor' but always set `$GIT_EDITOR'." - (interactive) - (with-editor-export-editor "GIT_EDITOR")) - -;;;###autoload -(defun with-editor-export-hg-editor () - "Like `with-editor-export-editor' but always set `$HG_EDITOR'." - (interactive) - (with-editor-export-editor "HG_EDITOR")) - -(defun with-editor-output-filter (string) - "Handle edit requests on behalf of `comint-mode' and `eshell-mode'." - (with-editor-sleeping-editor-filter nil string)) - -(defun with-editor-emulate-terminal (process string) - "Like `term-emulate-terminal' but also handle edit requests." - (let ((with-editor-sleeping-editor-regexp - (substring with-editor-sleeping-editor-regexp 1))) - (with-editor-sleeping-editor-filter process string)) - (term-emulate-terminal process string)) - -(defvar with-editor-envvars '("EDITOR" "GIT_EDITOR" "HG_EDITOR")) - -(cl-defun with-editor-read-envvar - (&optional (prompt "Set environment variable") - (default "EDITOR")) - (let ((reply (completing-read (if default - (format "%s (%s): " prompt default) - (concat prompt ": ")) - with-editor-envvars nil nil nil nil default))) - (if (string= reply "") (user-error "Nothing selected") reply))) - -;;;###autoload -(define-minor-mode shell-command-with-editor-mode - "Teach `shell-command' to use current Emacs instance as editor. - -Teach `shell-command', and all commands that ultimately call that -command, to use the current Emacs instance as editor by executing -\"EDITOR=CLIENT COMMAND&\" instead of just \"COMMAND&\". - -CLIENT is automatically generated; EDITOR=CLIENT instructs -COMMAND to use to the current Emacs instance as \"the editor\", -assuming no other variable overrides the effect of \"$EDITOR\". -CLIENT may be the path to an appropriate emacsclient executable -with arguments, or a script which also works over Tramp. - -Alternatively you can use the `with-editor-async-shell-command', -which also allows the use of another variable instead of -\"EDITOR\"." - :global t) - -;;;###autoload -(defun with-editor-async-shell-command - (command &optional output-buffer error-buffer envvar) - "Like `async-shell-command' but with `$EDITOR' set. - -Execute string \"ENVVAR=CLIENT COMMAND\" in an inferior shell; -display output, if any. With a prefix argument prompt for an -environment variable, otherwise the default \"EDITOR\" variable -is used. With a negative prefix argument additionally insert -the COMMAND's output at point. - -CLIENT is automatically generated; ENVVAR=CLIENT instructs -COMMAND to use to the current Emacs instance as \"the editor\", -assuming it respects ENVVAR as an \"EDITOR\"-like variable. -CLIENT may be the path to an appropriate emacsclient executable -with arguments, or a script which also works over Tramp. - -Also see `async-shell-command' and `shell-command'." - (interactive (with-editor-shell-command-read-args "Async shell command: " t)) - (let ((with-editor--envvar envvar)) - (with-editor - (async-shell-command command output-buffer error-buffer)))) - -;;;###autoload -(defun with-editor-shell-command - (command &optional output-buffer error-buffer envvar) - "Like `shell-command' or `with-editor-async-shell-command'. -If COMMAND ends with \"&\" behave like the latter, -else like the former." - (interactive (with-editor-shell-command-read-args "Shell command: ")) - (if (string-match "&[ \t]*\\'" command) - (with-editor-async-shell-command - command output-buffer error-buffer envvar) - (shell-command command output-buffer error-buffer))) - -(defun with-editor-shell-command-read-args (prompt &optional async) - (let ((command (read-shell-command - prompt nil nil - (let ((filename (or buffer-file-name - (and (eq major-mode 'dired-mode) - (dired-get-filename nil t))))) - (and filename (file-relative-name filename)))))) - (list command - (if (or async (setq async (string-match-p "&[ \t]*\\'" command))) - (< (prefix-numeric-value current-prefix-arg) 0) - current-prefix-arg) - shell-command-default-error-buffer - (and async current-prefix-arg (with-editor-read-envvar))))) - -(define-advice shell-command - (:around (fn command &optional output-buffer error-buffer) - shell-command-with-editor-mode) - "Set editor envvar, if `shell-command-with-editor-mode' is enabled. -Also take care of that for `with-editor-[async-]shell-command'." - ;; `shell-mode' and its hook are intended for buffers in which an - ;; interactive shell is running, but `shell-command' also turns on - ;; that mode, even though it only runs the shell to run a single - ;; command. The `with-editor-export-editor' hook function is only - ;; intended to be used in buffers in which an interactive shell is - ;; running, so it has to be removed here. - (let ((shell-mode-hook (remove 'with-editor-export-editor shell-mode-hook))) - (cond - ;; If `with-editor-async-shell-command' was used, then `with-editor' - ;; was used, and `with-editor--envvar'. `with-editor-shell-command' - ;; only goes down that path if the command ends with "&". We might - ;; still have to use `with-editor' here, for `async-shell-command' - ;; or `shell-command', if the mode is enabled. - ((and (string-suffix-p "&" command) - (or with-editor--envvar - shell-command-with-editor-mode)) - (if with-editor--envvar - (funcall fn command output-buffer error-buffer) - (with-editor (funcall fn command output-buffer error-buffer))) - ;; The comint filter was overridden with our filter. Use both. - (and-let* ((process (get-buffer-process - (or output-buffer - (get-buffer "*Async Shell Command*"))))) - (prog1 process - (set-process-filter process - (lambda (proc str) - (comint-output-filter proc str) - (with-editor-process-filter proc str t)))))) - ((funcall fn command output-buffer error-buffer))))) - -;;; _ - -(defun with-editor-debug () - "Debug configuration issues. -See info node `(with-editor)Debugging' for instructions." - (interactive) - (require 'warnings) - (with-current-buffer (get-buffer-create "*with-editor-debug*") - (pop-to-buffer (current-buffer)) - (erase-buffer) - (ignore-errors (with-editor)) - (insert - (format "with-editor: %s\n" (locate-library "with-editor.el")) - (format "emacs: %s (%s)\n" - (expand-file-name invocation-name invocation-directory) - emacs-version) - "system:\n" - (format " system-type: %s\n" system-type) - (format " system-configuration: %s\n" system-configuration) - (format " system-configuration-options: %s\n" system-configuration-options) - "server:\n" - (format " server-running-p: %s\n" (server-running-p)) - (format " server-process: %S\n" server-process) - (format " server-use-tcp: %s\n" server-use-tcp) - (format " server-name: %s\n" server-name) - (format " server-socket-dir: %s\n" server-socket-dir)) - (if (and server-socket-dir (file-accessible-directory-p server-socket-dir)) - (dolist (file (directory-files server-socket-dir nil "^[^.]")) - (insert (format " %s\n" file))) - (insert (format " %s: not an accessible directory\n" - (if server-use-tcp "WARNING" "ERROR")))) - (insert (format " server-auth-dir: %s\n" server-auth-dir)) - (if (file-accessible-directory-p server-auth-dir) - (dolist (file (directory-files server-auth-dir nil "^[^.]")) - (insert (format " %s\n" file))) - (insert (format " %s: not an accessible directory\n" - (if server-use-tcp "ERROR" "WARNING")))) - (let ((val with-editor-emacsclient-executable) - (def (default-value 'with-editor-emacsclient-executable)) - (fun (let ((warning-minimum-level :error) - (warning-minimum-log-level :error)) - (with-editor-locate-emacsclient)))) - (insert "with-editor-emacsclient-executable:\n" - (format " value: %s (%s)\n" val - (and val (with-editor-emacsclient-version val))) - (format " default: %s (%s)\n" def - (and def (with-editor-emacsclient-version def))) - (format " funcall: %s (%s)\n" fun - (and fun (with-editor-emacsclient-version fun))))) - (insert "path:\n" - (format " $PATH: %s\n" (split-string (getenv "PATH") ":")) - (format " exec-path: %s\n" exec-path)) - (insert (format " with-editor-emacsclient-path:\n")) - (dolist (dir (with-editor-emacsclient-path)) - (insert (format " %s (%s)\n" dir (car (file-attributes dir)))) - (when (file-directory-p dir) - ;; Don't match emacsclientw.exe, it makes popup windows. - (dolist (exec (directory-files dir t "emacsclient\\(?:[^w]\\|\\'\\)")) - (insert (format " %s (%s)\n" exec - (with-editor-emacsclient-version exec)))))))) - -(defconst with-editor-font-lock-keywords - '(("(\\(with-\\(?:git-\\)?editor\\)\\_>" (1 'font-lock-keyword-face)))) -(font-lock-add-keywords 'emacs-lisp-mode with-editor-font-lock-keywords) - -(provide 'with-editor) -;; Local Variables: -;; byte-compile-warnings: (not docstrings-control-chars) -;; indent-tabs-mode: nil -;; lisp-indent-local-overrides: ((cond . 0) (interactive . 0)) -;; End: -;;; with-editor.el ends here diff --git a/.config/emacs/lisp/libs/with-editor.elc b/.config/emacs/lisp/libs/with-editor.elc deleted file mode 100644 index aa39546..0000000 Binary files a/.config/emacs/lisp/libs/with-editor.elc and /dev/null differ diff --git a/.config/emacs/lisp/magit/.dir-locals.el b/.config/emacs/lisp/magit/.dir-locals.el deleted file mode 100644 index 07a40bb..0000000 --- a/.config/emacs/lisp/magit/.dir-locals.el +++ /dev/null @@ -1,16 +0,0 @@ -((nil - (indent-tabs-mode . nil)) - (emacs-lisp-mode - (checkdoc-allow-quoting-nil-and-t . t) - (lisp-indent-local-overrides . ((cond . 0) (interactive . 0)))) - (makefile-mode - (indent-tabs-mode . t) - (mode . outline-minor) - (outline-regexp . "#\\(#+\\)")) - (git-commit-mode - (git-commit-major-mode . git-commit-elisp-text-mode)) - (".github/PULL_REQUEST_TEMPLATE" - (nil (truncate-lines . nil))) - ("CHANGELOG" - (nil (fill-column . 70) - (mode . display-fill-column-indicator)))) diff --git a/.config/emacs/lisp/magit/.elpaignore b/.config/emacs/lisp/magit/.elpaignore deleted file mode 100644 index 6bba0d2..0000000 --- a/.config/emacs/lisp/magit/.elpaignore +++ /dev/null @@ -1,10 +0,0 @@ -.dir-locals.el -.elpaignore -.github -.mailmap -LICENSE -Makefile -default.mk -docs -lisp/Makefile -test diff --git a/.config/emacs/lisp/magit/.github/CONTRIBUTING.md b/.config/emacs/lisp/magit/.github/CONTRIBUTING.md deleted file mode 100644 index 9d2e1e7..0000000 --- a/.config/emacs/lisp/magit/.github/CONTRIBUTING.md +++ /dev/null @@ -1,15 +0,0 @@ -Magit has many users and very few maintainers, so we kindly ask to read -the appropriate guidelines before getting in contact. — Thanks! - -- 🆘 [How to ask for help](https://github.com/magit/magit/discussions/4630) -- 🪳 [How to report a bug](https://github.com/magit/magit/wiki/How-to-report-a-bug) -- 💡 [How to suggest a feature](https://github.com/magit/magit/discussions/4631) -- 🏗️ [Pull request guidelines](https://github.com/magit/magit/wiki/Pull-request-guidelines) -- ℹ️ [FAQ](https://docs.magit.vc/magit/FAQ.html) -- ℹ️ [Manual](https://docs.magit.vc/magit) - -TL;DR We now use discussions for feature requests (not issues) and prefer -if you ask the community for support instead of the overworked maintainers. - -Please also consider to contribute by supporting other users or by making -a [monetary donation](https://magit.vc/donate). — Thanks! diff --git a/.config/emacs/lisp/magit/.github/ISSUE_TEMPLATE/bug_report.md b/.config/emacs/lisp/magit/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index c472127..0000000 --- a/.config/emacs/lisp/magit/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: -name: 🪳 Report a bug -about: Report a defect. Do not use this for support requests and feature suggestions. -note: Keep in sync with wiki/How-to-report-a-bug.md ---- - -Please do not ignore these instructions. - -If you have just updated Magit, then restart Emacs. If that does not fix the issue, then also uninstall Magit and all dependencies that were updated at the same time, restart Emacs and then reinstall Magit. - -The reason why this might fix the issue is that updating a package does not cause the old version to be unloaded, so you might end up with a franken-version; a mixture of parts of the old and new version being loaded at the same time. Worse it is possible for the old version to leak into the byte-code of the new version, which is why reinstalling might help. - -Please explain - (1) what behavior you expected - (2) what behavior you observed - (3) and how we can reproduce the issue. - -Please include a backtrace in your report. In most cases doing: - - M-x toggle-debug-on-error RET - -and then going through the steps again should result in a backtrace. - -Also post the output of: - - M-x magit-version RET - -Before reporting a defect please try to reproduce it using an Emacs instance in which only Magit and its dependencies have been loaded. Other packages or your configuration should not be loaded. This makes it easier to determine whether the issue lays with Magit or something else. - -If you run Magit from its Git repository, then you can do so using: - - $ cd /path/to/magit - $ make emacs-Q - -Alternatively, run: - - M-x magit-emacs-Q-command RET - -to save a shell command to the `kill-ring` and the system's clip-board, which you can then copy into a shell to run. - -Finally, if that didn't work and you have installed Magit from Melpa, then run commands similar to the ones above, but use tab completion to replace the various Ns with the correct versions: - - $ cd ~/.emacs.d/elpa/magit-N - $ emacs -Q --debug-init --eval '(setq debug-on-error t)' -L ../cond-let-N -L ../llama-N -L ../magit-section -L ../seq-N -L ../transient-N -L ../with-editor-N -L . -l magit - -More debugging tools are described in the manual. - - https://docs.magit.vc/magit/Debugging-Tools.html - ----- now delete this line and everything above ---- diff --git a/.config/emacs/lisp/magit/.github/ISSUE_TEMPLATE/config.yml b/.config/emacs/lisp/magit/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 3b43af7..0000000 --- a/.config/emacs/lisp/magit/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,20 +0,0 @@ -blank_issues_enabled: false -contact_links: - - name: "💕 Please support my work on Magit and other Emacs projects" - url: https://github.com/sponsors/tarsius - about: Thanks! Any support helps. These donations from users are my only income. - - name: "💡 Suggest a feature ☛ please open a discussion instead of an issue" - url: https://github.com/magit/magit/discussions/categories/ideas - about: Start a discussion suggesting an improvement or a new feature. - - name: "🆘 Ask the community for support" - url: https://www.reddit.com/r/emacs - about: Please also consider supporting others. - - name: "🆘 Ask the maintainers for support ☛ please open a discussion" - url: https://github.com/magit/magit/discussions/categories/q-a - about: Please keep in mind that our bandwidth is limited. - - name: "ℹ️ Magit FAQ" - url: https://docs.magit.vc/magit/FAQ.html - about: Others might have had the same question before. - - name: "ℹ️ Magit Manual" - url: https://docs.magit.vc/magit/#Top - about: The fine manual may also be of use. diff --git a/.config/emacs/lisp/magit/.github/PULL_REQUEST_TEMPLATE b/.config/emacs/lisp/magit/.github/PULL_REQUEST_TEMPLATE deleted file mode 100644 index 1ec176d..0000000 --- a/.config/emacs/lisp/magit/.github/PULL_REQUEST_TEMPLATE +++ /dev/null @@ -1,31 +0,0 @@ -================================================================= -Use a dedicated feature branch -================================================================= - -Please use a dedicated feature branch for your feature request, instead of asking us to merge "your-fork/main" into the "origin/main". The use of dedicated branches makes it much more convenient to deal with pull-requests, especially when using Magit to do so. - -If you were about to open a pull-request asking us to merge your version of "main", then see [1] for instructions on how to quickly fix that and some information on why we ask you to do so. - -Additionally we ask you to allow us to push to the branch you want us to merge. We might want to push additional commits and/or make minor changes. Please make sure the box next to "Allow edits from maintainers" is checked before creating the pull-request. - - [1]: https://github.com/magit/magit/wiki/Dedicated-pull-request-branches - -================================================================= -Do NOT use Github to edit files and create commit messages -================================================================= - -Unless you are aware of all the pitfalls and take great care to avoid them, the use of Github results in many small defects, including but not limited to trailing whitespace, commit messages containing overlong lines and no newline at the very end, and "GitHub " being used as the committer. The last one cannot even be avoided, which I consider as an affront. - -Github is an insufficient interface for editing files and creating commits. Please don't do it when contributing to Magit. - -================================================================= -What you should write here -================================================================= - -Please summarize the changes made in the commits. Explain why you are making these changes, not just what changes you are making. This also applies to the commit messages. - -================================================================= -How to update the manual -================================================================= - -Edit only "magit.org" and "magit-section.org". To update "magit.texi" and "magit-section.texi" run "make texi". diff --git a/.config/emacs/lisp/magit/.github/workflows/compile.yml b/.config/emacs/lisp/magit/.github/workflows/compile.yml deleted file mode 100644 index 2c1a987..0000000 --- a/.config/emacs/lisp/magit/.github/workflows/compile.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: Compile -on: [push, pull_request] -jobs: - compile: - name: Compile - uses: emacscollective/workflows/.github/workflows/compile.yml@main diff --git a/.config/emacs/lisp/magit/.github/workflows/manual.yml b/.config/emacs/lisp/magit/.github/workflows/manual.yml deleted file mode 100644 index 2a655ae..0000000 --- a/.config/emacs/lisp/magit/.github/workflows/manual.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: Manual -on: - push: - branches: main - tags: "v[0-9]+.[0-9]+.[0-9]+" -jobs: - manual: - name: Manual - uses: emacscollective/workflows/.github/workflows/manual.yml@main - secrets: - rclone_config: ${{ secrets.RCLONE_CONFIG }} diff --git a/.config/emacs/lisp/magit/.github/workflows/stats.yml b/.config/emacs/lisp/magit/.github/workflows/stats.yml deleted file mode 100644 index 5597fb9..0000000 --- a/.config/emacs/lisp/magit/.github/workflows/stats.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Statistics -on: - push: - branches: main - schedule: - - cron: '3 13 * * 1' -jobs: - stats: - name: Statistics - uses: emacscollective/workflows/.github/workflows/stats.yml@main - secrets: - rclone_config: ${{ secrets.RCLONE_CONFIG }} diff --git a/.config/emacs/lisp/magit/.github/workflows/test.yml b/.config/emacs/lisp/magit/.github/workflows/test.yml deleted file mode 100644 index 01d105e..0000000 --- a/.config/emacs/lisp/magit/.github/workflows/test.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: Test -on: [push, pull_request] -jobs: - test: - name: Test - uses: emacscollective/workflows/.github/workflows/test.yml@main diff --git a/.config/emacs/lisp/magit/.gitignore b/.config/emacs/lisp/magit/.gitignore deleted file mode 100644 index 84c0d45..0000000 --- a/.config/emacs/lisp/magit/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/config.mk -/docs/*.html -/docs/*.info -/docs/*.pdf -/docs/*.texi -/docs/.revdesc -/docs/dir -/docs/stats/ -/lisp/*-autoloads.el -/lisp/*-pkg.el -/lisp/*.elc - -/docs/magit/ -/docs/magit-section/ -/lisp/magit-version.el - -/docs/*.epub -/docs/META-INF/ -/docs/OEBPS/ -/docs/epub.xml -/docs/mimetype - -*~ -/*.tar -/*.tar.gz diff --git a/.config/emacs/lisp/magit/.mailmap b/.config/emacs/lisp/magit/.mailmap deleted file mode 100644 index e386b18..0000000 --- a/.config/emacs/lisp/magit/.mailmap +++ /dev/null @@ -1,84 +0,0 @@ -Alex Dunn -Alex Ott -Allen Li -Andrew Zipperer -Andriy Kmit' -Bar Magal -Benjamin Motz -Bradley Wright -Buster Copley -Chillar Anand -Christophe Junke -Damien Cassou -Daniel Fleischer danielfleischer -David Abrahams -David Ellison -Dean Kariniemi <8913263+d3k4r@users.noreply.github.com> -Dennis Paskorz -Dominique Quatravaux -Evan Torrie -Evgkeni Sampelnikof -Evgkeni Sampelnikof -Fabian Wiget -Fritz Stelzer -Graham Clark -Ivan Brennan -Jean-Louis Giordano -Jesse Alama -Joakim Jalap -Johann Klähn -Jon Vanderwijk -Jonas Bernoulli -Jonas Bernoulli -Kan-Ru Chen -Leo Liu -Li Chen -Lucius Chen -Luís Oliveira -Luís Oliveira Luís Borges de Oliveira -Marc Herbert -Marc Herbert -Marcel Wolf marcel-wolf -Marian Schubert -Marius Vollmer -Marius Vollmer -Marius Vollmer -Marius Vollmer -Marius Vollmer -Mark Karpov -Markus Beppler <65115492+mbeppler@users.noreply.github.com> -N. Troy de Freitas <9503857+ntdef@users.noreply.github.com> -Naoya Yamashita -Natalie Weizenbaum Nathan Weizenbaum -Noam Postavsky -Noam Postavsky -Ola Nilsson Ola x Nilsson -Pancho Horrillo -Peter J. Weisberg -Peter Vasil -Phil Sainty -Philippe Vaucher -Raimon Grau -Robert Irelan -Ron Parker -Rémi Vanicat -Rüdiger Sonderfeld -Sean Allred -Seong-Kook Shin -Silent Sphere -Sylvain Rousseau -Syohei Yoshida -Sébastien Gross -Thierry Volpiatto -Tunc Uzlu -Wei Huang -Wilfred Hughes -Wouter Bolsterlee -Yann Hodique -Yann Hodique -Yann Hodique -Yann Hodique -Yuichi Higashi -Óscar Fuentes -Óscar Fuentes -Óscar Fuentes diff --git a/.config/emacs/lisp/magit/CHANGELOG b/.config/emacs/lisp/magit/CHANGELOG deleted file mode 100644 index 7de08f0..0000000 --- a/.config/emacs/lisp/magit/CHANGELOG +++ /dev/null @@ -1,617 +0,0 @@ -# -*- mode: org -*- -* v4.5.0 2026-01-01 - -- Removed support for loading Magit extensions from ".git/config". - Please [[https://github.com/magit/magit/commit/d662ec107e74a05a0348ca75c89ebd127d658656][use ~.dir-locals.el~ instead]]. d662ec107e - -- Reworked how the global ~magit-auto-revert-mode~ is, or is not, - enabled at startup. Enabling ~global-auto-revert-mode~ now disables - this mode. 38a916f555..de766d2968 et al. - -- Simplified ~magit-wip-mode~. This involves removing all other wip - modes (which allowed using only a subset of the protection offered - by ~magit-wip-mode~) and using the new ~magit-before-change-functions~ - and ~magit-after-apply-functions~ hooks. 98ef107037..fa629ad5b5 - -- Added experimental support for calling Lisp hooks from Git hooks, - and added a few such hooks: ~magit-common-git-post-commit-functions~, - ~magit-git-post-commit-functions~, ~magit-git-post-merge-functions~ - and ~magit-git-post-rewrite-functions~. - -- Replaced option ~magit-section-visibility-indicator~ (singluar) with - new option ~magit-section-visibility-indicators~ (plurarl) to better - support emacs sessions that have both terminal and gui frames. - 2d8f43e681 - -- ~mouse-set-point~ is now remapped to Magit's variant. fa5906621a - -- ~magit-autoloads~ is now loaded exactly once. 3d1a008f18 - -- Fixed custom type of ~magit-blame-styles~. 84c5c8c8c6 - -- Fixes regression in ~magit-rebase-autosquash~. It no longer excluded - the merge-base. 54e460a701 - -- A few hook functions were not autoloaded. #5464 - -- Some refinements were calculated for the diff in the commit - message buffer, despite not actually being displayed. #5483 - -- Commands for showing logs for wip branches were no longer displayed - in the log menu, despite ~magit-wip-mode~ being enabled. #5488 - -- Added new option ~magit-wip-debug~. 655bc502a3 - -- Various build improvements. - -* v4.4.2 2025-10-06 - -- Addressed harmless compiler warning. - -* v4.4.1 2025-10-06 - -- Added new option ~magit-log-trailer-labels~. #5432 - -- Added new command ~magit-delete-shelved-branch~. 31c0ae17d3 - -- Added new variable ~magit-save-repository-buffers-predicate~. #5450 - -- Fixed saving the value of the menus ~magit-diff~, ~magit-log~, - ~magit-diff-refresh~ and ~magit-log-refresh~. c7ba53b4b4 - -- A form from the ~cond-let~ library made it into the autoloads file, - where that library isn't being loaded. #5451 - -- ~magit-revert-rev-file-buffer~ did not respect a value of ~nil~ for - ~enable-local-variables~. 5eb31a419a - -- Improved commands for jumping to specific sections in revision - buffers. #5442 - -- Improved consistency of scroll command bindings. #5453 - -- It is possible again to exit ~magit-completing-read-multiple~ with - no input if REQUIRE-MATCH is ~t~. b5066e5fa4 - -- Diffs that appear in logs could not be parsed in some edge cases. - #5454 - -* v4.4.0 2025-09-09 - -- At least Emacs 28.1 is required now. Emacs 30.1 was released - earlier this year, so Emacs "oldoldstable" is still supported. - -- Code for tracking a position within a file across versions and - diffs, and the commands that build on that to allow jumping to - the same location in another version or diff, are undergoing - heavy refactoring and improvements. This is paying off technical - dept and prepares for upcoming user-level improvements as well - as for new features. Some changes in behavior already appear in - this release, as described below. - -- For staged and unstaged changes, ~magit-diff-visit-file~ (~RET~) now - always visits the blob actually corresponding to the line at point, - as it already did for committed changes. Previously it failed to - visit the index blob from an unstaged removed line when that file - has staged changes; and it failed to visit the index blob from a - staged added line. - - Visiting the file in the worktree is very useful, but, instead of - ~RET~, I recommend using ~C-~ (~magit-diff-visit-worktree-file~). - The new option ~magit-diff-visit-prefer-worktree~ allows restoring - the old behavior. See [[https://docs.magit.vc/magit/Visiting-Files-and-Blobs-from-a-Diff.html][Visiting Files and Blobs from a Diff]]. - -- "Blob navigation" is now aware of index blobs. It is possible to - navigate between such blobs, and the HEAD blob or the file on disk, - using the same key bindings used to time travel from one committed - blob to another. See [[https://docs.magit.vc/magit/Minor-Mode-for-Buffers-Visiting-Blobs.html][Minor Mode for Buffers Visiting Blobs]] and - [[https://docs.magit.vc/magit/Commands-for-Buffers-Visiting-Files.html][Commands for Buffers Visiting Files]]. - -- When quitting a blob-visiting buffer with ~q~, it is no longer - killed, iff it is being displayed in an additional window. The - behavior can be changed by binding ~q~ in ~magit-blob-mode-map~ to - one of the commands ~magit-bury-or-kill-buffer~, ~magit-bury-buffer~, - or ~magit-kill-this-buffer~. The former two are new commands. - 731642756f - -- ~magit-status-here~ now places the cursor within the diff of unstaged - changes, if the current line in a file-visiting buffer has unstaged - changes. If it does not, then it falls back to going to the - corresponding staged change. #4814 - -- Even though ~auto-revert-mode~ is enabled, if that has not yet kicked - in and the user visits a file that needs reverting, they used to be - asked to confirm the revert. efaf91d8af - -- ~magit-completing-read~ and ~magit-completing-read-multiple~ can now - require non-empty input. If REQUIRE-MATCH is ~any~, then the user - can exit with input that does not appear in the collection, but - is not allowed to exit with zero input. #5422 - -- ~magit-completing-read-multiple~ now adds the default choice to the - set of valid choices. 7167f70665 - -- ~magit-read-branch-or-commit~ can now exclude more than one possible - choice from the set of valid choices. 10c366ed52 - -- Improved minibuffer input for worktree commands, including adding - new option ~magit-read-worktree-directory-function~. - -- Section visibility indicators can now be displayed in the left - margin. #5424 - -- References in the ~refs/pullreqs~ namespace are no longer offered - as completion candidates. 87ddd8f7c4 - -- Improved font-lock in ~git-rebase-mode~. 3857b8bce9..9654f5e094 - -- Added new face ~magit-diff-conflict-heading-highlight~. 2e76ec9337 - -- Added new command ~magit-revision-jump~, a menu for use in - ~magit-revision-mode~, bound to ~j~. acf71f7eb4 - -- ~magit-dired-jump~ now supports ~magit-repolist-mode~. 8c4a903886 - -- Fixed a regression ~magit--refresh-buffer-set-positions~, added in - v4.3.7, which messed up the window-start. 406a3094a8 - -- ~magit-setup-buffer~ and ~magit-refresh-buffer~ take two new keyword - arguments INITIAL-SECTION and SELECT-SECTION. Two arguments of - ~magit-setup-buffer-internal~ are now keyword arguments. - ced0984540, c4def6d99a - -- All text inserted into Magit buffers that previously used ~face~ - now use ~font-lock-face~ and ~magit-section-mode~ can therefore set - ~font-lock-defaults~. Previously if some third-party packages used - ~font-lock-add-keywords~, some of Magit's own fontification would - be lost. Third-party packages that use ~magit-section-mode~, might - need to be adjusted accordingly. 7de0f1335f, b4768acb1f - -- Daring to use my new Cond-Let package and other shorthands. - 08dafc1732..1c48327a06, b377adb68c - -* v4.3.8 2025-07-05 - -Bugfixes: - -- In v4.3.7 we started to restore the display-start positions of the - windows displaying a buffer that is being refreshed, but in log - buffers that is undesirable. After creating a new commit we want - that to immediately be displayed at the top of windows displaying - log buffers. #5403 - -- Refreshing was skipped after discarding all untracked files. - -- When sub-directories contain ".gitignore" files, then invoking - ~magit-discard~ on the "Untracked files" section did not necessarily - remove the same set of files as listed in that section. (At least - it did show the files, which would be removed, in the confirmation - prompt.) #5405 - -* v4.3.7 2025-07-01 - -- Refreshing a buffer causes its content to be recreated, which can - result in scrolling. Now we attempt to restore the display-start - positions of the windows displaying the buffer. #5403 - -- When running ~git~ for side-effects and that signals an error, we - did not augment the error message to inform the user that the full - output can be found in the process buffer. When the error is not - signaled, we did already append that hint to the message. Also - added a new option, ~magit-show-process-buffer-hint~, for people who - are already aware of the process buffer and would like to avoid - the noisy reminder. #5396 - -Bugfixes: - -- Some instructions inserted into rebase sequence buffers were not - prefixed with ~comment-start~, instead # was used unconditionally. - #5388 - -- Fixed a regression in v4.3.6, which caused a conflict between the - overlays used for section highlighting and section selection, if - both of these faces relied on the same face property (likely the - foreground color). #5389 - -- Hunks could remain painted as selected when navigating away. #5393 - -- The log arguments "--grep" and "--graph" are no longer mutually - exclusive, but we still dropped the latter when the former was - used. #5391 - -- ~magit-save-repository-buffers~ errored on older Emacs releases, - if the value of the variable by the same name is ~ask~. #5399 - -- ~magit-after-save-refresh-status~ did not honor ~magit-inhibit-refresh~. - d9d2f6c312 - -* v4.3.6 2025-06-01 - -- Generalized and heavily refactored the code, previously used only to - highlight diff-related sections and to paint hunks, so that it can - be used for other sections as well. The new implementation should - also be a bit faster. cfe4faaaf6^..c556fee1bd - -- A single-section selection now requires a non-empty region. - 6c4c16942a - -- When creating a stash, "On : " is now offered as a second - future history element. 75c6191999, 9b81df36b4 - -- Added new commands ~git-rebase-drop~, ~git-rebase-alter~ and - ~git-rebase-squish~. 479c467080, 9674c4755a - -Bugfixes: - -- Fixed issues concerning date handling in log margins. #5373 - -- The list of rebase actions in the status buffer could contain - invalid elements derived from comments in Git's list of such - actions. 91806dc729 - -- Applying the region used to fail, if some part of the same hunk but - outside the region has conflicts, even if the part in the region did - not. 9e551d9eb7 - -* v4.3.5 2025-05-14 - -Bugfixes: - -- Fixed a v4.3.3 regression in inserting rebase actions into the - status buffer when stopping at the last commit. #5365 - -* v4.3.4 2025-05-13 - -- Arguments, that are normally set by cycling through the possible - values displayed in the menu, can now also be set using completion, - by using a prefix argument. #5362 - -Bugfixes: - -- Matching references were no longer displayed on the first line of - revision buffers. 48b158500d - -- Fixed a v4.3.3 regression in inserting rebase actions into the - status buffer when ~--rebase-merges~ is specified. #5365 - -- On the "Untracked files" section, ~k~ no longer worked as intended. - #5366 - -Also contains code and documentation cleanups and improvements. - -* v4.3.3 2025-05-01 - -- ~magit-section-show-level~ now acts on all selected sections. #5354 - -- Inserting the list of commits being rebased into the status buffer - is now much faster. 8e72767262 - -- All rebase actions are now inserted into the status buffer. - 69b310e109 - -- While editing the list of commits and actions to be rebased - ~git-rebase-kill-line~ (~k~) on a commented line now uncomments it. - ff44ee1bc3 - -- Added new variants of commands that deal with files for use in Dired - buffers, and improved existing variants. In Dired, these commands - are available from ~magit-file-dispatch~ (~C-c M-g~). 542c2f8a75 et al. - -- ~magit-branch-shelve~ now prepends the date to the refname, and - ~magit-branch-unshelve~ removes such prefixes. 78ffd1a389 - -- The new function ~magit-insert-shelved-branch~ can be added to - ~magit-refs-sections-hook~ to list shelved branches. d6b7784547 - -- Added new command ~magit-wip-purge~, which removes old branches - created by ~magit-wip-mode~. d5e0f3a639 - -- ~magit-blame-styles~ now supports inserting truncated commit hashes. - #4057 - -- Added new command ~magit-mouse-set-point~. 3c9e519197 - -Also contains code and documentation cleanups and improvements. - -* v4.3.2 2025-04-01 - -- Removed legacy options ~magit-wip-*-mode-lighter~. 225ea6fd00 - -- ~magit-log-current~ now falls back to displaying the log for ~HEAD~ if - no branch is checked out, and the now redundant ~magit-log-head~ is - no longer displayed in the ~magit-log~ menu by default. c8b1e12bd5 - -- Renamed ~magit-merge-into~ to ~magit-merge-dissolve~ and changed the - key binding in the ~magit-merge~ menu from ~i~ to ~d~. The description - in that menu already was "dissolve". Do this to make it more - obvious that this command deletes the source branch after it has - been merged into the target branch. #4386 - -- Added new option ~magit-process-apply-ansi-colors~ (but discourage - its use). #5348 - -- Support for Ido has been moved out into a new package ~magit-ido~. - 6aec967ee4 - -Bugfixes: - -- ~magit-after-save-refresh-buffers~ did not respect - ~magit-inhibit-refresh~. c0a8e694b9 - -- When washing of a section was delayed and it ends in an empty line, - that line was not always made part of the section. f6f25e6566 - -- In some cases section specific key bindings were not made available - as intended. 6ce1ece580, 3f79700f1b - -- In some cases ~magit-toggle-buffer-lock~ has to uniquify buffer names - but failed to do so. #5330 - -- After applying a hunk, the buffer was refreshed twice. #5343 - -- The diff shown by ~magit-diff-paths~ was not washed. #5093 - -Also contains more code and documentation cleanups and improvements. - -* v4.3.1 2025-03-02 - -- Added new option ~magit-format-file-function,~ and two functions to - optionally prefix file names with icons, with the help of either - ~all-the-icons~ or ~nerd-icons~. #5308 - -- Added new commands ~magit-previous-reference~ and ~magit-next-reference~, - with entry point ~C-c C-r~. Enable ~repeat-mode~ to keep navigating with - ~p~ and ~n~. #5310 - -Bugfixes: - -- ~magit-commit-revise~ failed if no arguments were used. #5306 - -- Some arguments were missing from diff menus when invoked from - the status buffer. #5309 - -- In some menus the bindings for ~--signoff~ conflicted with those for - other arguments. #5312 - -- Fixed unlikely issue in ~magit-git-mergetool~. 66e3ddffe4 - -- Unknown Git trailers resulted in a display error while writing - commit messages. 8c27c910ca - -- When the word at point matched the name of a branch, that was - unconditionally treated as the commit-at-point. This should only be - done when that word is shown using an appropriate face. 2b3f2cb9ad - -- Fixed bug in ~magit-section-cycle-diffs~. #5319 - -- ~magit-stage-untracked~ was a bit fragile. #5325 - -* v4.3.0 2025-02-04 - -- Added new option ~magit-refs-show-branch-descriptions~. 42ed6c1966 - -- When a stash cannot be applied using the trivial method, the user is - offered some fallback methods. The presentation of those has been - improved. #5253 a08b4dd513 - -- Added new hook options ~magit-revision-wash-message-hook~ and - ~magit-log-wash-summary-hook~, and populate them with new and - existing highlighting functions, making it easier to remove default - highlighting and to add custom highlighting. This also increases - consistency between how commit summaries are shown in logs and when - displaying complete commit messages. f54fce0ecc..b86fe009e2 - -- ~amend!~ markers are now highlighted like ~fixup!~ and ~squash!~ markers. - #5261 - -- ~magit-commit-create~ no longer amends to HEAD when called with a - prefix argument. The ~magit-commit~ menu offers four amend commands. - That should be good enough. 5e60aa72e5 - -- ~magit-commit~ no longer features the obscure ~magit-commit-reshelve~ by - default, but it can quickly be reinstated, using the level mechanism. - 20eb323b47 - -- Added new commands ~magit-commit-alter~ and ~magit-commit-revise~, - completing the already extensive set of "fixup" commands. #5261 - -- Improved commit menu, documentation and implementation details. - #5261 - -- The branch at point is detected in more contexts now, i.e., when - there is not actually a branch at point, but one can unambiguously - be derived from the thing at point. 4876f1921e - -- Reworked ~magit-process-password-prompt-regexps~ to be more permissive - and better structured. Hopefully that means we have to extend it - less frequently going forward, when users run into new prompts. - #5288 - -- Speed up listing untracked files in the status buffer, simplify how - the list is configured, and give up on optionally using a tree. - #5284 - -- Argument ~--signoff~ is now available in all menus that create commits. - However, it is no longer shown in any menu by default. See the end - of [[https://docs.magit.vc/transient/Enabling-and-Disabling-Suffixes.html][Enabling and Disabling Suffixes]] to learn how to enable it in all - menus at once in a single action. #5297 - -- Began using the ~##~ macro from the ~llama~ package. 0a64982100 - -- Stopped depending on the ~dash~ package. e40e8f1994 - -Bug fixes: - -- When applying a stash, it was not always discovered when the trivial - method was unsuccessful, and so the user was not offered the use of - a fallback method. #5253 929eb4dca5 - -- ~git-commit.el~ did not require ~magit-process~, which was only a - problem when it is loaded without also loading the rest of Magit. - #5280. - -- The use of an external diff drivers was not prevented in some - places. #5282 - -- ~magit-blame-maybe-show-message~ did not protect against interpreting - % in commit messages as %-specs. d0e795f423 - -- Parts of commit message headers lost the intended background color. - 46c3d8b0ad - -- The confirmation prompt of ~magit-worktree-delete~ failed to name the - affected worktree. #5286 - -- The wrong suffix color was used for ~magit-commit-absorb~ and - ~magit-commit-autofixup~. bfadd41079 - -- ~magit-stash-index~ did not use ~magit-stash-read-message-function~. - #5295 - -- Fixed an error that occurred when creating ~magit-hunk-section-map~ - and the user has disabled ~smerge-command-prefix~. The same bug - exists in Emacs since 29.1, so this will only help users stuck - on Emacs 28. #5300 - -- When the value of a diff or log menu was being initialized from the - arguments in the current buffer and the diff/log was already limited - to a set of files, then all other arguments were discarded. #5304 - -* v4.2.0 2025-01-01 - -- At least Git 2.25.0 is required now. 033a0c0cdc - -- At least Emacs 27.1 is required now. c1a86066e8 - -- Added new command ~magit-toggle-profiling~. f637dd1877 - -- Added new command ~magit-toggle-subprocess-record~. ec1f403af1 - -Bug fixes: - -- Fixed a regression in ~transient-init-value~. 5b4c4aea1b - -- Fixed setting ~fill-paragraph-function~ in - ~git-commit-setup-changelog-support~. 139e0fcff3 - -- ~magit-log-refresh~ lacked the ~--since~ and ~--until~ arguments, which - were already available in ~magit-log~. 3ecebe8d11 - -- Enabling verbose output in ~magit-commit-absorb~ caused an error. - #5272 - -- In logs, no longer strip ~heads/~ prefix from branch names if a tag - with the same name exists. 5cb3492464 - -- ~magit-list-special-refnames~ returned nonsense. #5277 - -* v4.1.3 2024-12-06 - -- For most important sections, if an error occurs while inserting the - section, the error message is now displayed in the section body. - #5255 - -- ~magit-submodule-populate~ now supports ~--recursive~. #5191 #5256 - -- Improved ~magit-process-password-prompt-regexps~. #5257 - -Bug fixes: - -- ~magit-stash-pop~ and ~magit-stash-apply~ sometimes installed conflicts - for the user to resolve that are more complicated than they need to - be. #5253 - -- ~magit-stash-push~ placed ~--~ before other arguments. #5260 - -- ~magit-autorevert~ failed to require ~magit-process~. #5263 - -* v4.1.2 2024-11-02 - -- Add various minor process logging improvements: - 5b30c05d3a magit--git-insert: Collapse process section if appropriate - b11524120e magit--git-insert: Optionally always log to process buffer - cd6cf89d6a Use different face for debug-only process sections - bba06845de magit-process-insert-section: Improve file-path comparison - f2a6133443 magit-run-git-async: No longer clutter ~*Messages*~ buffer - -Bug fixes: - -- If the left margin was in use before ~magit-blame-mode~ started using - that margin, then the old width was not restored when the mode was - disabled. #5236 - -- Prior to Tramp being loaded, setting ~magit-tramp-pipe-stty-settings~ - to ~nil~ resulted in an error, due to ~tramp-pipe-stty-settings~ not - being bound yet. #5240 - -- ~magit-copy-section-value~ no longer did anything for most section - types. #5244. - -- Global git arguments often got added twice to the list of arguments - ultimately passed to git. 914285a5e8 - -- Inserting the headers of status buffers involves temporary changes - to ~magit-insert-section-hook~. These changes were not restricted to - the current buffer, causing errors when ~magit-git-debug~ is enabled - and we thus insert sections in the process buffer, while the status - buffer is being refreshed. 11e13640c4 - -- Some ~git~ errors were not logged despite ~magit-git-debug~ being - enabled. 874fb0fede - -- ~magit-browse-thing~ and ~magit-visit-thing~ tried to turn anything - at point into an URL. Now the bail if there is no URL at point. - 7c842b8ac0 - -* v4.1.1 2024-10-01 - -- Avoid unnecessary work when ~auto-revert-remote-files~ is ~nil~. #5222 - -- Improved default choice offered by ~magit-branch-reset~ and - ~magit-reset-*~. #5230 - -Bug fixes: - -- Added a workaround for a regression in Git v2.46.0. #5212 - -- Section-specific bindings were removed when a section was expanded - whose body is not inserted until the expansion takes place. - 9395de2c94 - -- Addressed an incompatibility with Eglot. #5226 - -- Adapted to a change in ~define-globalized-minor-mode~ in Emacs 30, - which caused ~diff-hl-mode~ to be enabled in blob buffers. #5229 - -- When adding the commit at point to the completion defaults, it was - assumed that ~minibuffer-default-add-function~ cannot be nil. - 6d0075f523 - -- ~magit-blame--format-string-1~ didn't handle a list of faces - correctly. 5395798301 - -- Addressed an incompatibility with Indent-Bars. #5233 - -* v4.1.0 2024-09-01 - -- The library ~git-commit.el~ is no longer distributed as a separate - package, ~git-commit~, but as part of the ~magit~ package. - -- Improved ~magit-tag-release~'s consistency and handling of arguments. - #5102 - -- Updated tooling and other housekeeping. - -Bug fixes: - -- Only use an explicit range in ~magit-insert-recent-commits~, when also - using ~--graph~. With ~--graph~ it increases performance noticeably, - but without it decreases performance somewhat. #5075 - -- ~magit-completing-read-multiple~ now shows the default choice in the - prompt, if a completion framework is used, for which that is useful. - #5205. - -* Older releases - -See ~docs/RelNotes/~. diff --git a/.config/emacs/lisp/magit/LICENSE b/.config/emacs/lisp/magit/LICENSE deleted file mode 100644 index f288702..0000000 --- a/.config/emacs/lisp/magit/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/.config/emacs/lisp/magit/Makefile b/.config/emacs/lisp/magit/Makefile deleted file mode 100644 index b370717..0000000 --- a/.config/emacs/lisp/magit/Makefile +++ /dev/null @@ -1,195 +0,0 @@ --include config.mk -include default.mk - -## ################################################################### - -.PHONY: lisp docs \ - install install-lisp install-docs install-info \ - test test-interactive magit \ - clean clean-lisp clean-docs clean-archives \ - stats \ - dist versionlib magit-$(VERSION).tar.gz - -all: lisp docs - -help: - $(info ) - $(info See default.mk for variables you might want to set.) - $(info ) - $(info Build) - $(info =====) - $(info ) - $(info make [all] -- Compile elisp and documentation) - $(info make lisp -- Compile elisp) - $(info make redo -- Re-compile elisp) - $(info make docs -- Generate all manual formats) - $(info make redo-docs -- Re-generate all manual formats) - $(info make texi -- Generate texi manuals) - $(info make info -- Generate info manuals) - $(info make html -- Generate html manual files) - $(info make html-dir -- Generate html manual directories) - $(info make pdf -- Generate pdf manuals) - $(info make epub -- Generate epub manuals) - $(info ) - $(info Install) - $(info =======) - $(info ) - $(info make install -- Install elisp and documentation) - $(info make install-lisp -- Install elisp) - $(info make install-docs -- Install all documentation) - $(info make install-info -- Install info manuals only) - $(info ) - $(info Clean) - $(info ====) - $(info ) - $(info make clean -- Clean elisp, documentation and tarball) - $(info make clean-lisp -- Clean elisp) - $(info make clean-docs -- Clean docs) - $(info make clean-archives -- Clean release tarball) - $(info make clean-all -- Clean everything except tracked texi) - $(info make clean-stats -- Clean stats) - $(info ) - $(info Test) - $(info ====) - $(info ) - $(info make test -- Run tests) - $(info make test-interactive -- Run tests interactively) - $(info make emacs-Q -- Run emacs -Q plus Magit) - $(info make check-declare -- Check function declarations) - $(info ) - $(info Release Management) - $(info ==================) - $(info ) - $(info make authors -- Regenerate AUTHORS.md) - $(info make publish -- Publish snapshot manuals) - $(info make release -- Publish release manuals) - $(info make dist -- Create tarballs) - $(info make stats -- Regenerate statistics) - $(info make stats-upload -- Publish statistics) - @printf "\n" - -## Build ############################################################# - -lisp: - @$(MAKE) -C lisp lisp - @$(MAKE) -C test lisp - -redo: clean-lisp lisp - -docs: - @$(MAKE) -C docs docs - -redo-docs: - @$(MAKE) -C docs redo-docs - -texi: - @$(MAKE) -C docs texi - -info: - @$(MAKE) -C docs info - -html: - @$(MAKE) -C docs html - -html-dir: - @$(MAKE) -C docs html-dir - -pdf: - @$(MAKE) -C docs pdf - -epub: - @$(MAKE) -C docs epub - -## Install ########################################################### - -install: install-lisp install-docs - -install-lisp: lisp - @$(MAKE) -C lisp install - -install-docs: docs - @$(MAKE) -C docs install-docs - -install-info: info - @$(MAKE) -C docs install-info - -## Test ############################################################## - -test: lisp - @$(MAKE) -C test test - -test-interactive: - @$(MAKE) -C test test-interactive - -emacs-Q: clean-lisp - @$(MAKE) -C lisp autoloads - @$(EMACS_INTR) --debug-init --eval "(progn\ - (setq debug-on-error t)\ - (require 'magit-autoloads)\ - (global-set-key \"\\C-xg\" 'magit-status))" - -check-declare: - @$(MAKE) -C lisp check-declare - -## Clean ############################################################# - -clean: clean-lisp clean-docs clean-test clean-archives - -clean-lisp: - @$(MAKE) -C lisp clean - -clean-docs: - @$(MAKE) -C docs clean - -clean-test: - @$(MAKE) -C test clean - -clean-archives: - @$(RM) *.tar.gz *.tar lisp/magit-version.el - @$(RMDIR) magit-$(VERSION) - -clean-all: clean clean-stats - -clean-stats: - @$(MAKE) -C docs clean-stats - -## Release management ################################################ - -authors: - @$(MAKE) -C docs authors - -publish: - @$(MAKE) -C docs publish - -release: - @$(MAKE) -C docs release - -dist: clean-docs clean-archives versionlib info magit-$(VERSION).tar.gz - @$(RMDIR) magit-$(VERSION) - @$(RM) magit-version.el - -versionlib: - @$(MAKE) -C lisp versionlib - -DIST_ROOT_FILES = LICENSE default.mk Makefile README.md CHANGELOG -DIST_LISP_FILES = $(addprefix lisp/,$(ELS) magit-version.el Makefile) -DIST_DOCS_FILES = $(addprefix docs/,$(TEXIPAGES) AUTHORS.md Makefile) - -magit-$(VERSION).tar.gz: - @printf "Packing $@\n" - @$(MKDIR) magit-$(VERSION) - @$(CP) $(DIST_ROOT_FILES) magit-$(VERSION) - @$(MKDIR) magit-$(VERSION)/lisp - @$(CP) $(DIST_LISP_FILES) magit-$(VERSION)/lisp - @$(MKDIR) magit-$(VERSION)/docs - @$(CP) $(DIST_DOCS_FILES) magit-$(VERSION)/docs - @$(TAR) cz --mtime=./magit-$(VERSION) -f magit-$(VERSION).tar.gz magit-$(VERSION) - -## Statistics ######################################################## - -stats: - @$(MAKE) -C docs stats - -stats-upload: - @$(MAKE) -C docs stats-upload - diff --git a/.config/emacs/lisp/magit/README.md b/.config/emacs/lisp/magit/README.md deleted file mode 100644 index cc8c77f..0000000 --- a/.config/emacs/lisp/magit/README.md +++ /dev/null @@ -1,145 +0,0 @@ -
-

A Git Porcelain inside Emacs

-
-
- -

- Magit is an interface to the version control system - Git, implemented as an - Emacs package. - Magit aspires to be a complete Git porcelain. While we cannot - (yet) claim that Magit wraps and improves upon each and every Git - command, it is complete enough to allow even experienced Git users - to perform almost all of their daily version control tasks directly - from within Emacs. While many fine Git clients exist, only Magit - and Git itself deserve to be called porcelains. -

-
- -
- Keeping its users this excited is - - a lot of work - . - If Magit makes you
more productive too, - then please consider making a donation. -
-
- Thank you! — Jonas Bernoulli -
-
-
- - Sponsor my work using Github Sponsors -    - - Sponsor my work using Liberapay -
- - Sponsor my work using Opencollective -    - - Sponsor my work using PayPal -
-
-
- Some alternative donation methods are available. -
-
- -### Getting Started - -If you are new to Magit, then either one of the following two -articles should help understanding how it differs from other Git -clients. - -#### [Visual Magit walk-through](https://emacsair.me/2017/09/01/magit-walk-through) - -If you are completely new to Magit, then this article is a good -visual introduction. - -Almost everything that you see in Magit can be acted on by pressing -some key, but that's not obvious from just seeing how Magit looks. -The screenshots and accompanying text of this article explain how to -perform a variety of actions on Magit's output. - -#### [Magit, the magical Git interface](https://emacsair.me/2017/09/01/the-magical-git-interface) - -Magit differs significantly from other Git interfaces, and its -advantages are not immediately obvious simply from looking at a few -screenshots as presented in the preceding article. - -This article discusses Magit's properties in somewhat more abstract -terms. - -#### Video introductions - -If you prefer [video](https://magit.vc/screencasts/) introductions, -head over to that page, where find a collection of such introductions -and other videos about Magit, by various creators. - -*** -### Support and Contributing - -Magit has many users and very few maintainers, so we kindly ask to read -the appropriate guidelines before getting in contact. — Thanks! - -- 🆘 [How to ask for help](https://github.com/magit/magit/discussions/4630) -- 🪳 [How to report a bug](https://github.com/magit/magit/wiki/How-to-report-a-bug) -- 💡 [How to suggest a feature](https://github.com/magit/magit/discussions/4631) -- 🏗️ [Pull request guidelines](https://github.com/magit/magit/wiki/Pull-request-guidelines) -- ℹ️ [FAQ](https://docs.magit.vc/magit/FAQ.html) -- ℹ️ [Manual](https://docs.magit.vc/magit) - -TL;DR We now use discussions for feature requests (not issues) and prefer -if you ask the community for support instead of the overworked maintainers. - -Please also consider to contribute by supporting other users or by making -a [monetary donation](https://magit.vc/donate). — Thanks! - -*** -### Acknowledgments - -Magit was started by [Marius Vollmer][marius], and is now maintained by -[Jonas Bernoulli][jonas] and [Kyle Meyer][kyle]. Former maintainers are -[Nicolas Dudebout][nicolas], [Noam Postavsky][noam], -[Peter J. Weisberg][peter], [Phil Jackson][phil], [Rémi Vanicat][remi] and -[Yann Hodique][yann]. Many more people have [contributed code][authors], -suggested features or made monetary contributions. - -Thanks to all of you, may (the history of) the source be with you! - -*** -[![Compile](https://github.com/magit/magit/actions/workflows/compile.yml/badge.svg)](https://github.com/magit/magit/actions/workflows/compile.yml) -[![Test](https://github.com/magit/magit/actions/workflows/test.yml/badge.svg)](https://github.com/magit/magit/actions/workflows/test.yml) -[![Manual](https://github.com/magit/magit/actions/workflows/manual.yml/badge.svg)](https://github.com/magit/magit/actions/workflows/manual.yml) -[![NonGNU ELPA](https://emacsair.me/assets/badges/nongnu-elpa.svg)](https://elpa.nongnu.org/nongnu/magit.html) -[![Melpa](https://melpa.org/packages/magit-badge.svg)](https://melpa.org/#/magit) -[![Melpa Stable](https://stable.melpa.org/packages/magit-badge.svg)](https://stable.melpa.org/#/magit) - -[![Packaging status](https://repology.org/badge/vertical-allrepos/emacs%3Amagit.svg?header=&columns=4&minversion=4&exclude_unsupported=1)](https://repology.org/project/emacs%3Amagit/versions) - -[authors]: https://magit.vc/stats/magit/authors.html -[jonas]: https://emacsair.me -[kyle]: https://kyleam.com -[marius]: https://github.com/mvollmer -[nicolas]: http://dudebout.com -[noam]: https://github.com/npostavs -[peter]: https://github.com/pjweisberg -[phil]: https://github.com/philjackson -[remi]: https://github.com/vanicat -[yann]: https://yann.hodique.info diff --git a/.config/emacs/lisp/magit/default.mk b/.config/emacs/lisp/magit/default.mk deleted file mode 100644 index 7046d3b..0000000 --- a/.config/emacs/lisp/magit/default.mk +++ /dev/null @@ -1,249 +0,0 @@ -TOP := $(dir $(lastword $(MAKEFILE_LIST))) - -DOMAIN ?= magit.vc - -PKG = magit -PKGS = magit magit-section - -## User options ###################################################### -# -# You can override these settings in "config.mk" or on the command -# line. -# -# You might also want to set LOAD_PATH. If you do, then it must -# contain "-L .". -# -# If you don't do so, then the default is set in the "Load-Path" -# section below. The default assumes that all dependencies are -# installed either at "../", or when using package.el -# at "ELPA_DIR/-". - -PREFIX ?= /usr/local -sharedir ?= $(PREFIX)/share -lispdir ?= $(sharedir)/emacs/site-lisp/magit -infodir ?= $(sharedir)/info -docdir ?= $(sharedir)/doc/magit - -CP ?= install -p -m 644 -MKDIR ?= install -p -m 755 -d -RMDIR ?= rm -rf -TAR ?= tar -SED ?= sed - -EMACS ?= emacs -EMACS_ARGS ?= -EMACS_Q_ARG ?= -Q -EMACS_BATCH ?= $(EMACS) $(EMACS_Q_ARG) --batch $(EMACS_ARGS) $(LOAD_PATH) -EMACS_ORG ?= $(EMACS) $(EMACS_Q_ARG) --batch $(EMACS_ARGS) $(ORG_LOAD_PATH) -EMACS_INTR ?= $(EMACS) $(EMACS_Q_ARG) $(EMACS_ARGS) $(LOAD_PATH) - -LISP_EXTRA_TARGETS ?= check-declare - -INSTALL_INFO ?= $(shell command -v ginstall-info || printf install-info) -MAKEINFO ?= makeinfo -MANUAL_HTML_ARGS ?= --css-ref https://$(DOMAIN)/assets/page.css - -GITSTATS ?= gitstats -GITSTATS_DIR ?= $(TOP)docs/stats -GITSTATS_ARGS ?= -c style=https://magit.vc/assets/stats.css \ - -c max_authors=180 -c graph_max_authors=7 - -## Files ############################################################# - -ORGPAGES = $(addsuffix .org,$(PKGS)) -TEXIPAGES = $(addsuffix .texi,$(PKGS)) -INFOPAGES = $(addsuffix .info,$(PKGS)) -HTMLFILES = $(addsuffix .html,$(PKGS)) -HTMLTOPS = $(addsuffix /index.html,$(PKGS)) -HTMLDIRS = $(PKGS) -PDFFILES = $(addsuffix .pdf,$(PKGS)) -EPUBFILES = $(addsuffix .epub,$(PKGS)) - -# When making changes here, also update "/elpa-packages". - -ELS = git-commit.el -ELS += magit-section.el -ELS += magit-base.el -ELS += magit-git.el -ELS += magit-mode.el -ELS += magit-margin.el -ELS += magit-process.el -ELS += magit-transient.el -ELS += magit-autorevert.el -ELS += magit-core.el -ELS += magit-diff.el -ELS += magit-log.el -ELS += magit-wip.el -ELS += magit-reflog.el -ELS += magit-apply.el -ELS += magit-repos.el -ELS += magit.el -ELS += magit-status.el -ELS += magit-refs.el -ELS += magit-files.el -ELS += magit-reset.el -ELS += magit-branch.el -ELS += magit-merge.el -ELS += magit-tag.el -ELS += magit-worktree.el -ELS += magit-notes.el -ELS += magit-sequence.el -ELS += magit-commit.el -ELS += magit-remote.el -ELS += magit-clone.el -ELS += magit-fetch.el -ELS += magit-pull.el -ELS += magit-push.el -ELS += magit-patch.el -ELS += magit-bisect.el -ELS += magit-stash.el -ELS += magit-blame.el -ELS += magit-sparse-checkout.el -ELS += magit-submodule.el -ELS += magit-subtree.el -ELS += magit-ediff.el -ELS += magit-gitignore.el -ELS += magit-bundle.el -ELS += magit-extras.el -ELS += magit-dired.el -ELS += git-rebase.el -ELS += magit-bookmark.el -ELCS = $(ELS:.el=.elc) - -## Versions ########################################################## - -VERSION ?= $(shell \ - test -e $(TOP).git && \ - git describe --tags --abbrev=0 --always | cut -c2-) -REVDESC := $(shell test -e $(TOP).git && git describe --tags) - -EMACS_VERSION = 28.1 - -EMACS_OLD := $(shell $(EMACS_BATCH) --eval \ - "(and (version< emacs-version \"$(EMACS_VERSION)\") (princ \"true\"))") -ifeq "$(EMACS_OLD)" "true" - $(error At least version $(EMACS_VERSION) of Emacs is required) -endif - -## Load-Path ######################################################### - -# Remember to also update magit-emacs-Q-command! - -ifndef LOAD_PATH - -USER_EMACS_DIR = $(HOME)/.emacs.d -ifeq "$(wildcard $(USER_EMACS_DIR))" "" - XDG_CONFIG_DIR = $(or $(XDG_CONFIG_HOME),$(HOME)/.config) - ifneq "$(wildcard $(XDG_CONFIG_DIR)/emacs)" "" - USER_EMACS_DIR = $(XDG_CONFIG_DIR)/emacs - endif -endif - -ELPA_DIR ?= $(USER_EMACS_DIR)/elpa - -COMPAT_DIR ?= $(shell \ - find -L $(ELPA_DIR) -maxdepth 1 -regex '.*/compat-[.0-9]*' 2> /dev/null | \ - sort | tail -n 1) -ifeq "$(COMPAT_DIR)" "" - COMPAT_DIR = $(TOP)../compat -endif - -COND_LET_DIR ?= $(shell \ - find -L $(ELPA_DIR) -maxdepth 1 -regex '.*/cond-let-[.0-9]*' 2> /dev/null | \ - sort | tail -n 1) -ifeq "$(COND_LET_DIR)" "" - COND_LET_DIR = $(TOP)../cond-let -endif - -LLAMA_DIR ?= $(shell \ - find -L $(ELPA_DIR) -maxdepth 1 -regex '.*/llama-[.0-9]*' 2> /dev/null | \ - sort | tail -n 1) -ifeq "$(LLAMA_DIR)" "" - LLAMA_DIR = $(TOP)../llama -endif - -SEQ_DIR ?= $(shell \ - find -L $(ELPA_DIR) -maxdepth 1 -regex '.*/seq-[.0-9]*' 2> /dev/null | \ - sort | tail -n 1) -ifeq "$(SEQ_DIR)" "" - SEQ_DIR = $(TOP)../seq -endif - -TRANSIENT_DIR ?= $(shell \ - find -L $(ELPA_DIR) -maxdepth 1 -regex '.*/transient-[.0-9]*' 2> /dev/null | \ - sort | tail -n 1) -ifeq "$(TRANSIENT_DIR)" "" - TRANSIENT_DIR = $(TOP)../transient/lisp -endif - -WITH_EDITOR_DIR ?= $(shell \ - find -L $(ELPA_DIR) -maxdepth 1 -regex '.*/with-editor-[.0-9]*' 2> /dev/null | \ - sort | tail -n 1) -ifeq "$(WITH_EDITOR_DIR)" "" - WITH_EDITOR_DIR = $(TOP)../with-editor/lisp -endif - -MAGIT_SECTION_DIR ?= $(shell \ - find -L $(ELPA_DIR) -maxdepth 1 -regex '.*/magit-section-[.0-9]*' 2> /dev/null | \ - sort | tail -n 1) - -SYSTYPE := $(shell $(EMACS) -Q --batch --eval "(princ system-type)") -ifeq ($(SYSTYPE), windows-nt) - CYGPATH := $(shell cygpath --version 2>/dev/null) -endif - -LOAD_PATH = -L . - -# When making changes here, then don't forget to adjust DEPS below, -# ".github/ISSUE_TEMPLATE/bug_report.md", `magit-emacs-Q-command' -# and the "Installing from the Git Repository" info node accordingly. -# Also run "rgrep \b"))))) -#+macro: kbd (eval (format "@@texinfo:@kbd{@@%s@@texinfo:}@@" (let (case-fold-search) (replace-regexp-in-string (regexp-opt '("BS" "TAB" "RET" "ESC" "SPC" "DEL" "LFD" "DELETE" "SHIFT" "Ctrl" "Meta" "Alt" "Cmd" "Super" "UP" "LEFT" "RIGHT" "DOWN") 'words) "@@texinfo:@key{@@\\&@@texinfo:}@@" $1 t)))) -#+macro: kbdvar (eval (format "@@texinfo:@kbd{@@%s@@texinfo:}@@" (let (case-fold-search) (replace-regexp-in-string "<\\([a-zA-Z-]+\\)>" "@@texinfo:@var{@@\\1@@texinfo:}@@" (replace-regexp-in-string (regexp-opt '("BS" "TAB" "RET" "ESC" "SPC" "DEL" "LFD" "DELETE" "SHIFT" "Ctrl" "Meta" "Alt" "Cmd" "Super" "UP" "LEFT" "RIGHT" "DOWN") 'words) "@@texinfo:@key{@@\\&@@texinfo:}@@" $1 t) t)))) -#+macro: codevar (eval (format "@@texinfo:@code{@@%s@@texinfo:}@@" (let (case-fold-search) (replace-regexp-in-string "\\([A-Z][A-Z-]+\\)" "@@texinfo:@var{@@\\&@@texinfo:}@@" $1 t)))) -#+macro: var @@texinfo:@var{@@$1@@texinfo:}@@ -#+macro: dfn @@texinfo:@dfn{@@$1@@texinfo:}@@ diff --git a/.config/emacs/lisp/magit/docs/AUTHORS.md b/.config/emacs/lisp/magit/docs/AUTHORS.md deleted file mode 100644 index e1673d2..0000000 --- a/.config/emacs/lisp/magit/docs/AUTHORS.md +++ /dev/null @@ -1,428 +0,0 @@ -The following people have contributed to Magit. -For statistics see https://stats.magit.vc/magit/authors.html. - -Authors -------- - -- Marius Vollmer -- Jonas Bernoulli - -Active Maintainers ------------------- - -- Jonas Bernoulli -- Kyle Meyer - -Former Maintainers ------------------- - -- Nicolas Dudebout -- Noam Postavsky -- Peter J. Weisberg -- Phil Jackson -- Rémi Vanicat -- Yann Hodique - -All Contributors ----------------- - -- Aaron Culich -- Aaron L. Zeng -- Aaron Madlon-Kay -- Abdo Roig-Maranges -- Adam Benanti -- Adam Jones -- Adam Kruszewski -- Adam Porter -- Adam Spiers -- Adeodato Simó -- Ævar Arnfjörð Bjarmason -- Alan Falloon -- Alban Gruin -- Aleksey Uimanov -- Alexander Gramiak -- Alexander Miller -- Alex Branham -- Alex Dunn -- Alexey Voinov -- Alex Kost -- Alex Kreisher -- Alex Ott -- Allen Li -- Andreas Fuchs -- Andreas Liljeqvist -- Andreas Rottmann -- Andrei Chițu -- Andrew Eggenberger -- Andrew Kirkpatrick -- Andrew Psaltis -- Andrew Schwartzmeyer -- Andrew Zipperer -- Andrey Smirnov -- Andriy Kmit' -- Andy Sawyer -- Angel de Vicente -- Aria Edmonds -- Arialdo Martini -- Arnau Roig Ninerola -- Ashlynn Anderson -- Barak A. Pearlmutter -- Bar Magal -- Bart Bakker -- Basil L. Contovounesios -- Bastian Beischer -- Bastian Beranek -- Benjamin Motz -- Ben North -- Ben Walton -- Ben Zanin -- Bob Uhl -- Boruch Baum -- Bradley Wright -- Brandon W Maister -- Brennan Vincent -- Brian Leung -- Brian Warner -- Bryan Shell -- Buster Copley -- Cameron Chaparro -- Carl Lieberman -- Chillar Anand -- Chris Bernard -- Chris Done -- Chris LaRose -- Chris Moore -- Chris Ring -- Chris Shoemaker -- Christian Dietrich -- Christian Kluge -- Christian Tietze -- Christophe Junke -- Christopher Carlile -- Christopher Monsanto -- Clément Pit-Claudel -- Cornelius Mika -- Craig Andera -- Curt Brune -- Daanturo -- Dale Hagglund -- Damien Cassou -- Dan Davison -- Dan Erikson -- Daniel Brockman -- Daniel Farina -- Daniel Fleischer -- Daniel Gröber -- Daniel Hackney -- Daniel Kraus -- Daniel Mai -- Daniel Martín -- Daniel Mendler -- Daniel Nagy -- Dan Kessler -- Dan LaManna -- Danny Zhu -- Dato Simó -- David Abrahams -- David Ellison -- David Hull -- David L. Rager -- David Wallin -- Dean Kariniemi -- Dennis Paskorz -- Divye Kapoor -- Dominique Quatravaux -- Duianto Vebotci -- Eli Barzilay -- Ellis Kenyo -- Eric -- Eric Davis -- Eric Prud'hommeaux -- Eric Schulte -- Erik Anderson -- Eugene Mikhaylov -- Evan Torrie -- Evgkeni Sampelnikof -- Eyal Lotem -- Eyal Soha -- Fabian Wiget -- Felix Geller -- Felix Yan -- Feng Li -- Florian Ragwitz -- Franklin Delehelle -- Frédéric Giquel -- Fritz Grabo -- Fritz Stelzer -- gemmaro -- Geoff Shannon -- George Kadianakis -- Géza Herman -- Graham Clark -- Graham Dobbins -- Greg A. Woods -- Greg Lucas -- Gregory Heytings -- Greg Sexton -- Greg Steuck -- Guillaume Martres -- Hannu Koivisto -- Hans-Peter Deifel -- hokomo -- Huon Wilson -- Hussein Ait-Lahcen -- Ian Eure -- Ian Milligan -- Ilya Grigoriev -- Iñaki Arenaza -- Ingmar Sittl -- Ingo Lohmar -- Ioan-Adrian Ratiu -- Ivan Brennan -- Jacob Ilsø -- Jan Tatarik -- Jasper St. Pierre -- JD Smith -- Jean-Louis Giordano -- Jeff Bellegarde -- Jeff Dairiki -- Jeremy Meng -- Jeremy Sowden -- Jesse Alama -- Jim Blandy -- Joakim Jalap -- Johannes Altmanninger -- Johannes Maier -- Johann Klähn -- John Mastro -- John Morris -- John Wiegley -- Jonas Bernoulli -- Jonas Galvão Xavier -- Jonathan Arnett -- Jonathan del Strother -- Jonathan Leech-Pepin -- Jonathan Roes -- Jonathon McKitrick -- Jon Vanderwijk -- Jordan Galby -- Jordan Greenberg -- Jorge Israel Peña -- Josh Elsasser -- Josiah Schwab -- Julien Danjou -- Justin Burkett -- Justin Caratzas -- Justin Guenther -- Justin Thomas -- Kan-Ru Chen -- Kenny Ballou -- Keshav Kini -- Kevin Brubeck Unhammer -- Kevin J. Foley -- Kévin Le Gouguec -- Kimberly Wolk -- Knut Olav Bøhmer -- Kyle Meyer -- Laurent Laffont -- Laverne Schrock -- Leandro Facchinetti -- Lele Gaifax -- Lénaïc Huard -- Leo Liu -- Leonardo Etcheverry -- Leo Vivier -- Li Chen -- Lingchao Xin -- Lin Sun -- Li-Yun Chang -- Lluís Vilanova -- Loic Dachary -- Louis Roché -- Lucius Chen -- Luís Oliveira -- Luke Amdor -- Magnar Sveen -- Magnus Malm -- Mak Kolybabi -- Manuel Vázquez Acosta -- Marcel Wolf -- Marc Herbert -- Marcin Bachry -- Marco Craveiro -- Marco Wahl -- Marc Sherry -- Marian Schubert -- Mario Rodas -- Marius Vollmer -- Mark Hepburn -- Mark Karpov -- Mark Oteiza -- Markus Beppler -- Martin Joerg -- Martin Polden -- Matt Beshara -- Matthew Fluet -- Matthew Kraai -- Matthieu Hauglustaine -- Matus Goljer -- Maxim Cournoyer -- Michael Fogleman -- Michael Griffiths -- Michael Heerdegen -- Michal Sojka -- Miciah Masters -- Miles Bader -- Miloš Mošić -- Mitchel Humpherys -- Moritz Bunkus -- Nacho Barrientos -- Naoya Yamashita -- Natalie Weizenbaum -- Nguyễn Tuấn Anh -- Nic Ferier -- Nicholas Vollmer -- Nick Alcock -- Nick Alexander -- Nick Dimiduk -- Nicklas Lindgren -- Nicolas Dudebout -- Nicolas Petton -- Nicolas Richard -- Nikita Leshenko -- Nikolay Martynov -- Noam Postavsky -- N. Troy de Freitas -- Ola Nilsson -- Ole Arndt -- Oleh Krehel -- Orivej Desh -- Óscar Fuentes -- Pancho Horrillo -- Park Zhou -- Paul Pogonyshev -- Paul Stadig -- Pavel Holejsovsky -- Pekka Pessi -- Pengji Zhang -- Peter Eisentraut -- Peter Jaros -- Peter J. Weisberg -- Peter Vasil -- Philippe Cavalaria -- Philippe Vaucher -- Philipp Fehre -- Philipp Haselwarter -- Philipp Stephani -- Philip Weaver -- Phil Jackson -- Phil Sainty -- Pierre Neidhardt -- Pieter Praet -- Pieter van Oostrum -- Prathamesh Sonpatki -- Pratyush Yadav -- Pritam Baral -- rabio -- Radon Rosborough -- Rafael Laboissiere -- Rahul Rameshbabu -- Raimon Grau -- Ramkumar Ramachandra -- Remco van 't Veer -- Rémi Vanicat -- René Stadler -- Richard Kim -- Richard Sent -- Robert Boone -- Robert Irelan -- Robin Green -- Roey Darwish Dror -- Roger Crew -- Roland Marchand -- Romain Francoise -- Ron Parker -- Roy Crihfield -- Rüdiger Sonderfeld -- Russell Black -- Ryan C. Thompson -- Sam Cedarbaum -- Samuel Bronson -- Samuel W. Flint -- Sanjoy Das -- Sean Allred -- Sean Bryant -- Sean Farley -- Sean Whitton -- Sebastian Wiesner -- Sébastien Gross -- Seong-Kook Shin -- Sergey Pashinin -- Sergey Vinokurov -- Servilio Afre Puentes -- shoefone -- Shuguang Sun -- Siavash Askari Nasr -- Silent Sphere -- Simon Pintarelli -- Stefan Kangas -- Štěpán Němec -- Steven Chow -- Steven E. Harris -- Steven Thomas -- Steven Vancoillie -- Steve Purcell -- StrawberryTea -- Suhail Shergill -- Sylvain Rousseau -- Syohei Yoshida -- Szunti -- Takafumi Arakaki -- Tassilo Horn -- TEC -- Teemu Likonen -- Teruki Shigitani -- Thierry Volpiatto -- Thomas A Caswell -- Thomas Fini Hansen -- Thomas Frössman -- Thomas Jost -- Thomas Riccardi -- Tibor Simko -- Timo Juhani Lindfors -- Tim Perkins -- Tim Wraight -- Ting-Yu Lin -- Tom Feist -- Toon Claes -- Topi Miettinen -- Troy Hinckley -- Tsuyoshi Kitamoto -- Tunc Uzlu -- Ulrich Müller -- Vineet Naik -- Vitaly Ostashov -- Vladimir Ivanov -- Vladimir Panteleev -- Vladimir Sedach -- Waqar Hameed -- Wei Huang -- Wilfred Hughes -- Win Treese -- Wojciech Siewierski -- Wouter Bolsterlee -- X4lldux -- Xavier Noria -- Xavier Young -- Xu Chunyang -- Yann Herklotz -- Yann Hodique -- Ynilu -- York Zhao -- Yuichi Higashi -- Yuri Khan -- Zach Latta -- zakora -- Zhu Zihao -- ziggy -- zilongshanren diff --git a/.config/emacs/lisp/magit/docs/BACKERS.md b/.config/emacs/lisp/magit/docs/BACKERS.md deleted file mode 100644 index 847fc22..0000000 --- a/.config/emacs/lisp/magit/docs/BACKERS.md +++ /dev/null @@ -1,1402 +0,0 @@ -Thanks to your contributions and enthusiastic support -the Magit [crowdfunding campaign][1] was a huge success! - -A special thanks goes to [Mojotech][2], [Directangular][3] and -[Google Open Source][4] for their very generous contributions. - -[1]: https://www.kickstarter.com/projects/1681258897/its-magit-the-magical-git-client -[2]: https://www.mojotech.com -[3]: https://www.directangular.com -[4]: https://opensource.google.com - -I would also like to thank each one of the almost two thousand -other backers. It was very motivating to learn that so many users -care that much about Magit and the well-being of its maintainer. - -Thanks! - -Jonas Bernoulli - - ------------------------------------------------------------- - - -These are some of the 1987 backers: - -(If you backed the campaign and would like to be mentioned -here but are not, then please fill out the backer survey.) - -- 4xrsJCr9 -- <3 -- @amirrajan -- @arthurnn -- @nietaki -- @seriousben -- A.I. -- A.Weiher -- Aaditya Sood -- Aaron Jacobs -- Aaron Lee -- Aaron Madlon-Kay -- Aaron Mathews -- Aaron Schumacher -- Abdullah Alleweeth -- Abhijit Rao -- Abrahán Fernández Nieto -- Ada -- Adam Benzan -- Adam Bobrow -- Adam Collard -- Adam Olsen -- Adam Patterson -- Adam Shannon -- Adam Sjøgren -- Adriaan Leijnse -- Adrian Bradd -- Al Scott -- Alan Pavičić -- Alan Pearce -- Alan Shutko -- Alastair Rankine -- Alberto Donato -- Aleix Conchillo Flaque -- Aleksandar Simić -- Aleksandr Ivanov -- Aleksei Fedotov -- Alex Bennée -- Alex Branham -- Alex Dempsey -- Alex Ermolov -- Alex Murray -- Alex Reinhart -- Alex Schroeder -- Alex Speed Kjeldsen -- Alex Wiles -- Alex ter Weele -- Alexander Berezovsky -- Alexander Goldstein -- Alexander Lamaison -- Alexander Simms -- Alexander Stankov -- Alexandre Bertails -- Alexandre Duret-Lutz -- Alexandre Héaumé -- Alexandre Julliard -- Alexey Egorov -- Alexey Kapustin -- Alexis Marie Wright -- Aleš Bizjak -- Alfredo Aguirre -- Allen Short -- Amin Bandali -- Anatolii Smolianinov -- Anatolij Prihosko -- Anatoly Kudinov -- Andre Aberer -- Andrea Crotti -- Andrea Di Persio -- Andreas Aronsson -- Andreas J -- Andreas Marschke -- Andreas Textor -- Andreas Vollert -- Andreas Zweili -- Andrej Depperschmidt -- Andres Mariscal -- Andrew C May -- Andrew Childs -- Andrew Cowper -- Andrew Cox -- Andrew Evans -- Andrew Fray -- Andrew Grytsenko -- Andrew J Cosgriff -- Andrew Macgregor -- Andrew McDermott -- Andrew Mullins -- Andrew Sanchez -- Andrew Schwartzmeyer -- Andrew Shugarts -- Andrew Slough -- Andrew Sullivan -- Andrew Talbot -- Andrew Tropin -- Andrew Watts -- Andrzej Skiba -- András Simonyi -- Andy Bold -- Andy Drop -- Andy Moreland -- Anntoin -- Anonymous -- Anselm Lingnau -- Anthony Cowley -- Anthony Hobbs -- Anticrisis -- Anton Orlov -- Antoni Batchelli -- Antonio Miranda -- Aran Cox -- Arjen Wiersma -- Arjun -- Arnaud Meuret -- Arne Brasseur -- Arne Redlich -- Arong Pan -- Arthur A. Gleckler -- Arthur Leonard Andersen -- Artur Malabarba -- Artyom Kazak -- Ash -- Asherah -- Asilata Bapat -- Audun Gevelt -- August Lilleaas -- Axie Infinity -- Azundris -- Baishampayan Ghose -- Balaji Sivaraman -- Baldur -- Barak -- Barry Gitarts -- Barry McLarnon -- Bas Alberts -- Bascht -- Ben Hollis -- Ben Leggett -- Ben Plantinga -- Ben Swift -- Benaiah Mischenko -- Benedek Fazekas -- Benedikt Terhechte -- Beni Cherniavsky-Paskin -- Benjamin Beckwith -- Benjamin Hipple -- Benjamin Klüglein -- Benjamin Kudria -- Benjamin Ragheb -- Benjamin Savs -- Benoit Daffos -- Biao Xie -- Bill Stilwell -- Bjarke Vad -- Björn Larsson -- Bob Duke -- Bob Sun -- Bob Uhl -- Bobby Burden III -- Bodil Stokke -- Boris Dušek -- Boyd Adamson -- Bozhidar Batsov -- Brandon Adams -- Brandon Belew -- Brandon Dixon -- Brandon Fulk -- Brandon Orther -- Brendan Fahy -- Brendan Jackman -- Brendan Kirby -- Brett Witty -- Brian Brunswick -- Brian Carlson -- Brian Cobb -- Brian Danilko -- Brian Gruber -- Brian Hicks -- Brian James Rubinton -- Brian Leonard -- Brian Sniffen -- Brian Warner -- Bridger Howell -- Brooke Mitchell -- Bruce Ravel -- Bruno Jacquet -- Bryan Gilbert -- Bryan Willson Berry -- Bryce Kerley -- Cai Kechao -- Caibin Chen -- Caleb McCaffery -- Calogero Lo Leggio -- Cameron Higby-Naquin -- Cameron Stitt -- Carl Lange -- Carlo Sciolla -- Carlos Antonio Neira Bustos -- Carlos Rocha -- Carsten Strotmann -- Carsten.Koenig@hotmail.de -- Caspar -- Cena Mayo -- Chad Stovern -- Chaitanya Koparkar -- Chandan Rajendra -- Chao Liu from GRASP Lab, UPenn -- Charl P. Botha -- Charles L.G. Comstock -- Charlie Brodie -- Charlie McMackin -- Chas B. -- Chase Wang -- Chen Rotem Levy -- Chris Charles -- Chris Douty -- Chris Gray -- Chris Hanson -- Chris Johnson Bidler -- Chris Lample -- Chris Lindholm -- Chris Mann -- Chris McDevitt -- Chris McGrath -- Chris Nyland -- Chris R (offby1@) -- Chris Sims -- Chris Taylor -- Christian 'gicmo' Kellner -- Christian Berg -- Christian Johansen -- Christian Johansson -- Christian Lenke -- Christian Romney -- Christian Zang -- Christine und Arne Köhn -- Christoffer Schultz Jensen -- Christoph Egger -- Christoph Lange -- Christoph Paa -- Christophe Garion -- Christophe Junke -- Christophe Troestler -- Christophe Vu-Brugier -- Christopher Adams -- Christopher Genovese -- Christopher Giroir -- Christopher Jenkins -- Christopher Jordan -- Christopher M. Becker -- Cicero Jones -- Clay Haapala -- Cliff Wulfman -- Clément Pit-Claudel -- Cody Canning -- Colin McLear -- Colin P. D. Powell -- Constantine Khrulev -- Correl Roush -- Courtland Jones -- Craig Andera -- Craig Hawco -- Curt Brune -- D. Sere -- Damian Dobroczynski -- Damien G. -- Damien Merenne -- Damien Pollet -- Dan Davison -- Dan Forest -- Dan Harms -- Dan Jones -- Dan LaManna -- Dan Torop -- Danger Salad -- Daniel -- Daniel Bowman -- Daniel Caixinha -- Daniel Cowgill -- Daniel Gempesaw -- Daniel Grady -- Daniel J. Rothblatt -- Daniel Kraus -- Daniel Luna -- Daniel Ma -- Daniel Mai -- Daniel Martín -- Daniel Molina -- Daniel Moore (drmrd) -- Daniel S. F. Alves -- Daniel Skarda -- Daniel Tamai -- Daniel V -- Daniel de Haas -- Daniël de Kok -- Darren Aldredge -- Darryl Okahata -- Dave Aitken -- Dave Churchill -- Dave Kochbeck -- Dave Liepmann -- Dave Pearson -- Dave Pretty -- Dave Rolsky -- David Arnold -- David Berg Marklund -- David Duncan -- David Ellison -- David Goldfarb -- David Hodges -- David Hull -- David Krauser -- David Leimbach -- David Mayfield -- David Pathakjee -- David Radkowski -- David Robillard -- David S. Rosenberg -- David Scarpetti -- David Stone -- David Vázquez -- David Wen Riccardi-Zhu -- David Zuber -- Davidbrcz -- Davide Restivo -- Dean Sellis -- Deepu Mohan Puthrote -- Denis Haine -- Derek Chen-Becker -- Derek Scherger -- Derek Slager -- Derek Upham -- Devin -- Diane Trout -- DictatorBob -- Diego Vicente Martín -- Dieter Komendera -- Diez Roggisch -- Difrex -- Dimitre Liotev -- Dimitris Platis -- Dirk Breuer -- Divan Santana -- Dmitry Alexeev -- Dmitry Dzema -- Dmitry Lazurkin -- Dmitry Polyanitsa -- Dmitry Tymchuk -- Dominique Dumont -- Don Spencer -- DonBørn -- Doru Mihai Leonte -- Doug MacEachern -- Dr. Jobo -- Drew Raines -- Durant Schoon -- Dustin Maas -- Dustin Paluch -- Dylan Fitzgerald -- Dylan Moore -- Eddie Hillenbrand -- Eduardo Apolinario -- Eduardo Ruiz Macias -- Edward Faulkner -- Edward Knyshov -- Edward Steere -- Edwin Stearns -- Elaina Martineau -- Eli Naeher -- Elias Castegren -- Elis ""etu"" Hirwing -- Elsa Gonsiorowski -- Emanuel Tannert -- Emil Bergström -- Emil Klarskov -- Emil Lundmark -- Emilio y Marcelo -- Emre Sevinç -- Eric B. Decker -- Eric Brown -- Eric E. Moore -- Eric Hogberg -- Eric Hopkins -- Eric Seidel -- Erik Anderson -- Erik Edrosa -- Erik Nordlund -- Erik Pischel -- Erik Swanson -- Erik W. B. -- Erik Winkels -- Erkki Seppälä -- Erwin Junge -- Esben Sparre Andreasen -- Ethan Feldman -- Ethan Glasser-Camp -- Ettore Berardi -- Eugene Rwagasore -- Eugene Tan -- Evan Rowley -- Evgeniy Tyurkin -- Ewan Dawson -- Ezekiel Elin -- Fabian -- Fabian Otto -- Felipe M. -- Felix Panozzo -- Fernando Dobladez -- Fernando Varesi -- Fitz Elliott -- Flavien COGEZ -- Florian Adamsky -- Florian Bruhin (The Compiler) -- Florian Kempenich -- Florian Schmaus -- Florian Stock -- Florian Ulivi -- Foivos Zakkak -- Foxtur -- Fran Burstall -- Francesc Elies -- Francesc Rocher -- Frank Roland -- František Haifler -- François Morlet -- Fred Akalin -- Fred Boiteux -- Fred Kroon -- Frederic Dumont -- Frederik Banis -- Frederik Beaujean -- Fritz Grabo -- Frontside Software -- Fumitaka Tokumitsu -- Gabriel Adomnicai -- Gabriel J. Pérez Irizarry -- Gaby Launay -- Galder Zamarreño -- Galin Yordanov -- Garvin Guan -- Gary Trakhman -- Gavin Mercer -- Geoff MacIntosh -- Geoff Pado -- Geoff Wozniak -- Geoffrey J. Teale -- George Pittarelli -- Gerard Paapu -- Gerard Ryan -- Gergely Nagy -- Gergely Polonkai -- Giang-Son Nguyen -- Giorgos Logiotatidis -- Giovanni Azua -- Gitty McGitface -- Gitty McGitface -- Glenn R. Martin -- Gordon Freeman -- Gordon Gustafson -- Greece <3 magit -- Greg Chevalley -- Greg Leppert -- Gregg Hernandez -- Guido Schmidt -- Guilhem Doulcier -- Guillaume Ayoub -- Guillaume Marceau -- Guillermo Ramos -- GuiltyDolphin -- Gustav Wikström -- Gwenhael Le Moine -- Harald Hvaal -- Hector Castro -- Henri Jones -- Henrik Ahlgren -- Henrik Kjerringvåg -- Henrik Renlund -- Henry Laxen -- Henry Robinson -- Henry Walshaw -- Hertz -- Herwig Stuetz -- Hiren Shah -- Hiroki Kiyohara -- Hiroshi Tsutsui -- Hoel -- Holger Dürer -- Horst Gutmann -- Hung Pham -- Hynek Schlawack -- Håkan Nilsson -- Ian Johnson -- Ian Kerins -- Ian McCowan -- Ian Warford -- Ibrahim Awwal -- Icarus Sparry -- Igor Bronshteyn -- Igor Kupczyński -- Ikuru K -- Ilja Kocken -- Illia Shestakov -- Ingar Almklov -- Ionov Valentine -- Isaac Karth -- Israel Herraiz -- Itamar Ravid -- Itamar Turner-Trauring -- Iulian Costan -- Ivan Kanis -- Ivan Timokhin -- Ivo Reyes Román -- J Alexander Feldman-Crough -- Jacek Generowicz -- Jack Angers -- Jack Kelly -- Jack Letourneau -- Jack Moffitt -- Jack Nai-Chieh Chou -- Jack Wong -- Jacob Covington -- Jacob Ilsø Christensen -- Jacob Moeller -- Jacob O'Donnell -- Jaga Santagostino -- Jaidev Sridhar -- Jake McCrary -- Jakub Chmielarz -- Jakub Narębski -- James Felix Black -- James Ferguson -- James Orr -- James Sharman -- James Tranovich -- James Valleroy -- Jamie McClymont -- Jamie Nicol -- Jan Mas Rovira -- Jan Rychter -- Jan Seeger -- Jan Vincent Liwanag -- Jangseop Shin -- Jared Miller -- Jarno Malmari -- Jarrett P -- Jason Blevins -- Jason Orendorff -- Jasper Spaans -- Jeff Bauer -- Jeff McCarrell -- Jeff Tecca -- Jeff Waltzer -- Jeff Whitmire -- Jeff Workman -- Jeffrey I. Schiller -- Jeffrey Panczyk -- Jennifer Kowalsky -- Jens-Peter Thiry -- Jeremiah Peschka -- Jeremy Burks -- Jeremy Huffman -- Jeroen AH -- Jeroen Faijdherbe -- Jeroen Tiebout -- Jessica Claire Edwards -- Jethro Kuan -- Jiashu Wang -- Jim Blandy -- Jim Menard -- Jingcheng Xu -- Jiten K. Pathy -- Joachim 'Troglobit' Nilsson -- Joakim Ohlrogge -- Joakim Verona -- Joao Azevedo -- Joe Balancio -- Joe DeVivo -- Joe Gallo -- Joe Kiniry -- Joerg Jaspert (Ganneff) -- Johan Bay -- Johan Ekenberg -- Johan Forsberg -- Johan K. Jensen -- Johan S. -- Johan Sandblom -- Johan Sternerup -- Johannes 'ksjogo' Goslar -- Johannes Beigel -- Johannes Grødem -- Johannes Rainer -- Johannes W. -- John Anthony -- John Cinnamond -- John D. Hume -- John Giannelos -- John Haman -- John Krumpotick -- John Mastro -- John Peloquin -- John Urquhart Ferguson -- Johnny Chadda -- Jojo -- Jon Irving -- Jon M. Dugan -- Jon Raphaelson -- Jon Snader -- Jonas Ransjö -- Jonas Serych -- Jonas Strømsodd -- Jonathan Arnett (J3RN) -- Jonathan Lai -- Jonathan Miller -- Jonathan Rothberg -- Jonathan del Strother -- Joonas Sarajärvi -- Joost Diepenmaat -- Jordan Galby -- Jordan Mulcahey -- Jordon Biondo -- Joren Van Onder -- Jorge Dias -- Jorge Santiago -- Jos -- Josep Egea -- Joseph Churchill -- Joseph Garvin -- Joseph Jaoudi -- Joseph Mingrone -- Josh Berry -- Josh Comer -- Josh Elsasser -- Josh Lipschultz -- Josh Medeski -- Josh Mōller-Mara -- Josh Skidmore -- Josh Tilles -- Josh Valentine -- Joshua B. Smith -- Joshua E Cook -- Joshua F. McMichael -- Josiah Schwab -- Jostein Kjønigsen -- Jouni K. Seppänen -- Joël Franusic -- Juan E. Maya -- Juan Edi -- Juan Pedro Bolívar Puente (https://sinusoid.al) -- Julian Kniephoff -- Julien Blanchard -- Julio Borja Barra -- Justin Guenther -- Justin Kaipada -- Justin Schell -- Justin Smestad -- Justin Talbott -- Justin Wood -- Justine Tunney -- Jörg Ramb -- Jürgen Hackl -- Kaloian Doganov -- Kamen Naydenov -- Kamil & Hassan -- Kara Woo -- Karl Voit -- Karthikeyan S -- Katherine Lai -- Kaushal Modi -- Kaushik Chakraborty (kaychaks) -- Kavita Varsani -- Kazushige Hosokawa -- Kazuya Sakakihara -- Keiichi Watanabe -- Keith Amidon -- Keith Mantell -- Kelly McLaughlin -- Ken Olstad -- Kent Primrose -- Kevin Christen -- Kevin D Saunders -- Kevin Grimes, II -- Kevin J Foley -- Kevin Kelley -- Kevin Orr -- Khan Thompson -- Kieran Healy -- Kieran Trezona-le Comte -- Kim Frederiksen -- Kim Gräsman -- Kiran Kulkarni -- Klāvs Taube -- Konrad Voelkel -- Koray Al -- Kostiantyn Rybnikov -- Kridsada Thanabulpong -- Krista Victorsen -- Kristoffer -- Kungsgeten -- Kushal Pisavadia -- Kyle Brooks -- Kyle Machulis (qDot) -- Kyle Oba -- Kyle Purdon -- Kyle Schwab -- Kyle Sexton -- Kévin Le Gouguec -- Lardière Sébastien -- Lars Hesel Christensen -- Laurence Rochfort -- Laurent Charignon -- Laurent Gatto -- Leandro Cardoso -- Lefteris Karapetsas -- LegoNigel -- Leo Breebaart -- Leo C. Stein -- Leo Martel -- Leron Culbreath -- Les Jones -- Levi I. Tan Ong -- Liam Stewart -- Luca Manzoni -- Lucas Meyers -- Lucian Mogosanu -- Ludwig PACIFICI -- Luis Miguel Castañeda -- Luis Osa -- Luke Amdor -- Luke Francl -- Lute Kamstra -- Luís Oliveira -- Léo Gillot-Lamure -- M. Ian Graham -- Maarten Grachten -- Maciek Swiech, PhD -- Magit is full of magic! -- Magnar Sveen -- Magnus Malm -- Magnus Nyberg (nxtr) -- Mahinshaw@gmail.com -- Mak Kolybabi -- Maksym Planeta -- Man Roy -- Mandy -- Manfred Kroehnert -- Manish Sharma -- Mansur Ziatdinov -- Manuel Alonso -- Manuel Frischknecht -- Manuel Kallenbach -- Manuel Uberti -- Marc Massar -- Marc Nijdam -- Marc Sherry -- Marc T. Henry de Frahan -- Marcel Bollmann -- Marcello Nicoletti -- Marcin Cieślak -- Marcin Swieczkowski -- Marco Dalla Stella -- Marco Wahl -- Marcus Geiger -- Marcus Klemm -- Marcus Puchalla -- Mark A. Hershberger -- Mark Faldborg -- Mark Hepburn -- Mark Jeffcoat -- Mark Meredith -- Mark Ranallo -- Mark Schaake -- Mark Stradling -- Mark Tran -- Mark Triggs -- Markus Fix -- Marshall Quander -- Mart van de Wege -- Marten Lienen -- Marti Bolivar -- Martin Buchmann -- Martin Frost -- Martin Geisler -- Martin Huschenbett -- Martin Luethi -- Martin Mauch -- Martin Myrseth -- Martin Polak -- Martin Rechsteiner -- Martin Yrjölä -- Martin Šlouf -- Martino Visintin -- Martins Grunskis -- Mary Jo Brodzik -- Masayuki Onjo -- Mateusz Probachta (beetleman) -- Mathew Robinson -- Mathieu Corbin -- Mathieu Tartare -- Matija Zezelj -- Matt Curtis -- Matt Haffner -- Matt Kramer -- Matt Savoie -- Matt Usifer -- Matthew Bregg -- Matthew Curry -- Matthew Fluet -- Matthew Gregg -- Matthew Hitchman -- Matthew Piziak -- Matthew Plant -- Matthew Wells -- Matthias Güdemann -- Matthias Nüßler -- Matti Niemenmaa -- Mattias Bengtsson -- Matías Aguirre -- Mauricio Aldazosa Mariaca -- Mauricio Collares -- Max B. Hansson -- Max Diefenbach -- Max Regan -- Max Tweddell -- Max Willsey -- Maxim Ivanov -- Maxim Rurenko -- Mayank Jain -- Meiyo Peng -- Melioratus -- Menno Finlay-Smits -- Micah Anderson -- Michael Abrahams -- Michael Droettboom -- Michael Engelhardt -- Michael Gracie -- Michael Griffiths -- Michael Hansen -- Michael Kleehammer -- Michael Krasnyk -- Michael McCracken -- Michael Moreno -- Michael Overmeyer -- Michael Sloan -- Michael Welsh Duggan -- Michal Buczko -- Michał Politowski -- Mickaël Salihi -- Miguel Fernandes -- Mihai Rinzis -- Mikael Kermorgant -- Mikael Springer -- Mike Ashley -- Mike Crowe -- Mike Danylchuk -- Mike Gulick -- Mike Hewitson -- Mike Monette -- Mike T. Miller -- Mike Travers -- Mike Wagg -- Mike Zamansky -- Mikhail Pankov -- Mikhail Pontus -- Mikko Värri -- Miks Kalnins (MaikuMori) -- Milan Zamazal -- Miles Clark -- Miloš Mošić -- Mingwei Zhang -- Miranda Dobbs -- Mirzhan Irkegulov -- Mitchell A. Gordon -- Mitchell Bright -- Mitsutaka Takeda -- Mohammed Ismail Ansari (myTerminal) -- Moiz Bookwala -- Moritz Bunkus -- Morten Slot Kristensen -- Mr. Wacky -- Mrinal Purohit -- Murilo Pereira -- Murphy McMahon -- Nab Inno -- Nat Knight -- Nate Eagleson -- Nathan Collins -- Nathan Hitchings -- Nathan Sain -- Naupaka Zimmerman -- Neil Baylis -- Neil Durant -- Neurolit -- Niall Dooley (doolio) -- Nick Alcock -- Nick Fitzgerald -- Nick Higham -- Nick Spain -- Nicolas Dudebout -- Nicolas Ha -- Nicolas Hafner -- Nicolas Morey-Chaisemartin -- Nicolò Balzarotti -- Niels Widger -- Nikita Dudnik -- Nikita Leshenko -- Nikk Folts -- Niko Felger -- Nikolai Nespor -- Nikos Fertakis -- Nils -- Nils Grunwald -- Nils Pascal Illenseer -- Niluge_KiWi -- Nishioka Wataru -- Nishiyama Nobuyuki -- Noah Hoffman -- Noel Markham -- Norbert Kiesel -- Norman Walsh -- Norman Yamada -- Ola Nilsson -- Ole Jørgen Brønner -- Ole petter Orhagen -- Oleg Ivanov -- Oleg Kostyuchenko -- Oleg Matrokhin -- Oliver Caldwell -- Oliver Eidel -- Oliver Holworthy -- Oliver Marks -- Oliver Reiter -- Olivier Berger -- Olivier Tharan -- Olivier Yiptong -- Ollie Charles (ocharles) -- Onorio Catenacci -- P. Kunze -- Paolo G. Giarrusso -- Pasi Heikkinen -- Patrick Brown -- Patrick Chung -- Patrick Haun -- Patrick Kelley -- Patrick Nguyen -- Patrick Thomson -- Paul Hankes Drielsma -- Paul Healy -- Paul Kalupnieks -- Paul Oliver -- Paul R. Jorgensen -- Paul Reiter -- Paul Young -- Pavel Khlopin -- Pavel Panchekha -- Pawan Dubey -- Paweł Damasiewicz -- Paweł Kapała -- Pedro Pinto -- Pedro Romano -- Per Bergqwist -- Peter Borocz -- Peter Brachwitz -- Peter Buckley -- Peter C. Norton -- Peter Cheng -- Peter Christensen -- Peter Perron -- Peter Vasil -- Phil Austin -- Phil Dixon -- Phil Sung -- Philip Sequeira -- Philip Tran -- Philipp Baschke -- Philipp Klippel -- Philippe Bernery -- Philippe Cavalaria -- Philippe Vaucher -- Pierre Lrz -- Pierre Neidhardt -- Praveen Perera -- Radon Rosborough -- Rafal Kowalski -- Ramanathan Sivagurunathan -- Rami Massoud -- Rami Ylimäki -- Raniere Silva -- Rasmus Rygaard -- Ray Hixson -- Remco -- Remote Viewer -- Renat Galimov -- Renato Aguiar -- Rey Wright -- Rhys Powell -- Riccardo Cambiassi -- Richard Bonichon -- Richard Murri -- Richard Petri -- Richard Thames -- Rickard Sundin -- Riverprawn -- Rob Donnelly -- Robert Boone -- Robert Helgesson -- Robert Postill -- Robert Steward -- Robert Stuttaford -- Robin Neatherway -- Rodrigo -- Roland Reckel -- Romain Deterre -- Roman Kashitsyn -- Romario López -- Ron Lusk -- Ronan Barzic -- Rory Gibson -- Rory Molinari -- Ross Donaldson -- Ross Lonstein -- Rouven Czerwinski -- Royall Spence -- Ruben Bakker -- Ruben Maher -- Rupert Swarbrick -- Russell Healy -- Rutger Prins -- Ruud -- Ryan C. Thompson -- Ryan Eschinger -- Ryan Kaskel -- Ryan Mulligan -- Ryan Prior -- Ryan Seals -- Ryan Shaw -- Rémi Vanicat -- Rörd Hinrichsen -- Rúnar Berg Baugsson Sigríðarson -- SM -- SabreWolfy -- Sagun Khatri -- Saint Aardvark the Carpeted -- Sajith Sasidharan -- Sam Bleckley -- Sam Blumenthal -- Sam Brightman -- Sam Halliday -- Sam Pillsworth -- Samuel Cole -- Samuel Evans-Powell -- Samuel Tonini -- Sangho Na -- Santi de Ledesma -- Saul Reynolds-Haertle -- Sayash K -- Scott Barron -- Scott Determan -- Scott Dubinsky -- Scott Jacobsen -- Scott Ross -- Sean Allred -- Sean Andrews -- Sean Bowman -- Sean Grove (@sgrove) -- Sean J Williamson -- Sean McAfee -- Sean Patrick Hagen -- Sean Smith -- Seb Kri -- Sebastian Nørgaard -- Sebastian Schlag -- Sergey Kostrukov -- Sergey Timanin -- Shane Celis -- Shaun Lee -- Shigenobu Nishikawa -- Shingo Fukuyama -- Shmulik Regev -- Shreyas Ragavan -- Shubhang Mani -- ShuffelBag -- Shun Yu -- Simon Altschuler -- Simon Benfold -- Simon Brown -- Simon Fenton -- Simon Gregersen -- Simon Génier -- Simon Law -- Sir Garbagetruck -- Skip -- Slava Barinov -- Sliim -- Spruce Bondera -- Stefan Arentz -- Steffen Weinreich -- Stelian Ionescu -- Stephan Schmitt -- Stephan Schubert -- Stephen C. Gilardi -- Stephen Childs -- Stephen Pegoraro -- Stephen Whipple -- Stephen York -- Steven Rémot -- Stian Eikeland -- Stig Brautaset -- StupidCodeFactory -- Stéfan van der Walt -- Sumit J -- Superbil -- Sven Koschnicke -- Sven Rubben -- Sverre Johansen -- Swaroop C H -- Sylvain Rousseau -- Szabolcs Szilágyi -- Sébastien André -- Søren Lund -- Taavi Tani -- Takaaki Ishikawa -- Takeshi Teshima -- Tamas K. Papp -- Tarjei Bærland -- Tassilo Horn -- Taylor Skidmore -- TeMPOraL -- Terje Sten Bjerkseth -- Tero Paloheimo -- The Mad Hatter -- Thomas A Caswell -- Thomas Felber -- Thomas Gazagnaire -- Thomas Hisch -- Thomas Moulia -- Thomas Skardal -- Thommy H. -- Thor Adam -- Tiago Luchini -- Tianxiang Xiong -- Tibor Csögör -- Tilmann Singer -- Tim Howes -- Tim Johns -- Tim Perkins (@tprk77) -- Tim Scheer -- Tim Zallin -- Ting-Yu Lin -- Titus von der Malsburg -- Tjaart van der Walt -- Tobias Fankhänel -- Tom Lyons (tbl3rd) -- Tom Ridge -- Tom Talbot -- Tom W. -- Tom van der Sommen -- Tomasz Legutko -- Tomás Solar Castro -- Tony Finch -- Tony Kemp -- Toon Claes -- Topher Brown -- Tore Brede -- Travis B. Hartwell -- Travis Luckenbaugh -- Travis Poulsen -- Tresi Arvizo -- Trevoke -- Trevor Spiteri -- Tritlo -- Troy Hinckley -- Tuomas Kareinen -- Tushar Tyagi -- Tyler Romeo -- Tyler Sellon -- USAMI Kenta (tadsan, zonuexe) -- Umar Arshad -- Vaibhav Jain -- Valtteri -- Varun Madiath -- Vedang Manerikar -- Venkateswara Rao Mandela -- Victor Arias -- Victor Shulyak -- Victory Ejevika -- Vincent Demeester -- Vincent Pomageot -- Vindaar -- Vitor Capela -- Vivek Das Mohapatra -- Vlad -- Vlad Buslov -- Vladimir Shemankov -- Volker Haas -- Václav Haisman -- Wei Tang -- Wei-ju Wu -- Wendel Scardua -- Wes Hardaker -- Wilfred Hughes -- Will Fleming -- Will Hughes -- Will Newton -- Will Roe -- Willi Ballenthin -- William Casarin -- William Henney -- William Oberndorfer -- Willy Lee -- Willy Rempel -- Wolfgang Stief -- Xi Omicron Sigma -- Xi Shen -- Xuan Bi -- Yanko Simeonov - Zecho -- Yasushi SHOJI (""yashi"") -- Yen, Tzu-Hsi -- Yolanda Cadalbert -- YoungFrog -- Yu Miura -- Yuquan Fu -- Yuri Albuquerque -- Yuri Bronshtein -- Yuri Khan -- Yuta Yamada -- Yuuki Harano -- Zach Ingbretsen -- Zach Kost-Smith -- Zachary Kim -- Zachary Stevens -- ZaharK -- Zev Blut -- Zhiming Wang -- Zotan -- Zsolt Botykai -- agzam.ibragimov@gmail.com -- alex@olkhovskiy.com -- anderspree -- andrew.smirnov@gmail.com -- andron94 -- aneesh.kumar@gmail.com -- apeyroux -- baby-gnu.org -- bigjust -- bmac -- brandon.eltiste@gmail.com -- bsdmatburt@gmail.com -- bzg -- cbbrowne -- cfuhrman@gmail.com -- chpeer -- cmacrae -- cms -- comandante345 -- danmilon -- db48x -- designernasser@gmail.com -- dgoeke@gmail.com -- djeis -- dlowe -- dom.parry@gmail.com -- elseorand -- empty -- enderozcan -- frank.patz@gmail.com -- frankyxhl -- gabriele.lana@gmail.com -- gaetano -- gdcosta@gmail.com -- genehack -- george.l -- gingeralesy -- gmasgras@gmail.com -- goosetherumfoodle -- greetings_from_italy -- gregory@brusick.ch -- gsnewmark -- haff -- hensansi -- hugurp -- ilitzroth@gmail.com -- iwan -- jakobj -- jao -- jarvisschultz -- joesmoe10@gmail.com -- jonas.bulow@gmail.com -- jonasac -- joranvar -- jvshahid -- jward -- jwerak -- k-sunako -- kalle.lindqvist@mykolab.com -- karate expert -- karronoli -- kenneth@geisshirt.dk -- kiwanami -- kltm -- krvkir -- l26wangca@gmail.com -- laduke -- lambdageek -- lischenko -- lobachevsky -- luke@balooga.com -- mail.urfi@gmail.com -- manojm.321@gmail.com -- marco 'rho lambda pi' rolappe -- mats manet -- mds2 -- mgdelacroix -- miguelgr -- milan.v.mitrovic@gmail.com -- mr.adtaylor@gmail.com -- n2o -- netWorms -- nick.lanham.nexus@gmail.com -- ninesigns -- nivekuil -- noonker -- nyyManni -- ojab -- oppenlander -- pancho horrillo -- paralin -- patrickwinter@posteo.ch -- pcmantz@mcpantz.org -- pepone.onrez@gmail.com -- peter ""git push -f"" aaser -- pitometsu -- rafael@micubiculo.com -- rails-to-cosmos -- ray keung -- rdomigan -- realloc() -- roomkey.com -- rouadec -- runejuhl -- sbaker617 -- shapr -- shino -- simon.leinen@gmail.com -- snowball -- sponrad -- stask -- steffen@g7n.dk -- taku0 -- tanzoniteblack -- thirteen37 -- thomas.stenhaug@gmail.com -- thomasf@jossystem.se -- toby cabot -- tomterl -- trobanga -- trocster -- turnspike.com -- tuxtimo -- tzz@lifelogs.com -- umejam -- vaartis -- vargonaut -- vincenzo.disomma@gmail.com -- wtp -- www.drinkiwiki.com -- yewton -- yoshinori kawahara -- zerth -- Álvaro González Sotillo -- Åsmund Grammeltvedt -- Étienne BERSAC -- Étienne Deparis -- Ömer Yildiz -- Łukasz Korecki diff --git a/.config/emacs/lisp/magit/docs/Makefile b/.config/emacs/lisp/magit/docs/Makefile deleted file mode 100644 index 5b606de..0000000 --- a/.config/emacs/lisp/magit/docs/Makefile +++ /dev/null @@ -1,208 +0,0 @@ --include ../config.mk -include ../default.mk - -.PHONY: install clean AUTHORS.md stats - -## Build ############################################################# - -docs: texi info html html-dir pdf - -texi: $(TEXIPAGES) -info: $(INFOPAGES) dir -html: $(HTMLFILES) -html-dir: $(HTMLTOPS) -pdf: $(PDFFILES) -epub: $(EPUBFILES) - -ORG_EVAL += --load ol-man --eval "(progn $$ORG_MAN_EXPORT)" -ORG_EVAL += --eval "(setq indent-tabs-mode nil)" -ORG_EVAL += --eval "(setq org-src-preserve-indentation nil)" -ORG_EVAL += --eval "\ -(defun org-texinfo--sanitize-content (text)\ - (replace-regexp-in-string \"[@@{}]\" \"@@\\&\" text))" -ORG_EVAL += --funcall org-texinfo-export-to-texinfo - -redo-docs: - @touch $(ORGPAGES) - @make docs - -.revdesc: ; -_ := $(shell test "$(REVDESC)" = "$$(cat .revdesc 2> /dev/null)" ||\ - echo "$(REVDESC)" > .revdesc) - -%.texi: %.org .orgconfig .revdesc - @printf "Generating $@\n" - @$(EMACS_ORG) $< $(ORG_EVAL) - -%.info: %.texi - @printf "Generating $@\n" - @$(MAKEINFO) --no-split $< -o $@ - -dir: magit.info magit-section.info - @printf "Generating dir\n" - @echo $^ | xargs -n 1 $(INSTALL_INFO) --dir=$@ - -HTML_FIXUP_CSS = '//a\ -\ -\n\ -\n\ -\n\ -\n\ -\n' -HTML_FIXUP_ONLOAD = 's///' -HTML_FIXUP_MENU = '/<\/body>/i
<\/div>' - -%.html: %.texi - @printf "Generating $@\n" - @$(MAKEINFO) --html --no-split $(MANUAL_HTML_ARGS) $< - @sed -i -e $(HTML_FIXUP_CSS) -e $(HTML_FIXUP_ONLOAD) -e $(HTML_FIXUP_MENU) $@ - -%/index.html: %.texi - @$(RMDIR) $(HTMLDIRS) - @printf "Generating magit/*.html\n" - @$(MAKEINFO) --html -o $(PKG)/ $(MANUAL_HTML_ARGS) magit.texi - @for f in $$(find magit -name '*.html') ; do \ - sed -i -e $(HTML_FIXUP_CSS) -e $(HTML_FIXUP_ONLOAD) -e $(HTML_FIXUP_MENU) $$f ; \ - done - @printf "Generating magit-section/*.html\n" - @$(MAKEINFO) --html -o $(PKG)-section/ $(MANUAL_HTML_ARGS) magit-section.texi - @for f in $$(find magit-section -name '*.html') ; do \ - sed -i -e $(HTML_FIXUP_CSS) -e $(HTML_FIXUP_ONLOAD) -e $(HTML_FIXUP_MENU) $$f ; \ - done - -%.pdf: %.texi - @printf "Generating $@\n" - @texi2pdf --clean $< > /dev/null - -%.epub: %.texi - @printf "Generating $@\n" - @$(MAKEINFO) --docbook $< -o epub.xml - @xsltproc $(DOCBOOK_XSL) epub.xml 2> /dev/null - @echo "application/epub+zip" > mimetype - @zip -X --quiet --recurse-paths -0 $@ mimetype - @zip -X --quiet --recurse-paths -9 --no-dir-entries $@ META-INF OEBPS - @$(RMDIR) $(EPUBTRASH) - -## Install ########################################################### - -install: install-info install-docs - -install-docs: install-info - @$(MKDIR) $(DESTDIR)$(docdir) - $(CP) AUTHORS.md $(DESTDIR)$(docdir) - -install-info: info - @$(MKDIR) $(DESTDIR)$(infodir) - $(CP) $(INFOPAGES) $(DESTDIR)$(infodir) - -## Clean ############################################################# - -clean: - @printf " Cleaning docs/*...\n" - @$(RMDIR) dir $(INFOPAGES) $(HTMLFILES) $(HTMLDIRS) $(PDFFILES) - @$(RMDIR) $(EPUBFILES) $(EPUBTRASH) - @$(RMDIR) $(GENSTATS_DIR) - -## Release management ################################################ - -authors: AUTHORS.md - -AUTHORS.md: - @printf "Generating AUTHORS.md..." - @test -e $(TOP).git \ - && (printf "$$AUTHORS_HEADER\n" > $@ \ - && git log --pretty=format:'- %aN' | sort -u | \ - grep -v dependabot >> $@ \ - && printf "done\n" ; ) \ - || printf "FAILED (non-fatal)\n" - @git commit --gpg-sign -m "AUTHORS.md: Update list of contributors" \ - -o -- $@ ../.mailmap && git show --pretty= -p HEAD || true - -DOCS_DOMAIN = docs.$(DOMAIN) -SNAP_TARGET = $(subst .,_,$(DOCS_DOMAIN)):devel/ -DOCS_TARGET = $(subst .,_,$(DOCS_DOMAIN)): - -publish: redo-docs - @printf "Publishing snapshot manual...\n" - @cp $(PKG).pdf $(PKG)/$(PKG).pdf - @cp $(PKG)-section.pdf $(PKG)-section/$(PKG)-section.pdf - @$(RCLONE) sync $(RCLONE_ARGS) $(PKG) $(SNAP_TARGET)/$(PKG)/ - @$(RCLONE) sync $(RCLONE_ARGS) $(PKG)-section $(SNAP_TARGET)/$(PKG)-section/ - -release: redo-docs - @printf "Publishing release manual...\n" - @cp $(PKG).pdf $(PKG)/$(PKG).pdf - @cp $(PKG)-section.pdf $(PKG)-section/$(PKG)-section.pdf - @$(RCLONE) sync $(RCLONE_ARGS) $(PKG) $(DOCS_TARGET)/$(PKG)/ - @$(RCLONE) sync $(RCLONE_ARGS) $(PKG)-section $(DOCS_TARGET)/$(PKG)-section/ - -## Statistics ######################################################## - -STAT_DOMAIN = stats.$(DOMAIN) -STAT_TARGET = $(subst .,_,$(STAT_DOMAIN)):$(PKG)/ - -stats: - @printf "Generating statistics\n" - @$(GITSTATS) $(GITSTATS_ARGS) $(TOP) $(GITSTATS_DIR) - -stats-upload: - @printf "Uploading statistics...\n" - @$(RCLONE) sync $(RCLONE_ARGS) stats $(STAT_TARGET) - -## Lisp ############################################################## - -# When making changes here, then also adjust the copy in magit-base.el. -define ORG_MAN_EXPORT -(define-advice org-man-export (:around (fn link description format) gitman) - (if (and (eq format 'texinfo) ;' - (string-match-p "\\`git" link)) - (replace-regexp-in-string "%s" link " -@ifinfo -@ref{%s,,,gitman,}. -@end ifinfo -@ifhtml -@html -the %s(1) manpage. -@end html -@end ifhtml -@iftex -the %s(1) manpage. -@end iftex -") - (funcall fn link description format))) -endef -export ORG_MAN_EXPORT - -## Templates ######################################################### - -define AUTHORS_HEADER -The following people have contributed to Magit. -For statistics see https://$(STAT_DOMAIN)/magit/authors.html. - -Authors -------- - -- Marius Vollmer -- Jonas Bernoulli - -Active Maintainers ------------------- - -- Jonas Bernoulli -- Kyle Meyer - -Former Maintainers ------------------- - -- Nicolas Dudebout -- Noam Postavsky -- Peter J. Weisberg -- Phil Jackson -- Rémi Vanicat -- Yann Hodique - -All Contributors ----------------- - -endef -export AUTHORS_HEADER diff --git a/.config/emacs/lisp/magit/docs/RelNotes/0.5.1.txt b/.config/emacs/lisp/magit/docs/RelNotes/0.5.1.txt deleted file mode 100644 index d08cdb0..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/0.5.1.txt +++ /dev/null @@ -1,11 +0,0 @@ -Magit v0.5.1 Release Notes -========================== - -This is the first release of Magit. Enjoy! - -Released 14 August 2008 by Marius Vollmer. - -Authors -------- - - 157 Marius Vollmer diff --git a/.config/emacs/lisp/magit/docs/RelNotes/0.6.1.txt b/.config/emacs/lisp/magit/docs/RelNotes/0.6.1.txt deleted file mode 100644 index a58c3ba..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/0.6.1.txt +++ /dev/null @@ -1,24 +0,0 @@ -Magit v0.6.1 Release Notes -========================== - -Released 16 October 2008 by Marius Vollmer. - -Changes since v0.5.1 --------------------- - -Almost everything has changed. Some highlights: - - * Magit now works with Git 1.6.0. (John Wiegley) - - * Support for interactive rewriting. - - * Sections can be shown and hidden. - - * Staging, unstaging, applying, reverting and discarding changes can - now be done line-by-line, not only hunk-by-hunk. - -Authors -------- - - 212 Marius Vollmer - - John Wiegley diff --git a/.config/emacs/lisp/magit/docs/RelNotes/0.7.0.txt b/.config/emacs/lisp/magit/docs/RelNotes/0.7.0.txt deleted file mode 100644 index d035539..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/0.7.0.txt +++ /dev/null @@ -1,70 +0,0 @@ -Magit v0.7.0 Release Notes -========================== - -Released 8 March 2009 by Marius Vollmer. - -Changes since v0.6.1 --------------------- - - * Tagging, on 't' and 'T'. - - * Stashing, on 'z' and 'Z'. - - * Wazzup, on 'w'. Wazzup gives you an overview over how other - branches relate to the current one. - - * There is more control over pushing. 'P' now takes a prefix argument - and pushing a branch without a default remote will ask for one. - - * Logs have changed a bit: 'l' shows the traditional brief log, and - 'L' shows a more verbose log. Use the prefix arg to specify the - range of the log. - - * M-x magit-status doesn't prompt anymore for a directory when invoked - from within a Git repository. Use C-u to force a prompt. - - * When you have nothing staged, 'c' will now explicitly ask whether to - commit everything instead of just going ahead and do it. This can - be customized. - - * The digit keys '1', '2', '3', and '4' now show sections on the - respective level and hide everything below. With Meta, they work on - all sections; without, they work only on sections that are a parent - or child of the current section. - - * Typing '+' and '-' will change the size of hunks, via the "-U" - option to git diff. '0' resets hunks to their default size. - - * Typing 'k' on the "Untracked files" section title will offer to - delete all untracked files. - - * Magit understands a bit of git-svn: the status buffer shows unpushed - and unpulled commits, 'N r' runs git svn rebase, and 'N c' runs git - svn dcommit. - - * Magit now also works when the directory is accessed via tramp. - - * M-x magit-status can also create new repositories when given a - directory that is not a Git repository. - - * Magit works better with oldish Gits that don't understand "--graph", - for example. - - * The name of the Git program and common options for it can be - customized. - -Authors -------- - - 107 Marius Vollmer - 18 John Wiegley - 9 Alexey Voinov - 5 Marcin Bachry - 3 Rémi Vanicat - 2 Alex Ott - 2 René Stadler - 2 Steve Purcell - 1 Daniel Farina - 1 David Wallin - 1 Ian Eure - 1 Jesse Alama diff --git a/.config/emacs/lisp/magit/docs/RelNotes/0.8.0.txt b/.config/emacs/lisp/magit/docs/RelNotes/0.8.0.txt deleted file mode 100644 index 3ce415f..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/0.8.0.txt +++ /dev/null @@ -1,55 +0,0 @@ -Magit v0.8.0 Release Notes -========================== - -Released 7 May 2010 by Phil Jackson. - -Changes since v0.7.0 --------------------- - - * By setting magit-repo-dirs, you can get better repo completion. - Magit will offer all subdirectories (up to magit-repo-dirs level - deep) of the listed directories when magit-status asks for a - directory to work on. You can get the old behavior with a double - prefix to magit-status. - - * Hitting 'c' or 'C' while resolving a conflict in the middle of a - rebase will offer to continue the rebase instead of trying to commit - your changes. - - * Pulling will ask which branch to pull from when you don't have a - default branch configured. - - * Switching to a remote branch will offer to create a local tracking - branch for it. - - * Hitting C-c C-s while editing a commit message will toggle the - "--signoff" option. - - * Hitting 's' on the "Untracked files" section title will stage all - untracked files. - - * Hitting 'C-u S' will stage all untracked and tracked files. - - * Performance improvements in the status buffer. - - * Bug fixes to make Magit work better with newer Gits. - -Authors -------- - - 66 Phil Jackson - 53 Marius Vollmer - 27 Rémi Vanicat - 7 Alexey Voinov - 5 Hannu Koivisto - 5 Roger Crew - 4 John Wiegley - 4 Moritz Bunkus - 3 Ben Walton - 2 Marcin Bachry - 2 Óscar Fuentes - 1 David Abrahams - 1 Leo Liu - 1 Pavel Holejsovsky - 1 Ramkumar Ramachandra - 1 Steve Purcell diff --git a/.config/emacs/lisp/magit/docs/RelNotes/0.8.1.txt b/.config/emacs/lisp/magit/docs/RelNotes/0.8.1.txt deleted file mode 100644 index 95b204f..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/0.8.1.txt +++ /dev/null @@ -1,28 +0,0 @@ -Magit v0.8.1 Release Notes -========================== - -Released 10 June 2010 by Phil Jackson. - -Changes since v0.8.0 --------------------- - - * New library `rebase-mode.el'. Edit Git rebase files. - - * New commands `magit-log-all' and `magit-log-first-parent'. - - * New command `magit-git-command'. Run any Git command. - - * `magit-remote-update' learned to fetch just the current remote. - - * `magit-tag' learned to place the tag on something other than HEAD. - -Authors -------- - - 55 Phil Jackson - 7 Rémi Vanicat - 7 Ævar Arnfjörð Bjarmason - 4 Natalie Weizenbaum - 2 Ramkumar Ramachandra - 1 Mark Hepburn - 1 Moritz Bunkus diff --git a/.config/emacs/lisp/magit/docs/RelNotes/0.8.2.txt b/.config/emacs/lisp/magit/docs/RelNotes/0.8.2.txt deleted file mode 100644 index 9367486..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/0.8.2.txt +++ /dev/null @@ -1,27 +0,0 @@ -Magit v0.8.2 Release Notes -========================== - -Released 10 July 2010 by Phil Jackson. - -Changes since v0.8.1 --------------------- - - * Use shorter more human readable representations for refs. - - * Optionally show refs for remote branches the way Git would. - - * Tell VC to update the mode-line for us. - -Authors -------- - - 21 Phil Jackson - 18 Natalie Weizenbaum - 2 Alan Falloon - 2 Moritz Bunkus - 2 Rémi Vanicat - 1 Alex Ott - 1 Leo Liu - 1 Sean Bryant - 1 Ævar Arnfjörð Bjarmason - 1 Óscar Fuentes diff --git a/.config/emacs/lisp/magit/docs/RelNotes/1.0.0.txt b/.config/emacs/lisp/magit/docs/RelNotes/1.0.0.txt deleted file mode 100644 index 92f9175..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/1.0.0.txt +++ /dev/null @@ -1,84 +0,0 @@ -Magit v1.0.0 Release Notes -========================== - -Released 23 March 2011 by Phil Jackson. - -Changes since v0.8.2 --------------------- - - * New library `magit-key-mode.el'. From a popup buffer dispatch - Magit/Emacs commands which wrap Git commands and select the - arguments passed to Git. Group various sets of related commands - in new menus and adjust them accordingly. - - * New library `magit-svn.el' based on code previously in `magit.el'. - Improve the implementation. Control `git svn' from Magit. - - * New library `magit-topgit.el' based on code previously in - `magit.el'. Improve the implementation. Control TopGit from Magit. - - * Provide a wrapper for `completing-read'. Support using iswitchb to - do completion. - - * Fixed and improved information shown during a rebase. - - * New macro `magit-define-inserter' to define functions which insert - sections. - - * New macro `magit-add-action'. A hook-like extension mechanism for - commands that behave differently based on the type of the section - at point. - - * New macro `magit-define-command'. Like `defun' but also define - a hook in addition to the function/command. If a hook function - succeeds do not run the function body as passed to this macro. - - * New commands `magit-add-change-log-entry' - and `magit-add-change-log-entry-other-window'. - - * New command `magit-change-what-branch-tracks'. - - * New commands `magit-run-git-gui' and `magit-run-gitk'. - - * Various new submodule commands. - - * Various new branch commands. - - * Various new log commands. Remove some old log commands. - - * Make reflog commands more like the log commands. - - * Numerous bugfixes and tweaks. - -Authors -------- - - 197 Phil Jackson - 27 Natalie Weizenbaum - 25 Óscar Fuentes - 22 Moritz Bunkus - 20 Rémi Vanicat - 17 Aaron Culich - 10 Timo Juhani Lindfors - 8 Ramkumar Ramachandra - 8 Ævar Arnfjörð Bjarmason - 6 Yann Hodique - 5 Hannu Koivisto - 5 Julien Danjou - 5 Peter J. Weisberg - 4 Leo Liu - 3 Robin Green - 2 Brian Warner - 2 Christian Kluge - 2 Marc Herbert - 1 Andreas Fuchs - 1 Chris Bernard - 1 David Abrahams - 1 Dominique Quatravaux - 1 John Wiegley - 1 Paul Stadig - 1 Philip Weaver - 1 Remco van 't Veer - 1 Robert Boone - 1 Rüdiger Sonderfeld - 1 Tom Feist diff --git a/.config/emacs/lisp/magit/docs/RelNotes/1.1.0.txt b/.config/emacs/lisp/magit/docs/RelNotes/1.1.0.txt deleted file mode 100644 index 762d202..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/1.1.0.txt +++ /dev/null @@ -1,112 +0,0 @@ -Magit v1.1.0 Release Notes -========================== - -Released 23 December 2011 by Yann Hodique. - -Changes since v1.0.0 --------------------- - - * Added distinct faces for various different kinds of refs. - - * Completely redesigned existing faces. - - * Added library `magit-classic-theme.el' for users who like the old - faces better. - - * Share many more key bindings between all Magit modes. Previously - many commands were only available in certain buffers, even though - they are useful in all Magit buffers. - - * Added library `magit-simple-keys.el' for users who don't like the - popups. - - * Added support for using Ido to do completion. - - * Added support for Ediff. - - * Added shell script `magit'. - - * Added library `magit-bisect.el'. - - * Added library `magit-stgit.el'. - - * Added mode `magit-svn-mode'. - - * Added mode `magit-topgit-mode'. - - * Added mode `magit-rebase-mode'. - - * Added buttons to commit buffer to cycle to commits which were - previously shown. The commands are `magit-show-commit-backward' - and `magit-show-commit-forward. - - * Defined backward compatibility implementations of some Emacs - functions. - - * Type changes are now shown in diffs. - - * Added option `magit-set-upstream-on-push'. - - * Added option `magit-default-tracking-name-function'. - - * Added option `magit-log-auto-more'. - - * Added option `magit-create-branch-behaviour'. - - * Added option `magit-status-buffer-switch-function'. - - * Added option `magit-rewrite-inclusive'. - - * Added options `magit-highlight-trailing-whitespace' and - `magit-highlight-indentation'. - - * Added command `magit-show'. Visit REVISION:FILE. - - * Added command `magit-delete-branch-forced'. - - * Added command `magit-log-edit-toggle-author'. - - * `magit-reset-working-tree' learned to remove untracked files. - - * `magit-push' learned to set the upstream branch. - -Authors -------- - - 152 Peter J. Weisberg - 55 Yann Hodique - 18 Phil Jackson - 18 Pieter Praet - 18 Rémi Vanicat - 12 Moritz Bunkus - 10 Lluís Vilanova - 8 Eli Barzilay - 7 Nicolas Dudebout - 6 Roger Crew - 5 Štěpán Němec - 3 David Abrahams - 3 Hannu Koivisto - 3 Jeff Bellegarde - 3 Rüdiger Sonderfeld - 2 Alan Falloon - 2 Andreas Rottmann - 2 Andrew Kirkpatrick - 2 Craig Andera - 2 Jasper St. Pierre - 1 Andrey Smirnov - 1 Bastian Beischer - 1 Chris Moore - 1 Daniel Brockman - 1 Eric Davis - 1 George Kadianakis - 1 Kimberly Wolk - 1 Luke Amdor - 1 Luís Borges de Oliveira - 1 Marc Herbert - 1 Marco Craveiro - 1 Ramkumar Ramachandra - 1 Steve Purcell - 1 Thomas Jost - 1 Tibor Simko - 1 Tom Feist - 1 Ævar Arnfjörð Bjarmason diff --git a/.config/emacs/lisp/magit/docs/RelNotes/1.1.1.txt b/.config/emacs/lisp/magit/docs/RelNotes/1.1.1.txt deleted file mode 100644 index 21b3baf..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/1.1.1.txt +++ /dev/null @@ -1,25 +0,0 @@ -Magit v1.1.1 Release Notes -========================== - -Released 14 January 2012 by Yann Hodique. - -Changes since v1.1.0 --------------------- - - * `magit-svn-get-local-ref' learned to expand branch specs containing - braces. - - * `magit-log-edit' learned to amend and create commits with no message. - - * Several other fixes and improvements. - -Authors -------- - - 6 Nicolas Dudebout - 6 Yann Hodique - 1 Graham Clark - 1 Justin Caratzas - 1 Peter J. Weisberg - 1 Ryan C. Thompson - 1 Timo Juhani Lindfors diff --git a/.config/emacs/lisp/magit/docs/RelNotes/1.1.2.txt b/.config/emacs/lisp/magit/docs/RelNotes/1.1.2.txt deleted file mode 100644 index 4950edc..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/1.1.2.txt +++ /dev/null @@ -1,33 +0,0 @@ -Magit v1.1.2 Release Notes -========================== - -Released 23 September 2012 by Yann Hodique. - -Changes since v1.1.1 --------------------- - - * Modes now have proper mode-line lighters. - - * Hook variables are now defined semi-explicitly. - - * Uninteresting refs are no longer shown in logs. - - * The deprecated `assoc' library is no longer used. - - * Several other fixes and improvements. - -Authors -------- - - 13 Yann Hodique - 9 Peter J. Weisberg - 2 Jonas Bernoulli - 2 Ramkumar Ramachandra - 1 Bradley Wright - 1 Bryan Shell - 1 Damien Cassou - 1 Eric Davis - 1 John Wiegley - 1 Nic Ferier - 1 Nick Alcock - 1 Rémi Vanicat diff --git a/.config/emacs/lisp/magit/docs/RelNotes/1.2.0.txt b/.config/emacs/lisp/magit/docs/RelNotes/1.2.0.txt deleted file mode 100644 index b27f259..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/1.2.0.txt +++ /dev/null @@ -1,73 +0,0 @@ -Magit v1.2.0 Release Notes -========================== - -Released 23 September 2012 by Yann Hodique. - -Changes since v1.1.2 --------------------- - - * Rewrote the branch manager. - - * Diffs are optionally refined using `diff-refine-hunk'. - - * Added library `magit-blame.el' defining new mode - `magit-blame-mode'. - - * Added library `magit-wip.el' defining new modes - `magit-wip-save-mode' and `magit-wip-mode'. - - * New section movement commands; `magit-goto-next-sibling-section' - and `magit-goto-previous-sibling-section'. - - * Added command `magit-file-log'. - - * Added command `magit-manual-merge'. - - * `magit-delete-branch-force' was merged into `magit-delete-branch'. - - * `magit-move-branch' learned to force the rename. - - * `magit-reset-working-tree' learned to remove ignored files. - - * `magit-pull' learned to set `branch.BRANCH.merge'. - - * `magit-log-edit' learned to respect GIT_AUTHOR_EMAIL, - GIT_AUTHOR_NAME and GIT_AUTHOR_DATE. - - * `magit-visit-item' learned to visit untracked files, diffs and - hunks. - - * Added option `magit-sha1-abbrev-length'. - -Authors -------- - - 157 Yann Hodique - 61 Nicolas Dudebout - 14 Peter J. Weisberg - 12 Jonas Bernoulli - 10 Ryan C. Thompson - 7 Miles Bader - 6 Damien Cassou - 5 Samuel Bronson - 4 Dale Hagglund - 4 Eli Barzilay - 4 Takafumi Arakaki - 4 rabio - 3 Leonardo Etcheverry - 3 Nick Alcock - 3 Rémi Vanicat - 3 Rüdiger Sonderfeld - 2 Graham Clark - 2 Hans-Peter Deifel - 2 Moritz Bunkus - 1 Andreas Liljeqvist - 1 Christian Dietrich - 1 Christopher Monsanto - 1 Daniel Hackney - 1 Hannu Koivisto - 1 John Wiegley - 1 Jonathan Roes - 1 Ole Arndt - 1 Ron Parker - 1 Suhail Shergill diff --git a/.config/emacs/lisp/magit/docs/RelNotes/1.2.1.txt b/.config/emacs/lisp/magit/docs/RelNotes/1.2.1.txt deleted file mode 100644 index 6e255bf..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/1.2.1.txt +++ /dev/null @@ -1,15 +0,0 @@ -Magit v1.2.1 Release Notes -========================== - -Released 23 May 2014 by Jonas Bernoulli. - -Changes since v1.2.0 --------------------- - - * `magit-delete-directory' was rewritten to deal with an incompatible - change in `delete-directory' in Emacs v24.4. - -Authors -------- - - 1 Jonas Bernoulli diff --git a/.config/emacs/lisp/magit/docs/RelNotes/1.2.2.txt b/.config/emacs/lisp/magit/docs/RelNotes/1.2.2.txt deleted file mode 100644 index e529dc9..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/1.2.2.txt +++ /dev/null @@ -1,17 +0,0 @@ -Magit v1.2.2 Release Notes -========================== - -Released 23 October 2014 by Jonas Bernoulli. - -Changes since v1.2.1 --------------------- - - * `magit-delete-directory' uses itself when deleting recursively, - instead of `org-delete-directory' which it was copied from. - - * Many byte-compile warnings were addressed. - -Authors -------- - - 5 Jonas Bernoulli diff --git a/.config/emacs/lisp/magit/docs/RelNotes/1.4.0.txt b/.config/emacs/lisp/magit/docs/RelNotes/1.4.0.txt deleted file mode 100644 index f0f8d9e..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/1.4.0.txt +++ /dev/null @@ -1,231 +0,0 @@ -Magit v1.4.0 Release Notes -========================== - -Released 1 April 2015 by Jonas Bernoulli. - -This release sits in the middle of a commit marathon that lasted for -more than 4700 commits. - -When I became Magit's new maintainer during the summer of 2013 Magit -was already a big success, but underneath its shiny surface it was -having some serious problems. Over the years the source had gotten -very disorganized and many old abstractions were no longer sufficient. -Unfortunately existing code had almost never been adjusted when new -features had been added, leading to a lot of new code that worked -around limitations of existing code. - -This was clearly not sustainable in the long run, and so I started -cleaning up and replacing the existing abstractions with simpler, yet -often more powerful implementations. Unfortunately his had to happen -incrementally as it was seldom possible to cleanup one area without -making substantial changes elsewhere. Along the way I also addressed -many of the hundreds of feature requests, but that was more of a bonus -- the focus was on getting the codebase ready for future improvements. - -At the beginning of 2014 I moved development to the new next branch. -Working on a branch which was not used by thousands of Melpa users -allowed me to move faster and users were no longer affected by the -occasional regression. But it also meant that I now had to maintain -two branches. In hindsight I should have released the master branch -as 1.3.0 at that time, despite all the known defects it had. - -Since then I have finished the cleanup on the next branch and then -moved on to implement many new features. On the master branch the -focus was on bugfixes and the occasional backport. This release is -based on the master branch. Later this spring 2.1.0 will be released -based on the next branch. - -Compiling a list of all changes in 1.4.0 would by a major amount of -work in itself, so instead the below list is for the most part limited -to major changes, which enabled the user visible changes. Many users -don't have to be told about the new features anyway - they have been -using them for more than a year now. - -Changes since v1.2.2 --------------------- - - * The libraries `magit-topgit.el', `magit-stgit.el', and - `magit-svn.el' all reincarnated as separate repository. - - * The libraries `magit-classic-theme.el' and `magit-simple-keys.el', - which allowed users to undo some of the changes in older releases, - were removed. - - * The library `rebase-mode.el' was renamed to `git-rebase-mode.el' - and moved to the `magit/git-modes' repository. - - * The library `magit-log-edit-mode.el' was removed and replaced with - `git-commit-mode.el' from the `magit/git-modes' repository. - - * The functionality provided by the library `magit-bisect.el' was - replaced with a new implementation in `magit.el'. - - * The package `cl-lib` is now used instead of the obsolete `cl'. - - * The library `magit.el' no longer lacks any recognizable structure. - - * The macro `magit-define-command' was removed. - The hook that was defined in addition to the command only served - to make things more complicated and the generated doc-string was - insufficient. - - * The use of "section actions" has been reduced to a minimum. - Commands that behave differently depending on the type of the - current section still use `magit-section-case' or in some cases - even `magit-section-action', but the preferred way for users to - add new variants now is to add a new command to the type-specific - section keymap, instead of the hooks defined by - `magit-section-action'. - - * More work is done directly in `magit-with-section'. - Most of the helper functions were removed. These functions - were not intended to be used directly, but that did not keep - contributors from doing so, leading to many inconsistencies. - - * The mode machinery was massively refactored. - Most importantly the new macro `magit-mode-setup' was added, - replacing the old `magit-mode-init' which forgoes most of the - things each and every of its callers has to do, which let to many - inconsistencies - - * The refresh machinery was massively refactored. - A refresh now has to be requested more explicitly by either calling - `magit-refresh' or one of the functions that call Git and then the - former. Also, refreshing now more often correctly preserves point. - - * Washing diffs now takes less cycles. - Previously the code used to wash diffs was very complicated. It - passed around state using many dynamically bound variables, and - called `git diff' many times. Now we call `git diff' once and then - wash its output in one go. - - * Commits and stashes are now washed using the regular diffwasher. - - * Low-level functions for running Git were massively refactored, and - many new variants were added. Previously many callers had to deal - with the gory details themselves (and usually did it badly). - - * The output from processes is now logged in a dedicated buffer. - From this buffer it's also possible to kill a running process. - - * The Wazzup buffer was massively refactored. - All options to optionally make it faster were removed, as it is now - faster out-of-the-box without sacrificing any functionality at all. - - * Many more competing abstractions were unified. - It was common to have one no longer sufficient core abstraction, and - several competing wrapper abstractions. In most cases this has been - replaced with a single, less complex implementation, which serves all - of the current use cases. - - * Refreshing "after a asynchronous process has run" now happens after - the process has actually finished. That was always the intention, - but not what actually used to happen. - - * The commit message is no longer provided when calling `git commit'. - Instead Git populates a file with a template and then uses $EDITOR - to have the user edit that. This did not work so well for a while - but now we succeed in having the emacsclient being used as $EDITOR. - - * A new Branch Manager was added. - - * Log learned to show optionally show author information in the - margin. - - * Terminology with regards to what a tracking branch is, was fixed. - - * When creating a new branch the default choice is what Git would - default to, instead of some silly name. - - * Tools used to test whether Git supports certain features was removed. - Instead we now require a non-ancient version of Git. - - * The shell script `magit' reincarnated as a separate repository. - -Authors -------- - - 1838 Jonas Bernoulli - 171 Yann Hodique - 121 Pieter Praet - 59 Rémi Vanicat - 24 Nicolas Dudebout - 21 Takafumi Arakaki - 16 acple - 14 Phil Jackson - 13 Rüdiger Sonderfeld - 12 Mitchel Humpherys - 8 Servilio Afre Puentes - 7 Ramkumar Ramachandra - 7 Teruki Shigitani - 6 Lluís Vilanova - 6 Sergey Vinokurov - 5 Thierry Volpiatto - 4 Moritz Bunkus - 4 Noam Postavsky - 4 Seong-Kook Shin - 3 Laurent Laffont - 3 Leonardo Etcheverry - 3 Loic Dachary - 3 Raimon Grau - 3 Sébastien Gross - 2 Bastian Beischer - 2 Damien Cassou - 2 Evgkeni Sampelnikof - 2 Greg A. Woods - 2 Greg Sexton - 2 Jesse Alama - 2 Leandro Facchinetti - 2 Nguyễn Tuấn Anh - 2 Nick Alexander - 2 Pekka Pessi - 2 Philippe Vaucher - 2 Rafael Laboissiere - 2 Sebastian Wiesner - 1 Abdo Roig-Maranges - 1 Adam Spiers - 1 Andrei Chițu - 1 Andrew Schwartzmeyer - 1 Brandon W Maister - 1 Chris Done - 1 Chris Ring - 1 Christopher Monsanto - 1 Cornelius Mika - 1 Dan LaManna - 1 David Hull - 1 Dennis Paskorz - 1 Divye Kapoor - 1 Eric Schulte - 1 Felix Geller - 1 Feng Li - 1 Geoff Shannon - 1 Jan Tatarik - 1 Jeff Dairiki - 1 John Wiegley - 1 Jordan Greenberg - 1 Kyle Meyer - 1 Lele Gaifax - 1 Manuel Vázquez Acosta - 1 Marcel Wolf - 1 Marian Schubert - 1 Matus Goljer - 1 Nick Dimiduk - 1 Nicolas Richard - 1 Peter J. Weisberg - 1 Philipp Haselwarter - 1 Prathamesh Sonpatki - 1 Romain Francoise - 1 Roy Crihfield - 1 Sanjoy Das - 1 Sergey Pashinin - 1 Steve Purcell - 1 Steven Chow - 1 Steven Thomas - 1 Thomas Frössman - 1 Thomas Riccardi - 1 Ting-Yu Lin - 1 Wilfred Hughes - 1 Win Treese - 1 York Zhao - 1 aaa707 - 1 Ævar Arnfjörð Bjarmason diff --git a/.config/emacs/lisp/magit/docs/RelNotes/1.4.1.txt b/.config/emacs/lisp/magit/docs/RelNotes/1.4.1.txt deleted file mode 100644 index 15dc747..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/1.4.1.txt +++ /dev/null @@ -1,31 +0,0 @@ -Magit v1.4.1 Release Notes -========================== - -Released 12 April 2015 by Jonas Bernoulli. - -This is a bugfix release. - -Changes since v1.4.0 --------------------- - - * The external library `magit-log-edit.el' is no longer supported. - If it is still installed, then instruct the user to remove it. - - * The function `magit-maybe-show-setup-instructions' is now run even - when `magit' has not been loaded by the time `after-init-hook' ran. - - * Invalid `:package-version' keywords in option definitions were - fixed. In some cases the value was "2.1.0" instead of "1.4.0". - - * Some unnecessary obsolete-variable definitions were removed. - - * Running tests on Travis CI was fixed. - - * The Makefile, README.md, and release notes received minor fixes - and cleanup. - -Authors -------- - - 9 Jonas Bernoulli - 1 Noam Postavsky diff --git a/.config/emacs/lisp/magit/docs/RelNotes/1.4.2.txt b/.config/emacs/lisp/magit/docs/RelNotes/1.4.2.txt deleted file mode 100644 index b50f1a8..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/1.4.2.txt +++ /dev/null @@ -1,23 +0,0 @@ -Magit v1.4.2 Release Notes -========================== - -Released 8 June 2015 by Jonas Bernoulli. - -This is a bugfix release. - -Changes since v1.4.1 --------------------- - - * Automatic revers of file-visiting buffers now works again in Emacs - version 24.5. It was broken due to an incompatible change in that - Emacs release. - - * Git's reflogs sometimes end with bogus entries. We now work around - that when listing stashes. - -Authors -------- - - 11 Jonas Bernoulli - 1 Peter Vasil - 1 Steven E. Harris diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.1.0.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.1.0.txt deleted file mode 100644 index 85e8d41..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.1.0.txt +++ /dev/null @@ -1,433 +0,0 @@ -Magit v2.1.0 Release Notes -========================== - -Released 1 July 2015 by Jonas Bernoulli. - -This release marks the end of a commit marathon that lasted for more -than 4700 commits. It is the first major release in over two and a -half years. The last major release was 1.2.0, which was released -under old leadership. Version 1.4.0, which I released earlier this -year, for the most part consisted of changes that prepared for this -release (so you might want to read the respective release notes too). - -This release comes with many new and exciting features, but the most -important change is the massive increase in consistency both in the -user interface and the internal abstractions. - -Magit always provided a very intuitive staging interface, which is -vastly superior to `git add --interactive'. This release extends this -to other apply variants. Starting with this release, other areas have -also begun to be more than just incremental improvements over what Git -itself provides. But this is still limited to certain features which -have gotten more attention than others (most prominently rebasing). - -Interlude ---------- - -The code base is finally in a state that allows me to concentrate on -implementing my vision of what version control could be like. But -this will only be possible if, unlike during the last two and a half -years, I am being paid for my work. - -I intend to run a fund-raising campaign, but you can already donate -now (see http://magit.vc/donations.html). I am also looking for -corporate sponsorship and/or employment. One area where Magit -actually lags behind other Git clients is integration with Git hosting -platforms and code review tools. I hope that these platforms have an -interest in being supported by the best Git client and are willing to -pay for it. - -I am very interested in a job that would let me work on Magit *and* on -other projects, which would benefit from the skills I have acquired -integrating two complex systems and dealing with all the social and -technical challenges that arise when running a popular project. - -Changes since v1.4.0 --------------------- - - * A new manual has been added. It's much more comprehensive than the - old manual and instead of just documenting the various commands and - options, it also explains concepts and plumbing functions, and - comes with extensive indices for commands, functions, and options. - - Actually three new manuals were added; the packages `magit-popup' - and `with-editor' are documented in separate manuals. - - The manuals are written in Org mode and then exported to Texinfo. - - * Performance is much better now. In most cases this was achieved by - delaying work until it is actually needed. Most importantly diffs - are only partially washed until being fully expanded. Some - features come in a fancy and in a fast variant; when that is the - case, we now usually default to the fast variant. - - * Many options can now be set on a per-repository basis, and the - manual describes how to do so. (Actually this was always possible - but, because it was undocumented, nobody did it.) It's possible to - define "repository classes", e.g. "huge repositories", and then add - the respective repositories to that class. This is very useful in - order to turn off certain features only in repositories where they - would have a negative impact on performance, without having to do - it for each repository individually. - - * Many faces have been simplified. Most importantly, section heading - faces no longer set a background color (except for hunk headings) - and instead just use the default background. Refname faces no - longer set the background color or the box property. - - * Many, probably the majority of, functions, variables, and faces - have been renamed, which was necessary because there was very - little consistency before. - - Most importantly, the names of commands and options now begin with - a prefix that includes the name of the respective git sub-command. - For example, the names of all commands and options related to - diffing now begin with `magit-diff-'. - - Many plumbing functions and variables were also renamed. In some - cases, that also lead to shared prefixes, such as `magit-process-', - `magit-mode-', `magit-git-', and `magit-insert-'. But many - plumbing functions and variables continue to use names whose only - common part is the `magit-' prefix. - - Future renames will be performed at well defined times and obsolete - function/variable definitions will be provided for backward - compatibility. No renames are planned at present. - - * The external libraries `git-commit-mode.el' and `git-rebase-mode.el' - are no longer required and have to be uninstalled because they - conflict with their successors `git-commit.el' and `git-rebase.el', - which are now maintained inside the Magit repository instead of the - Git-Modes repository. - - The library `git-commit.el' can be used without Magit, so it is - distributed as a separate Elpa package. However, `git-rebase.el' - now depends on several Magit libraries and is therefore distributed - as part of the `magit' package. - - * The library `magit-key-mode.el' was removed and replaced with - `magit-popup.el'. The new implementation is much more flexible and - easier to use than the old one. Major new features include setting - default arguments directly inside the popup and macros for defining - new popups and extending existing popups. - - This new library can also be used by packages that are not related - to Magit and is therefore available as a separate Elpa package. - - * The library `with-editor.el' was added. Its purpose is to use the - emacsclient as $GIT_EDITOR when git is started as a subprocess and - requires an editor. This is used while committing and rebasing. - This also works over Tramp, where a "sleeping editor" shell script - is used to communicate over standard output instead of a socket - like the emacsclient does. - - The `1.4.0' release already supported this, but this release splits - this feature into a separate library. And now that it is a separate - library, it can also be used by packages that are not related to - Magit. `with-editor.el' is distributed as a separate Elpa package. - - * All libraries are now located in the new `lisp/' subdirectory. - - * The library `magit.el' has been split into many new libraries. - The code base is now much better organized. Together with the - description of plumbing commands in the manual, this should make it - much easier for contributors to get started. - - * The library `magit-wip.el' has been rewritten from scratch and no - longer depends on the external and unmaintained shell script from - https://github.com/bartman/git-wip. - - * There are now three different modes that commit to the - work-in-progress refs before/after certain events, and in addition - to the old working tree wip refs, these modes now also commit to - index wip refs. When these new modes are turned on, Git's - protection of committed (but dangling) changes is effectively - extended to uncommitted changes (which some exceptions). These - modes are not enabled by default due to performance concerns. - - * The library `magit-blame.el' has been rewritten from scratch. The - new implementation can blame recursively, jump to the next/previous - chunk from the same commit, replace headings with separator lines, - scroll the revision buffer for the chunk at point (like log buffers), - and fine-tune the arguments for `git blame' using a popup. - - * The new library `magit-ediff.el' replaces the old Ediff support. - The new implementation comes with a dwim command and a popup, and - it relies less on high-level functions provided by VC and Ediff - itself, because many of those turned out to be unsuitable. - - * The popular third-party library `dash.el' is now required. This - is the only mandatory external dependency now, except for Git and - Emacs themselves, of course. - - * When using Ido inside Magit, users now have to install the - third-party library `ido-completing-read+.el'. This is necessary - because the function `ido-completing-read', which is part of the - built-in library `ido.el', is not a sufficient drop-in replacement - for `completing-read'. - - * The new macro `magit-insert-section' replaces `magit-with-section'. - The macros `magit-cmd-insert-section' and `magit-git-insert-section' - were removed without a direct replacement. - - * The new functions `magit-insert' and `magit-put-face-property' take - care of working around the fact that negative overlay priorities - are not supported, i.e., that overlays always take precedence - against text properties. Previously this was done in various - places, and not always correctly (e.g., in some cases overlays did - not evaporate). - - * The section visibility and movement commands were rewritten from - scratch. All those commands now share the prefix `magit-section-' - and edge cases are handled better. New commands were added that - allow cycling the visibility of sections and their children. From - a user perspective Magit's section handling is now quite similar to - that of Org mode. - - * The macro `magit-section-action' was removed. The related macro - `magit-section-case' still exists and will continue to do so. The - action variant provided user-customizable hooks, but these hooks - were rarely, if ever, used. Instead of such action hooks, users who - wish to extend Magit now have to use type-specific section keymaps. - - * Section highlighting was rewritten from scratch. The new - implementation uses hooks to allow washing certain section types - differently than others - without obfuscating the simple cases. - Washing diffs is much more complicated than washing all other - sections, and that part has been factored out. The washing of - all other section types is now quite simple. - - * The appearance of the region now indicates whether it is valid as a - selection. As far as Magit is concerned, valid selections are hunk - internal regions and regions that mark sibling sections of the same - type. When a region does not satisfy one of these, then it is - displayed the sames as in other buffers and Magit cannot act on it. - - * The new option `magit-no-confirm' makes it easy to forgo having to - confirm potentially dangerous actions. Many of these actions are - only dangerous for users who don't know how to undo them. When the - wip modes are turned on, many more previously fatal actions can be - easily undone. Adding `safe-with-wip' here makes it unnecessary to - confirm these actions. - - * The new Refs buffer combines the features of the old Wazzup and - Branch Manager buffers into one, more powerful and efficient - synthesis. For each reference, cherries can be shown by expanding - the ref section, but unlike in the Wazzup buffer, the cherries are - not calculated until the expansion happens, making it vastly more - efficient. Besides local and remote branches, the buffer now also - lists tags, and users can add additional sections listing other - refs, e.g., stashes. The format of refs headers is now - customizable. - - * File-visiting buffers are now reverted without using code from the - built-in `autorevert.el` library. The function we previously used - was intended for internal use only and indeed, changes made there - broke Magit in the past. - - * The new option `magit-revert-buffers' controls whether and how - buffers visiting tracked files are reverted. As before, such - buffers are reverted by default. But by default this is now done - rather noisily to encourage users to read the doc-string and - pick what is right for them. It's now also possible to revert - asynchronously and for the user to be asked every time there are - buffers that could be reverted. This option replaces - `magit-auto-revert-mode`. - - * Many new section inserters are available. Some are variations of - default inserters; `magit-insert-unpulled-cherries', for example, is - like `magit-insert-unpulled-commits' but prefixes each commit with - "+" or "-" to indicate its "cherry state". Other inserters are - completely new (e.g., `magit-insert-unpulled-module-commits'). - - * The header sections in status buffers can now be customized using - the new `magit-status-headers-hook'. This is an additional section - insertion hook; separating it from `magit-status-sections-hook' - gives users complete control over what information is displayed in - the headers, while still making the first header the parent section - of all the other header lines. - - * Many commands that previously could only act on the section at - point can now act on all sections selected by a region, which can - span sibling sections of the same type. - - * Many commands now more intelligently dwim based on the section at - point. - - * Where it makes sense, completion and confirmation have been merged - into a single user action. Many commands that previously allowed - carrying out or aborting some action now also allow the user to act - on something different from the default choice. Where one - previously had to confirm with `yes RET', one now confirms with just - `RET' (to accept the default choice, which previously was the only - choice). - - * The distinction between the various "apply variants" has been - clearly worked out, and they now all provide the same feature set. - The variants are: stage, unstage, discard, reverse, and "regular - apply". In all cases, it is possible to act on a file or hunk, or - part of a hunk. When acting on the hunk level, all variants are - implemented on top of `git apply', thus the name "apply variants". - - Un-/staging has always been one of Magit's most beloved features, - and this release takes it to the next level by making the other - apply variants just as consistent, powerful, and intuitive to use. - - All apply variants are context aware, meaning that, for example, the - stage variant knows that an already staged change cannot be staged. - That leads to better error messages. - - * The committing prefix now features additional variants. It was - already possible to quickly create a fixup or squash commit; the - new variants do that and then also instantly perform a rebase to - actually combine these commits with their intended target commits. - - * Rebase sequences are now initiated from the new rebasing prefix. - Several rebasing variants exist, of course including basic - "rebase onto something" and interactive rebase. Other variants - automatically detect and combine squash and fixup commits with - their intended targets. Others let the user edit or reword a - single commit, without having to go through the steps that are - irrelevant in these cases. - - * When a rebase sequence stops at a commit, then the rebasing prefix - instead features suffix commands for continuing, editing, or - aborting the sequence; or skipping the current commit. - - * When a rebase sequence stops, the status buffer displays a list of - the already applied and yet-to-be applied commits. These commits - can be acted on like those in logs. - - * Cherry-picking, reverting, and applying patches using `git am' are - treated the same way as rebasing. A prefix command features - several variants to initiate the sequence. When a sequence is in - progress, then the same prefix instead features suffix commands for - continuing or aborting the sequence, and the status buffer lists - the relevant commits. - - * The magit-specific "rewriting" feature has been removed because it - was a hybrid of "rebasing" and "cherry-picking" and vastly - inferior to both of them. - - * The merging prefix features several new convenient merge variants. - - * Merges can now be previewed before actually carrying them out. - - * When a merge results in conflicts then the commits being merged are - listed in the status buffer, making it easier to review conflicting - changes in the context they were created. - - * Its now possible to discard one side of a conflict directly from - the hunk containing the conflict, using the regular discard key - `k'. It's also possible to restore a conflict. - - * When using an existing branch as the starting-point of a new - branch, it is now automatically configured as the upstream branch. - - * The branching prefix now features suffix commands for un-/setting - the upstream branch. Previously this was coupled with pushing in - a truly obscure way. - - * Branch descriptions can now be displayed in the refs or status - buffer, and the description can be edited using a suffix command - from the branching prefix. - - * The URL of a remote can now be changed from the remoting prefix. - - * A new pulling prefix command was added, which features several new - pulling variants. Previously only one pulling command existed and - it had to be controlled using prefix arguments, which was very - cumbersome. - - * A new pushing prefix command was added, which features several new - pushing variants. Previously only one pushing command existed and - it had to be controlled using prefix arguments, which was very - cumbersome. - - * The various tagging commands are now suffix commands of the new - tagging prefix command. - - * It is now possible to stash, or create a snapshot from, just the - staged or the unstaged changes, instead of both. Suffix commands - for branching, listing, and showing stashes were added to the - stashing prefix - - * When creating stashes the new implementation in `magit-wip.el' is - used instead of `git stash'. This allows the user to create - snapshot stashes without touching any files in the working tree. - - * The submodule prefix now features new suffix commands for adding, - setting up, and fetching modules. - - * Submodules with unmerged commits can now be displayed in the status - buffer. Sections representing submodules can be expanded to show - their unpulled commits. These commits can be acted on like commits - belonging to the super-project. - - * Support for displaying diffs inside the log buffer instead of in a - separate diff buffer has been removed. It might come back one day, - but the old implementation had just fallen behind regular one-line - log too much. - - * The logging prefix features many new infix arguments and suffix - commands, which can now be combined in more flexible ways than - before. - - * Many commands that previously read a single commit, branch, or - file in the minibuffer, can now read multiple, comma-separated items - from the user, while providing completion candidates for all of - them. Likewise, when selecting a range, completion is available - for the second commit too. - - * All of Git's reset variants are now exposed as individual commands, - but not all of them have a key binding by default. - -This was just the tip of the iceberg. - -Authors -------- - - 2187 Jonas Bernoulli - 28 Sebastian Wiesner - 25 Kyle Meyer - 19 Noam Postavsky - 17 Pieter Praet - 12 Rémi Vanicat - 9 Florian Ragwitz - 5 Philippe Vaucher - 5 Ramkumar Ramachandra - 4 Cornelius Mika - 4 Kan-Ru Chen - 4 Syohei Yoshida - 3 Alex Dunn - 3 Alex Kost - 3 Nicolas Richard - 2 Eric Schulte - 2 Ingo Lohmar - 2 Mitchel Humpherys - 2 Peter Eisentraut - 2 Ryan C. Thompson - 1 Adeodato Simó - 1 Andrew Schwartzmeyer - 1 Andy Sawyer - 1 Bradley Wright - 1 Guillaume Martres - 1 John Mastro - 1 John Wiegley - 1 Julien Danjou - 1 Lingchao Xin - 1 Mark Oteiza - 1 Michael Fogleman - 1 Michael Griffiths - 1 Michal Sojka - 1 Natalie Weizenbaum - 1 Oleh Krehel - 1 Peter Vasil - 1 Rüdiger Sonderfeld - 1 Steven E. Harris - 1 Teemu Likonen - 1 Thomas A Caswell - 1 Tim Perkins - 1 Tim Wraight - 1 Wei Huang - 1 Xavier Noria diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.10.0.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.10.0.txt deleted file mode 100644 index bb42609..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.10.0.txt +++ /dev/null @@ -1,85 +0,0 @@ -Magit v2.10.0 Release Notes -=========================== - -Released 4 January 2017 by Jonas Bernoulli. - -We are pleased to announce the release of Magit version 2.10.0, -representing 85 commits by six people over one month. - -Also see https://emacsair.me/2017/01/04/magit-2.10. - -Changes since v2.9.0 --------------------- - -* Many new, well organized, libraries were added, consisting of code - that was previously located inside a messier "magit.el". #2908 - -* The function `magit-display-buffer' now sets the focus on the frame - used to display the selected window. #2865 - -* The Custom groups are better organized now. New groups were added, - but many options also moved between groups that already existed - before. 422d776e, 33c5c1ca - -* Many Custom groups and options now link to the relevant Info nodes - and to other relevant groups. 810d7fb4 - -* Many doc-strings were improved, added, and fixed. 47aae617 - -* Added the function `magit-repolist-column-dirty', which can be added - to `magit-repolist-columns' and `magit-submodule-list-columns'. #2907 - -* The obsolete variable `magit-repository-directory-depth' is no - longer defined as an option. 09993c39 - -* The obsolete hook variable `magit-status-refresh-hook' is no longer - defined explicitly. 7e96e831 - -Fixes since v2.9.0 ------------------- - -* Customizations of hooks were ignored, if the `custom-set-variables' - form was evaluated before the Magit libraries were loaded. #2902 - -* When rebase stopped at a commit, point was no longer placed on that - commit. #2884 - -* When creating a commit, `magit-display-buffer-fullcolumn-most-v1' - filled the entire frame, hiding the commit message buffer. #2891 - -* The commands `magit-reflog' and `magit-reflog-current' reported - a revision's reflog as empty when the name of a file in the - repository, relative to the top-level directory, matched the - revision name. 5264ffcb - -* The function `magit-repolist-column-upstream' returned the current - branch instead of its upstream. 46acbd6d - -* The functions `magit-repolist-column-unpulled-from-upstream' and - `magit-repolist-column-unpushed-to-upstream' raised a type error - if the upstream was configured but did not exist. #2904 - -* The default values of the options `magit-submodule-list-columns' - and `magit-repolist-columns' didn't match the documentation and the - Custom type. But the code that that uses these values is resilient - against that defect and so the only effect was that the values were - reported as mismatched in the Custom interface. 79f6af23 - -* The Custom type of option `magit-update-other-window-delay' didn't - match the default value. eb6d8bde - -* The shell command generated by `magit-emacs-Q-command' could end - up trying to load a directory as a library, due to a bug in Emacs. - 83980c66, debbugs#16406 - -This release also contains documentation updates and typo fixes. - -Authors -------- - - 68 Jonas Bernoulli - 13 Kyle Meyer - 1 Aleksey Uimanov - 1 Alexander Gramiak - 1 Noam Postavsky - 1 Wouter Bolsterlee diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.10.1.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.10.1.txt deleted file mode 100644 index 7f90600..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.10.1.txt +++ /dev/null @@ -1,57 +0,0 @@ -Magit v2.10.1 Release Notes -=========================== - -Changes since v2.10.0 ---------------------- - -* The command `ido-enter-magit-status' is now being autoloaded. #2918 - -* The minor-mode `bug-reference-mode' is now being suggested when - customizing `magit-revision-mode-hook' and `git-commit-setup-hook'. - e0d57c49 - -* The function `magit-version' can now deal with the Magit libraries - being symlinked to, which is required for the new `straight' package - manager. #2967 - -Fixes since v2.10.0 -------------------- - -* When multiple stashes were selected by the region, responding "no" - when asked to confirm the deletion of these stashes resulted in a - type error. #2917 - -* The function `magit-split-range' choked on ranges if one of the - revisions was omitted, breaking a diff variant and potentially - other uses as well. #2928 - -* The function `magit-commit-setup' called without an argument, which - causes the option `enable-local-variables' to be ignored. #2946 - -* When committing inside a repository that was created using `git - init --separate-git-dir', the diff buffer was empty, instead of - showing the changes about to be committed. For some reason that - git command, unlike other commands that do essentially the same - thing, does not set `core.worktree', which confused Magit. #2955 - -* In the repository list buffer, the columns that are supposed to list - unpushed and unpulled commit counts, were blank. #2960 - -* The command `magit-reflog-head' did not properly format reflog lines - for branch renaming events. 2a268e20 - -* The commands `magit-diff-show-or-scroll-down' and - `magit-diff-or-scroll-up' scrolled instead of updated the revision - or stash buffer, when that already showed the requested reference - but that reference no longer pointed at the same revision. #2966 - -This release also contains typo fixes and other documentation fixes. - -Authors -------- - - 16 Jonas Bernoulli - 4 Kyle Meyer - 2 Alex Kost - 1 Kévin Le Gouguec - 1 Radon Rosborough diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.10.2.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.10.2.txt deleted file mode 100644 index bcaa040..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.10.2.txt +++ /dev/null @@ -1,47 +0,0 @@ -Magit v2.10.2 Release Notes -=========================== - -Changes since v2.10.1 ---------------------- - -* The new command `git-rebase-noop' adds a noop action during a - rebase. It can be used to make git perform a rebase even if none - of the commits are selected. #2991 - -Fixes since v2.10.1 -------------------- - -* Cherry-picking a commit with multiple parents was not possible, - because "--mainline" was treated as a switch rather than an option, - and because of a too-strict assertion that only single-parent commits - can be cherry-picked. #2978 - -* `magit-abbrev-length' mishandled two edge cases, returning 0 when - called within an empty repository or outside of a repository. - 077740f5 - -* A bug fix in the last release broke the visit-file functionality in - diff buffers displayed while committing. #2988 - -* Diff buffers did not recognize "rev^-n" as a short-hand for - "rev^n..rev" (new in Git v2.11), resulting in the buffer header - incorrectly indicating that the diff was between "rev^-n" and the - working tree. 293f0cc8 - -* In diff buffers created using the dotted range notation, the command - `magit-diff-visit-file' incorrectly swapped which revision was - visited for deleted and added lines. For example, with the range - "rev1..rev2", calling `magit-diff-visit-file' on a deleted line - visited the blob for rev2. c24f32cd - -This release also contains other minor improvements, bug fixes, and -documentation fixes. - -Authors -------- - - 10 Jonas Bernoulli - 9 Kyle Meyer - 1 Ben North - 1 Fabian Wiget - 1 Mark Oteiza diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.10.3.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.10.3.txt deleted file mode 100644 index 1a77c40..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.10.3.txt +++ /dev/null @@ -1,41 +0,0 @@ -Magit v2.10.3 Release Notes -=========================== - -Changes since v2.10.2 ---------------------- - -* The new command `magit-do-async-shell-command' opens the file at - point with `dired-do-async-shell-command'. "&" is now bound to - this command. #2992 - -Fixes since v2.10.2 -------------------- - -* The command `magit-bisect-run' now uses a shell to run the command - entered in response to the "Enter shell command" prompt. #3001 - -* Discarding a renamed file failed if the original file was within a - directory that no longer existed. #2998 - -* When inserting information about a rebase in progress into the - status buffer, "exec" lines were treated as a commit, leading to an - error. #3002 - -* The command `magit-blame' failed in blob-visiting buffers if the - corresponding file no longer exists in the HEAD or the index. - -* The command `magit-remote-add' asked whether to set the new remote - as the `remote.pushDefault', when that variable is already set and - and it was configured not to ask in that case. 4f565039 - -This release also contains typo fixes and documentation improvements. - -Authors -------- - - 10 Jonas Bernoulli - 2 Kyle Meyer - 1 Basil L. Contovounesios - 1 Damien Cassou - 1 Duianto Vebotci - 1 Noam Postavsky diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.11.0.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.11.0.txt deleted file mode 100644 index 5ceb776..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.11.0.txt +++ /dev/null @@ -1,210 +0,0 @@ -Magit v2.11.0 Release Notes -=========================== - -Released 13th September 2017 by Jonas Bernoulli. - -I am pleased to announce the release of Magit version 2.11.0, -representing 303 commits by 26 contributors over six months. - -Also see https://emacsair.me/2017/09/12/magit-2.11. - -Changes since v2.10.3 ---------------------- - -* The popup `magit-remote-popup' now exposes the `-f' switch for `git - remote add', which allows the user to control whether information - from the remote is fetched after the remote is added. The default - behavior is still to fetch after adding a remote (i.e., the switch - is enabled by default). #2997 - -* Added option `magit-list-refs-sortby' to allow more control over the - order of refs in prompts. #2872 - -* The Magit wrappers around the default Emacs completion functions now - override the default behavior of alphabetically sorting choices when - displaying them in the "*Completions*" buffer. In repositories with - many release tags, the new behavior prevents completion prompts from - being dominated by version tags instead of branch names. #2925 - -* The commands `magit-git-command', `magit-git-command-topdir', - `magit-shell-command', and `magit-shell-command-topdir' now use - `read-shell-command' to read the command and a shell to run it. - Packages like `pcmpl-git' and `bash-completion' can now be used - to get command-line completion when using these commands. #2951 - -* The commands `magit-git-command' and `magit-git-command-topdir' can - now call arbitrary commands. The initial-value when reading the - command is "git ", and you can remove that to call something else. - #2951 - -* Added option `magit-shell-command-verbose-prompt'. #2951 - -* The function `magit-branch-or-commit-at-point' now offers the - appropriate default choice in a `magit-merge-preview-mode' buffer - and in blob-visiting buffers. #3039, #3066 - -* On Travis tests are now run against all supported Emacs releases, as - well as against snapshots of the `master' and `emacs-25' branches. - #3046 - -* Added command `magit-debug-git-executable'. #3044 - -* Added new function `magit-display-file-buffer-other-window' to be - used as `magit-display-file-buffer-function'. - -* Added `--mainline' switch to `magit-revert-popup'. #3018 - -* Added `magit-file-checkout' to `magit-reset-popup'. #3052 - -* When a revision is shown from a log buffer, the revision buffer now - inherits the file restriction of the log buffer. #3056 - -* Added new command `magit-diff-toggle-file-filter'. #3062 - -* Added new option `magit-use-sticky-arguments' that provides more - control over how diff and log commands reuse arguments from existing - buffers. #3074 - -* Added imenu support in log, revision, and status buffers. #3022 - -* Added command `magit-abort-dwim` to abort the current operation. - Depending on the context, this will abort a merge, a rebase, a - patch application, a cherry-pick, a revert, or a bisect. #3017 - -* The command `magit-clone' now suggests a directory name that more - closely follows `git clone' when no directory is given. #3079 - -* The commands `magit-subtree-add', `magit-subtree-pull', and - `magit-subtree-push' now offer more completion candidates. #3081 - -* The log buffer now shows the line range restriction (i.e., `-L' - argument) in its header. #3075 - -* Added new functions `magit-repolist-column-branches' and - `magit-repolist-column-stashes', which insert the count of branches - and stashes into submodules and repository list buffers. By default - they are used in submodule lists but not in the repository list. - -* Text inside brackets in commit messages (including when shown in a - log) are now highlighted using face `magit-keyword'. - -* Invocations of git are cached over the whole body of - `magit-run-git', not just during the status buffer refresh. This - should make staging and unstaging slightly faster. #3096 - -* When reading a value for the `--reuse-message' option, the popup - `magit-commit-popup' now prompts with all ref names, offering - `ORIG_HEAD' as the default if it exists. #3110 - -* Added bookmark support in status, refs, log, reflog, stashes, - cherry, diff, revision, stash, and submodule-list buffers. #3113 - -* Added new function `magit-insert-modules', a wrapper around the - existing `magit-insert-modules-*' functions. Also added options - `magit-module-sections-hook' and `magit-module-sections-nested', - to allow tuning the behavior of this function. #3141 - -* Renamed function `magit-insert-submodules' to - `magit-insert-modules-overview' for consistency with other - `magit-insert-modules-*' functions. #3141 - -* Inserting module sections is much faster now. #3141 - -* Added `--no-verify' switch to `magit-rebase-popup'. #3144 - -* The `--no-verify' switch in `magit-commit-popup' is now bound to "h" - instead of "n" for consistency with `magit-push-popup' and - `magit-rebase-popup'. #3144 - -* Added support for the file "EDIT_DESCRIPTION", which is used instead - of "BRANCH_DESCRIPTION" for editing a branch's description as of Git - 2.13.0. #3149 - -Fixes since v2.10.3 -------------------- - -* Rebasing was sometimes interrupted by an error about the index lock - already being held. This happened because VC asynchronously checks - for files with conflict, which involved using a git command that - grabs the lock. Magit now redefines that VC command to use a git - command that does not grab the lock. #2708, debbugs#21559 - -* Adding an untracked subdirectory as a submodule failed if a remote - was not configured for the subdirectory repository. #3047 - -* Parsing the log buffer failed if the log displayed a ref that - contained parentheses in its name. #3028 - -* Parsing the `git show' and `git log' output for a signed commit - failed with the Git variable `log.showSignature' enabled. #3061 - -* When deleting the current branch, `magit-branch-delete' did not ask - for confirmation in some cases. #3058 - -* When using a non-standard `magit-display-file-buffer-function' that - does not select the window used to display the buffer, then the - point in that window was not adjusted. #3082 - -* `git-rebase-mode' did wrongly assume that there is no space after - the comment character in action lines that are commented out. #3085 - -* The command `magit-show-commit' mistakenly displayed a tag's commit - when point was on a branch with the same name. #3098 - -* The command `magit-log-buffer-file' miscalculated line numbers from - the region. #3075 - -* Staging a link failed when it points to a repository. - -* When setting the upstream of a branch that isn't the current branch, - the user was asked what branch to use as the upstream of the current - branch anyway, even though the correct branch would then be modified. - -* When deleting a branch that is merged into the current branch but - not into its own upstream branch, then the user was not offered to - force the deletion, causing it to fail. #3107 - -* With `find-file-visit-truename' set to a non-nil value, the commands - `magit-status' and `magit-init' failed to detect when their - directory argument was a symlink that resolved to the output of - `magit-toplevel'. #3115 - -* Using an url instead of a remote name as `branch..remote' was - not properly supported, causing issues when trying to pull or push. - #3116 - -* The log margin displayed invalid information for cherries. #3163 - -This release also contains the fixes described in the v2.10.{1,2,3} -release notes, as well as other minor improvements, bug fixes, typo -fixes, and documentation fixes. - -Authors -------- - - 148 Jonas Bernoulli - 93 Kyle Meyer - 15 Damien Cassou - 15 Noam Postavsky - 5 Basil L. Contovounesios - 3 Justin Guenther - 2 Alex Kost - 2 Duianto Vebotci - 2 Radon Rosborough - 2 Štěpán Němec - 1 Adam Benanti - 1 Allen Li - 1 Ben North - 1 Erik Anderson - 1 Eyal Lotem - 1 Fabian Wiget - 1 Ioan-Adrian Ratiu - 1 Jeremy Meng - 1 Justin Burkett - 1 Justin Thomas - 1 Kévin Le Gouguec - 1 Marc Sherry - 1 Mark Karpov - 1 Mark Oteiza - 1 Sean Whitton - 1 Yuri Khan diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.12.0.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.12.0.txt deleted file mode 100644 index 5f1980b..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.12.0.txt +++ /dev/null @@ -1,645 +0,0 @@ -Magit v2.12.0 Release Notes -=========================== - -Released 29th March 2018 by Jonas Bernoulli. - -I am pleased to announce the release of Magit version 2.12.0, -representing 610 commits by 30 contributors over six months. - -Also see https://emacsair.me/2018/03/29/magit-2.12. - -Upcoming breaking changes -------------------------- - -* An upcoming release will remove support for older versions of Emacs. - It isn't yet certain in what Magit release that will happen and what - the new minimal version of Emacs will be. You should consider to - update to the latest Emacs release now, or at least to v25.1, which - was released one and a half years ago. - -* Likewise support for older versions of Git is going to be removed. - You should update to at least v2.4, which was released almost three - years ago. Older releases don't get security updates anymore, which - is another reason to update. - -* The option `magit-no-confirm-default' has been demoted to a variable - and will be removed in v2.13.0. Please migrate your customizations - to the new option `magit-dwim-selection'. #3232 - -Changes since v2.11.0 ---------------------- - -* Added new commands `magit-previous-line' and `magit-next-line' as - substitutes for `previous-line' and `next-line'. Magit's selection - mechanism is based on the region but selects an area that is larger - than the region. This causes shift-selection to select two lines on - the first invocation when using the vanilla commands. On section - headings and inside hunk bodies the new magit-specific variants - don't move point on the first invocation and thereby they only - select a single section or line. Which inconsistency you prefer - is a matter of preference. #2912 - - To use the Magit-specific variants add this to your init file: - - (define-key magit-mode-map [remap previous-line] 'magit-previous-line) - (define-key magit-mode-map [remap next-line] 'magit-next-line) - -* The command `magit-refs-popup' now remembers arguments and they are - displayed in the header-line of `magit-refs-mode' buffers. The popup - command still invokes the default action by default when invoked from - another buffer, but when invoked from a `magit-refs-mode' buffer it - now shows the popup. #2898 - -* The module overview section now shows a hash for modules that don't - have a tag and column alignment is optimized. #3160 - -* The diff that is being displayed while committing learned about a - few more special cases. #3095 - -* Added new command `magit-branch-or-checkout' as a potential - substitute for `magit-checkout'. Setup instructions can be found in - the manual. #3104 - -* Added new customizable options `magit-log-highlight-keywords' and - `magit-diff-highlight-keywords', which control whether text inside - brackets is highlighted in magit-log and magit-diff buffers - respectively. #3190 - -* When the names of Magit buffers are not uniquified then their names - now end with an asterisk. When the `uniquify' package is used, then - that still is not possible due to limitations in that package. #2841 - -* When selecting a fixup target then the log graph, which makes it - less likely that you attempt to modify a merged commit, which would - result in the merges being lost when rebasing. c0209c74d - -* Added the existing commands `magit-blame' and `magit-blob-next' to - the `magit-file-popup' popup. - -* Added new command `magit-blame-reverse'. See the updated manual - for information on how to best use this and other blaming commands. - #3055 - -* Keywords in brackets are now being highlighted in `magit-refs-mode' - and `git-rebase-mode' buffers, and the headers of `magit-status-mode' - buffers, like they already were in logs. #3179 - -* Added new variable `magit-buffer-lock-functions' to support - third-party packages in creating Magit-like buffers. #3191 - -* Improve padding of head-line and add new faces `magit-header-line-key' - and `magit-header-line-log-select'. #3194 - -* When a stash has a note attached to it, then show it in the - `magit-stash-mode' buffer. aff2fba8f - -* Added new command `magit-rebase-remove-commit' to the rebase popup. - -* The remote popup can now be used to set various remote related - variables. #3165 - -* Added new commands `magit-patch-apply' and `magit-patch-apply-popup'. - The latter is available from inside `magit-am-popup' ("w"). #2940 - -* Added new command `magit-patch-save' for saving a diff into a patch - file. In diff buffers it is bound to "C-x C-w". #2950 - -* Added new command `magit-stash-branch-here', which — unlike the - existing `magit-stash-branch' — creates a branch that starts at - the current HEAD instead of at the commit that was current when - the stash was created. #2935 - -* Added new command `magit-dired-log' intended to be bound in - `dired-mode-map'. #3011 - -* The list of rebase actions displayed in the status buffer now also - shows "exec" actions. #3003 - -* While it exists, the stash created by `git rebase --autostash' is - now also displayed in the list of stashes. #3146 - -* When the current branch has no upstream or when all commits have - already been pushed there, then the status buffer now shows - `magit-log-section-commit-count' recent commits. If you previously - used `magit-insert-unpulled-from-upstream-or-recent', then remove - that from `magit-status-sections-hook', as it is an obsolete alias - for `magit-insert-unpulled-from-upstream' now. #3227 - -* When switching between showing "Unmerged into " and - "Recent commits", preserve the visibility of that section. #3227 - -* When prompting for a branch to delete, the current branch is no - longer offered as default choice, except in cases where it is likely - that that is actually what the user wants. #2924 - -* Added new popup `magit-worktree-popup' and bound "%" to it. #2927 - -* The commands `magit-file-delete' and `magit-file-untrack' now act on - the selected files and with a prefix argument they force the action. - #2930 - -* When requesting the history of a single file that is no longer being - tracked, use the `--full-history' argument. Otherwise no history at - all would be shown. #3012 - -* Added new option `magit-patch-save-arguments'. #3218 - -* Leading tabs in files no longer cause misalignment in diffs. This - is done by overriding the mechanism used by the display engine to - determine how wide a tab should be, which doesn't work when there - are additional characters before the "leading" tabs that should - count as an additional, but very short tab-stop. #3185 - -* The command `magit-visit-ref' now drops the prefix argument before - calling `magit-show-commit' when appropriate, and when using the - `create-branch' variant and the branch exists, then it offers to - simply checking it out instead of resetting it first. #3009 - -* The output of `magit-list-repositories' is now sorted by module path - instead of module name. b6f6cf4a6 - -* For a long time Magit has supported selecting two or more sibling - sections using the region and then acting on that selection instead - of only on the current section. Single-section selections were not - supported and a region that did not span multiple siblings was not - visualized as a selection. Now that is supported. - - Not every section-aware command was adjusted to take single-section - selections into account because in many cases that would have led to - undesired changes in behavior. #3026 - -* The command `magit-branch-spinoff' now spins off just HEAD when that - constitutes the single-section selection. Previously one could only - spin off all commits that weren't in the upstream yet or at least - two commits. #2920 - -* Added switch `--local-user' to the tag popup. #3237 - -* When discarding untracked files, then offer to delete the buffers - visiting them. #3243 - -* When there is a valid selection based on the region, then the region - itself was never visualized. Now it is, but only if it stays within - a single line. #3249 - -* Added new command `magit-branch-checkout' and bound "l" in the - branch popup to it. This command always checks out a local branch. - Valid inputs are an existing local branch, a remote branch for which - no corresponding local branch exists, and a new branch name that - doesn't match the name of any existing local or remote branch. #2906 - -* The command `magit-show-commit' now offers the revision at point as - the default completion choice if the less generic mechanisms used to - determine the "current" revision fail. This is useful for visiting - revisions mentioned in commit messages. #2949 - -* Hashes inside commit messages are now turned into `commit' sections. - Note that this can be disabled and that even if you do so you can - still visit the commit at point using "RET". #2949 - -* The documentation regarding completion, confirmation, the selection, - and the hunk-internal region was significantly extended. It might - be worth reading that. - -* Added new option `magit-dwim-selection', which allows configuring - commands that would otherwise ask the user to select among possible - candidates to use the default instead, with or without confirmation. - #3232 - -* When there is a stash at point, then the commands `magit-stash-drop' - and `magit-stash-pop' now ask for confirmation. The former command - previously allowed users to select another stash instead and the - latter used to act on the stash at point without giving the user a - chance to abort. These changes are implemented using the new option - `magit-dwim-selection' and can easily be reverted. #2916 - -* Aborting a commit is seen as an error by Git and like all such - errors it was reported to users, which led to confusion and a few - bug reports. Now that non-error is being suppressed. #2932 - -* The option `magit-ref-namespaces' was demoted to a variable and its - format changed. #2923 - -* Some refs that are being displayed in logs are now being compressed - to save space while providing more information. #2923 - -* Added new option `magit-submodule-fetch-jobs'. By default multiple - modules are being fetched in parallel now. #3261 - -* The command `magit-show-commit' now also shows notes specified using - `notes.displayRef', not just those specified using `core.notesRef'. - #2857 - -* The package `magit-popup' is maintained in its own repository now. - 4d5d9bfac - -* The popup `magit-notes-popup' now shows the values of the relevant - variables and allows changing them. #2857 - -* The cherry-picking commands now try to use or not use the - `--mainline' argument as appropriate instead of erroring out. #2980 - -* Added `magit' as an alias for `magit-status' because I have been - told that that improves discoverability. This might or might not - make it easier for users to get started with Magit without taking - a brief glimpse at the documentation. #3290 - -* The command `magit-log-buffer-file' now also works in Dired buffers. - -* The commands `magit-stage-untracked' has been taught about the Borg - package manager. When staging a package repository it now offers to - also assimilate (aka install) that package. dc857e2ed - -* Added new command `magit-browse-pull-request', which reads an open - pull request and then visits it in a browser. For now this only - supports Github, but other Git forges will be supported in the - future. #3134 - -* Added new commands `magit-checkout-pull-request' and - `magit-branch-pull-request' to the branch popup. For now they only - support Github, but other Git forges will be supported in the future. - #3134 - -* The command `magit-branch-delete' now offers to also delete the - corresponding remote after deleting a local branch that was created - with `magit-branch-pull-request' or `magit-checkout-pull-request', - provided that remote has no other tracking branches. #3134 - -* When it is not possible to blame in reverse, then the blame popup - does not offer that command anymore. c6ef61b2e - -* The mode line process indicator, displayed in the mode line when Git - is run for side-effects, is now more visible than before, and is - additionally used to highlight process errors. - - New face `magit-mode-line-process' is applied to the mode line - process indicator to improve the visibility of pending asynchronous - processes (in particular), as Magit remains responsive after - initiating such commands (for instance fetching or rebasing), but - will not update its buffers until the process has completed, which - might take longer than anticipated. Customize this face if you wish - to make this indicator more (or less) visible. #3284 - - If the Git process returns an error, the mode line process indicator - is no longer removed, and new face `magit-mode-line-process-error` - is applied to highlight the error status. Details of the error from - the process buffer are also provided as a tool-tip. The error - indicator will remain visible in the mode line until a magit buffer - is refreshed. If you do not want errors to be indicated in the mode - line, customize the `magit-process-display-mode-line-error' user - option. #3297 - -* When staging and unstaging at the file level and there are arguments - that cause whitespace differences to be hidden, then apply the - visible changes using `git-apply' instead of using `git-add' and - `git-rm' because doing that would also un-/stage the invisible - changes. #3102 - -* Added new command `magit-diff-visit-file-other-window'. It isn't - bound by default because that would result in changes to existing - key bindings, which is something that is frowned upon. To use this - command add something like this to your init file. #2833 - - (define-key magit-file-section-map (kbd "SPC") - 'magit-diff-visit-file-other-window) - (define-key magit-hunk-section-map (kbd "SPC") - 'magit-diff-visit-file-other-window) - -* The widths of tabs in diffs can now be adjusted to match the widths - that would be used in the corresponding file-visiting buffers. This - is disabled by default because it can be expensive to determine the - appropriate values (and also unnecessary when using spaces for - indentation). Use the new option `magit-diff-adjust-tab-width' to - control if and when the tab widths should be adjusted. #2929 - -* Added documentation about how to contribute to the documentation. - -* In the references buffer the remote part of the branch names are now - hidden in the remote specific lists of branches by default, which is - done to preserves space. The option `magit-refs-show-remote-prefix' - can be used to revert this change. - -* The mode `git-commit-mode' now offers three font-lock levels, - including one that is fruitier than the previous font-lock level. - Local and remote branches are shown using different colors now. - 7a50bfdb0 ff - -* When a signed tag points at the shown revision, then the revision - buffer now also contains information about the tag signature. #3015 - -* The commands `magit-remote-remove' and `magit-branch-delete' now - unset the relevant push-remote related variables, which Git fails to - do, unlike for other variable affected by the removal of a remote or - branch. Likewise the command `magit-remote-rename' now renames such - variables. #2850 - -* Depending on the value of the new `magit-branch-rename-push-target' - option the command `magit-branch-rename' may now also preserve the - local branch's push-remote or even rename the push branch on the - remote. The default is to do both. #2850 - -* Added argument `--subject-prefix' to the patch popup. 24ce90832 - -* The section visibility is now being cached for all sections. - Previously this was only done for some sections. When a section - disappeared and later appeared again, then it went back to its - initial visibility. The option `magit-section-cache-visibility' can - be used to restrict the cache to certain sections again. #2780 - -* The section visibility cache can now also remember that a section - should be expanded instead of being hidden when the latter is the - default and the section reappears. Previously only the opposite - was possible. #2780 - -* For `magit-status-mode' and `magit-refs-mode' buffers the visibility - cache now persists when killing the buffer. #2780 - -* Added command `magit-remote-prune-refspec', which is necessary - because Git does not ignore invalid refspecs and instead refuses - to fetch using only the refspecs that are still valid. #3134 - -* Sections are now defined as classes instead of as structs. This - is only a first step towards taking advantage of generic methods. - A few subclasses are already being defined and dedicated slot - accessors have been deprecated in favor of `oref'. 651a9abcc ff - -* When asking the user whether to save modified file-visiting buffers - during a refresh, then also allow them to remember the choice for - the current session. I still think it is better to just always save - by setting the option `magit-save-repository-buffers' to `dontask'. - #3344 - -* The terminology about modules as used by Git is ambiguous. Magit - now avoids the term "initialized" and instead uses the term - "populated" to refer to a module whose working directory exists. - The names of commands have been adjusted accordingly. For example, - unlike "git submodule init", which does *not* actually "initialize" - a module, `magit-submodule-popuplate' does "populate" a module - (using "git submodule update --init"). #2911 - -* Most module commands now default to act on the selected modules or - if no modules are selected the current module, if any. Otherwise - they fall back to read a single module from the user. Previously - some of these commands acted on all modules and it was not possible - to perform the respective actions on a subset of modules. Acting - on all suitable modules is still possible using a prefix argument. - #2911 - -* Many arguments have been added to the module popup. #2911 - -* Added new option `magit-refs-filter-alist', which allows omitting - some references from being displayed in `magit-refs-mode' buffers. - -* Added new command `magit-merge-squash'. #3348 - -* Several new libraries were created from code previously in magit.el. - 0d6389680 - -* Added new commands `magit-merge-absorb' and `magit-merge-into', - which not only merge a local branch into another but also remove - the merged branch. #2922. - -* Added new commands `magit-cherry-harvest', `magit-cherry-donate', - `magit-cherry-spinout' and `magit-cherry-spinoff', which move - commits from one branch to another and also remove them from the - branch where they were previously located. #2921 - -* Added new command `magit-diff-unmerged' and taught `magit-diff-dwim' - about unmerged changes too. #3382 - -* The command `magit-push-refspecs' got its own history variable. - #3361 - -* By default the names of Magit buffers now either have a star at both - ends, or at neither when using the `uniquify' package. 831372a4f - -* Added new commands `magit-branch-shelve' and - `magit-branch-unshelve'. Use them to replace a branch with a less - visible ref while preserving the ref log. This is useful for work - that you probably but not certainly will end up discarding. You - might want to add these commands to the branch popup. 568b11f64 - -* The look of `magit-refs-mode' buffers was changed to save horizontal - space and three new options `magit-refs-primary-column-width', - `magit-refs-focus-column-width' and `magit-refs-pad-commit-counts' - were added. #3378 - -* When the dispatch popup is invoked in non-Magit buffers, then certain - actions that cannot be used there are no longer shown. 83cc91a30 - -* When the dispatch popup is invoked in a file-visiting buffer, then - it now also lists the actions from the file popup. 40361273a - -* Added new variable `magit-log-format-message-function'. #3384 - -* Added commands `magit-commit-reshelve' and `magit-reshelve-since', - replacing and improving upon commands from the `magit-rockstar' - package, which was deprecated. The former changes the dates of HEAD - and the latter those of a range of commits leading up to HEAD. - -* Added argument `--reverse' to the log popup. When that argument is - used, then the incompatible `--graph' is silently dropped. 07e1d69d2 - -* Added new option `magit-log-header-line-function'. #3395 - -* Added new command `magit-remote-prune'. 6258dd92c - -* Added new hook `magit-unwind-refresh-hook', which is like the - existing `magit-post-refresh-hook' except that is runs even if an - error occurs during the refresh. 9f838cc04 - -Fixes since v2.11.0 -------------------- - -* `git-commit-propertize-diff' could end up making the buffer - read-only. 746f2361b - -bc1093846 magit-popup: locally set help-window-select when describing function -c9689c670 magit-popup: locally set another display-buffer variable - -* `git-rebase-mode-show-keybindings' failed to process non-English - usage instructions in interactive rebase buffers. #3175 - -* The refresh cache was not properly invalidated after creating a new - repository. 7a1f1eb44 - -* The `with-editor-mode' minor-mode was sometimes enabled twice in the - same buffer. 9be36868b - -* For bare repositories all files were shown as being deleted in some - contexts. b5f05c457 - -* When a command was invoked from a popup and it set `this-command', - then that was later overwritten. a74c9b9d4 - -* While setting `magit-credential-cache-daemon-socket's initial value - an error occurred when `credential.helper's value is the empty string. - 4b15d5825 - -* Fixup commands did not warn about merges in the rebase range until - after creating the fixup commit. #3176 - -* Instant fixup allowed selecting a commit that is not reachable from - HEAD, which, for the instant variants (but only those), clearly is - a user mistake that should be caught immediately. #3176 - -* If `magit-git-executable' is an absolute path, then an error - occurred in `magit-debug-git-executable'. 9b7e34c29 - -8ed2eb4f5 magit-branch-reset: use magit-local-branch-at-point - -* The previous window configuration was not restored by - `magit-log-select-pick' and `magit-log-select-quit'. #3211 - -* When `magit-branch-spinoff' failed to perform the checkout it - never-the-less attempted to perform the subsequent steps. #3210 - -* Jumping to the correct location in a man page failed for many - switches and options. deb482063 ff - -* The default action of `magit-branch-config-popup' was a command that - isn't even available in the popup. eaa836fe2 - -* The command `magit-branch-spinoff' didn't try to prevent the user - from entering a string containing whitespace as a branch name. - bd6055ab2 - -* The command `magit-commit' failed to commit everything after asking - for confirmation if it is called from a subdirectory. #3221 - -* The command `magit-completing-read' didn't offer any completion - candidates. 387257f20 - -* In some cases an error occurred when showing the remote popup because - the length of the remotes name was not taken into account. a9177e5b9 - -* The command `magit-branch-rename' failed to rename a local branch if - a tag existed with the same name. #3222 - -* The command `magit-file-delete' ignored the prefix argument instead - of forcing the action as intended. 0df686bfd - -* Fixed a broken highlighting special case. #3238 - -* When staging all unstaged changes using "s" on "Unstaged changes" - while there also are staged changes, then the user was not asked for - confirmation. #3238 - -* When reverting a commit users are required to edit the revert - message on some platforms but not on others. #3239 - -* In a secondary worktree `magit-git-dir' failed to return a remote - path when the repository is accessed using Tramp. #3228 - -* When the user chose the default offered by `magit-patch-apply', - then that function failed to expand the file-name so that Git would - understand it. ab00c5ba2 - -* The face `magit-graph' was also used for the commit message, which - only was noticeable when the face was customized. It appears that - nobody ever did that. 47e94767b - -* When `magit-branch-read-upstream-first' is nil, then the value - returned by `magit-branch-read-args' was broken. #3268 - -* Fixed encoding of non-ascii filename arguments to git on - `windows-nt' systems. #3250 - -* A bug in `magit-list-active-notes-refs' slowed down - `magit-show-commit'. #3275 - -* The command `magit-worktree-checkout' wasn't able to checkout - arbitrary commits, just refs. #3277 - -* Due to misunderstood `flyspell' implementation details - `git-commit-turn-on-flyspell' did some unnecessary work and made - claims that are not actually true. 24c966082 - -* When the git executable could not be found, then Magit often claimed - that the user was doing something outside of a Git repository - instead. #3310 - -* The command `magit-submodule-add' always used a kludge that is - only needed when using Ido, resulting in a unnecessary removal - of functionality. 5e43377d2 - -* The function `magit-maybe-save-repository-buffers' in some cases - needlessly redisplayed a message. #3319 - -* The branch description was displayed in weird ways in a few places. - d98c44bd7, 9003b85da - -* When stashing untracked files, then the untracked files in - subdirectories were not removed from the working tree. #3334 - -* The command `magit-worktree-delete' failed to delete a worktree when - its directory no longer existed. #3355 - -* A kludge used to work around a bug in Emacs 24 prevented - `magit-copy-buffer-revision' from deactivating the mark. #3352 - -* When visiting the last blob that still had the line at point in a diff, - then that only jumped to the correct line, but not the correct column. - ebe3b5229 - -* For unpopulated modules `magit-list-submodules' showed information - about the super-repository instead. Now such modules are omitted. - 1c4fa9b14 - -* The commands `magit-am-apply-patches' and `magit-am-apply-maildir' - did not work over Tramp because they passed Tramp file names directly - to git. This was fixed in a way that should prevent similar issues - elsewhere. #3368 - -* The function `magit-branch-commit-at-point' preferred tags over - branches, which is a strange default for most callers. f2b318856 - -* The arguments set in the popup were ignored when displaying tags - in refs buffers. ae007a757 - -* When `magit-diff-section-arguments' calls for it, then all - diff-related sections are supposed to be limited to a subdirectory, - but sections listing untracked and tracked files ignored it. #3376 - -* Saving wip refs often failed because `magit-update-ref' used the - refresh cache. e0e1a44f3 - -* Buffers listing repositories using `tabulated-list-mode' did not - preserve point when being refreshed. 2f0302635 - -This release also contains other minor improvements, bug fixes, typo -fixes, and documentation fixes. - -Authors -------- - - 500 Jonas Bernoulli - 26 Kyle Meyer - 15 Phil Sainty - 13 Alexander Gramiak - 13 Noam Postavsky - 7 Sean Allred - 4 Basil L. Contovounesios - 3 Bastian Beischer - 3 Damien Cassou - 3 Štěpán Němec - 2 Bar Magal - 2 Daniel Mai - 2 Matthew Fluet - 1 Chris LaRose - 1 Daniel Gröber - 1 Daniel Kraus - 1 David Ellison - 1 Fritz Stelzer - 1 Jim Blandy - 1 John Mastro - 1 Kenny Ballou - 1 Matthieu Hauglustaine - 1 Matus Goljer - 1 Orivej Desh - 1 Philipp Stephani - 1 Radon Rosborough - 1 Vladimir Panteleev - 1 Wilfred Hughes - 1 Wouter Bolsterlee - 1 Xu Chunyang diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.12.1.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.12.1.txt deleted file mode 100644 index a7e0971..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.12.1.txt +++ /dev/null @@ -1,16 +0,0 @@ -Magit v2.12.1 Release Notes -=========================== - -Fixes since v2.12.0 -------------------- - -* Magit 2.12.0 depended on a non-existent Magit-Popup version. - -* Key bindings in `magit-remote-popup' conflicted. - -Authors -------- - - 8 Jonas Bernoulli - 1 Dean Kariniemi - 1 Phil Sainty diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.13.0.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.13.0.txt deleted file mode 100644 index 9b93813..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.13.0.txt +++ /dev/null @@ -1,122 +0,0 @@ -Magit v2.13.0 Release Notes -=========================== - -Released 2nd June 2018 by Jonas Bernoulli. - -I am pleased to announce the release of Magit version 2.13.0, -representing 166 commits by 18 contributors over two months. - -Also see https://emacsair.me/2018/06/02/magit-2.13. - -Upcoming breaking changes -------------------------- - -* This is the last release to support Emacs 24.4. Going forward at - least Emacs 25.1 is required. - -* This is the last release to support Git 1.9.4. Going forward at - least Git 2.4 is required. - -* Many functions and variables that have been declared obsolete for - a while now are going to be removed after this release. - -All of these changes will happen on "master", the development branch. -Note that the snapshot packages on Melpa are built from that branch. -If you cannot update Emacs and/or Git now, then you should pin Magit -to Melpa-Stable to stick with this release (and bugfix releases) for -the time being. - -Breaking changes ----------------- - -* As announced earlier, the obsolete option `magit-no-confirm-default' - has been removed. #3232 - -Changes since v2.12.0 ---------------------- - -* Augmenting a file- or blob-visiting buffer with blame information - was completely rewritten, making the implementation more robust and - adding many new features. It is now possible blame in order to get - an answer to the question "what commits remove these lines". It is - no longer necessary for the buffer to be put into `read-only-mode', - when displaying blame information. New visualization styles were - added and users can define their own styles. New commands to visit - blobs related to the current chunk were added. - -* Added new command `magit-tag-release'. This is a fairly opinionated - command and its only use to you might be to serve as a template for - your own variant. - -* Added new section inserter `magit-insert-ignored-files', which - could be added to `magit-status-sections-hook'. - -* The mode `global-magit-file-mode' is now enabled by default, making - the `magit-file-popup' available on "C-c M-g". 0ec28b97 - -* Added new commands `magit-log-trace-definition' and - `magit-diff-trace-definition', which show a log with diffs about the - definition at point. #2588 - -* Added new commands `magit-edit-line-commit' and - `magit-diff-edit-hunk-commit', which allow editing the commit that - added the line at point. febe79ba 22b13337 - -* The interactive prompts for the various reset commands now indicate - the branch which is going to be reset. #3438 - -* Added new option `magit-published-branches', providing an additional - safety-net. If you try to modify a commit that has been pushed to - one of these branches already, then you are now being asked whether - you really want to do that. Do not rely on this exclusively, there - are edge-cases that are ambiguous and are not always handled as you - might have expected. add4a7f3 ff - -* Gravatar images are now being inserted asynchronously. #3452 - -* After deleting the current worktree, `magit-delete-worktree' now - shows the status buffer for another worktree. d9cd4611 - -* Added new command `magit-worktree-checkout-pull-request'. a3d788ec - -* New variable `magit-get-previous-branch-timeout' limits the amount - of time spent in `magit-get-previous-branch'. #3457 - -Fixes since v2.12.0 -------------------- - -* The recently added command `magit-branch-pull-request' had various - issues concerning pull-requests referencing branches from the - upstream repository. #3416 #3417 #3461 - -* The values of diffstat sections was wrong for sections that - represent renamed files. 66d9558f - -* Time zones were not handled correctly when calculating times for - blame headings. #3443 - -This release also contains the fixes described in the v2.12.1 release -notes, as well as other minor improvements, bug fixes, typo fixes, and -documentation fixes. - -Authors -------- - - 138 Jonas Bernoulli - 6 Kyle Meyer - 2 Alban Gruin - 2 Basil L. Contovounesios - 2 Buster Copley - 2 Christophe Junke - 2 Mario Rodas - 2 Phil Sainty - 1 Aaron Madlon-Kay - 1 Ben North - 1 Dean Kariniemi - 1 Eli Barzilay - 1 Jon Vanderwijk - 1 Jonathan Leech-Pepin - 1 Justin Guenther - 1 Li-Yun Chang - 1 Marc Sherry - 1 Noam Postavsky diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.13.1.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.13.1.txt deleted file mode 100644 index 3447dab..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.13.1.txt +++ /dev/null @@ -1,34 +0,0 @@ -Magit v2.13.1 Release Notes -=========================== - -Fixes since v2.13.0 -------------------- - -* The prompt used by `magit-rebase-interactive-assert' was wrong. - 37d76f409 - -* `magit-rebase-autosquash' asked for confirmation when the user - already confirmed earlier. 02e6c75b6 - -* `magit-log-wash-rev` errored in ~magit-cherry-mode~, starting with - Emacs 26.1. 1ee577b35 - -* Magit used a completion function to make the built-in completion - respect the collection's order. Even though that wasn't necessary - for Ivy and Helm it did the same here, which became a problem when a - change in Helm caused fuzzy completion to break in combination with - a completion function. Likewise a change in Ivy caused Magit's sort - order to be ignored, which we work around now. #3476, #3477 - -* When using cygwin, then `git-commit-setup-font-lock' could end up - trying to run git in a non-existent directory. #3505 - -* `magit-insert-modules-unpushed-to-pushremote' failed to insert - anything due to a typo in the used commit range. d4e159f35 - -Authors -------- - - 11 Jonas Bernoulli - 8 Kyle Meyer - 5 Noam Postavsky diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.2.0.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.2.0.txt deleted file mode 100644 index 2b77c4a..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.2.0.txt +++ /dev/null @@ -1,219 +0,0 @@ -Magit v2.2.0 Release Notes -========================== - -Released 16 August 2015 by Jonas Bernoulli. - -We are pleased to announce the release of Magit version 2.2.0, -representing 321 commits by 19 people over 6 weeks. - -I would like to thank Kyle Meyer and Noam Postavsky for joining -the developer team and helping me with this release. -- Jonas - -Changes since v2.1.0 --------------------- - -* The Elpa packages `with-editor' and `magit-popup' now depend on the - package `async' and turn on the mode `async-bytecomp-package-mode'. - If available, the mode is turned on even when these packages have - not been installed from an Elpa archive. It is being turned on in - both of these libraries because any one of them might be the first - package from the Magit repository that is being updated. - - It is possible to prevent the mode from being turned on when loading - these libraries by setting `async-bytecomp-allowed-packages' to nil - before loading them. If you do that, then you must mention that you - have done so when reporting a bug (which might therefore be due to - miscompiled files). - - Turning on `async-bytecomp-package-mode' advises `package--compile', - instructing it to compile Magit and its dependencies (as well as - others packages listed in `async-bytecomp-allowed-packages' and - their dependencies) in a separate Emacs instance. - - Unfortunately it is necessary that we do this because when an old - version of a package is already loaded when a new version is being - installed, then the old version sometimes interferes during - compilation of the new version, leading to miscompiled files. - - This usually does not happen very often, but when updating from - Magit v1 to v2 then it is expected, which is why users were - instructed to uninstall the old version before installing v2.1.0. - Unfortunately many users never saw those instructions, so we have - no choice but to use this approach to get rid of miscompiled files. - -* Two new commands have been added to the diff refresh popup that - allow the range of the previous diff to be manipulated. - `magit-diff-flip-revs' swaps the revisions of the range, and - `magit-diff-switch-range-type' toggles between ".." and "..." range - types. - -* The commands `magit-ediff-show-unstaged', `magit-ediff-show-staged', - `magit-ediff-show-commit', and `magit-ediff-show-working-tree' have - been added to the Ediff popup. - -* New option `magit-ediff-dwim-show-on-hunks' controls whether calling - `magit-ediff-dwim' runs a show variant (`magit-ediff-show-unstaged' - or `magit-ediff-show-staged') rather than `magit-ediff-stage' when - point is on an uncommitted hunk. - -* `magit-diff' and `magit-ediff-compare' no longer prompt the user for - confirmation when constructing a range from the last and first - commits selected by a region. A prefix argument can now be used to - specify that the diff is between the second revision and the common - ancestor of both revisions (i.e., the "..." range type is used). - -* `magit-ediff-*' variants now limit file choices to those that have - changed between the revisions of interest. If only one file has - changed, this file is used without prompting. - -* `magit-diff' and `magit-ediff-compare' now consider the location at - point when choosing the default for the prompt, and this default - value usually corresponds with the actions of their DWIM - counterparts. - -* The key in Ediff popup for `magit-ediff-compare' has changed from - "d" to "r" to be consistent with the key in the diff popup for the - similarly behaved `magit-diff`. - -* Entering a single commit for the range to `magit-ediff-compare' now - compares the commit with the working tree (like `magit-diff' and - `git diff') rather than the previous commit. - -* The popup `magit-diff-refresh-popup' and its suffix commands and - helper functions were fixed. Most importantly file arguments and - diff-type arguments are no longer lost when this popup is used - - it only changes those arguments it is supposed to change. Also - the popup only lists the arguments which can actually be used in - the current buffer (in status buffers fewer are supported than in - diff-only buffers). - -* The popup `magit-diff-popup' and its suffix commands now use the - arguments currently in the `magit-diff-mode' buffer of the current - repository. Previously the arguments were always reset to the - default value of `magit-diff-arguments'. - -* The default values of `magit-diff-section-arguments' and - `magit-diff-arguments' now contain the `--no-ext-diff' switch. - -* New popup `magit-log-refresh-popup' allows changing the log - arguments used in the current buffer. This allows changing the - arguments used in a log buffer without having to specify the - reference(s) again. And it makes it possible to change the log - arguments used in the status buffer, which previously required that - option `magit-log-section-arguments' was customized manually. - -* When a log is displayed for the purpose of having the user select - a commit, then this is now displayed in a buffer separate from the - regular log buffer. New option `magit-log-select-buffer-name-format' - controls the name of that buffer and new option - `magit-log-select-arguments' controls the arguments. - -* The default value of `magit-log-section-arguments' now contains the - `--decorate' switch. - -* `magit-log-buffer-file' respects the log arguments currently in - effect in the repositories log buffer, or if that doesn't exist the - default value of `magit-log-arguments'. Because this command is not - invoked from the log popup, it's now also possible to turn on the - `--follow' using a prefix argument. - -* Log graphs are no longer shown in color by default, because turning - the control sequences into faces is very inefficient. To allow - users to get back the colorful graphs, the `--color' switch has been - added to the log popup. - -* In the refs manager, `RET' on a local branch again "visits" that - branch by checking it out (like in v1.4). With a prefix argument it - instead "visits" the branch by showing information about other refs - relative to the visited one (like in v2.1 even without a prefix - argument). - - When the new option `magit-visit-ref-create' is non-nil, then a - remote branch is "visited" by creating a new local branch that - tracks that remote branch, and checking out that local branch. - -* To avoid losing any standard functionality, `C-w' and `M-w' now - fallback to `kill-ring-save' when the region is active. They also - work in more places and in some cases copy more useful information - than before. - -* New option `magit-push-always-verify' has been added because changes - in v2.1 caused many users to accidentally push to `master' instead - of a remote feature branch as intended. All users should set this - option to nil, but only after having read the documentation. The - commands that respect this option instruct users to consult its - documentation. - -* Moving through a log using `n' and `p' is now much faster because - the revision buffer is no longer recreated for each commit along the - way. Because Emacs does not support key-down-events this had to be - implemented using a timer, which has the unfortunate effect that it - leads to a delay even when only pressing one of these keys briefly - to move by a single line. This delay can be adjusted using the new - option `magit-diff-auto-show-delay'. - -* When creating a new branch, first reading the starting point and - only then the name of the new branch has advantages. But many users - disagree, so the option `magit-branch-read-upstream-first' has been - added. It defaults to t. - -* New commands `magit-wip-log' and `magit-wip-log-current' allow - showing log for a branch and its wip refs (which the various wip - modes commit to). - -* New command `magit-submodule-deinit'. - -* New command `magit-commit-augment' allows the user to pick a commit - to squash into and edit the squash commit message. - -* New push commands `magit-push-implicitly' and `magit-push-quickly'. - -* When reading user input, many commands now offer a better default - choice and better completion candidates. - -* All apply variants now use `--3way' when called with a prefix - argument. - -* Log commands now respect the entries in the .mailmap file. - -* The command `magit-pull-current' now also fetches tags by default. - -* When a file has conflicts then the type of conflict is shown now. - -* New option `magit-log-show-refname-after-summary'. - -* New section inserter `magit-insert-user-header'. - -* New face `magit-section-secondary-heading'. - -* New commands `magit-run-gitk-all' and `magit-run-gitk-branches'. - The existing command `magit-run-gitk' now always calls `gitk' - without any arguments. - -* New commands `magit-shell-command' and `magit-shell-command-topdir'. - -This release also contains various documentation fixes, code -clean-ups, bug fixes, and other small to medium improvements. - -Authors -------- - - 225 Jonas Bernoulli - 67 Kyle Meyer - 8 Noam Postavsky - 3 Mitchel Humpherys - 2 Greg Lucas - 2 Mark Karpov - 2 Yuichi Higashi - 1 Johann Klähn - 1 Josiah Schwab - 1 Kan-Ru Chen - 1 Nicklas Lindgren - 1 Phil Sainty - 1 Richard Kim - 1 Robin Green - 1 Rémi Vanicat - 1 Steven Vancoillie - 1 Thomas Frössman - 1 Ting-Yu Lin - 1 Vineet Naik diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.2.1.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.2.1.txt deleted file mode 100644 index 11771bf..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.2.1.txt +++ /dev/null @@ -1,45 +0,0 @@ -Magit v2.2.1 Release Notes -========================== - -Released 24 August 2015 by Jonas Bernoulli. - -This is a bugfix release. - -* The version strings in the manual were not set to "2.2" when v2.2.0 - was released. - -* Some menu bindings were not adjusted when commands were renamed. - -* The "next" tag was never shown in the "Tag(s)" header of the status - buffer. - -* Blaming did not abort gracefully when the user killed the buffer. - -* Blaming failed on indirect buffers. - -* Blaming did not detect when a file was untracked. - -* Blaming passed the wrong line range when the file's buffer was - narrowed. - -* `magit-shell-command-topdir' used `magit-git-command' instead of - `magit-shell-command'. - -* `magit-copy-as-kill' added "nil" to the `kill-ring' when there was - nothing useful to put there. - -* `magit-find-file-hook', `magit-find-index-hook', - `magit-refresh-popup-buffer-hook' were used without being defined - using `defvar'. - -* `magit-format-ref-labels' failed to work around a Git bug, resulting - in refnames not being colorized when `--simplify-by-decoration' is - used. - -This release also contains various documentation fixes. - -Authors -------- - - 16 Jonas Bernoulli - 11 Kyle Meyer diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.2.2.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.2.2.txt deleted file mode 100644 index 1d5ec52..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.2.2.txt +++ /dev/null @@ -1,45 +0,0 @@ -Magit v2.2.2 Release Notes -========================== - -Released 3 September 2015 by Jonas Bernoulli. - -This is a bugfix release. - -* `magit-diff-wash-diff' choked on unmerged binary files. #2211 - -* `magit-blame-popup' did not allow empty input when reading a value - for "-C" or "-M". #2208 - -* The `emacsclient' executables belonging to non-current alternative - installations of Emacs on Debian were not considered when setting - the default value of `with-editor-emacsclient-executable'. #2217 - -* `server-edit', which switches to a buffer preferably one with - another client, was used when finishing or aborting a `with-editor' - session. When `emacsclient' was used to connect to a server and - then a commit or rebase was invoked, then there would be another - client and switching to its buffer after finishing the commit or - rebase would be undesirable. Now we use `server-done' instead. - #2197 - -* When `--stat' abbreviates the name of a file, then that name was - stored in the section object instead of the full name. #2199 - -* `magit-file-relative-name' with non-nil TRACKED failed in Tramp - repositories. #2206 - -* After failing to clone, `magit-clone' also tried to show the status - of the non-existent clone. #2203 - -* `magit-wip-log' did not display a log if the working tree or index - ref did not exist. - -This release also contains various documentation fixes and code -clean-ups. - -Authors -------- - - 29 Jonas Bernoulli - 5 Kyle Meyer - 1 Barak A. Pearlmutter diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.3.0.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.3.0.txt deleted file mode 100644 index ae09967..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.3.0.txt +++ /dev/null @@ -1,251 +0,0 @@ -Magit v2.3.0 Release Notes -========================== - -Released 28 October 2015 by Jonas Bernoulli. - -We are pleased to announce the release of Magit version 2.3.0, -representing 367 commits by 12 people over 10 weeks. - -Changes since v2.2.0 --------------------- - -* Added `--interactive' switch to `magit-rebase-popup' so that rebase - variants which normally perform a non-interactive rebase can be used - to perform an interactive rebase too. #2186 - -* Commands that perform an interactive rebase should no longer be used - non-interactively (i.e., they should only be used as commands). #2187 - -* Rebasing commands now can start with a root commit. Root commits - are detected automatically, so users don't have to use the `--root' - switch explicitly. #2187 - -* Added new command `magit-checkout-file'. - -* Added new option `magit-bury-buffer-function' to give users more - control over how Magit buffers are buried, replacing the old binary - option `magit-restore-window-configuration'. The default is still - the same, i.e., `magit-restore-window-configuration' is used. #2193 - -* Added new function `magit-mode-quit-window' as a simpler variant to - `magit-restore-window-configuration'. #2193 - -* Information about related refs in `magit-revision-mode' buffers are - now grouped in the same section as other headers and are formatted - like those other headers instead of like diffstats. The redundant - header which previously grouped the related refs section is gone. - All headers are inserted by the new `magit-insert-revision-headers' - section inserter. #2216 - -* No longer avoid calling git more than absolutely necessary when - creating a `magit-revision-mode' buffer. This simplifies parsing, - makes it simpler to prettify how information is presented, allows - users to customize how and in what order information is presented, - and prepares for faster, asynchronously created diffs. #2216 - -* The various sections in revision buffers are now inserted using new - section inserters named `magit-insert-revision-{*}', all of which - are part of the default value of `magit-revision-sections-hook'. - #2216 - -* The various sections in diff buffers are now inserted using new - section inserters named `magit-insert-diff-{*}', all of which are - part of the default value of `magit-diff-sections-hook'. #2216 - -* Added new option `magit-revision-headers-format' whose value is - passed to `git show --format=' to insert most of the headers, - excluding the related-refs headers. The default value now uses - placeholders which respect information in the file ".mailmap". - #2216 - -* Removed options `magit-revision-show-notes', - `magit-diff-show-xref-buttons', `magit-revision-show-xref-buttons', - `magit-diff-show-diffstat', and `magit-revision-show-diffstat'. - Whether these sections are inserted is now controlled using the - hooks `magit-diff-section-hook' and `magit-revision-section-hook'. - #2216 - -* Gravatar images can now be shown in `magit-revision-buffers'. New - option `magit-revision-show-gravatars' controls whether these images - should be inserted and can also be used to adjust to customizations - of `magit-revision-headers-format'. - - This feature is not enabled by default due to privacy concerns. - - Gravatar images are spliced into two halves which are then displayed - on separate lines. On OS X the splicing has a bug in some Emacs - builds, which causes the top and bottom halves to be interchanged. - Setting the new option `magit-revision-use-gravatar-kludge' to `t' - works around this issue. #2216 - -* After using the region to stage or discard parts of a hunk, point is - now placed on the beginning of the next or previous block of changed - lines. Previously we just jumped to the beginning of the hunk at - the same index as the previous hunk, but that often was very far - away from where point was before the refresh. #2227 - -* The function `magit-toplevel' was refactored and many tests were - added. It now returns the correct value when a symlink to a - sub-directory of a working tree is involved. #2242 - -* New option `magit-keep-region-overlay' allows displaying the region - overlay together with the visualization of a valid Magit selection. - See the doc-string for why we think you shouldn't do that, but if - you disagree then you can now have it your way. #2091 - -* Avoid the inefficiency of `git log --graph --max-count=N REV' (it - calculates the graph for all reachable commits, not just the N - commits), by additionally limiting the history using a range - calculated from REV and N, when possible. #2243 - -* Renamed `magit-file-buffer-mode' to `magit-file-mode'. Related - symbols were renamed accordingly. - -* Added new minor mode `magit-blob-mode' and new commands - `magit-blob-previous' and `magit-blob-next'. #2195 - -* Added new commands `magit-branch-spinoff' and `magit-branch-reset'. - #2191 - -* Added new option `magit-status-expand-stashes'. - -* In addition to `default-directory' also set `list-buffers-directory' - to the top-level of the working tree in Magit buffers, causing that - directory to be displayed in the "File" column of the *Buffer List* - buffer. - -* Added a kludge to keep Cygwin and MYSYS2 executables from expanding - globs when called from a native Windows Emacs executable. #2281 - -* Added a revision stack. The new commands `magit-copy-section-value' - and `magit-copy-buffer-revision', which are intended for use inside - Magit buffers, push an entry to the stack, and the new command - `magit-pop-revision-stack' inserts a representation into an editable - buffer. New option `magit-pop-revision-stack-format' controls how - the representation of the revision is formatted. The old commands - `magit-copy-as-kill' and `magit-copy-buffer-thing-as-kill' have been - removed. #2225 - -* The default values of options `magit-commit-extend-override-date' - and `magit-commit-extend-override-date' changed to `t'. - -* Added new option `magit-log-show-margin'. - -* Added new option `magit-log-remove-graph-args'. #2226 - -* Added support for showing actionable diffs inside logs. #2226 - -* Added basic support for tracing the evolution of a region. #2226 - -* Added new command `magit-stash-format-patch'. - -* All apply variants learned how to apply multiple hunks at once. #2271 - -* Regular apply learned how to apply multiple files at once. #2271 - -* `git-commit-setup' learned to handle Cygwin paths. It had to be - taught about that separately from the rest of Magit, because, for - historic reasons, we try to keep the `git-commit' package usable - without Magit. - -* The signatures of `magit-mode-setup' and `magit-mode-get-buffer' - have changed, and `magit-mode-get-buffer-create' has been removed. - Extensions have to be adjusted accordingly. #2282. - -* All Magit-Mode buffers (including process buffers, but excluding - popup, blob-visiting, and file-visiting buffers, whose major-modes - do not derive from `magit-mode' and therefore aren't "Magit-Mode - buffers") are now displayed using `magit-display-buffer', which is a - wrapper around the low-level `display-buffer'. High-level functions - such as `pop-to-buffer' and `switch-to-buffer' are no longer used to - display Magit buffers. - - `magit-display-buffer' uses the function specified by the new option - `magit-display-buffer-function' to actually display the buffer in - some window. The default value is `magit-display-buffer-traditional'. - By implementing their own variant to wrap around `display-buffer', - users can take complete control over how Magit buffers are displayed. - It's also possible to use `display-buffer' directly and specify the - display actions in `display-buffer-alist'. - - Added new options `magit-pre-display-buffer-hook' and - `magit-post-display-buffer-hook', and removed the options - `magit-status-buffer-switch-function' and - `magit-diff-switch-buffer-function'. #2282 - -* Added new options `magit-generate-buffer-name-function', - `magit-buffer-name-format', and `magit-uniquify-buffer-names', - replacing the various `magit-{*}-buffer-name-format' options. #2282 - -* Added new command `magit-toggle-buffer-lock'. Previously it was - possible to prevent Magit from reusing an existing buffer to display - something else, using the command `magit-rename-buffer' (which was - removed). Now this is done by locking the buffer to its value. - #2282 - -* The status buffer is now always refreshed after running a Magit - command triggers a refresh. Previously that was only the case if - the buffer in which the command was invoked was a Magit buffer too. - -* Added optional support for refreshing the status buffer every time a - buffer visiting a file, which is tracked in the current repository, - is saved. To enable this add `magit-after-save-refresh-buffers' to - `after-save-hook'. - -* Added new functions `magit-log-maybe-update-revision-buffer', - `magit-log-maybe-update-blob-buffer', - `magit-status-maybe-update-revision-buffer', and - `magit-status-maybe-update-blob-buffer', and added some of them to - `magit-section-movement-hook'. Removed the function - `magit-log-maybe-show-commit', which served about the same purpose - as these new functions. Previously one had to customize the option - `magit-diff-auto-show' to control when the other buffer was updated, - now one does so by adding or removing the above functions to or from - `magit-section-movement-hook'. The other window is only ever - updated now, to initially create it, use `SPC'. #2338 - -* Added new hook `magit-process-find-password-functions', with no - default members. These functions, if any, are run when git requests - a password from the user, if there are no such functions, or if they - fail, then the user has to type the password as before. Added new - function `magit-process-password-auth-source'. It can be added to - that hook and uses `auth-source' to get the password from one of the - sources it supports. #2311 - -* Removed broken support for unicode log graphs. - -* `magit-expand-git-file-name' learned to use the output of `mount' to - map Cygwin paths into native Windows paths. `git-commit-setup' now - uses `magit-expand-git-file-name' if available. #2348 - -* Added new function `magit-define-popup-sequence-action' and taught - related functions about `:sequence-actions'. - -* Added new hook `magit-credential-hook' and added new hook function - `magit-maybe-start-credential-cache-daemon' to it. This allows - starting Git's credential daemon separately, which is necessary - because Emacs sends SIGHUP and closes the pty when e.g `git push' - (which started the daemon) finishes. Upon receiving that signal - the daemon terminates. We work around this by starting the daemon - directly before invoking the git subcommand which might need - credentials. #2360 - -This release also contains the changes described in the v2.2.1 and -v2.2.2 release notes, as well as various other documentation fixes, -code clean-ups, bug fixes, and other small to medium improvements. - -Authors -------- - - 305 Jonas Bernoulli - 38 Kyle Meyer - 15 Noam Postavsky - 1 Andriy Kmit' - 1 Barak A. Pearlmutter - 1 Brian Warner - 1 Damien Cassou - 1 John Mastro - 1 Nicolas Petton - 1 Nikolay Martynov - 1 Peter Jaros - 1 Phil Sainty diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.3.1.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.3.1.txt deleted file mode 100644 index b1d1291..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.3.1.txt +++ /dev/null @@ -1,31 +0,0 @@ -Magit v2.3.1 Release Notes -========================== - -Released 11 November 2015 by Jonas Bernoulli. - -This is a bugfix release. - -* `magit-stash-drop' now shows a message with the hash of the dropped - stash to make it easier to recover from dropping the wrong stash. - -* `magit-revert-buffers' now avoids needlessly connecting to unrelated - hosts. It first checks whether a given file is on the same host as - the repository, and only if that is so it checks whether the file is - located inside the repository, using `file-in-directory-p', which, - for Tramp files, requires connecting to the remote host. - -* `magit-commit-message-buffer' no longer hangs when a symlink to the - repository is involved. - -This release also contains various documentation fixes and code -clean-ups. - -Authors -------- - - 10 Jonas Bernoulli - 3 Noam Postavsky - 2 Kyle Meyer - 1 Carl Lieberman - 1 David L. Rager - 1 Syohei Yoshida diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.4.0.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.4.0.txt deleted file mode 100644 index bedd075..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.4.0.txt +++ /dev/null @@ -1,147 +0,0 @@ -Magit v2.4.0 Release Notes -========================== - -Released 18 January 2016 by Jonas Bernoulli. - -We are pleased to announce the release of Magit version 2.4.0, -representing 269 commits by 14 people over 12 weeks. - -Also see http://emacsair.me/2016/01/18/magit-2.4. - -Changes since v2.3.0 --------------------- - -* The new mode `magit-auto-revert-mode', a magit-specific globalized - variant of `auto-revert-mode', replaces the old implementation, which - was configured using the option `magit-revert-buffers'. The new mode - is enabled for all users by default. It may be disabled before - loading magit by setting `magit-auto-revert-mode' (or the obsolete - alias `magit-revert-buffers') to nil. To disable the mode after - loading magit, a call to (magit-auto-revert-mode -1) is required. - #2474 - -* The option `magit-refresh-status-buffer' was added, allowing users - to prevent automatic refreshes of the status buffer for performance - reasons. - -* All of Git's push-related variables are now honored. #2414 - -* In addition to the upstream branch, the push-remote (configured - using `branch..pushRemote' or `remote.pushDefault') is now - also fully supported. #2414 - -* The status buffer now features up to four logs listing unpulled and - unpushed commits. Two for the upstream and two for the push-remote. - #2414 - -* The branch popup now shows the most important Git variables that are - in some way related to branches. The values of these variables can - now be conveniently changed from that popup. #2414 - -* The fetch, pull, push, and rebase popups now feature an action which - acts on the push-remote, another which acts on the upstream, and yet - another which acts on any other source or target. For each of these - actions the respective branch is shown in the popup. - - The actions in the push popup are displayed even if the respective - variables are unset - they then offer to set these variables before - pushing. Setting `magit-push-current-set-remote-if-missing' to nil - disables this. - - Many key bindings were changed for consistency and safety reasons. - Likewise many commands were renamed and their behavior was adjusted. - Some new commands, related to the push-remote, were added. #2414 - -* The command `magit-push-implicitly' was removed from the push popup. - The command's doc-string explains how to put it back. If these - instructions are followed, then the popup shows what will happen if - the command is used. #2453 - -* The command `magit-push-to-remote' was added. The command's - doc-string explains how to add it to the push popup. #2453 - -* The option `magit-push-always-verify' was removed. That was only a - temporary kludge to keep users from shooting themselves in the foot. - This is no longer necessary because one now always sees where one is - about to push to. #2414 - -* The popup command `magit-pull-and-fetch-popup' was added as a - possible replacement for the separate `magit-push-popup' and - `magit-fetch-popup'. #2452 - -* The option `magit-branch-prefer-remote-upstream' was added for users - who prefer to always use remote branches as upstreams. #2447 - -* The options `magit-clone-set-remote.pushDefault' and - `magit-remote-add-set-remote.pushDefault' were added. #2447 - -* When Git is run for side-effects and exits with a non-zero status, - then the respective error message is now inserted into the status - buffer. This should help those users who do not see that message - when it is being displayed in the echo area. - -* Popups gained support for a new event type `:variable', which can be - used to change the value of Git variables. This can only be used in - combination with Magit (just `magit-popup.el' by itself is not - sufficient). #2409 - -* The backward-compatibility kludge `magit-branch-manager' has been - removed. The one and only binding to show the refs buffer now is - "y"; the "b v" binding has been removed. - -* The command `with-editor-finish' now runs the new hook - `with-editor-post-finish-hook'. - -* The command `magit-diff-visit-file' now runs the new hook - `magit-diff-visit-file-hook'. - -* When the upstream branch or push remote is configured but the - respective branch does not actually exist, then that is now reported - in the header of the status buffer. #2390 - -* The header line about the upstream branch in the status buffer is - now prefixed with either "Merge" or "Rebase", depending on the value - of `branch..rebase'. #2390 - -* `magit-define-popup' learned two new arguments, `:setup-function' and - `:refresh-function'. These arguments should be used instead of the - MODE argument, which is now deprecated. #2389 - -* Negative text properties are no longer faked; that was just too ugly - and inefficient. Since v2.1.0 Magit no longer sets the background - color for any faces except for those related to diffs. Third-party - themes which still set the background color of non-diff faces have - to be adjusted, because the background color of these faces would be - shadowed by the highlighting of the current section. This does not - apply to diff-related faces because diff sections are highlighted - differently from other sections. #2387 - -* The commands `git-rebase-move-line-up' and `git-rebase-move-line-down' - have been extended. When a region is active, they now operate on - all lines touched by the region, not just the current line. In - addition, a numeric prefix can now be given to specify how many - lines the current line or selection is moved across. - -* The option `magit-popup-display-action' was added. - -This release also contains the changes described in the v2.3.1 release -notes, as well as various other documentation fixes, code clean-ups, -bug fixes, and other small to medium improvements. - -Authors -------- - - 226 Jonas Bernoulli - 22 Kyle Meyer - 10 Noam Postavsky - 1 Carl Lieberman - 1 Damien Cassou - 1 David L. Rager - 1 John Mastro - 1 Lele Gaifax - 1 Michael Heerdegen - 1 Miloš Mošić - 1 Raimon Grau - 1 Sylvain Rousseau - 1 Syohei Yoshida - 1 Zach Latta diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.4.1.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.4.1.txt deleted file mode 100644 index 872a6df..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.4.1.txt +++ /dev/null @@ -1,31 +0,0 @@ -Magit v2.4.1 Release Notes -========================== - -Updates since v2.4.0 --------------------- - -* Added new utility functions `magit-rev-abbrev', `magit-ref-p', and - `magit-tag-p'. - -Fixes since v2.4.0 ------------------- - -* When determining the emacsclient executable most suitable for the - current emacs instance, With-Editor ignored any executable that is - actually named "emacsclient-snapshot". - -* When determining the most suitable git executable, an error occurred - if "Git for Windows 1.x" is used and an cygpath executable is - available. - -* An error occurred when refreshing the status buffer when there is a - new, staged but not yet committed, submodule. - -This release also contains typofixes. - -Authors -------- - - 9 Jonas Bernoulli - 4 Kyle Meyer - 1 Noam Postavsky diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.5.0.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.5.0.txt deleted file mode 100644 index cce9fed..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.5.0.txt +++ /dev/null @@ -1,122 +0,0 @@ -Magit v2.5.0 Release Notes -========================== - -Released 30 January 2016 by Jonas Bernoulli. - -We are pleased to announce the release of Magit version 2.5.0, -representing 78 commits by 4 contributors over 2 weeks. - -Also see http://emacsair.me/2016/02/10/magit-2.5. - -Changes since v2.4.0 --------------------- - -* The library `with-editor.el' reincarnated as a separate repository. - - It was already available as a separate package, and since it can be - of use for packages that have absolutely nothing to do with `magit' - it makes sense to maintain it separately. That wasn't done before - because that would have made it harder to change it and its users - within the magit repository in parallel. I expect there will be - few such changes in the future. - -* Added new library `magit-submodule.el'. It contains code that was - previously spread across various libraries. - -* Added new option `auto-revert-buffer-list-filter' and redefined - `auto-revert-buffers' from `autorevert.el' to use it. Added new - predicates `magit-auto-revert-buffer-p' and the more restrictive - `magit-auto-revert-repository-buffer-p', which are both intended - to be used as potential value of the option. - - For now the option defaults to `nil', but that might change in a - future release. When Magit explicitly calls `auto-revert-buffers' - (as opposed to when that is called due to a file notification event - or by a timer), and `auto-revert-buffer-list-filter' is `nil', then - it is let-bound to `magit-auto-revert-repository-buffer-p'. - - Users who use Tramp and experience delays, should consider setting - the option to `magit-auto-revert-repository-buffer-p'. - -* By default, invoking `magit-unstage' on a committed change now - performs an action which is somewhat similar to unstaging. The - change is reverted in the index, but not the working tree. This - allows extracting changes from HEAD. - - Setting the new option `magit-unstage-committed' to nil, disables - this behavior. Attempting to unstage a committed change would then - result in an error again. - -* Because file notifications may arrive with a delay, the option - `magit-auto-revert-immediately' now defaults to `t' even when file - notifications can be used, - -* Like `magit-refresh' already did, `magit-refresh-all' now runs the - hooks `magit-pre-refresh-hook' and `magit-post-refresh-hook'. - -* The heading of the section which lists commits that exist in the - current branch but not in its upstream was changed from "Unpushed - to " to "Unmerged into ", because one usually - should merge into that branch instead of pushing to it. - -* Added new commands `magit-remote-set-head' and - `magit-remote-unset-head'. - -* By default `magit-clone' now deletes the symbolic-ref "origin/HEAD" - right after running `git clone', which insists on creating it. - - The new option `magit-clone-set-remote-head' can be set to `t' to - go back to keeping that symbolic-ref. We default to removing it, - because it does not actually get automatically updated when the - HEAD of the remote changes, which makes it rather pointless. - -* Added new option `magit-prefer-remote-upstream' which controls - whether commands which read the upstream or starting-point from - the user would rather offer a local or a remote branch as default - completion candidate. - -* Added the switch `--cover-letter' to `magit-patch-popup', and taught - `magit-format-patch' to immediately open the letter in a buffer. - -* Added new option `++order' to the various log popups. This option - and its value are converted to `--VALUE-order' before calling `git'. - This option was added instead of the switches `--author-date-order', - `--date-order', and `--topo-order' because adding all three would be - too noisy and because they are mutually exclusive. - -Fixes since v2.4.1 ------------------- - -* Creating a stash in a secondary working tree failed if no other - stash already existed in the repository. - -* Creating a Magit buffer failed if `uniquify-buffer-name-style's - value is `nil'. - -* Resetting a branch to an arbitrary commit caused its upstream - configuration to be mangled. - -* Resetting a branch to another branch caused the former to be - configured as the upstream of the latter. That behavior was - introduced by accident when the argument `--track' was replaced with - the variable `branch.autoSetupMerge' in the popup. Because it would - be undesirable to restore the `--track' argument in the popup, one - now has to use a prefix argument to set the upstream while resetting. - -* The manually set state of the margin in log and reflog buffers was - not preserved and instead reset to the default state when a command - was invoked which changes what log/reflog is being displayed. - -* Pressing RET on a variable in a popup caused an error. - -This release also contains the fixes described in the v2.4.1 release -notes, as well as various typofixes, documentation updates, code -clean-ups, bug fixes, and other small improvements. - -Authors -------- - - 62 Jonas Bernoulli - 9 Kyle Meyer - 4 Noam Postavsky - 3 Alex Dunn diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.6.0.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.6.0.txt deleted file mode 100644 index c58fdc2..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.6.0.txt +++ /dev/null @@ -1,134 +0,0 @@ -Magit v2.6.0 Release Notes -========================== - -Released 29 March 2016 by Jonas Bernoulli. - -We are pleased to announce the release of Magit version 2.6.0, -representing 77 commits by 7 contributors over 2 months. - -Also see http://emacsair.me/2016/03/29/magit-2.6. - -Updates since v2.5.0 --------------------- - -* Added a cache, which memorizes the values of some function calls for - the duration of a refresh. This cuts the calls to git in half. - -* Added new option `magit-diff-hide-trailing-cr-characters'. When its - value is non-nil (the default on Windows), then ^M characters at the - end of diff lines are hidden. - -* Added new command `magit-diff-buffer-file-popup' intended for use in - file-visiting buffers. It shows the same popup as `magit-diff-popup' - but starts out already limited to the visited file. - -* Added new command `magit-ediff-show-stash', which is available in - the Ediff popup and will be used when `magit-ediff-dwim' is called - with point on a stash. - -* Added new command `magit-reset-popup' featuring all the available - reset variants. - -* Added new command `magit-push-refspecs', which allows pushing using - one or more comma-separated and refspecs, which are explicitly typed - in the minibuffer. - -* Added new commands `magit-fetch-refspec' and `magit-fetch-branch'. - -* Added new section inserters - `magit-insert-modules-unpulled-from-pushremote' and - `magit-insert-modules-unpushed-to-pushremote', and renamed - `magit-insert-unpulled-module-commits' to - `magit-insert-modules-unpulled-from-upstream' and - `magit-insert-unpushed-module-commits' to - `magit-insert-modules-unpushed-to-upstream'. - -* The command `magit-submodule-add' now allows using a module name - different from the path of the module. - -* If `magit-push-current-set-remote-if-missing's value is `default', - then the command `magit-push-current-to-pushremote' now offers to - set `remote.pushDefault' unless the push-remote is already set in - some way. Previously this command offered to set the local value - `branch.NAME.pushRemote' for all non-nil values of the option. - -* When washing the diff that is to be displayed while writing a - commit message takes too long, then it is now possible to abort that - by pressing `C-g'. Previously that would have aborted the commit. - -* When `magit-process-raise-error' is non-nil, then the displayed - error message now also mentions the `default-directory', which is - useful when using Magit as a library in another packages that runs - git in many different repositories. - -* The `magit-insert-section' macro's TYPE argument can now have the - form `(eval FORM)' instead of a symbol. An atomic TYPE is never - evaluated, but FORM is evaluated at run-time. - -Fixes since v2.5.0 ------------------- - -* Staging hunks/regions belonging to files with CRLF line endings on - Windows (or, to be precise, when `default-process-coding-system' had - CRLF end-of-line conversion) ended up erroneously staging changes - with LF line endings. Magit now ensures line endings are preserved - by enforcing a `process-coding-system' with LF end-of-line - conversion. The new behavior may be disabled by setting the option - `magit-process-ensure-unix-line-ending' to `nil'. - -* If the user sets the variable `magit-auto-revert-mode' or the - obsolete alias `magit-revert-buffers' to nil anytime during startup - (before or after `magit-autorevert' is loaded) then the mode is now - no longer turned on (actually it is explicitly turned off). - -* When a revision buffer was limited to a set of files, its header - line did not say so. - -* The function `magit-run-git-with-input' had stopped calling - `magit-pre-call-git-hook' and logging its git command to the - magit-process buffer. - -* The function `magit-diff-wash-submodule did not handle some less - common cases. - -* The command `magit-section-cycle-diffs' hung when hiding sections. - -* Invoking `magit-commit-popup's default action by invoking the popup - command with a prefix argument failed due to a typo. - -* The command `magit-toggle-buffer-lock' failed if another buffer is - already locked to the same value. - -* The command `magit-clone' did not switch to the cloned repository - before trying to delete the symbolic-ref "origin/HEAD". - -* The commands `magit-insert-unpulled-from-pushremote' and - `magit-insert-unpushed-to-pushremote' missed an edge case when - checking whether their section should be inserted into the status - buffer. - -* The command `magit-merge-preview' did not recognize sections for - added or deleted files. - -* The command `magit-show-stash' did not properly handle untracked - files that were within subdirectories. - -* On `windows-nt' systems, having `mount' in `exec-path' caused Magit - to assume that git is from Cygwin. - -* Added a kludge to work around a bug in Apple's OS X which causes - `file-accessible-directory-p' to return incorrect results. - -This release also contains typofixes, documentation updates, and code -clean-ups. - -Authors -------- - - 53 Jonas Bernoulli - 13 Kyle Meyer - 4 Luís Oliveira - 4 Noam Postavsky - 1 Dan Erikson - 1 Dato Simó - 1 Russell Black diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.6.1.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.6.1.txt deleted file mode 100644 index 075f1c0..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.6.1.txt +++ /dev/null @@ -1,40 +0,0 @@ -Magit v2.6.1 Release Notes -========================== - -Fixes since v2.6.0 ------------------- - -* When a submodule is manually removed without staging the removal, - then the status buffer could no longer be updated. - -* In some cases not all modified submodules were shown in the status - buffer. - -* Visiting a blob did turn on `diff-hl-mode' if the global mode is on. - -* Stash and wipref were needlessly signed if signing is enabled. - -* The command `git-commit-save-message' did not strip diffs produced - by `git commit --verbose'. - -* Diffs produced by `git commit --verbose' were not completely - highlighted in the commit message buffer. - -* When the commit message buffer contains nothing but a single line - that does not end with a newline, then a warning was shown about - there being a non-empty second line. - -* When installing from Melpa, `async-bytecomp-package-mode' was no - longer activated early enough. - -This release also contains documentation updates, typofixes, fixes for -minor bugs, and other small improvements. - -Authors -------- - - 14 Jonas Bernoulli - 5 Kyle Meyer - 1 Fritz Grabo - 1 Ingo Lohmar - 1 Noam Postavsky diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.6.2.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.6.2.txt deleted file mode 100644 index 9433128..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.6.2.txt +++ /dev/null @@ -1,52 +0,0 @@ -Magit v2.6.2 Release Notes -========================== - -Changes since v2.6.1 --------------------- - -* Added new section inserter `magit-insert-submodules'. For each - submodule it inserts the module path and a description of its tip. - -* When re-adding an already configured but for some reason unstaged - submodule, then `magit-submodule-add' now offers the configured - submodule name as default choice. - -Fixes since v2.6.1 ------------------- - -* When possible `git merge (--no-commit|--edit)' perform fast-forward - merges, which isn't what one would expect. `magit-merge-nocommit' - and `magit-merge-editmsg' now work around that by always using - `--no-ff'. - -* The command `magit-log', when called with `--patch' but without - `--graph', deleted the first two characters of file names in the - diff. - -* When performing an instant fixup/squash, the rebase often failed - because the commit process still held the lock on `index.lock'. - -* The command `magit-submodule-add' offered an invalid default choice - for the module path and allowed selecting a file that isn't a - repository. - -* `git-rebase-mode' failed to prevent `save-place-mode' from having an - effect. - -* The section inserter `magit-insert-unpulled-from-upstream-or-recent' - failed to insert the recent commits instead when no upstream is - configured. - -* Two key bindings in `magit-pull-and-fetch-popup' conflicted. - -* The default value for `magit-cygwin-mount-points' checked if - "git.exe" was a cygwin flavor of git, instead of the (possibly user - customized) value of `magit-git-executable'. - -Authors -------- - - 21 Jonas Bernoulli - 1 John Mastro - 1 Kyle Meyer - 1 Noam Postavsky diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.7.0.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.7.0.txt deleted file mode 100644 index 74c6ce9..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.7.0.txt +++ /dev/null @@ -1,81 +0,0 @@ -Magit v2.7.0 Release Notes -========================== - -Released 19 May 2016 by Jonas Bernoulli. - -We are pleased to announce the release of Magit version 2.7.0, -representing 116 commits by 7 people over 7 weeks. - -Also see http://emacsair.me/2016/05/19/magit-2.7. - -Changes since v2.6.0 --------------------- - -* Added new popup `magit-subtree-popup' and bound "O" to it. - -* Added new popup `magit-branch-config-popup' and made it available - from the popups `magit-branch-popup', `magit-pull-and-fetch-popup', - `magit-pull-popup', `magit-fetch-popup', and `magit-push-popup'. - - With a prefix argument it reads a branch to be configured in the - minibuffer instead of using the current branch. - -* Added new option `magit-branch-popup-show-variables', defaulting to - t to avoid changing key bindings. When set to nil, no variables are - displayed directly in the `magit-branch-popup', instead the subpopup - `magit-branch-config-popup' has to be used. - -* Added new popup command `magit-log-buffer-file-popup'. - -* Added new command `magit-diff-buffer-file' and new option - `magit-diff-buffer-file-locked'. When the value of the option is - non-nil, the default, then the command uses a dedicated buffer. - -* Added new option `magit-log-buffer-file-locked'. When its value is - non-nil, the default, then `magit-log-buffer-file' uses a dedicated - buffer. - -* Added new commands `magit-worktree-checkout', - `magit-worktree-branch', `magit-worktree-delete', - and `magit-worktree-status'. - -* Added new section inserter `magit-insert-worktrees' - -* The command `magit-clone' now runs asynchronously, which avoids - blocking Emacs and allows handling password prompts. - -* The command `magit-stage' learned to stage an untracked file while - leaving its content unstaged (i.e., `git add --intent-to-add') when - called with a prefix argument. - -* The command `magit-reverse' learned to use `--reject' to ensure that - non-conflicting hunks are applied and that conflicting hunks are put - into reject files. - -* When the command `magit-discard' is used on staged changes, then - that is done by first reversing the changes in the index and then in - the working tree. The second step could fail due to conflicts. Now - the `--reject' argument is used, which ensures that non-conflicting - hunks are applied and that conflicting hunks are put into reject - files. - -* The command `magit-rebase-continue' learned to reuse the old commit - message as-is when called with a prefix argument. - -* In the refs buffer symbolic refs, such as "remotes/origin/HEAD", are - no longer omitted from the lists of local and remote branches. - -This release also contains the fixes described in the v2.6.1 and -v2.6.2 release notes, as well as various other documentation fixes, -code clean-ups, bug fixes, and other small to medium improvements. - -Authors -------- - - 95 Jonas Bernoulli - 10 Kyle Meyer - 7 Noam Postavsky - 1 Bart Bakker - 1 Fritz Grabo - 1 Ingo Lohmar - 1 John Mastro diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.8.0.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.8.0.txt deleted file mode 100644 index 2ca6b70..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.8.0.txt +++ /dev/null @@ -1,128 +0,0 @@ -Magit v2.8.0 Release Notes -========================== - -Released 21 August 2016 by Jonas Bernoulli. - -We are pleased to announce the release of Magit version 2.8.0, -representing 124 commits by 11 people over 3 months. - -Also see http://emacsair.me/2016/08/21/magit-2.8. - -Changes since v2.7.0 --------------------- - -* Added several new functions that are suitable values for - `magit-display-buffer-function': - `magit-display-buffer-same-window-except-diff-v1', - `magit-display-buffer-fullframe-status-v1', - `magit-display-buffer-fullframe-status-topleft-v1', and - `magit-display-buffer-fullcolumn-most-v1'. - -* Added new commands `magit-list-repositories' and related new option - `magit-repolist-columns'. - -* Added new commands `magit-list-submodules and related new option - `magit-submodule-list-columns'. - -* Added new command `magit-branch-orphan'. - -* Added new command `magit-log-move-to-parent'. - -* Added support for globbing in file arguments of diff and log - commands. - -* Added support for showing and copying bad commit identified by git - bisect. - -* Added new option `magit-log-output-coding-system'. - -* Added new option `magit-no-message', which can be used to suppress - certain messages whose usefulness are being disputed. - -* Taught `magit-find-file-noselect' and `magit-find-index-noselect' to - use Emacs' encoding detection, and enable `revert-buffer' to work in - those buffers. This makes `magit-ediff-*' commands more useful for - files with non-standard encoding. - -* Taught `magit-insert-bisect-rest' to show the log graph by default. - The new option `magit-bisect-show-graph' controls this. - -* Taught `magit-insert-submodules' to display more information. - -* When a refresh causes the previously current hunk section to - disappear, which happens when it was applied in some way, then we - attempt to move to a sibling hunk. When that succeeds, then that is - now considered a proper move and `magit-section-movement-hook' is - called, which in turn may cause the current hunk to be recentered. - -* In addition to the directory, each member of the value of option - `magit-repository-directories' can now specify the depth to look for - repositories inside that directory, overriding the default depth - specified using the option `magit-repository-directories-depth'. - -* Blob visiting buffers can now be reverted, which is useful when they - visit a reference. - -* Command `magit-stage' can now be used outside of Magit buffers. - -* Commands that read a branch or commit from the user now also offer - tags as completion candidates. - -* Taught `magit-insert-worktrees' to use relative filenames. - -Fixes since v2.7.0 ------------------- - -* Function `magit-get-all' did split multi-line values into multiple - values. - -* Function `magit-subtree-read-prefix' which is used in order to read - the `--prefix' argument from the subtree popup was missing. - -* Command `magit-blame' failed when run in a blob buffer for a file - located in a subdirectory. - -* Command `magit-diff-visit-file' didn't visit a blob when called - inside a `magit-stash-mode' buffer. - -* Command `magit-submodule-add' did not allow picking a path that - does not exist yet and read the path before the url. - -* Command `magit-submodule-setup' did update existing modules, which - can cause them to become detached. - -* Command `magit-popup-describe-function' could create an extra window - on wide frames. - -* Commands `magit-diff-show-or-scroll-{up,down}' failed to scroll - stash buffers. - -* Mode `git-rebase-mode' did not respect the Git variable - `core.commentChar'. - -* Sections in the process buffer sometimes had invalid parent - sections, causing movement and visibility commands to fail, and - expected Git errors not to be handled gracefully in some cases. - -* Merges where not performed asynchronously, which made it impossible - to read a passphrase from the user, needed for commit signing. - -* In bare repositories tracked files were listed as deleted. - -This release also contains typofixes, documentation updates, code -clean-ups, bug fixes, and other small to medium improvements. - -Authors -------- - - 59 Jonas Bernoulli - 33 Noam Postavsky - 23 Kyle Meyer - 2 Mario Rodas - 1 Andriy Kmit' - 1 Basil L. Contovounesios - 1 Chris Shoemaker - 1 Ivan Brennan - 1 Laverne Schrock - 1 Samuel W. Flint - 1 Wilfred Hughes diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.9.0.txt b/.config/emacs/lisp/magit/docs/RelNotes/2.9.0.txt deleted file mode 100644 index d7fa73c..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.9.0.txt +++ /dev/null @@ -1,437 +0,0 @@ -Magit v2.9.0 Release Notes -========================== - -Released 7 December 2016 by Jonas Bernoulli. - -We are pleased to announce the release of Magit version 2.9.0, -representing 250 commits by 18 people over 15 weeks. - -Also see https://emacsair.me/2016/12/07/magit-2.9. - -Breaking changes since v2.8.0 ------------------------------ - -* For historic reasons "RET" behaved differently in `magit-refs-mode' - than anywhere else. "RET" is one of Magit's most essential key - bindings and users quickly learn that regardless of what is actually - at point, it always shows more information about that thing in - another buffer. It can be very confusing if the references buffer - breaks this convention. - - Now `magit-visit-ref' behaves just like `magit-show-commit' even in - `magit-refs-mode' buffers. By default at least; you can easily - revert this change using: - - (setq magit-visit-ref-behavior '(checkout-any focus-on-ref)) - - However we recommend that you instead press "b b RET" to checkout - the reference at point, just like you always had to do in other - buffers. And "C-u y o RET" to make commit counts and lists of - cherries commits relative to the reference at point. - - Furthermore the option `magit-visit-ref-create' was removed. If you - previously had that set to `t', then you can achieve the same using: - - (add-to-list 'magit-visit-ref-behavior 'create-branch) - - However we recommend that you instead press "b c RET RET", just like - you always had to do in other buffers. #2868 - -* The option `magit-popup-show-common-commands' now defaults to `nil'. - - This was done to make popups less noisy but increases the odds - that some users will never become aware of the common commands. - To counter that, the usage instructions displayed in the echo area - now also mention the key that can be used to show these commands - temporarily. #2868 - - You can easily revert this change using: - - (setq magit-popup-show-common-commands t) - -* The option `magit-popup-use-prefix-argument' defaults to `default' - now, meaning that the use of a prefix argument causes the popup's - default action to be invoked directly without the popup being shown - first. - - Previously the use of a prefix argument did not invoke the popup - or its default action, and instead informed users that they had to - choose what behavior they wanted and that they had to set the option - accordingly. Doing that was necessary three years ago, when the - default behavior changed when "magit-key-mode.el" was replaced with - "magit-popup.el". Now we don't need that safety net anymore. #2868 - -* If, and only if, point is on a removed line in a diff, then "RET" - now jumps to the last commit which still had that line, not the - commit which removed that line. Staged changes are excluded from - this new behavior because in that case it seems favorable to always - visit the file in the working tree to make further changes. #2755 - - You can easily revert this change using: - - (setq magit-diff-visit-previous-blob nil) - -* The margin that by default is displayed in pure log buffers and - optionally in some other buffers that contain logs is now more - flexible and easier to customize and to change on the fly. - - The popup that "L" is bound to now features three commands that - for changing the appearance of the margin: `magit-toggle-margin', - `magit-toggle-margin-details' and `magit-cycle-margin-style'. - - The binding for `magit-toggle-margin' has changed from "L t" to the - simpler "L L". You can easily revert this change using: - - (magit-change-popup-key 'magit-log-refresh-popup :action ?L ?t) - (magit-change-popup-key 'magit-margin-popup :action ?L ?t) - - For each mode that supports the margin there now exists a dedicated - option named `magit-*-margin', which controls whether the margin is - shown initially, whether the author name is displayed in addition - to the committer date, and how that committer date is formatted. - All of these options can be found in the new `magit-margin' Custom - group. - - It is now possible to show the actual committer date, using a time - format of your choosing. Previously the only option was to display - the age of the commit. - - The old options that were previously used to configure the margin - have been removed. If you have customized `magit-log-show-margin', - `magit-reflog-show-margin' and/or `magit-refs-show-margin', then you - now have to customize the respective new variable whose names do not - contain "-show". The same applies if you have previously changed - the value of `magit-log-margin-spec'. Unfortunately this cannot be - automated because the format of the values has changed and because - the old customizations do not unambiguously map to the new options. - - You might also want to customize the options `magit-status-margin', - `magit-stashes-margin' and `magit-log-select-margin', for all of - which no corresponding `magit-*-show-margin' used to exist. Another - new option is `magit-refs-margin-for-tags'. - - If you choose to display the commit dates instead of the commit - ages in all supported modes, then you should set `magit-log-margin' - before loading `magit'. If you do that then the default values of - the other `magit-*-margin' options will use the same commit date - style without you having to customize each option individually. - #2885, #2792 - -* By default Git-Commit no longer complains about a summary line that - is too long by some standards. You can easily revert this change - using: 2f115d51 - - (add-to-list 'git-commit-style-convention-checks - 'overlong-summary-line) - -* In buffers used to write commit messages `fill-column' is no longer - set to 72. Instead the default value 70 is used (or whatever local - or global value is set up through other means). You can easily - revert this change using: #2848, #2852 - - (setq git-commit-fill-column 72) - -* When it takes too long to parse diffs, then Magit used to stop - expanding diff sections after one second. This was a constant - source of confusion and one second is a very long time anyway, so - this did not really help hiding the slowness, so this kludge was - effectively dropped. You can easily revert this change using: - - (setq magit-diff-expansion-threshold 1.0) - - By the way, improving performance will soon be a priority again. - #2886 - -Changes since v2.8.0 --------------------- - -* Magit has a new shiny logo! It was created by Dmitriy A. from - Prospect One. Thanks a lot! https://prospectone.io/portfolio/magit - -* The new option `magit-branch-adjust-remote-upstream-alist' can be - used to configure what branch to use as upstream when branching a - remote branch. Without setting this option the upstream ends up - being the same branch as the one referred to by the push-remote. - 85c3053d - -* The per-refresh cache, which is used to save calls to git because - that is surprisingly slow on Windows, has been improved for calls to - `git config'. Instead of just avoiding identical calls to `git - config' as for other sub-commands, we now call `git config --list' - only once per refresh to obtain a list of all variables and their - values. #2743 - -* When visiting a file or blob buffer by pressing "RET" while point is - inside a diff, then the position this jumps to is now accurate (even - when jumping to the file in the working tree from a diff that wasn't - about changes in the working tree). #2828 - -* When visiting a file or blob buffer by pressing "RET" while point is - inside a diff, then the buffer may be widened but only if necessary. - If it isn't necessary to widen the buffer to jump to the appropriate - location, because that position falls into the narrowed region, then - that the buffer isn't widened. #2804, #2818 - -* Hunk refinement is now faster. Users who previously set - `magit-diff-refine-hunk' to `nil' due to performance issues may - find that it now works well even when set to `all'. #2834 - -* The new options `magit-diff-highlight-hunk-region-functions' and - `magit-diff-unmarked-lines-keep-foreground' (which was previously - defined as an undocumented variable) allow tuning the appearance - of the hunk-internal region. - - The new function `magit-diff-highlight-hunk-region-using-face', - provides a new style; it makes the hunk-internal region bold (or - italic). I recommend you customize the above option to use this - function instead of one of the functions mentioned below. - - The new functions `magit-diff-highlight-hunk-region-using-overlays' - and `magit-diff-highlight-hunk-region-using-underline' draw one-pixel - lines before and after the hunk-internal region. Both of these - functions have (different) glitches and due to limitations of Emacs' - display engine it is not possible to fix those. #2293, #2758, #2791 - -* Added command `magit-find-git-config-file' and variants to make it - easier to open a file located in the git directory when ".git" is - a regular file whose contents describe the location of the real git - directory. 8664223c - -* Added command `magit-emacs-Q-command' to make troubleshooting and - bug reporting easier for users not installing from the git - repository. #2856 - -* The command `magit-branch-spinoff' learned to remove only a subset - of commits from the previously current branch, instead of resetting - it to its upstream, when the region selects commits reachable from - HEAD. 1e652b87 - -* The command `magit-branch-delete' now falls back to deleting the - tracking branch when the user attempts to delete a remote branch - which does not actually exist on the remote anymore. #2778 - -* The command `magit-diff-dwim' learned about additional cases. On - a non-current branch it now shows the diff for "CURRENT...BRANCH" - (instead of "BRANCH..CURRENT") and inside a stash buffer it shows - the diff for the commit at point. #2812 - -* The command `magit-push', which "o" is bound to in the push popup, - now offers the push-branch as default choice. Only if that is not - set does it default to the upstream as before. And when pushing a - commit that is reachable from HEAD, then it offers to push to the - push-branch or upstream of the current branch (which still has to - be forced explicitly). #2820 - -* Log commands now support completion of refs in the "refs/tags" and - "refs/pull" namespaces. #2878 - -* Added option `magit-no-confirm-default' to allow specifying commands - which should just use the default choice instead of having the user - confirm that by pressing RET. I recommend you don't use this, but - if you think that the defaults are so good that you always want to - use them, then this might make it a bit easier for you. #2741 - -* Added option `magit-slow-confirm' for users who are afraid they - would answer `y-or-n-p' questions to quickly. One action, deleting - all stashes, now defaults to having to be confirmed with "yes RET". - #2752 - -* Added option `magit-view-git-manual-method' to allow following links - to the Git Info manual by visiting the respective manpage instead. - de38266a - -* The option `magit-branch-prefer-remote-upstream' now also supports - regexps as members instead of only complete branch names. #2823 - -* The option `magit-branch-read-upstream-first' used to be a boolean. - Now it supports a third value `fallback', which means to read the - upstream first like `t', but if the value provided by the user does - not reference an existing revision, then it is treated as the name of - the new branch and the upstream is read using the second prompt, as - if the value of this option were `nil'. #2741 - -* When deleting a stash, the hash is now logged to the process log - buffer in addition to *Messages*, making it more likely that a - user who accidentally deleted a stash would find the information - required to undo that. #2746 - -* The environment variable `INSIDE_EMACS' is now set when calling git. - #2789 - -* `magit-define-popup' now allows specifying `:max-action-columns' per - section by using a function that returns a different value based on - the heading, which is passed as argument. 964fcbe0 - -* Added support for new gpg status letters X, Y, R, and E. #2845 - -* Added `hl-line-mode' to `magit-repolist-hook' and - `magit-submodule-list-hook' and defined those hooks explicitly. - 9f806732 - -* Added the `--gpg-sign=' option to the revert popup. 916e4599 - -* Added the `--sort=' option to the show-refs popup. (Use "C-u y" to - show the popup instead of invoking its default action as "y" does.) - 8ab81f06 - -* Added new faces `git-rebase-comment-heading' - and `git-rebase-comment-hash'. #2769 - -* `whitespace-mode' is not compatible with Magit buffers, where it is - now actively prevented from being turned on by the user. #2821 - -Fixes since v2.8.0 ------------------- - -* The command `magit-list-repositories' failed on empty repositories. - 09fac022 - -* The Git variable `pull.rebase' was ignored when determining whether - the current branch is being rebased onto its upstream in order to - display that information in the status buffer. 9c946ee3 - -* On 32-bit systems `magit-format-log-margin' failed because it tried - to truncate a time float that was too large for that. #2765 - -* On Emacs v25.1 the hunk-internal region flashed briefly on - mouse-down-1 events and the delimiting horizontal lines could end - up having the height of a regular line instead of just a single - pixel. #2758 - -* On Windows, when using a `windows-nt' Emacs together with a cygwin - Git, we failed to instruct Emacs to not use dos shell quoting when - calling git. And if Git wasn't available, then that caused an - error, which prevented Magit from being loaded. #2842 - -* The encoding of commit messages is controlled by the Git variable - `i18n.logOutputEncoding' but we failed to take that into account. - Fixes by setting `i18n.logOutputEncoding' to UTF-8, but only inside - Magit and only for `window-nt'. #2738, #2813 - -* It wasn't taken into account, until a few days after the release, - that as of Git v2.11, the default abbreviation size is no longer - hardcoded as 7 but instead scales with the repository size. #2880 - -* File and directory local variables were not honored in the buffers - used to write commit messages. #2852 - -* The caching mechanism that is supposed to ensure that sections of - unpulled and unpushed commits remain collapsed even when they - disappear was broken for a while. 0ad041c4 - -* Process sentinels did not in all cases ensure that the correct - buffer was current before doing something that assumes that this is - the case. Almost always that did not matter because it was the case - anyway, but if other timers are running then it is possible that - those make the wrong buffer current. #2836 - -* Process sentinels and filters used when blaming assumed that the - `exit' process status indicates success. #2836 - -* The commands `magit-clone' and `magit-init' did not work over Tramp. - #2806, #2807 - -* The commands `magit-worktree-checkout' and `magit-worktree-branch' - did not expand the path they pass to git, which is necessary because - git does not know the meaning of "~/". #2796 - -* The commands which create fixup/squash commands and then immediately - squash them into the target commit did not remove `--gpg-sign' or - add `--no-gpg-sign'. Signing such commits is not only unnecessary; - unless the passphrase was cached earlier, trying to sign resulted in - the process indefinitely waiting for the passphrase to arrive with - no way for the user to actually provide it. #2799 - -* Depending on the value of `magit-save-repository-buffers' the user - might have been asked whether s/he wants to save "git-rebase-todo", - which is never necessary and just a distraction. #2770, #2771 - -* The function `magit-save-repository-buffers' did not follow symlinks. - #2843 - -* Directories whose names begin with a period were filtered out when - using `magit-repository-directories' to calculate a list of repos. - #2830 - -* The user name and email, which are displayed when reading a gpg key - from the user, were not stripped from the chosen value before being - handed off to git. #2761 - -* When the upstream of the current branch is a remote whose url isn't - configured then that caused an error when refreshing the status - buffer. #2858 - -* Buffers visiting a blob used the file's `default-directory' - even when that directory did not exist in the working tree. The - top-level directory is now used as `default-directory' when the - subdirectory does not exist. cfe46766 - -* When visiting a directory by displaying a Dired buffer, we used to - display a buffer for the parent of the directory in question and - placed point on the name of the directory. But the intention always - was to show the Dired buffer for the directory itself. 5665ba94 - -* Visiting or deleting a submodule listed inside "Modules" failed. - The latter is now done by de-initalizing the module. c26b746e - -* In the list of commits that are being rebased in the status buffer, - HEAD was sometimes prefixed with "same" when "stop" would have been - correct. #2877 - -* The highlighting of a non-empty second line in a commit message was - not automatically updated. #2777 - -* When `--force-with-lease' was added to the `magit-push-popup', - `--force' was removed, but sometimes the former just isn't enough. - be39a9ba - -* The face `magit-diff-file-heading-highlight' used to inherit from - `magit-diff-file-heading', which by default makes text bold. That - resulted in the complete current heading to be bold, but only the - file-name part is supposed to be bold. a4b52516 - -* The manual stated that "DEL" in Git Rebase mode was bound to - `magit-diff-show-or-scroll-down', which was not the case. A new - command `git-rebase-show-or-scroll-down` has been added and bound - to "DEL" to provide this functionality. #2863 - -* The function `magit-repolist-status' did not expand the filename - which may be necessary when listing submodules. cc8c1385 - -* The macro `magit-with-temp-index' did honor the refresh cache, even - though its BODY may contain calls to git that are identical to - outside calls during the same refresh, but which are expected to - return a different value due to the use of a different index. #2883 - -* The log margin did not show the author of stashes. #2846 - -* The status header about the upstream did not take - `branch.NAME.rebase' into account. e65f15d0 - -* Highlighting overlays could not be garbage collected until after a - refresh. #2888 - -This release also contains typofixes, documentation updates, -code clean-ups, and other small bug fixes and improvements. - -Authors -------- - - 196 Jonas Bernoulli - 21 Kyle Meyer - 12 Noam Postavsky - 4 Alexander Gramiak - 2 Adam Porter - 2 Marco Wahl - 2 Sean Allred - 1 Allen - 1 Basil L. Contovounesios - 1 Chillar Anand - 1 Graham Dobbins - 1 Joakim Jalap - 1 Josiah Schwab - 1 Keshav Kini - 1 Marian Schubert - 1 Philipp Stephani - 1 Tunc Uzlu - 1 York Zhao diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.90.0.org b/.config/emacs/lisp/magit/docs/RelNotes/2.90.0.org deleted file mode 100644 index 4d9f6e5..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.90.0.org +++ /dev/null @@ -1,423 +0,0 @@ -* Magit v2.90.0 Release Notes - -Released 8th November 2018 by Jonas Bernoulli. - -I am pleased to announce the release of Magit version 2.90.0, -representing 395 commits by 18 contributors over five months. - -Also see https://emacsair.me/2018/11/08/magit-2.90. - -** Breaking changes - -- Dropped support for Emacs 24.4. At least Emacs 25.1 is required - now. - -- Dropped support for Git 1. At least Git 2.0.0 is required now. The - reason 2.0.0 is the new minimal version isn't its roundness but the - discovery that some parts of Magit already depended on that release - for two years. Since we will soon drop support for versions before - (probably) 2.4.0 anyway, we don't add a backward compatibility - kludge for the feature that already requires 2.0.0 but instead bump - the minimal version a first time. - -- Many commands were renamed, making their names longer. The old - names are defined as aliases for now. This is part one of a two - part change. In this release we rename, for example, ~magit-tag~ to - ~magit-tag-create~ and in a later release ~magit-tag-popup~ will be - renamed to ~magit-tag~. #3619 - -- Removed many obsolete variable and function aliases. - -- Removed many obsolete variables that are not mere aliases. - -- Removed ~magit-section~ accessor functions. Use the ~oref~ and ~oset~ - functions instead. - -- The function ~magit-section-when~ has been deprecated in favor - of ~magit-section-match~ or the new ~magit-section-value-if~. The - signatures of some related low-level functions have changed. #3590 - -- The ~submodule~ section type has been renamed to ~module~, same for the - plural variant and the related section-specific keymaps. 35f803c9c, - 59e3891fd - -- Added a new function ~magit-completing-read-multiple*~, which is more - like ~magit-completing-read~ than ~magit-completing-read-multiple~. - Authors of extension should use the new function, which eventually - will replace the old one. cb4d59190 - -** Changes since v2.13.0 - -- Added a new mode ~magit-wip-mode~, which enables automatic committing - to work-in-progress refs whenever that makes sense. Previously - multiple ~magit-wip-*~ modes had to be enabled to accomplish the same. - These modes still exist, the new mode is implemented on top of them, - but their explicit use by the user is discouraged. #3534 - -- Added a new option ~magit-wip-merge-branch~, which causes the current - branch to be merged into its wip refs after creating a new commit on - the current branch. This isn't enabled by default yet because some - additional tooling is required to deal with the fact that this - prevents the wip refs from ever being garbage collected, and results - in unwieldy commit graphs when history manipulation is involved. - #3534 - -- Added new commands ~magit-wip-log-index~ and ~magit-wip-log-worktree~. - #3534 - -- It is now possible to specify the major-mode used to edit commit - messages on a per-repository basis. The same major-mode is also - used to prettify commit messages when displaying existing commit - messages in ~magit-revision-mode~ buffers. - - To set the major-mode to be used for commit messages add an entry - to the appropriate ~.dir-locals.el~ file using ~git-commit-mode~ as - the key, as if that mode were a major-mode. This can also be used - to set other variables in the buffers used to /edit/ commit messages. - - If ~$GIT_WORK_TREE/.git~ is a file, then ~$GIT_WORK_TREE/.dir-locals.el~ - would normally not apply when editing a file inside ~$GIT_DIR~. Magit - uses it anyway unless ~$GIT_DIR/.dir-locals.el~ exists. - - 55ba0534c, d7412da32, c5269547a - -- Added a new major-mode ~git-commit-elisp-text-mode~ intended to be - used when editing commit messages for Elisp projects. It derives - from ~text-mode~ and additionally highlights ~`symbols'~ and "strings". - d7fa6632b - -- Changed the order and the initial visibility of log sections in the - status buffer to optimize for "usefulness". Previously the focus - was on making it more likely that the user did not ignore the less - frequently useful logs, but that was quite annoying because it got - in the way of the more frequently performed tasks. #3518 - -- Added new option ~magit-status-initial-section~, which controls which - section point is placed on when a status buffer is created. The new - default is to place point on the section that follows the headers, - i.e., the second section. This is quite flexible, you might want to - read the doc-string. 87de83da8, #3562, #3518 - -- Added new commands ~magit-commit-absorb~ and ~magit-commit-absorb-popup~. - These commands depend on the ~git-autofixup~ script, which is available - from https://github.com/torbiak/git-autofixup. #3053 - -- Began migrating from using section "types" to using section classes - that can inherit from other classes. #3590 - -- Removed many backward compatibility hacks, which are no longer - necessary. - -- Began to use features and many convenience functions that we - couldn't use before because we still supported Emacs 24.4. - -- ~magit-file-rename~ now reads the target from the same directory as - the source. This is more convenient because removing parts of the - path is easier than adding them again. - -- Added new ~magit-gitignore-popup~ and bound ~I~ to it, making it - possible to use ~i~ for the ~magit-imerge-popup~ from the ~magit-imerge~ - package. - -- Renamed the existing command ~magit-describe-section~ to - ~magit-describe-section-briefly~ and added a new command - ~magit-describe-section~, which pops up a ~*Help*~ buffer, - which contains information about the function and hook - used to insert the section. #3539 - -- Added new ~magit-refname-pullreq~ face and a corresponding entry to - ~magit-ref-namespaces~. - -- Added new option ~magit-log-trace-definition-function~, which allows - specifying the function that ~magit-log-trace-definition~ should use - to determine the function at point. The default is ~which-function~. - Previously the less complete ~add-log-current-defun~ was used. - #3483, 9ff266358 - -- fixup! and squash! are now highlighted like [keywords] in logs. - 426773040 - -- Added new stub commands ~magit-browse-thing~ and ~magit-edit-thing~. - Like other ~magit-*-thing~ functions they are intend to be replaced - in section-specific keymaps. The ~forge~ package will use do so for - these commands. 56fccaca6, 0fa3092eb - -- In case they are bound when Magit is loaded then ~$GIT_DIR~ and - ~$GIT_WORK_TREE~ are unset now. Magit breaks if these variables are - set and the most likely cause for them to be set is a user error. - 2d7d5d840 - -- ~magit-merge-into~ now only offers local branches for completion and - defaults to the upstream. If the upstream is a remote branch then - it defaults to the respective local branch. a52d70198 - -- It is now possible to set the face used to highlight the headings of - certain sections using the new ~heading-highlight-face~ slot. 2319a1e0e - -- The summary line of a commit message and the first line of notes are - now emphasized more to make it more obvious what text is part of the - commit message and what text was added by a note. fda4b936c - -- Detection of the branch at point was improved. #3530 - -- Added new shortstat margin style for logs. Performance isn't good - yet, so you might want to avoid this for long logs. #3035 - -- Added new variable ~magit-perl-executable~ for platforms that put ~perl~ - in unusual places. We use ~perl~ for some one-liners that are embedded - in lisp because we known that it is available because ~git~ depends on - it. #3538 - -- Added new command ~magit-reset-worktree~. The existing ~magit-reset-*~ - commands already implemented the variants supported by ~git reset~, - now Magit also implements the variant missing from that. b4d5c2bee - -- Improved ~magit-process-password-auth-source~'s entry matching. - 60a335e5c - -- Added new hook ~magit-create-buffer~ hook. 2113dfc3d - -- When the user "discards" a file with conflicts then they are asked - which side of the conflict they want to keep. When multiple files - are selected, then it is now possible to decide for all of them at - once. #3553 - -- Added option ~--ignore-submodules~ to diff popups. This option does - not only affect diffs but also the dedicated module sections and can - therefore be used to temporarily hide all information about modules, - which can be expensive to calculate. #3555, #3568 - -- Added ~--graph~ to the default value of ~magit-log-select-arguments~ - instead of hard-coding this argument for some of the users of the - log-select machinery. #3559 - -- The upstream of the current branch is no emphasized in logs, by - default by making it italic. #3573 - -- Added new command ~magit-submodule-remove~ and the new related option - ~magit-submodule-remove-trash-gitdirs~. The default is to not trash - the gitdirs. ~magit-submodule-add~ now offers to reuse an existing - gitdir when re-adding a submodule. #3585 - -- ~magit-submodule-add~ is run asynchronously now. #3585 - -- Information about the running Git process is now also shown in the - mode-line of buffers that were created after the process was - started. 43264c873 - -- Rebase commands that continue a rebase sequence can now use ~git rbr~ - instead of ~git rebase~. To initiate a rebase sequence using ~git rbr~ - you may use https://github.com/fanatoly/magit-rbr. c2cd780b2 - -- The manual is now also available in epub format, but it isn't very - pretty. #3579 - -- Added new hooks ~magit-stage-hook~ and ~magit-unstage-hook~. #3496 - -- Added new hook ~git-commit-post-finish-hook~, a hook that has been - requested many times but which I did not implement before because it - is impossible to make 100% reliable. When the ~emacsclient~ returns, - then that does not mean that the calling process is done too. We - avoid a race condition by waiting for ~HEAD~ to point to a different - commit than it used to point to, before running the hook. If it - takes longer than a second for this to happen, then the hook is not - run. A few unsafe commands are also blacklisted because they - perform other things after creating the commit and that would lead - to another race condition. #3615, d445a3d30, af4bf8df8 - - This hook is used instead of ~with-editor-post-finish-hook~ (on which - the former is build) to merge the current branch into its wip refs - when ~magit-wip-merge-branch~ is non-nil. - -- Added new hook ~magit-post-commit-hook~, which is only run after - running a ~magit-commit-*~ command that does not require the user - to edit the commit message. #3615 - -- ~magit-format-patch~ can now be told to only include the changes to - certain files in the patch. It now also refreshes Magit buffers. - #3601 - -- The list of related refs in ~magit-revision-mode~ buffers is no longer - truncate when it doesn't fit on a single line. Instead users can - now specify the kinds of refs that should be inserted in such - buffers using the option ~magit-revision-insert-related-refs~. #3487 - -- Added new function ~magit-gitdir~ scheduled to replace ~magit-git-dir~ - eventually because the latter has a really strange signature. - 5f407a29a - -- Created new libraries from existing code. 9efcb1e8b ff - -- The option ~magit-revision-show-gravatar~ is now easier to customize. - Customizing it to only show one of the two images actually works - now. f4b8fee66, b82228bc6 - -- The option ~magit-repository-directories~ has a non-nil default value - now. f77d1158b - -- The list of stashes in the status buffer is initially collapsed now. - 4dc1d0593 - -- The commands ~magit-previous-line~ and ~magit-next-line~ are used by - default now. 3ae75c865 - -- Added support for ~--left-right~ output in logs. #3627 - -- Added new option ~magit-with-editor-envvar~. Changing its value from - ~GIT_EDITOR~ to ~GIT_SEQUENCE_EDITOR~ allows users to continue to use - Magit (~git-rebase.el~ actually) to edit rebase sequence but to use - another editor to edit commit messages and such. #3629 - -- Added new option ~magit-clone-default-directory~. #3635 - -- ~magit-ref-namespaces~ is now taken into account when colorizing - branch names in buffers listing refs. #3645 - -- Added new option ~magit-revision-fill-summary-line~. #3610 - -** Fixes since v2.13.0 - -- A confirmation prompt during rebase was wrong. 37d76f409 - -- ~magit-rebase-autosquash~ asked for confirmation when the user already - confirmed earlier. 02e6c75b6 - -- ~magit-commit-add-log~ inserted after the diff that gets inserted if - ~commit.verbose~ is ~true~. #3480 - -- ~magit-log-wash-rev~ errored in ~magit-cherry-mode~, starting with Emacs - 26.1. - -- ~magit-dired-jump~ failed, starting with Emacs 26.1. #3469 - -- Magit used a completion function to make the built-in completion - respect the collection's order. Even though that wasn't necessary - for Ivy and Helm it did the same here, which became a problem when a - change in Helm caused fuzzy completion to break in combination with - a completion function. Likewise a change in Ivy caused Magit's sort - order to be ignored, which we work around now. #3476, #3477 - -- In some edge cases ~magit-branch-pull-request~ used to set Git - variables to invalid values. #3417 - -- The section visibility cache used ~eq~ when it should have used ~equal~. - It also briefly used ~alist-get~, which we cannot do because that did - not take a ~testfn~ argument in Emacs 25. #3495, #3499 - -- Detecting whether a commit has already been pushed to a "publishing" - branch was much slower than it had to be. #3519 - -- ~magit-gitignore-popup~'s autoload definition was broken. - -- When using cygwin, then ~git-commit-setup-font-lock~ could end up - trying to run git in a non-existent directory. #3505 - -- ~magit-completing-read~ did not protect the value of ~this-command~ even - though there is code that assumes it does. #3529 - -- ~magit-read-file-trace~ in some cases claimed that valid user input - was invalid even though it was valid. Now we don't try to validate - it anymore. #3531 - -- We didn't account for the surprising fact that asking whether the - value of a local variable is risky can change point. #3541 - -- ~magit-merge-into~ signaled an error if the upstream of the current - branch isn't configured instead of letting the user pick a target. - #3550 - -- Some of the more complex ~magit-cherry-*~ variants did not abort if - the first step failed. #3556 - -- Trying to visit a commit of a submodule directly from the status - buffer of the super-projects resulted in an error. #3563 - -- ~magit-file-rename~ failed to rename a file that is located at the - top-level of the working tree. #3569 - -- Magit didn't account for ~git rebase -i --root~ corrupting the root - commit's author date field, resulting in its output being corrupted - too. #3574 - -- If given one invalid rev, then ~magit-rev-eq~ returned ~nil~, but when - both revs are invalid, then it returned ~t~. Now it returns ~nil~ in - both cases. - -- In an edge case ~magit-diff-type~ falsely concluded that the - uncommitted changes in a diff buffer already are committed. #2627 - -- ~magit--github-url-p~ failed to return ~t~ for an url for Github - Enterprise instances. #3572 - -- Trying to insert Gravatar images resulted in an error if the service - is not reachable. #3597 - -- ~magit-display-buffer~ always selected the appropriate frame even if - that was already selected. That is undesirable because selecting - a frame has side-effects. f07eb85c6 - -- A key binding was not updated when ~magit-submodule-deinit~ was renamed - to ~magit-submodule-unpopulate~. b06845208 - -- ~magit-submodule-visit~ could end up re-populating the visited module. - 3d794cd01 - -- The third-party ~git-annex~ program converts submodule gitdirs to - symlinks, which we did not account for. #3599 - -- ~magit-bisect-start~ did fail silently when invalid user input, which - flipped the good and bad revisions, instead of providing an - informative error message. #3604 - -- ~magit-bisect-start~ did fail silently when there are uncommitted - changes instead of providing an informative error message. In some - cases it actually is possible to bisect with uncommitted changes but - that would be dangerous and we do not try to detect whether that is - the case and just always error out. #3604 - -- When applying changes, then the ~--unidiff-zero~ and ~-C0~ arguments - were not automatically used when needed. The former wasn't used - because of a bug, the latter because I was not aware that there - was an edge case that makes that necessary. #3608 - -- Backported a fix (from Emacs 27) for an Emacs bug that sometimes - caused ~git rebase~ to fail to acquire the ~index.lock~. #2708, - https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21559 - -- Autoloading ~magit-submodules~ didn't work. #3618 - -- Reverting files failed if the selection contained only binary files. - c7bbe3e9a - -- ~magit-read-repository~ failed when ~magit-repository-directories~ is - non-nil but no repository can be found in those directories. #3636 - -- Attempting to reverse changes to binary files failed with an error - that wasn't informative enough. #3625 - -- When a local branch is being renamed, then ~magit-branch-rename~ used - to also rename the (remote) push-target, which is unsafe in some - cases. Now it always asks the user before doing so. 14c7b1381 - -* Authors - - 333 Jonas Bernoulli - 31 Kyle Meyer - 13 Noam Postavsky - 2 Phil Sainty - 1 Alex Branham - 1 Aria Edmonds - 1 Arialdo Martini - 1 Basil L. Contovounesios - 1 Benjamin Motz - 1 Bob Uhl - 1 Eric Prud'hommeaux - 1 Felix Yan - 1 John Morris - 1 Jordan Galby - 1 Louis Roché - 1 Mak Kolybabi - 1 Miciah Masters - 1 N. Troy de Freitas - 1 Pierre Neidhardt - 1 Raimon Grau diff --git a/.config/emacs/lisp/magit/docs/RelNotes/2.90.1.org b/.config/emacs/lisp/magit/docs/RelNotes/2.90.1.org deleted file mode 100644 index 2c601f8..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/2.90.1.org +++ /dev/null @@ -1,39 +0,0 @@ -* Magit v2.90.1 Release Notes -** Changes since v2.90.0 - -- Added ~bug-reference-mode~ to ~git-commit-setup-hook~. e19e8fb1e - -- The "Version" column in ~magit-submodule-list-mode~ and - ~magit-repolist-mode~ buffers now shows when a repository is dirty. - 0b86dbfd6 - -- Added new command ~magit-log-merged~. This command requires - ~git-when-merged~ (https://github.com/mhagger/git-when-merged). It - isn't bound in ~magit-log-popup~ by default. To add it, you can use - something like - - #+BEGIN_SRC emacs-lisp - (magit-define-popup-action 'magit-log-popup - ?m "Log commit's merge" 'magit-log-merged) - #+END_SRC - - #3657 - -** Fixes since v2.90.0 - -- Bumped the minimal required version of ~git-commit~ to the correct - version. e9bd33758 - -- Dropped the new "v" prefix that we started to add to release tags - starting with the previous release in places where that prefix is - undesirable. f441cf6d7 - -- Staging and unstaging submodules while ~diff.submodule~'s value is ~log~ - broke shortly before the v2.90.0 release. #3654 - -* Authors - - 10 Jonas Bernoulli - 1 Allen Li - 1 Kevin Brubeck Unhammer - 1 Kyle Meyer diff --git a/.config/emacs/lisp/magit/docs/RelNotes/3.0.0.org b/.config/emacs/lisp/magit/docs/RelNotes/3.0.0.org deleted file mode 100644 index 0c9883d..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/3.0.0.org +++ /dev/null @@ -1,686 +0,0 @@ -* Magit v3.0.0 Release Notes - -Released 25th May 2021 by Jonas Bernoulli. - -I am pleased to announce the release of Magit version 3.0.0, -representing 1264 commits by 87 contributors over 2.5 years. - -Also see https://emacsair.me/2021/05/25/magit-3.0. - -** Breaking changes - -- Dropped support for Git v2.0 and v2.1. - -- After some users intervened I have decided to NOT drop support for - Emacs 25 in this release as I had intended to do. Emacs 25 should - remain supported for at least a few more releases. - -- Magit now uses Transient instead of Magit-Popup. In the transition - many popups gained new arguments and/or commands, most of which are - not mentioned explicitly in these release notes. Many of these - commands are hidden by default because they are only useful to a - subset of users. See https://emacsair.me/2019/02/14/transient-0.1 - for information about the new Transient library and how to enable - hidden commands, among other things. - -- The commands ~magit-branch-pull-request~, ~magit-checkout-pull-request~ - and ~magit-worktree-checkout-pull-request~ were removed in favor of - improved implementations provided by the new Forge package. (See - https://emacsair.me/2018/12/19/forge-0.1 for more information about - Forge.) - -- ~C-c C-e~ is no longer bound to ~magit-dispatch-popup~. It is bound to - ~magit-edit-thing~ now, so that Forge can add section-specific - bindings using this key. ~magit-dispatch-popup~ has been renamed to - ~magit-dispatch~ and continues to be available on ~h~, ~?~ and ~C-c C-c~. - #3659 - -- ~C-c C-b~ is no longer bound to ~magit-browse-thing~ to avoid a conflict - with ~magit-go-backward~ in diff and log buffers. ~C-c C-w~ (as in web) - is used instead now. #3659 - -- The option ~magit-display-file-buffer-function~ was removed. 8a214c9fb - -- The buffer-local variable ~magit-refresh-arguments~ was replaced with - several variables because ~(nth N magit-refresh-arguments)~ just isn't - very informative. Several related API functions had to be changed - in incompatible ways. This was done by adding new functions and - keeping the old variable and functions around for backward - compatibility. Packages using the obsolete variable and functions - should be adjusted soon. #3836 - -- Magit-Section is now distributed as a separate package, as announced - here: https://emacsair.me/2020/01/23/magit-section. #4003 - -- Magit now adds three global key bindings, which can be prevented - by setting the new option ~magit-define-global-key-bindings~ before - loading ~magit~. Note that if you bind these keys to other commands - anywhere in your init file (even *after* loading ~magit~), then Magit - won't override those bindings. See the options doc-string for - more information. #4237 - -- Magit no longer depends on ~async-bytecomp~ to avoid a certain class - of mystery bugs because this effort backfired. 86eec7ba3 - -- ~global-git-commit-mode~ is no longer autoloaded. Users who commit - from the command-line but still want to use ~git-commit-mode~, might - now have to load ~git-commit~ explicitly in their init file. - 13f20763a - -** Changes since v2.90.0 - -- It isn't always obvious that a section can be expanded, especially - to users who are just getting started with Magit. Mainly to make - it easier for those users, expandable and collapsible sections now - get an indicator in the fringe. - - The new option ~magit-section-visibility-indicator~ can be used to - disable this or to select the alternative style, which shows an - ellipsis at the end of the heading of each expandable section - instead. #3679 - -- The "Version" column in ~magit-submodule-list-mode~ and - ~magit-repolist-mode~ buffers now shows when a repository is dirty. - 0b86dbfd6 - -- Added new command ~magit-log-merged~. This command requires - ~git-when-merged~ (https://github.com/mhagger/git-when-merged). - It is a suffix of ~magit-log~ but is disabled by default. #3657 - -- Added new class slot ~keymap~ to allow other packages to define - section-specific keymaps without naming them ~magit-TYPE-section-map~, - which would mean using a symbol prefix (~magit-~) that does not match - the package name. - -- Added new option ~magit-diff-refine-ignore-whitespace~, overriding and - defaulting to the value of ~smerge-refine-ignore-whitespace~. #3671 - -- Added new option ~magit-diff-paint-whitespace-lines~, which controls - in what kind of lines (added/removed/context) whitespace errors are - highlighted. #3671 - -- It is now possible to show whitespace errors only in uncommitted - changes by setting ~magit-diff-paint-whitespace~ to ~uncommitted~. The - obsolete value ~status~ is treated as a synonym. The intention always - was to allow limiting to uncommitted changes and limiting to changes - shown in the status buffer was the closest approximation readily - available when this feature was first added. #3671 - -- The commands ~magit-commit-instant-fixup~, ~magit-commit-instant-squash~ - and ~magit-rebase-autosquash~ now unconditionally preserve empty - commits that were already present before the autosquash rebase - performed by these commands. This is the safe default; if you want - to drop such commits, then you have to enable ~--autosquash~ in the - popup and then invoke ~magit-rebase-interactive~. #3670 - -- ~magit-rebase-remove-commit~ now supports removing the ~HEAD~ - commit. #4195 - -- The option ~magit-repository-directories~ defaults to ~nil~ again - because the non-nil default added in v2.90.0 led to surprising - changes in behavior. The documentation of this option and the - related ~magit-status~ command were made less ambiguous. #3673 - -- Renamed the face ~git-commit-note~ to ~git-commit-keyword~ because that - is what text in brackets is called elsewhere in Magit and because - the term "note" was ambiguous in this context. The old face name - is still defined as an alias, but that will be removed eventually. - -- The command ~magit-worktree-checkout~ now also offers tags and remote - branches as completion candidates. #3692 - -- The command ~magit-commit-reword~ now always uses ~--allow-empty~ - because when you reword an empty commit, then you have already - confirmed that you are okay with that commit being empty. - -- The new buffer-local variable ~git-commit-need-summary-line~ can - be of use if you want to write Git notes without separating the - first line with an empty line from the rest of the text. #3676 - -- Made ~magit-tag-release~ more flexible and added it as a suffix of - ~magit-tag~. 2d14f84b2 - -- Bound "C-c C-o" (in addition to "C-c C-w") to ~magit-browse-thing~ for - consistency with ~org-open-at-point~'s binding. 1e1193666 - -- ~magit-copy-section-value~ now supports stripping diff markers. #3716 - -- ~magit-insert-*-branch-header~ now colorizes keywords in the message. - 98e328200 - -- ~magit-unstage~ can now unstage files that were staged using - ~--intent-to-add~. #3753 - -- ~magit-read-branch-or-commit~ now offers symbolic refnames such as - ~ORIG_HEAD~ as completion candidates. #3766 - -- ~magit-stage-modified~ and ~magit-unstage-all~ now take the log file - filter into account. #3767 - -- New command ~magit-skip-worktree~ can be used to tell Git to pretend - that the working tree version is up-to-date; ~magit-no-skip-worktree~ - does the opposite. Both commands are available from the - ~magit-gitignore~ prefix but are disabled by default. #3710 - -- ~--rebase-merges~, an option available in Git version 2.18.0 and - later, is now supported. The ~--rebase-merges~ infix of - ~magit-rebase~ is disabled by default. #3762 - -- New command ~git-rebase-break~ inserts a "break" action in the - rebase to-do sequence (available as of Git v2.20). #3762 - -- ~git-rebase-kill-line~ and the commands for changing the action of a - commit line (e.g., ~git-rebase-squash~) learned to work on all lines - selected by the region. #4172 - -- The ~--color-moved~ diff argument is supported now, but isn't - available from the diff transients by default. To enable it - use "C-x l" in those transients. #3424 - -- Added new option ~magit-revision-filter-files-on-follow~ that - controls whether a revision buffer shown from a log shares the log's - file restriction despite ~--follow~ being in the log arguments. - #3680 - -- ~magit-cherry~ is now available from the ~magit-dispatch~ prefix. - ef311f378 - -- ~magit-cherry-spinoff~ now offers the upstream as the default - starting-point. e5a2a0ac2 - -- Added new command ~magit-branch-spinout~. #3794. - -- ~magit-process-password-auth-source~ now allows the use of emails as - usernames. 05d82d501 - -- Added new option ~magit-prefer-push-default~, which controls whether - commands that configure the push-remote do so by setting the value - of ~remote.pushDefault~ or ~branch..pushRemote~. Also removed - option ~magit-remote-set-if-missing~. 07ca042b6 - -- Support for bookmarks was rewritten from scratch. #3836, cd391a035 - -- The new options ~magit-prefix-use-buffer-arguments~ and - ~magit-direct-use-buffer-arguments~ replace the old option - ~magit-use-sticky-arguments~. The default "stickiness" of arguments - has changed. #3836, 0e67ca9eb - -- Like when moving through a log, moving through a list of cherries - now automatically updates the revision or blob buffer. #3836 - -- Added new option ~magit-worktree-read-directory-name-function~. #3820 - -- Basic optional support for ~libgit2~ was added, but because so few - functions are currently implemented using that library, opting in - currently has almost no effect. #3841 - -- ~git bisect~ is now run asynchronously. #3802 - -- ~magit-bisect~ now supports specifying alternate terms. The new - infixes and suffix related to this functionality are disabled by - default. - -- ~magit-branch-or-commit-at-point~ now falls back to an abbreviated - hash instead of something like "master~2", because the latter often - leads to undesirable behavior. fd5eb5b43 - -- ~magit-toggle-buffer-lock~ is now a suffix of both ~magit-diff~ and - ~magit-log~. c09993112 - -- When invoked with a prefix argument, then ~magit-clone~ now acts as a - prefix command. If the new option ~magit-clone-always-transient~ is - non-nil, then it always acts as a prefix command. #3846 - -- Clone commands now accept repository names and similar abbreviations - in addition to complete urls. The new options ~magit-clone-name-alist~ - and ~magit-clone-url-format~ control how the translation is done. #3846 - -- When called from ~magit-dispatch~, then ~magit-diff~ and ~magit-log~ no - longer set the file limit to the file visited in the current buffer. - ccc72469e - -- ~RET~ (~magit-diff-visit-file~) on a committed change now always visits - the respective commit. Previously it did that for all commits - except the ~HEAD~ commit. This made it impossible to visit the ~HEAD~ - commit using this or a related command and also was inconsistent. - - Likewise ~RET~ on an uncommitted removal now visits ~HEAD~, the last - commit that still had those lines. Previously it visited the file - in the working tree, making it difficult to blame the previous - version of modified lines. - - Now ~C-RET~ (~magit-diff-visit-worktree~) has to be used to visit the - file in the working tree for any commit or uncommitted removals. - Setting the new option ~magit-diff-visit-avoid-head-blob~ to a non-nil - value restores the old behavior of ~magit-diff-visit-file~. #3848 - -- ~magit-diff-visit-worktree~ now does a much better job at jumping to - the correct location in the file. c9e5425cd - -- Added new command ~magit-find-file-other-frame~. 9a69c74ca - -- Renamed command ~magit-diff-visit-file-worktree~ to - ~magit-diff-visit-worktree-file~. 4f739cd35 - -- Added new commands ~magit-diff-visit-file-other-frame~, - ~magit-diff-visit-worktree-file-other-window~, and - ~magit-diff-visit-worktree-file-other-frame~. 756d61911, 6704b3248 - -- Added new option ~magit-process-prompt-functions~. #3845 - -- ~magit-find-file~ is now available from ~magit-file-dispatch~. - 9c587d458 - -- ~magit-find-file~ and related commands learned to visit a file from - the worktree or index. #3860 - -- ~magit-find-file~ and related commands learned to go to the position - in the visited file that corresponds to the position in the - previously current buffer. #3860 - -- ~magit-diff-buffer-file~ learned to visit a commit instead of a range - when appropriate. #3860 - -- ~magit-show-commit~ and ~magit-diff-buffer-file~ learned to go to the - position in the diff that corresponds to the position in the - previously current file-visiting buffer. #3860 - -- Added new command ~magit-blob-visit-file~. When visiting a blob, then - it goes to the same location in the respective file in the working - tree. #3860 - -- ~magit-add-change-log-entry{,-other-window}~ learned to extract the - file name from blob-visiting buffers. - -- ~magit-tag-release~ now runs ~git~ asynchronously. #3855 - -- When invoked with two prefix arguments, then ~magit-mode-burry-buffer~ - now also kills all other Magit buffers associated with the current - repository. #3863 - -- ~magit-branch-or-commit-at-point~ was taught about Forge pull-requests. - 9447edd12 - -- When merging a branch that corresponds to a Forge pull-request, then - the commit message is modified to contain the pull-request number. - 15331d7c0 - -- For consistency ~magit-file-rename~ now also renames buffers that - visit untracked files. #3916 - -- Additional history simplification arguments were added to the log - transients. Because only a minority of users will use those, they - were put on levels that are not shown by default. 8f8a2f1cf - -- Added new commands ~magit-assume-unchanged, ~magit-no-assume-unchanged~, - ~magit-jump-to-skip-worktree~ and ~magit-jump-to-assume-unchanged~, and - section inserter ~magit-insert-assume-unchanged-files~. 2d0de8614 ff - -- Magit buffers are now compatible with ~whitespace-mode~ (and other - modes which use font-lock). #3840 - -- Added new command ~magit-status-here~ available from file-visiting - buffers at ~C-c M-g g~. This command tries to go to the position in - the status buffer that corresponds to the position in the current - file-visiting buffer. Setting ~magit-status-goto-file-position~ to - a non-nil value causes ~magit-status~ to behave the same way. #3930 - -- Replaced ~magit-repolist-column-dirty~ with ~magit-repolist-column-flag~ - which allows specifying arbitrary flags and predicates in custom order - using ~magit-repolist-column-flag-alist~. #3936 #3937 - -- The buffer that shows a stash is now updated automatically when - moving through a list of stashes if the user added the new - ~magit-status-maybe-update-stash-buffer~ and/or - ~magit-stashes-maybe-update-stash-buffer~ to - ~magit-section-movement-hook~. #3943 - -- Added new commands ~magit-log-matching-branches~ and - ~magit-log-matching-tags~. #3958, #3983 - -- Added new option ~magit-disable-line-numbers~. #3971 - -- Added new option ~magit-log-margin-show-committer-date~. 1b9995238 - -- Added new command ~magit-worktree-move~ to allow you to move an - existing worktree to a new directory. #3978 - -- Introduced two new faces to customize the appearance of commit messages: - ~magit-diff-revision-summary~ and ~magit-diff-revision-summary-highlight~. - #3988 - -- Commands under the ~magit-gitignore~ prefix now include directories - that contain only untracked files as completion candidates. #3985 - -- Added new command ~magit-toggle-verbose-refresh~. c63ec3920 - -- Added new function ~magit-disable-section-inserter~, which can be used - to disable a section only in the current repository. This mechanism - is useful for exceptionally large repositories. #4017 - -- Added new transient prefix command ~magit-status-jump~ and turned the - existing jumper commands into suffixes. 655950f40 - -- Added new option ~magit-copy-revision-abbreviated~. #4014 - -- Added new transient prefix command ~git-commit-insert-pseudo-header~ - and turned the existing inserter commands into suffixes. e88242679 - -- Added new command ~magit-push-notes-ref~. dff0bca6f - -- The ~--irreversible-delete~ diff argument is supported now, but isn't - available from the diff transients by default. To enable it use - "C-x l" in those transients. #4056 - -- Added new command ~magit-reset-keep~. 0ea8b0ef6 - -- Added new option ~magit-reshelve-since-committer-only~. #4101 - -- Added new command ~magit-commit-absorb~ as an alternative to - ~magit-commit-autofixup~. 9423edc0b - -- Added new option ~magit-status-use-buffer-arguments~. #4046 - -- Added new command ~magit-project-status~. #4173 - -- Added new variable ~magit-process-extreme-logging~ for debugging - purposes. #4217 - -- Taught Isearch and Swiper how to expand Magit sections when the - current match is inside a hidden section and how to close sections - again. #3999 - -- Added new command ~magit-commit-absorb-modules~. 10b4bec53 - -- Added new transient command ~magit-shortlog~. #4262 - -- Added new command ~magit-generate-changelog~. c5e118111 - -- The name of the main branch is no longer hard-coded to "master". - Now we use the value of ~init.defaultBranch~ if that is set and the - named branch exists. If not, then some other names that are - commonly used for the main branch are tried as a potential fallback. - c4494ac0b - -- Added new option ~magit-diff-extra-stat-arguments~. 1bd4fe26e - -- Added support for ~git-credential-manager-core~. #4318 - -- The name of the upstream remote is no longer hard-code to "origin". - See the doc-string of function ~magit-primary-remote~ to learn how to - customize this. f883b62fe - -This release also contains numerous other improvements. - -** Fixes since v2.90.0 - -- Bumped the minimal required version of ~git-commit~ to the correct - version. e9bd33758 - -- Dropped the new "v" prefix that we started to add to release tags - starting with the previous release in places where that prefix is - undesirable. f441cf6d7 - -- Staging and unstaging submodules while ~diff.submodule~'s value is ~log~ - broke shortly before the v2.90.0 release. #3654 - -- When another window is already displaying the file buffer, then - ~magit-display-file-buffer-other-window~ did additionally display - it in the current window. #3662 - -- It was undefined whether highlighting of word-granularity - differences or of whitespace-error had higher priority. #3671 - -- The Custom type definition of ~magit-diff-adjust-tab-width~ was - broken. #3671 - -- In the log-select buffers point was no longer placed on the same - commit as was at point in the buffer from which the command was - invoked. #3674 - -- ~magit-diff-type~ falsely concluded that a diff buffer showed - unstaged changes when diffing a range where the right side resolves - to the same commit as ~HEAD~. #3666 - -- ~magit-log-trace-definition-function~ defaulted to ~which-function~, - which isn't reliable because it used Imenu, which uses a cache but - by default never invalidates. Now we use ~magit-which-function~, a - replacement that never uses an outdated cache. - -- ~magit-log-trace-definition~ didn't account for Git treating "-" - differently from, e.g., "_", leading to false-positives like - "foo-suffix" being considered a match for "foo". - -- ~magit-log-trace-definition~ didn't do the escaping that Git expects - for function names with colons. #4051 - -- A regression in ~magit-log-move-to-parent~ prevented it from doing its - job. #3682 - -- Since v2.11.0 ~magit-log-revision-headers-format~ lines in the log - output (shown via ~++header~) weren't displayed properly when - ~--graph~ was enabled. #4129 - -- ~magit-clone~ didn't run ~magit-credential-hook~. #3683 - -- ~magit-list-repositories~ failed if one of the repositories that it - tries to list is empty. #3686 - -- The summary element from ~git-commit-font-lock-keyword-1~ lost against - the elements of ~git-commit-elisp-text-mode-keywords~, causing the - summary line to lose its special appearance when a "string" or - `symbol' appears in it. - -- ~magit-split-branch-name~ did not take into account that remote names - can contain slashes. #3685 - -- ~magit-which-function~ now simply resets Imenu's cache and then calls - ~which-function~. The old approach that tried to outsmart Imenu was - broken. #3691 - -- ~magit-describe-section-briefly~ did not actually display a section - ident when called interactively, as the docstring claimed. Now it - displays the section ident, which is useful in - ~magit-status-initial-section~. - -- Section movement commands got confused by type change sections being - treated as a special kind of hunk. #3698 - -- ~x-strech-cursor~ was set globally. #3707 - -- ~magit-blame-echo~ was broken. #3720 - -- ~magit-rev-name~ sometimes returned ~nil~ even when it could return a - name and it returned, e.g., "origin/HEAD" instead of "origin/master". - 2042957a7, d500c442 - -- ~magit-insert-*-branch-header~ did not account for empty commit - messages. #3719 - -- ~magit--painted-branch-at-point~ failed in some cases, causing an - error. e7e612e3c - -- In newer Git versions the rebase list shown in the status buffer - could contain duplicated entries for the current commit. 1e1cd0e28 - -- When deleting a remote branch failed, the logic for deciding whether - to prune the local remote-tracking ref was too loose, leading to - false positives. #3650 - -- ~magit-ediff-stage~ offered untracked files as completion candidates - even though it cannot handle those. 8dd612dfb - -- Fix handling of passphrase prompts which are output with leading - carriage return, such as those produced by Openssh 8.0. #3843 - -- The default value for ~magit-view-git-manual-method~ was treated as - invalid. #3873 - -- Unlike other ~magit-*-files~ functions, ~magit-ignored-files~ returned - paths relative to the current directory instead of the top-level of - the repository. 6d3f12d58 - -- Staging a hunk applied the change to the wrong location in rare - cases where repetitive diff context prevented ~git apply~ from - finding the correct location. #3924 - -- Staging a hunk with no context now aborts, as staging a region - within such a hunk already did, to avoid unintended and confusing - results. #3924 - -- Adjusted many faces so that they continue to extend to the edge of - the window as intended. This was made necessary by a backward - incompatible change in Emacs 27. #3986 - -- The ability to stage regions from within intent-to-add files broke - for users running Git v2.19.0 or later due to a change in the - default display of these files in the diff output. #4026 - -- ~magit-stash-branch-here~ applied the stash without checking out the - new branch. d3cee7f8c - -- A regression in v2.90.0 led to ~magit-wip-mode~ committing to "/refs/heads/HEAD" rather than "/HEAD" when on a - detached head. - -- Modifying a file, marking it with a "skip-worktree" or "assume - unchanged" bit, and then modifying it again triggered a failure in - ~magit-wip-commit-worktree~. #4037 - -- ~magit-abbrev-length~ returned an incorrect result when - ~core.abbrev~ was explicitly set to "auto". - -- Calling ~magit-status~ in a repository with a corrupt Git - configuration didn't propagate the error and instead preseted the - directory as though it was uninitialized. #4337 - -- When the status buffer is not shown in any buffer but point is on - a hunk, and editing and saving the respective file causes, that - hunk to disappear or change, then Magit ended up changing point - in the file-visiting buffer. #4196 - -- Various bug fixes to - ~magit-branch-delete~ (3e73ff19d), - ~magit--{upstream,pushbranch}-suffix-predicate~ (0ce7fbbc2), - ~magit-patch-create~ (470272a0f), - ~magit--cherry-spinoff-read-args~ (add276810), - ~magit-refs--insert-cherry-commits~ (3b37e6dc1), - ~magit--{pushbranch,upstream}-suffix-predicate~ (cef3b1217), - ~magit-diff-insert-file-section~ (01cf0c165), - ~magit-insert-unpushed-to-upstream-or-recent~ (02445d6e3), - ~magit-ref-equal~ (46862d9d2), - ~magit-ref-fullname~ (66b85daea), - ~magit-insert-unpulled-from-upstream~ (0363e9bac), - ~magit-git-version~ (0abc761f5), - ~auto-revert-buffers--buffer-list-filter~ (713bd64bf), - ~magit-insert-revision-gravatar~ (1f7e84c26), - ~magit-process-unset-mode-line~ (457a685e5), - ~magit-ido-completing-read~ (f52ab7977), - ~magit-file-untrack~ (0984d77fb), - ~magit-ref-p~ (8b33bc7c7), - ~git-commit-setup~ (675b75ded), - ~magit-{,no-}skip-worktree~ (34d6ac27d), - ~magit-fetch-all~ (904bb82ca), - ~magit-branch-configure~ (7246bf291), - ~magit--maybe-update-blob-buffer~ (1d57893a6), - ~magit-...-maybe-update-...-buffer~ (8d3459b55), - ~magit-read-gpg-secret-key~ (9d68a455d), - ~magit-gitignore-in-subdir~ (8c4e8ed74), - ~magit-save-repository-buffers~ (82136796f), - ~magit-stash-drop~ (a4972766a), - ~magit-ignore-submodules-p~ (a7699f868), - ~magit-log-propertize-keywords~ (ac1ee3df5), - and then I stopped adding to this list. - -This release also contains numerous other bug fixes, typo fixes, and -documentation fixes. - -* Authors - - 1001 Jonas Bernoulli - 120 Kyle Meyer - 10 Basil L. Contovounesios - 9 Noam Postavsky - 5 Vladimir Panteleev - 4 Damien Cassou - 4 Daniel Martín - 4 Sam Cedarbaum - 4 Štěpán Němec - 3 Adam Porter - 3 Benjamin Motz - 3 Kévin Le Gouguec - 2 Alban Gruin - 2 Allen Li - 2 Bastian Beischer - 2 Clément Pit-Claudel - 2 Daniel Fleischer - 2 Evan Torrie - 2 Ingmar Sittl - 2 Leo Vivier - 2 Martin Polden - 2 Naoya Yamashita - 2 Phil Sainty - 2 Philipp Stephani - 2 Radon Rosborough - 2 Ryan C. Thompson - 2 Szunti - 2 Tassilo Horn - 2 Thierry Volpiatto - 2 Troy Hinckley - 2 zilongshanren - 1 Adam Kruszewski - 1 Adam Spiers - 1 Alexander Miller - 1 Andrew Eggenberger - 1 Andrew Psaltis - 1 Andrew Schwartzmeyer - 1 Arnau Roig Ninerola - 1 Ashlynn Anderson - 1 Ben North - 1 Brian Leung - 1 Dan Davison - 1 Danny Zhu - 1 David Ellison - 1 Dominique Quatravaux - 1 Eric - 1 Fritz Grabo - 1 Gregory Heytings - 1 Hussein Ait-Lahcen - 1 Ian Milligan - 1 Ilya Grigoriev - 1 Johann Klähn - 1 Johannes Altmanninger - 1 Jonas Galvão Xavier - 1 Jonathan Arnett - 1 Jonathan del Strother - 1 Jordan Galby - 1 Josh Elsasser - 1 Justin Guenther - 1 Keshav Kini - 1 Kevin Brubeck Unhammer - 1 Kevin J. Foley - 1 Knut Olav Bøhmer - 1 Magnus Malm - 1 Mario Rodas - 1 Martin Joerg - 1 Matthew Kraai - 1 Maxim Cournoyer - 1 Michael Griffiths - 1 Ola x Nilsson - 1 Pancho Horrillo - 1 Philipp Fehre - 1 Pritam Baral - 1 Roey Darwish Dror - 1 Sean Whitton - 1 Simon Pintarelli - 1 Steve Purcell - 1 Thomas Fini Hansen - 1 Topi Miettinen - 1 Tsuyoshi Kitamoto - 1 Vitaly Ostashov - 1 Vladimir Sedach - 1 Wojciech Siewierski - 1 Yann Herklotz - 1 Ynilu - 1 Zhu Zihao - 1 zakora diff --git a/.config/emacs/lisp/magit/docs/RelNotes/3.1.0.org b/.config/emacs/lisp/magit/docs/RelNotes/3.1.0.org deleted file mode 100644 index 9467c7b..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/3.1.0.org +++ /dev/null @@ -1,58 +0,0 @@ -* Magit v3.1.0 Release Notes - -Released 1st July 2021 by Jonas Bernoulli. - -I am pleased to announce the release of Magit version 3.1.0, -representing 31 commits by 4 contributors over one month. - -Also see https://emacsair.me/2021/07/01/magit-3.1. - -** Breaking changes - -- The function signature of ~magit-completing-read-multiple~ was not - compatible with that of ~completing-read-multiple~, so we deprecate - it. Use the improved ~magit-completing-read-multiple*~ instead. - #4420 - -- The description of ~magit-merge-into~ in the merge menu was changed - to "dissolve" (from "merge into"). In the future we are going to - change the key binding from "i" to "d" as well, to keep it mnemonic. - We don't make both changes at once in the hope that this makes the - transition easier for existing users. 4c096921f - -** Changes since v3.0.0 - -- Adjusted to changes to Eieio in Emacs 28. a3626277c, 54a0019f3 - -- Added new command ~magit-log-move-to-revision~. #4418 - -- ~A m~ is now also bound to ~magit-merge-squash~. Despite the name it - fits better there. 51152fdec - -** Fixes since v3.0.0 - -- Fixed ~magit-emacs-Q-command~ and ~make build~ for ELPA users. - f50c3aa56 - -- Fixed reading choice in ~magit-process-git-credential-manager-core~. - #4396 - -- ~magit-blame~ didn't account for quoted file names when parsing - output from ~git blame~. #4400 - -- A regression in v3.0.0 prevented ~magit-bisect-run~ from executing - ~git bisect run~ unless ~magit-bisect-start~ was called beforehand. - f592e367d - -- ~magit-log-select-quit~ failed to call ~magit-log-select-quit-function~. - #4423 - -- The entry for pull-requests in ~magit-list-refs-namespaces~ did not - match the ref names used by Forge for that purpose. 4c3373f9a - -* Authors - - 24 Jonas Bernoulli - 3 Kyle Meyer - 1 Siavash Askari Nasr - 1 TEC diff --git a/.config/emacs/lisp/magit/docs/RelNotes/3.2.0.org b/.config/emacs/lisp/magit/docs/RelNotes/3.2.0.org deleted file mode 100644 index 11f1ef4..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/3.2.0.org +++ /dev/null @@ -1,85 +0,0 @@ -* Magit v3.2.0 Release Notes - -Released 1st August 2021 by Jonas Bernoulli. - -I am pleased to announce the release of Magit version 3.2.0, -representing 84 commits by 5 contributors over one month. - -Also see https://emacsair.me/2021/08/01/magit-3.2. - -** Changes since v3.1.0 - -- The default of ~magit-bury-buffer-function~ was changed to - ~magit-mode-quit-window~. #4412 - -- Added new option ~magit-remote-git-executable~ alongside the existing - ~magit-git-executable~. Previously the latter was used for local and - remote ~git~ processes alike, now the former specifies the executable - that is used when Tramp is involved. Using a single variable was - problematic because we had to use an absolute path on Windows for - performance reasons but that path was almost certainly wrong when - using Tramp. #4447 - -- We now use an absolute path for ~magit-git-executable~ on macOS as - well because at least for some macOS users using just the name of - the executable performs horribly. #4447 - -- The section showing openpgp output in the revision buffer is now - collapsible and starts out collapsed for good signatures or when the - certificate is missing. This hopefully makes it more appealing to - enable ~--show-signature~ (and maybe even encourages some authors to - start signing commits). 1e08ac6fd - -- A mode change or rename can now be applied (un-/staged etc.) without - also applying edits to the same file and vice-versa. #4439 - -- Many commands that act on (or default to) the commit at point now - pick that up in a few more places; when the string at point is a - known hash, on a blame chunk, and on a hunk or file inside a log. - d8d3e4813, 40ad7a25c, 402112c6e - -- The default ~magit-pop-revision-stack-format~ now include the - committer date. 1f85297a3 - -- The default ~magit-log-revision-headers-format~ now includes notes. - 33bd79fd45 - -- Added new options ~magit-repolist-sort-key~ - and ~magit-submodule-list-sort-key~. #4409 - -- Added new function ~magit-repolist-column-flags~. 35067f512 - -- Added new option ~magit-ediff-use-indirect-buffers~. #4395 - -- Added new function ~magit-process-git~. fd5cf6173 - -- Added new function ~magit-git-config-p~. 60f82a323 - -** Fixes since v3.1.0 - -- In the normal case ~magit-name-tag~ failed to return the tag. - 14170b4ea - -- ~magit-completing-read-multiple*~ tried to use a variable that is - unbound if ~helm~ isn't loaded. 29b0cb489 - -- Some push commands couldn't deal with remote and branch names that - contain the percent character. #4428 - -- ~magit-git-shortlog~ got stuck in the repository in which it was first - invoked. 384610edb - -- ~magit-commit-augment~ did not support ~--allow-empty~. bbdfd4287 - -- Squash commands didn't fully take ~--author~ into account. 02d2917c6 - -- ~magit-completing-read-multiple*~ conflicted with the ~consult~ package. - #4437 - -* Authors - - 73 Jonas Bernoulli - 6 Kyle Meyer - 2 Boruch Baum - 1 Philippe Cavalaria - 1 Toon Claes diff --git a/.config/emacs/lisp/magit/docs/RelNotes/3.2.1.org b/.config/emacs/lisp/magit/docs/RelNotes/3.2.1.org deleted file mode 100644 index 2573a5b..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/3.2.1.org +++ /dev/null @@ -1,12 +0,0 @@ -* Magit v3.2.1 Release Notes - -Released 6st August 2021 by Jonas Bernoulli. - -I am pleased to announce the release of Magit version 3.2.1. - -This is the first release that is available from NonGNU Elpa. It is -identical to version 3.2.0 except for dependency metadata, which had -to be changed so that this package could be released on NonGNU Elpa. - -Also see https://emacsair.me/2021/08/06/nongnu-elpa -and https://elpa.nongnu.org/nongnu/magit.html. diff --git a/.config/emacs/lisp/magit/docs/RelNotes/3.3.0.org b/.config/emacs/lisp/magit/docs/RelNotes/3.3.0.org deleted file mode 100644 index 47371b4..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/3.3.0.org +++ /dev/null @@ -1,137 +0,0 @@ -* Magit v3.3.0 Release Notes - -Released 4th October 2021 by Jonas Bernoulli. - -I am pleased to announce the release of Magit version 3.3.0, -representing 88 commits by 6 contributors over two month. - -Also see https://emacsair.me/2021/10/04/magit-3.3. - -** Breaking changes - -- The last remaining alphabetic keys (both lower- and uppercase) are - now bound in ~magit-mode-map~. ~H~ to ~magit-describe-section~, ~j~ to the - new ~magit-status-quick~ (or ~magit-status-jump~ in status buffers), ~J~ - to the new ~magit-display-repository-buffer~, ~Q~ to ~magit-git-command~ - and ~Z~ to ~magit-worktree~, and once Forge is loaded, then ~N~ to - ~forge-dispatch~. (~Z~ used to be bound to ~magit-stash~, which now is - only available on ~z~.) #4259, 9bec1c54a, e401bd4d3 - -- ~I~ is now bound to ~magit-init~ instead of ~magit-gitignore~, which - continues to be available on ~i~. Users of the ~magit-imerge~ package - (which previously bound ~i~) should consult its library header for a - suggestion on how to resolve the resulting conflict. b54b537db - -** Changes since v3.2.0 - -- No longer automatically add ~--full-history~ when showing a log for a - single file that isn't being tracked anymore. #4381 - -- ~magit-stash-both~ now asks before discarding merge state. #4345 - -- Several infix arguments, which previously could only be disabled - or have a numeric value, can now also be enabled without having - an explicit numeric value. #4379 - -- Added ~-Xignore-space-change~ and ~-Xignore-all-space~ to ~magit-merge~. - Like most newly added expert arguments they have to be explicitly - [[https://docs.magit.vc/transient/Enabling-and-Disabling-Suffixes.html][revealed]]. #4387 - -- Added new command ~magit-status-quick~, which shows the status buffer - but avoids refreshing it for performance reasons. #4259 - -- Added new commands ~magit-display-repository-buffer~ (bound to ~j~ in - Magit buffers) and ~magit-switch-to-repository-buffer~ (bound to ~J~) - and variants for switching to any existing Magit buffer belonging - to the current repository. #4259 - -- Added new command ~magit-dired-am-apply-patches~ for use in Dired. - #4094. - -- Rearranged ~magit-patch~ and added a binding for ~magit-am~. 8ec3a1a21, - 8cadf302b - -- Added new command ~magit-help~ (bound to ~h~ in ~magit-dispatch~), which - simply shows Magit's Info manual. 5bba62629 - -- When listing entries for Imenu, then remove entry counts from group - titles for the benefit of third-party packages that need stable - titles. #4477 - -- Include Forge's ~pullreq~ and ~issue~ sections when listing entries for - Imenu. f4016f734 - -- Bound ~imenu~ in the ~magit-status-jump~ prefix. 678df30c3 - -- Added new transient prefix command ~magit-bundle~, which provides - support for ~git bundle~. #4392 - -- When minibuffer completion allows for a branch or a commit to be - selected and the former is preferred and thus offered as default - then, if possible, offer the commit at point as the first choice - initially accessible with ~next-history-element~. #4291 - -- Bound ~magit-refs-set-show-commit-count~ in the ~magit-show-refs~ - prefix. 2fe42f63d - -- Added new option ~magit-commit-diff-inhibit-same-window~. #4132 - -- Added support for invoking Smerge's "keep" commands when point is on - a hunk in a Magit buffer. They can be invoked using the same key - bindings as in file-visiting buffers or ~RET~, ~u~, ~b~ and ~l~. #4458 - -- Added new command ~magit-remote-unshallow~. #4480 - -- Added new option ~git-commit-use-local-message-ring~. #4503 - -** Fixes since v3.2.0 - -- Make ~magit-branch-remote-head~ and ~magit-branch-current~ fall back - to ~:inverse-video~ when the ~:box~ attribute isn't support, i.e., in - a terminal. If this change does not have any effect for you then - your theme probably changes these faces and should stop doing so. - #4206 - -- In some cases refreshing a buffer caused the cursor to jump to a - different position. #4148 - -- ~magit-convert-filename-for-git~ did not expand absolute filenames, - which is necessary because Git does not understand ~~/~. de1dc8e74 - -- ~magit-rebase~ did not enable ~--autostash~ by default but the - documentation says it does. 421be65a3 - -- ~magit-clone-read-repository~ did not convert filenames before passing - them to Git. 4aa7d2928 - -- Due to a regression in v2.90.0, ~magit-wip-log~ and - ~magit-wip-log-current~ failed to extract the previous tips of the - wip refs from the reflog (which is relevant when - ~~magit-wip-merge-branch~ is nil). c327824b0 - -- An old attempt to avoid needlessly updating section highlighting - did not actually succeed. #3976 - -- An error occurred when first showing a status buffer and - ~which-function-mode~ is enabled because that caused Imenu to collect - items at a time when that is not possible yet. #4481 - -- A change in Git v2.32.0 made it necessary to explicitly filter out - directories when committing to wip worktree refs. #4499 - -- Fixed appearance of Gravatar images by forcing their size instead - relying the service to return the promised size as advertised. - 8771401d4 - -- ~git-commit-setup~ enabled the major-mode after setting local - variables, which caused non-permanent variables to be reset. - ece2cb84d - -* Authors - - 76 Jonas Bernoulli - 8 Kyle Meyer - 1 Daniel Nagy - 1 Franklin Delehelle - 1 Jonathon McKitrick - 1 Lin Sun diff --git a/.config/emacs/lisp/magit/docs/RelNotes/4.0.0.org b/.config/emacs/lisp/magit/docs/RelNotes/4.0.0.org deleted file mode 100644 index 68bb6fb..0000000 --- a/.config/emacs/lisp/magit/docs/RelNotes/4.0.0.org +++ /dev/null @@ -1,532 +0,0 @@ -* Magit v4.0.0 Release Notes - -Released 8th August 2024 by Jonas Bernoulli. - -I am pleased to announce the release of Magit version 4.0.0, -representing 1077 commits by 69 contributors over three years. - -Also see https://emacsair.me/2024/08/09/magit-4.0. - -** Breaking changes - -- Dropped support for Emacs 25. 7c794201c4 - -- Removed several functions, variables and variable values that were obsoleted - in past releases: - - bc18ba942f Removed ~git-commit-fill-column~, obsolete since v2.11.0 - - 6b4f7f5811 Removed ~magit-section-when~, obsolete since v2.90.0 - - a8c92cc35d Removed face aliases, obsolete since v2.12.0 and v3.0.0 - - ed8067830f Removed variables and functions obsolete since v3.3.0 - - 553968346d Removed support for obsolete ~magit-branch-rename-push-target~ values - - b47efecfe6 Removed support for obsolete %-sequence in ~magit-branch-name-format~ - -- Removed library ~magit-libgit.el~, which was only a proof-of-concept, without - Magit actually making use of it. Packagers were discouraged from including - this library in the Magit package, but many disregarded that. Because that - caused issues for many users, it had to be removed. c9fd81217c, 703dfe5812 - -- Completed the switch to a new ~magit-completing-read-multiple~ implementation. - a162b8a71e - -** Changes since v3.3.0 - -- Added many context menus, which can be invoked using the mouse or a key - (~menu~ by default) and are a great way to discover context sensitive commands. - Context menus were added in Emacs 28.1 and are disabled by default. Enable - ~context-menu-mode~ or set ~magit-section-show-context-menu-for-emacs<28~ to ~t~, - if you are still using an older release. [[https://github.com/magit/magit/issues/4645][#4645]] - -- The menu-bar menu, which was severely neglected for many years, finally got a - makeover. It no longer offers a completely random subset of Magit's features. - Now it can be used to invoke most of the commands that could also be invoked - using ~magit-dispatch~; but by means of a small furry animal. 5641d3749c - -- Rewrote Imenu support, which resulted in a few new features and much less - code. 4727dcbe22 ff - -- Move imenu and bookmark support to the independently distributed ~magit-section~ - package, so that it can be used by third-party packages, without having to - depend on the ~magit~ package. [[https://github.com/magit/magit/issues/5104][#5104]] - -- One does not simply change key bindings; at least not as a package maintainer. - ~magit-define-global-key-bindings~ used to be a boolean, now it can be set to - ~recommended~, to opt in to new easier top-level bindings, which do not require - changing modifiers mid-sequence. 8b1f599de4 - -- For the longest time (which is why I don't consider this a bug fix) toggling - a section caused point to move to the beginning of that section. Stop doing - that, unless absolutely necessary. 9d8d5e5603 - -- Added support for displaying errors that occur when washing a section. - Use that for diff and log buffers, so users can investigate what went wrong. - 78a979fde5, 2bd3db69d6, d05b1ed381, a760dd1078 - -- Massively reduced the expansion of the essential macro ~magit-insert-section~, - moving most work to new support functions. [[https://github.com/magit/magit/issues/5130][#5130]] 13e4422584..058ca81497, - ee6fbba360..e2ca80a26e, 3695493ce8..f7cba11588 - -- Avoid expensive and/or unnecessary work, including: - - 8606488578 magit-save-repository-buffers: Rev-parse only once per directory - - ff4710afa6 Deprecate magit-git-dir to avoid needlessly repeating work - - e94b6ebfdb [[https://github.com/magit/magit/issues/4900][#4900]] Record diff-type in magit-diff-mode buffers - - 6852936364 [[https://github.com/magit/magit/issues/4768][#4768]] magit-wip-mode: Speedup activation by avoiding duplicated work - - 241b327b7a [[https://github.com/magit/magit/issues/4974][#4974]] Don't use markers in log buffers - - d536ef9e21 Don't preserve visibility in log buffers - - Limit use of log graphs and signature verification. 545a64c3ee, e32cec06a4 - - d73a3b11db Record child sections in reverse in log buffers - - 6014320c3e magit-module-confirm: Use refresh cache - - fef45b274e magit-insert-child-count: Minor performance tweak - - 4ec4d0272e magit-insert-section--finish: Optimize propertizing leaf sections - - 54d969b62f magit-insert-section--finish: Optimize for leaf sections - - 5544bac955 magit-insert-section--finish: Avoid unnecessary work for root section - - ~magit-turn-on-auto-revert-mode-if-desired~ performs cheaper checks first now. - [[https://github.com/magit/magit/issues/4591][#4591]] - - For performance reasons the "margin" style sadly had to be removed from - ~magit-blame-styles~. 608242086e - -- Added new commands ~git-commit-co-developed~ and ~git-commit-insert-trailer~ - (menu) [[https://github.com/magit/magit/issues/4810][#4810]], ~git-commit-search-message-backward~ and - ~git-commit-search-message-forward~ [[https://github.com/magit/magit/issues/4537][#4537]], ~git-rebase-update-ref~ [[https://github.com/magit/magit/issues/4776][#4776]], - ~magit-back-to-indentation~ [[https://github.com/magit/magit/issues/5183][#5183]], ~magit-git-mergetool~ [[https://github.com/magit/magit/issues/4128][#4128]], - ~magit-jump-to-ignored~ 550d99d86d, ~magit-log-related~ c33ed664e6, - ~magit-mouse-toggle-section~ 949b4a47a4, ~magit-profile-refresh-buffer~ - d520ce3306, ~magit-repolist-fetch~ [[https://github.com/magit/magit/issues/4453][#4453]], ~magit-repolist-find-file-other-frame~ - [[https://github.com/magit/magit/issues/4453][#4453]], ~magit-repolist-mark~ and ~magit-repolist-unmark~ [[https://github.com/magit/magit/issues/4453][#4453]], - ~magit-smerge-keep-all~ [[https://github.com/magit/magit/issues/4756][#4756]], ~magit-stage-buffer-file~ ebd7a0635d, - ~magit-stash-push~ (menu) [[https://github.com/magit/magit/issues/4583][#4583]], ~magit-toggle-git-debug~ 2ed5a06d08, - ~magit-unstage-buffer-file~ ebd7a0635d, ~magit-update-default-branch~ 59833692ed, - and others. - - - Added new transient menu ~magit-sparse-checkout~, which provides an interface - to the ~git sparse-checkout~ command, introduced in Git v2.25. [[https://github.com/magit/magit/issues/4102][#4102]] - - - Added new command ~magit-clone-sparse~, which makes it possible to clone - a repository and then immediately enable a sparse checkout, avoiding a - checkout of the full working tree. [[https://github.com/magit/magit/issues/4102][#4102]] - - - Added new command ~magit-stash-push~, which allows specifying a list of - files to be stashed. [[https://github.com/magit/magit/issues/4583][#4583]] - - - Added new command ~magit-ediff-resolve-all~, an alternative to - ~magit-ediff-resolve-rest~ (formerly known as ~magit-ediff-resolve~). The - new option ~magit-ediff-dwim-resolve-function~ controls which is used by - ~magit-ediff-dwim~ (another new command, ~magit-git-mergetool~, can also be - used). [[https://github.com/magit/magit/issues/4348][#4348]] - - - ~magit-refresh-buffer~ is now defined as a command. 26eac2bcb0 - -- Added new infix arguments: - - Added ~--diff-merges~ to ~magit-diff~ and ~magit-diff-refresh~. [[https://github.com/magit/magit/issues/4989][#4989]] - - Added ~--ff-only~ to ~magit-pull~. f766f68f78 - - Added ~--filter~ to ~magit-clone~ (hidden by default) to support partial - cloning, a feature that is available as of Git v2.17. [[https://github.com/magit/magit/issues/4102][#4102]] - - Added ~--force-rebase~ to ~magit-rebase~. 73b44644f6 - - Added ~--force~ to ~magit-fetch~ and ~magit-pull~. [[https://github.com/magit/magit/issues/5162][#5162]] - - Added ~--ignore-date~ to ~magit-rebase~. 7f03f572d5 - - Added ~--update-refs~ to ~magit-rebase~. 2fee806a01 - -- Added new hooks ~git-commit-post-finish-hook-timeout~ [[https://github.com/magit/magit/issues/4828][#4828]], - ~magit-post-clone-hook~ [[https://github.com/magit/magit/issues/4849][#4849]], ~magit-post-create-buffer-hook~ 26eec13943, and - ~magit-wash-message-hook~ 594bd14614. - -- Added new options ~git-commit-cd-to-toplevel~ [[https://github.com/magit/magit/issues/4973][#4973]], - ~magit-ediff-dwim-resolve-function~ 5a7519fd3d, ~magit-log-color-graph-limit~ - 545a64c3ee, ~magit-log-merged-commit-count~ [[https://github.com/magit/magit/issues/4711][#4711]], - ~magit-log-show-signatures-limit~ e32cec06a4, ~magit-openpgp-default-signing-key~ - 4eed9e1a45, ~magit-process-timestamp-format~ [[https://github.com/magit/magit/issues/4920][#4920]], - ~magit-revision-insert-related-refs-display-alist~ [[https://github.com/magit/magit/issues/4885][#4885]], - ~magit-section-show-context-menu-for-emacs<28~ 0168be9366, and - ~magit-verbose-messages~ 7fbf89cb52. - -- Added new faces ~git-rebase-action~ [[https://github.com/magit/magit/issues/4544][#4544]], ~magit-branch-warning~ bf3bcbe051, and - ~magit-section-child-count~ [[https://github.com/magit/magit/issues/4599][#4599]]; and added built-in faces ~diff-refine-added~ - and ~diff-refine-removed~ to the ~magit-faces~ custom group. - -- Added new function ~git-commit-turn-on-orglink~, intended for use in - ~git-commit-setup-hook~. d122f15edd - -- ~git-commit.el~ no longer depends on ~dash~. bb7b7a4020 - -- Some repository and submodule list columns got a bit fancier. - 3f3980735f 451438dc90 - -- Refreshing a repository or submodule list buffer now restores the previous - position. 1feda0cb1c - -- Added new variable ~magit-submodule-list-predicate~. ceab3124fb - -- ~magit-diff-dwim~ uses a more useful range when showing unpushed and unpulled - changes. 9413847c1a - -- When invoked with a prefix argument, ~magit-fetch-modules~ now acts as a - transient prefix command. fd5b9eadf3 - -- ~magit-cherry-branch~ now supports using a detached HEAD as source. ff3269814c - -- ~git-commit-save-message~ now reports whether the message was actually saved. - dfe3d03a14 - -- Make use of ~with-connection-local-variables~, and for older Emacsen use a - stripped down implementation. [[https://github.com/magit/magit/issues/4568][#4568]] - -- Added some forward compatibility for SHA-256. [[https://github.com/magit/magit/issues/4585][#4585]] - -- Added ~magit-mode-bury-buffer~ to ~magit-dispatch~. 5a2624985a - -- ~magit-tag-release~ learned to extract the version string from the HEAD commit's - message. 429d5c55e8 - -- Improved version display and sorting in repository list buffers. - 53199f2dd5, 68be0584f4 - -- Added support for marking repositories in repository list buffers and acting - on the marked repositories. [[https://github.com/magit/magit/issues/4453][#4453]] - -- Improved internals of the version/feature check caches. On the user visible - side, teach ~magit-zap-caches~ to zap everything, when invoked with a prefix - argument. [[https://github.com/magit/magit/issues/4603][#4603]] - -- When blaming, neighboring chunks about the same commit are now combined into - just one chunk. [[https://github.com/magit/magit/issues/4030][#4030]] - -- Taught ~magit-diff-dwim~ about commits of submodules shown in the status buffer - of the super-repository. [[https://github.com/magit/magit/issues/4151][#4151]] - -- A cherry pick or revert can now be continued when there are unstaged changes - as long as there are no unresolved conflicts, a behavior that more closely - matches the command-line behavior. [[https://github.com/magit/magit/issues/4615][#4615]] - -- ~magit-ediff-read-files~ now tries to detect renames in one-file logs. - b32521d543 - -- Increased use of section type, keymap and binding inheritance. - 70b34f08ab - -- Depend on the Compat package, allowing me to use convenient features that were - added to Emacs over the last few years, without having to wait another few - years, until everybody has updated to a reasonably recent Emacs release. - 571b4346c1 - -- Tag messages and signatures are now turned into sections in commit buffers. - 476383fc8f - -- Work has began on making internal circular dependencies between Magit - libraries a thing of the past. - -- The help text displayed in ~git-rebase-mode~ buffers got a makeover. - 670dad14b5 ff - -- Improved the diff to be shown while committing is determined. [[https://github.com/magit/magit/issues/3246][#3246]] - -- ~magit-reverse~ is now permitted in diff buffers between HEAD and - the working tree. e94b6ebfdb [[https://github.com/magit/magit/issues/5090][#5090]] - -- Registered a ~bookmark-handler-type~ for our handler. adf5848ea7 - -- No longer exit transient while toggling margin or cycling styles. bf0ef3826b - -- ~magit-clone-url-format~ can now be configured to an alist to support servers - that employ different URL schemes. [[https://github.com/magit/magit/issues/4738][#4738]] - -- Repositories hosted on Sourcehut can now be cloned by name. [[https://github.com/magit/magit/issues/4741][#4741]] - -- 564cff8a40 [[https://github.com/magit/magit/issues/4751][#4751]] magit-diff-wash-diffstat: Improve file rename identification -- ce0746ab9f [[https://github.com/magit/magit/issues/4743][#4743]] diff: Mention when a file is a binary -- 1c51352e6f [[https://github.com/magit/magit/issues/4785][#4785]] magit-branch-delete: Improve suggested branch for checkout -- 5d6c01e293 [[https://github.com/magit/magit/issues/4767][#4767]] magit-commit-squash-internal: Restore window conf after showing diff -- 74d14c2d10 magit-log-reflog-re: Handle "rewritten during rebase" -- 2653432bb5 [[https://github.com/magit/magit/issues/4776][#4776]] git-rebase: Support update-ref action -- 161ab48520 [[https://github.com/magit/magit/issues/4810][#4810]] git-commit: Add "Co-developed-by" header -- 99d9b3008a magit-long-lived-branches: New variable -- cd6fbe2887 [[https://github.com/magit/magit/issues/4837][#4837]] magit-branch-read-args: Read another name if chosen branch exists -- 410e4583e0 [[https://github.com/magit/magit/issues/4181][#4181]] Enable navigating broken sections -- b7daf6a2ff [[https://github.com/magit/magit/issues/4905][#4905]] magit-branch-delete: Improve "also on remote?" prompt -- dd2e870b13 [[https://github.com/magit/magit/issues/4823][#4823]] magit-save-repository-buffers: Wip commit all files at once -- b2c4a26b5b [[https://github.com/magit/magit/issues/4923][#4923]] magit-diff-show-or-scroll: Also handle tags -- 85d0554f4f [[https://github.com/magit/magit/issues/4920][#4920]] Optionally display process start time in margin of process buffers -- 2f3740ab68 [[https://github.com/magit/magit/issues/4786][#4786]] If bisect was invoked with --first-parent, use it for rest log too -- 25dbf32d86 [[https://github.com/magit/magit/issues/4781][#4781]] Perform checkouts asynchronously -- 152478b01f magit-branch-or-commit-at-point: Get from unpushed/unpulled sections -- e38500b590 git-commit-header-line-format: New variable -- 09f600fdcd..ebd7a0635d Improved commands for staging and unstaging files. -- 2c2b34d7ac [[https://github.com/magit/magit/issues/4966][#4966]] magit-file-{ignore,tracked}-p: Convert filename for git -- decd5f40dd [[https://github.com/magit/magit/issues/4970][#4970]] magit-stash-pop: Use pop instead of apply -- b3f7e24616 magit-map-sections: New function -- 667deaa74e magit-stage-file: Support staging ignored files -- d46270cb65 [[https://github.com/magit/magit/issues/4990][#4990]] git-commit-setup-font-lock: Set comment-end to the empty string -- 7d4092f00b Apply stash even if "git stash apply" cannot do it -- 186414ae41 [[https://github.com/magit/magit/issues/4998][#4998]] When inserting pseudo header, always prompt with a prefix argument -- ace5ca4401 [[https://github.com/magit/magit/issues/4999][#4999]] magit--imenu-goto-function: New function -- 27099441a0 [[https://github.com/magit/magit/issues/5000][#5000]] Offer textual range at point as next history element -- ae7f5e9fb4 magit-log-refresh: No longer exit transient after any margin command -- dd14e0c3c6 [[https://github.com/magit/magit/issues/5027][#5027]] git-commit: Ignore leading comment when inserting headers -- b436ad3830 git-commit: Replace the term "(pseudo) header" with "trailer" -- 72fbb3a579 magit-stash-read-message: Provide a default instead of magic -- 51f04d6826 [[https://github.com/magit/magit/issues/5042][#5042]] magit-branch-reset: Offer commit at point as history element -- fb1a3c487e [[https://github.com/magit/magit/issues/5051][#5051]] magit-sequencer-abort: Require confirmation -- 4efecc80a6 magit-log-move-to-revision: Default to fixup target if any -- 025c48ed68 magit-section-lineage: Optionally return objects instead of types -- 8a3674b427 completion: Prevent Vertico from sorting completion candidates -- 09961f67a4 [[https://github.com/magit/magit/issues/5097][#5097]] git-commit-turn-on-flyspell: Don't check below cut-line -- 0032ffca8d magit-branch: Add global variable suffixes by default -- 8a3c1ccdda magit-section-cycle: Pivot to tab-next if there is a binding conflict -- 28bcd29db5 [[https://github.com/magit/magit/issues/5107][#5107]] magit--shell-command: Use magit-with-editor -- f49584599c Hide placeholder commands from execute-completing-read -- e37c9ea4de Make discouraged use of git-commit-mode-hook safer and more convenient -- d98e935ed7 [[https://github.com/magit/magit/issues/5134][#5134]] magit-{browse,visit}-thing: Handle raw URL links -- 22fd8f8594 git-commit: Disable auto-filling for summary line -- f3b6864969 magit-insert-heading: Add optional CHILD-COUNT argument -- 6359e5c98f magit-hack-dir-local-variables: New function -- d1e2beb866 magit-file-checkout: Support selecting a directory -- 538cb2f90b [[https://github.com/magit/magit/issues/5176][#5176]] magit-file-section-indent: New variable -- 86509cb09e magit-run-git: Return exit-code -- 1fdb30cc1a [[https://github.com/magit/magit/issues/5188][#5188]] magit-log-select: Place cursor on first non-squash commit -- eb0b81e71d [[https://github.com/magit/magit/issues/5109][#5109]] Remove obsolete advice for Tramp - -** Fixes since v3.3.0 - -- ~magit-status-quick~ wasn't autoloaded. [[https://github.com/magit/magit/issues/4519][#4519]] - -- Magit's version could not be detected if it was installed using Straight. - [[https://github.com/magit/magit/issues/4526][#4526]] - -- Automatic saving of file-visiting buffers was broken inside remote - repositories that are accessed using Tramp. [[https://github.com/magit/magit/issues/4292][#4292]] - -- Worktree commands and listing worktrees in the status buffer were broken - inside remote repositories that are accessed using Tramp. [[https://github.com/magit/magit/issues/4326][#4326]] - -- Due to a regression in v3.3.0 setting the mark did not highlight the current - and only selected section until a second section is selected. 348d9b9861 - -- A diff header added in a new Git release wasn't handled yet. [[https://github.com/magit/magit/issues/4531][#4531]] - -- Fixed calculation of gravatar image size. ecfaa325a3 - -- ~magit-branch-checkout~ refreshed the buffer before all work was done. - a14f847d97 - -- Section highlighting was not always updated when it should have, and sometimes - it was done needlessly. aba0a59611, 41fcb24761, 10b5407131 - -- ~magit-dispatch~ contained a binding that conflicted with that of - ~transient-help~. f85c4efb52 - -- ~magit-diff-wash-submodule~ didn't account for empty commit messages. [[https://github.com/magit/magit/issues/4538][#4538]] - -- Empty face definitions weren't defined properly, resulting in "rogue" faces. - a66b86d511 - -- ~magit-remote-at-point~ could return invalid values on branch sections. - 2039619696 - -- Fixed a regression in ~magit-log-maybe-update-blob-buffer~. [[https://github.com/magit/magit/issues/4552][#4552]] - -- The helper function ~magit-current-blame-chunk~ passed the directory visited by - a Dired buffer to ~git blame~, leading to some commands (e.g., ~magit-checkout~) - erroring when called from a Dired buffer. [[https://github.com/magit/magit/issues/4560][#4560]] - -- ~magit-convert-filename-for-git~ needed yet another tweak on Windows. [[https://github.com/magit/magit/issues/4557][#4557]] - -- For Helm users, calling ~magit-stash-drop~ on the "Stashes" section has been - broken since v3.0.0. [[https://github.com/magit/magit/issues/4571][#4571]] - -- ~magit-list-refs~ failed to list a poorly named ~head~ branch. [[https://github.com/magit/magit/issues/4576][#4576]] - -- ~magit-rebase~ offered arguments that aren't supported by the Git version in - use. 5e70f10566 - -- ~magit-generate-changelog~ wasn't autoloaded. [[https://github.com/magit/magit/issues/4581][#4581]] - -- Failed to specify ~:test~ when calling ~cl-set-difference~ with strings. - d899f0e7a6 - -- ~magit-section-show-child-count~ broke on commits that have no children. [[https://github.com/magit/magit/issues/4598][#4598]] - -- ~magit-fetch-modules~ offered the ~--all~ argument, but that wasn't useful. - dc11ba7b29 - -- ~magit-discard~ didn't properly handle conflicts resulting from a file being - renamed on both sides. [[https://github.com/magit/magit/issues/4225][#4225]] - -- Since v3.0.0, ~magit-pull-from-pushremote~ has failed on non-fast-forward - merges. [[https://github.com/magit/magit/issues/4604][#4604]] - -- ~magit-insert-revision-message~ got tripped up by messages that begin with a - commit hash. [[https://github.com/magit/magit/issues/4602][#4602]] - -- ~git-commit.el~ didn't always use ~magit-git-executable~, instead hard coding - "git", even if Magit is available. 77255776cb - -- ~magit-global-core.notesRef~ and ~magit-global-core.displayRef~ didn't actually - handle global value. 0f96d39834 - -- ~magit-blame--make-highlight-overlay~ put the highlighting on the wrong line. - [[https://github.com/magit/magit/issues/4620][#4620]] - -- A regression from v3.2.0 broke visiting a file when that file has a mode - change and point is on the file or the mode change section. [[https://github.com/magit/magit/issues/4623][#4623]] - -- Module sections used the wrong keymap. 94aca04dc8 - -- In-progress cherry-picks were not always recognized. [[https://github.com/magit/magit/issues/4646][#4646]] - -- Locating remote executables was broken. 4d1d00e6fa - -- The use of external diff tools was not prevented everywhere we need the - ability to feed the output back to ~git apply~. [[https://github.com/magit/magit/issues/4664][#4664]] - -- The revision syntax for matching commit message was not supported. [[https://github.com/magit/magit/issues/4662][#4662]] - -- ~magit-current-blame-chunk~ errored at eob. 437dfe95e9 - -- ~magit-revision-refresh-buffer~ could set ~magit-buffer-revision-hash~ to - something that is not a hash. 2676dddb84 - -- ~magit-tag-release~ failed to create the first release. ea1d09e0a7 - -- 84922c3997 magit-show-commit: Fix handling of current buffer's file -- 71f7d1df1d magit-diff-wash-hunk: Handle one line edge case -- 1b0474b590 [[https://github.com/magit/magit/issues/4693][#4693]] Highlight trailing whitespace on lines using dos eol style -- 4b8eab3af1 [[https://github.com/magit/magit/issues/4697][#4697]] magit-{branch-or,}commit-at-point: Only use blame chunk when blaming -- 9b48dd7e36 [[https://github.com/magit/magit/issues/4702][#4702]] Prefer 'git log --no-walk' to 'git show --no-patch' -- 64cca91341 magit-push: Fix magit-push-implicitly--desc -- 5f5e065e1e magit-list-worktrees: Always include path in returned value -- c1def98185 magit--minibuf-default-add-commit: Fix position of commit -- c92dee94e9 magit-save-repository-buffers: Handle let-bound default-directory -- 9a69e3d479 [[https://github.com/magit/magit/issues/4765][#4765]] magit-blame--make-margin-overlays: Fix beginning of each overlay -- 557ab2c062 magit-diff-wash-diff: Fix headers for "git log -L --no-prefix" -- 8158b484ae magit-list-module-paths: Ensure they are relative to top-level -- 87e68e0a8e [[https://github.com/magit/magit/issues/4803][#4803]] magit-tag-release: Fix case when no default is detected -- a3d3758b26 [[https://github.com/magit/magit/issues/4807][#4807]] magit-file-rename: Fix initial-input for destination -- 2a5815fee1 [[https://github.com/magit/magit/issues/4806][#4806]] git-commit-font-lock-keywords-1: Use more restrictive keyword regexp - -- Commands that use optional third-party Git extensions didn't consider that - extension executables may be installed in Git's exec path instead of a - directory in ~exec-path~. [[https://github.com/magit/magit/issues/4812][#4812]] - -- ~magit-show-commit~ showed the incorrect commit when called on a chunk generated - by ~magit-blame-reverse~. [[https://github.com/magit/magit/issues/4834][#4834]] - -- 2286a63974 [[https://github.com/magit/magit/issues/3624][#3624]] Fix applying changes over Tramp from Windows -- fa0997797b magit-process-filter: Suppress bogus error when aborting emacsclient -- 76fe394953 magit-log-merged: Fix incorrect calculation of distance from tip -- 6d325d90ba Revert "git-commit-setup: Enable mode after setting local variables" -- 467bb21f7d magit-commit-diff-1: Take --allow-empty into account -- 97a95f7007 [[https://github.com/magit/magit/issues/4883][#4883]] magit-revision-fill-summary-line: Use revision buffer's window width -- 8586e49d81 [[https://github.com/magit/magit/issues/4891][#4891]] magit-auto-revert-mode: Leave disabled in one more case -- 5bd6c15089 magit-save-repository-buffers: Guard against disappeared repository -- dec25b407b [[https://github.com/magit/magit/issues/4898][#4898]] magit-log-set-commit-limit: Modify copy of magit-buffer-log-args -- 1d4bf64f33 [[https://github.com/magit/magit/issues/4903][#4903]] magit-insert-remote-branches: Fix Git 2.40 compatibility -- beb3d6cae2 [[https://github.com/magit/magit/issues/4787][#4787]] magit-wash-bisect-log: Ignore '# status:' lines -- dd649baf7c [[https://github.com/magit/magit/issues/4922][#4922]] diff: Fix visiting removed lines of renamed file -- 3224b1765f [[https://github.com/magit/magit/issues/4744][#4744]] Keep cursor from getting stuck in invisible text -- 9c66514b2c [[https://github.com/magit/magit/issues/4940][#4940]] magit-restore-window-configuration: Select buffer -- 031b9fad42 [[https://github.com/magit/magit/issues/4949][#4949]] magit-display-repository-buffer: Fix doing so -- a003d3c11c [[https://github.com/magit/magit/issues/4954][#4954]] magit-clone-internal: correctly get origin value from args -- 8b3acf7473 [[https://github.com/magit/magit/issues/4962][#4962]] Fix killing process if user input is aborted -- 4ca7b95f28 magit-diff-type: Fix in logs when section isn't provided as argument -- 93d30c5459 [[https://github.com/magit/magit/issues/4976][#4976]] magit-cygwin-mount-points: Don't use cygwin hack remotely -- 027bae37ae [[https://github.com/magit/magit/issues/4988][#4988]] git-commit-setup: Fix auto-mode-alist for remote files -- 889ed3111a [[https://github.com/magit/magit/issues/4977][#4977]] Allow un-/staging binary files when whitespace is being ignored -- 7a1d503470 [[https://github.com/magit/magit/issues/5005][#5005]] git-commit-insert-header: Fix determining location -- 18d1b13675 [[https://github.com/magit/magit/issues/5006][#5006]] magit-process-finish: Avoid unnecessary magit-process-buffer call -- 3329bf0f4f magit-list-refs: Exclude all symbolic references -- 139f603cb8 [[https://github.com/magit/magit/issues/5021][#5021]] magit-hunk-section-map: Honor smerge-command-prefix again -- c6a62accc5 [[https://github.com/magit/magit/issues/5029][#5029]] magit-jump-*-pushremote: Restore functionality - -- If applying a patch series with ~git am~ failed, the status buffer incorrectly - repeated already applied patches in the list of remaining patches. [[https://github.com/magit/magit/issues/5024][#5024]] - -- b187753717 magit-insert-section-body: Ensure parent sections get extended - -- ~magit-bisect-run~ is supposed to abort if there are uncommitted - changes or if the revisions are flipped (like ~magit-bisect-start~ - does), but these checks were unintentionally dropped in Magit - v3.1.0. [[https://github.com/magit/magit/issues/5070][#5070]] - -- debb9723d9 Support staging hunks over Tramp again -- c3b7fd7dc4 [[https://github.com/magit/magit/issues/5076][#5076]] magit-status-setup-buffer: Ensure correct position when narrowed -- 8fd3cce75c magit-completing-read: Support using function as COLLECTION -- fc485bae0d [[https://github.com/magit/magit/issues/5092][#5092]] magit-insert-remote-branches: Skip HEAD if not symref -- 36be3d66ed [[https://github.com/magit/magit/issues/5102][#5102]] magit-tag-release: Use magit-run-git-with-editor -- 65ecb9c5fc Only hook up git-commit-setup-font-lock-in-buffer once mode is enabled -- 0e8f25a8d8 [[https://github.com/magit/magit/issues/5094][#5094]] elpa/elpa/magit magit--git-wash: Support commands whose non-zero status isn't an error -- faa308fccd [[https://github.com/magit/magit/issues/5122][#5122]] magit-module-confirm: Never require confirmation with prefix argument -- ea02c8e634 magit-log-buffer-file: Support using the region in blobs again -- ea0f07e549 [[https://github.com/magit/magit/issues/5158][#5158]] magit-section--enable-long-lines-shortcuts: Fix warning -- 9d4192b7b1 [[https://github.com/magit/magit/issues/5116][#5116]] Fix visiting file from buffer created with magit-diff-paths -- ad68015aa1 [[https://github.com/magit/magit/issues/5178][#5178]] magit-confirm: Directly support two rounds of prompt formatting -- f31cf79b27 [[https://github.com/magit/magit/issues/5175][#5175]] magit-parse-git-async: Discard stderr for now - -* Authors - - 899 Jonas Bernoulli - 78 Kyle Meyer - 7 Nacho Barrientos - 5 Basil L. Contovounesios - 4 Andrey Smirnov - 4 Damien Cassou - 4 Park Zhou - 4 Phil Sainty - 4 Stefan Kangas - 3 Daniel Mendler - 2 Aaron L. Zeng - 2 Alex Kreisher - 2 Ben North - 2 Brennan Vincent - 2 Martin Joerg - 2 Nicholas Vollmer - 2 ziggy - 1 Adam Jones - 1 Adam Porter - 1 Allen Li - 1 Andrew Zipperer - 1 Angel de Vicente - 1 Arialdo Martini - 1 Bastian Beranek - 1 Ben Zanin - 1 Brian Leung - 1 Cameron Chaparro - 1 Christian Tietze - 1 Christopher Carlile - 1 Daanturo - 1 Dan Kessler - 1 Daniel Martín - 1 Ellis Kenyo - 1 Eugene Mikhaylov - 1 Eyal Soha - 1 Frédéric Giquel - 1 Greg Steuck - 1 Géza Herman - 1 JD Smith - 1 Jean-Louis Giordano - 1 Jeremy Sowden - 1 Johannes Maier - 1 Jorge Israel Peña - 1 Li Chen - 1 Lin Sun - 1 Lénaïc Huard - 1 Magnar Sveen - 1 Markus Beppler - 1 Matt Beshara - 1 Ola Nilsson - 1 Paul Pogonyshev - 1 Philipp Stephani - 1 Pieter van Oostrum - 1 Pratyush Yadav - 1 Rahul Rameshbabu - 1 Robert Irelan - 1 Roland Marchand - 1 Ron Parker - 1 Sean Allred - 1 Sean Farley - 1 Sean Whitton - 1 Shuguang Sun - 1 StrawberryTea - 1 Ulrich Müller - 1 Vladimir Ivanov - 1 Waqar Hameed - 1 dependabot[bot] - 1 hokomo - 1 shoefone diff --git a/.config/emacs/lisp/magit/docs/htmlxref.cnf b/.config/emacs/lisp/magit/docs/htmlxref.cnf deleted file mode 100644 index cc394c0..0000000 --- a/.config/emacs/lisp/magit/docs/htmlxref.cnf +++ /dev/null @@ -1,42 +0,0 @@ -# https://www.gnu.org/software/texinfo/manual/texinfo/html_node/HTML-Xref-Configuration.html - -EMACS = https://www.gnu.org/software/emacs/manual - -auth mono ${EMACS}/html_mono/auth.html -auth node ${EMACS}/html_node/auth/ - -ediff mono ${EMACS}/html_mono/ediff.html -ediff node ${EMACS}/html_node/ediff/ - -elisp mono ${EMACS}/html_mono/elisp.html -elisp node ${EMACS}/html_node/elisp/ - -emacs mono ${EMACS}/html_mono/emacs.html -emacs node ${EMACS}/html_node/emacs/ - - -MAGIT = https://docs.magit.vc - -forge mono ${MAGIT}/forge.html -forge node ${MAGIT}/forge/ - -ghub mono ${MAGIT}/ghub.html -ghub node ${MAGIT}/ghub/ - -magit mono ${MAGIT}/magit.html -magit node ${MAGIT}/magit/ - -transient mono ${MAGIT}/transient.html -transient node ${MAGIT}/transient/ - -with-editor mono ${MAGIT}/with-editor.html -with-editor node ${MAGIT}/with-editor/ - - -MIRROR = https://emacsmirror.net/manual - -borg mono ${MIRROR}/borg.html -borg node ${MIRROR}/borg/ - -epkg mono ${MIRROR}/epkg.html -epkg node ${MIRROR}/epkg/ diff --git a/.config/emacs/lisp/magit/docs/magit-section.org b/.config/emacs/lisp/magit/docs/magit-section.org deleted file mode 100644 index a731113..0000000 --- a/.config/emacs/lisp/magit/docs/magit-section.org +++ /dev/null @@ -1,309 +0,0 @@ -#+title: Magit-Section Developer Manual -:PREAMBLE: -#+author: Jonas Bernoulli -#+email: emacs.magit@jonas.bernoulli.dev -#+date: 2015-{{{year}}} - -#+texinfo_dir_category: Emacs -#+texinfo_dir_title: Magit-Section: (magit-section). -#+texinfo_dir_desc: Use Magit sections in your own packages. -#+subtitle: for version 4.5.0 - -#+setupfile: .orgconfig - -This package implements the main user interface of Magit — the -collapsible sections that make up its buffers. This package used -to be distributed as part of Magit but how it can also be used by -other packages that have nothing to do with Magit or Git. - -To learn more about the section abstraction and available commands and -user options see [[info:magit#Sections]]. This manual documents how you -can use sections in your own packages. - -#+texinfo: @noindent -This manual is for Magit-Section version 4.5.0. - -#+texinfo: @insertcopying -:END: -* Introduction - -This package implements the main user interface of Magit — the -collapsible sections that make up its buffers. This package used -to be distributed as part of Magit but how it can also be used by -other packages that have nothing to do with Magit or Git. - -To learn more about the section abstraction and available commands -and user options see [[info:magit#Sections]]. This manual documents -how you can use sections in your own packages. - -When the documentation leaves something unaddressed, then please -consider that Magit uses this library extensively and search its -source for suitable examples before asking me for help. Thanks! - -* Creating Sections - -- Macro: magit-insert-section [name] (type &optional value hide) &rest body :: - - Create a section object of type CLASS, storing VALUE in its - ~value~ slot, and insert the section at point. CLASS is a - subclass of `magit-section' or has the form ~(eval FORM)~, in - which case FORM is evaluated at runtime and should return a - subclass. In other places a sections class is often referred - to as its "type". - - Many commands behave differently depending on the class of the - current section and sections of a certain class can have their - own keymap, which is specified using the `keymap' class slot. - The value of that slot should be a variable whose value is a - keymap. - - For historic reasons Magit and Forge in most cases use symbols - as CLASS that don't actually identify a class and that lack the - appropriate package prefix. This works due to some undocumented - kludges, which are not available to other packages. - - When optional HIDE is non-~nil~ collapse the section body by - default, i.e., when first creating the section, but not when - refreshing the buffer. Else expand it by default. This can be - overwritten using ~magit-section-set-visibility-hook~. When a - section is recreated during a refresh, then the visibility of - predecessor is inherited and HIDE is ignored (but the hook is - still honored). - - BODY is any number of forms that actually insert the section's - heading and body. Optional NAME, if specified, has to be a - symbol, which is then bound to the object of the section being - inserted. - - Before BODY is evaluated the ~start~ of the section object is set - to the value of `point' and after BODY was evaluated its ~end~ is - set to the new value of ~point~; BODY is responsible for moving - ~point~ forward. - - If it turns out inside BODY that the section is empty, then - ~magit-cancel-section~ can be used to abort and remove all traces - of the partially inserted section. This can happen when creating - a section by washing Git's output and Git didn't actually output - anything this time around. - -- Function: magit-insert-heading [child-count] &rest args :: - - Insert the heading for the section currently being inserted. - - This function should only be used inside ~magit-insert-section~. - - When called without any arguments, then just set the ~content~ - slot of the object representing the section being inserted to - a marker at ~point~. The section should only contain a single - line when this function is used like this. - - When called with arguments ARGS, which have to be strings, or - ~nil~, then insert those strings at point. The section should not - contain any text before this happens and afterwards it should - again only contain a single line. If the ~face~ property is set - anywhere inside any of these strings, then insert all of them - unchanged. Otherwise use the `magit-section-heading' face for - all inserted text. - - The ~content~ property of the section object is the end of the - heading (which lasts from ~start~ to ~content~) and the beginning - of the the body (which lasts from ~content~ to ~end~). If the - value of ~content~ is ~nil~, then the section has no heading and - its body cannot be collapsed. If a section does have a heading, - then its height must be exactly one line, including a trailing - newline character. This isn't enforced, you are responsible for - getting it right. The only exception is that this function does - insert a newline character if necessary. - - If provided, optional CHILD-COUNT must evaluate to an integer or - boolean. If ~t~, then the count is determined once the children have been - inserted, using ~magit-insert-child-count~ (which see). For historic - reasons, if the heading ends with ":", the count is substituted for - that, at this time as well. If ~magit-section-show-child-count~ is ~nil~, - no counts are inserted - -- Macro: magit-insert-section-body &rest body :: - - Use BODY to insert the section body, once the section is expanded. - If the section is expanded when it is created, then this is - like ~progn~. Otherwise BODY isn't evaluated until the section - is explicitly expanded. - -- Function: magit-cancel-section :: - - Cancel inserting the section that is currently being inserted. - Remove all traces of that section. - -- Function: magit-wash-sequence function :: - - Repeatedly call FUNCTION until it returns ~nil~ or the end of the - buffer is reached. FUNCTION has to move point forward or return - ~nil~. - -* Core Functions - -- Function: magit-current-section :: - - Return the section at point or where the context menu was invoked. - When using the context menu, return the section that the user - clicked on, provided the current buffer is the buffer in which - the click occurred. Otherwise return the section at point. - -- Function magit-section-at &optional position :: - - Return the section at POSITION, defaulting to point. Default to - point even when the context menu is used. - -- Function: magit-section-ident section :: - - Return an unique identifier for SECTION. The return value has the - form ~((TYPE . VALUE)...)~. - -- Function: magit-section-ident-value value :: - - Return a constant representation of VALUE. - - VALUE is the value of a ~magit-section~ object. If that is an - object itself, then that is not suitable to be used to identify - the section because two objects may represent the same thing but - not be equal. If possible a method should be added for such - objects, which returns a value that is equal. Otherwise the - catch-all method is used, which just returns the argument - itself. - -- Function: magit-get-section ident &optional root :: - - Return the section identified by IDENT. - IDENT has to be a list as returned by ~magit-section-ident~. - If optional ROOT is non-~nil~, then search in that section tree - instead of in the one whose root ~magit-root-section~ is. - -- Function: magit-section-lineage section &optional raw :: - - Return the lineage of SECTION. - If optional RAW is non-~nil~, return a list of section objects, - beginning with SECTION, otherwise return a list of section types. - -- Function: magit-section-content-p section :: - - Return non-~nil~ if SECTION has content or an unused washer function. - -The next two functions are replacements for the Emacs functions that -have the same name except for the ~magit-~ prefix. Like -~magit-current-section~ they do not act on point, the cursors position, -but on the position where the user clicked to invoke the context menu. - -If your package provides a context menu and some of its commands act -on the "thing at point", even if just as a default, then use the -prefixed functions to teach them to instead use the click location -when appropriate. - -- Function magit-point :: - - Return point or the position where the context menu was invoked. - When using the context menu, return the position the user clicked - on, provided the current buffer is the buffer in which the click - occurred. Otherwise return the same value as ~point~. - -- Function magit-thing-at-point thing &optional no-properties :: - - Return the THING at point or where the context menu was invoked. - When using the context menu, return the thing the user clicked - on, provided the current buffer is the buffer in which the click - occurred. Otherwise return the same value as ~thing-at-point~. - For the meaning of THING and NO-PROPERTIES see that function. - -* Matching Functions - -- Function: magit-section-match condition &optional (section (magit-current-section)) :: - - Return ~t~ if SECTION matches CONDITION. - - SECTION defaults to the section at point. If SECTION is not - specified and there also is no section at point, then return - ~nil~. - - CONDITION can take the following forms: - - - ~(CONDITION...)~ matches if any of the CONDITIONs matches. - - ~[CLASS...]~ matches if the section's class is the same - as the first CLASS or a subclass of that; - the section's parent class matches the - second CLASS; and so on. - - - ~[* CLASS...]~ matches sections that match [CLASS...] and - also recursively all their child sections. - - ~CLASS~ matches if the section's class is the same - as CLASS or a subclass of that; regardless - of the classes of the parent sections. - - Each CLASS should be a class symbol, identifying a class that - derives from ~magit-section~. For backward compatibility CLASS - can also be a "type symbol". A section matches such a symbol - if the value of its ~type~ slot is ~eq~. If a type symbol has - an entry in ~magit--section-type-alist~, then a section also - matches that type if its class is a subclass of the class that - corresponds to the type as per that alist. - - Note that it is not necessary to specify the complete section - lineage as printed by ~magit-describe-section-briefly~, unless - of course you want to be that precise. - -- Function: magit-section-value-if condition &optional section :: - - If the section at point matches CONDITION, then return its value. - - If optional SECTION is non-~nil~ then test whether that matches - instead. If there is no section at point and SECTION is ~nil~, - then return ~nil~. If the section does not match, then return - ~nil~. - - See ~magit-section-match~ for the forms CONDITION can take. - -- Macro: magit-section-case &rest clauses :: - - Choose among clauses on the type of the section at point. - - Each clause looks like ~(CONDITION BODY...)~. The type of the - section is compared against each CONDITION; the BODY forms of the - first match are evaluated sequentially and the value of the last - form is returned. Inside BODY the symbol ~it~ is bound to the - section at point. If no clause succeeds or if there is no - section at point, return ~nil~. - - See ~magit-section-match~ for the forms CONDITION can take. - Additionally a CONDITION of ~t~ is allowed in the final clause, and - matches if no other CONDITION match, even if there is no section - at point. - -* Copying -:PROPERTIES: -:COPYING: t -:END: - -#+begin_quote -Copyright (C) 2015-{{{year}}} Jonas Bernoulli - -You can redistribute this document and/or modify it under the terms -of the GNU General Public License as published by the Free Software -Foundation, either version 3 of the License, or (at your option) any -later version. - -This document is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. -#+end_quote - -# LocalWords: ARGS CONDITIONs EVAL Git Git's IDENT -# LocalWords: LocalWords MERCHANTABILITY Magit Makefile -# LocalWords: alist eval featurep ident keymap magit ol -# LocalWords: runtime src texinfo utils - -# IMPORTANT: Also update ORG_ARGS and ORG_EVAL in the Makefile. -# Local Variables: -# eval: (require 'magit-base nil t) -# eval: (require 'ol-man nil t) -# indent-tabs-mode: nil -# org-src-preserve-indentation: nil -# End: diff --git a/.config/emacs/lisp/magit/docs/magit.org b/.config/emacs/lisp/magit/docs/magit.org deleted file mode 100644 index 62912c2..0000000 --- a/.config/emacs/lisp/magit/docs/magit.org +++ /dev/null @@ -1,9641 +0,0 @@ -#+title: Magit User Manual -:PREAMBLE: -#+author: Jonas Bernoulli -#+email: emacs.magit@jonas.bernoulli.dev -#+date: 2015-{{{year}}} - -#+texinfo_dir_category: Emacs -#+texinfo_dir_title: Magit: (magit). -#+texinfo_dir_desc: Using Git from Emacs with Magit. -#+subtitle: for version 4.5.0 - -#+setupfile: .orgconfig - -# Emacs on GNU ELPA build server is too old, so all "man:" links -# will be broken, but this at least allows us to generate the manual. -#+options: broken-links:mark - -Magit is an interface to the version control system Git, implemented -as an Emacs package. Magit aspires to be a complete Git porcelain. -While we cannot (yet) claim that Magit wraps and improves upon each -and every Git command, it is complete enough to allow even experienced -Git users to perform almost all of their daily version control tasks -directly from within Emacs. While many fine Git clients exist, only -Magit and Git itself deserve to be called porcelains. - -#+texinfo: @noindent -This manual is for Magit version 4.5.0. - -#+texinfo: @insertcopying -:END: -* Introduction - -Magit is an interface to the version control system Git, implemented -as an Emacs package. Magit aspires to be a complete Git porcelain. -While we cannot (yet) claim that Magit wraps and improves upon each -and every Git command, it is complete enough to allow even experienced -Git users to perform almost all of their daily version control tasks -directly from within Emacs. While many fine Git clients exist, only -Magit and Git itself deserve to be called porcelains. - -Staging and otherwise applying changes is one of the most important -features in a Git porcelain and here Magit outshines anything else, -including Git itself. Git's own staging interface (~git add --patch~) -is so cumbersome that many users only use it in exceptional cases. -In Magit staging a hunk or even just part of a hunk is as trivial as -staging all changes made to a file. - -The most visible part of Magit's interface is the status buffer, which -displays information about the current repository. Its content is -created by running several Git commands and making their output -actionable. Among other things, it displays information about the -current branch, lists unpulled and unpushed changes and contains -sections displaying the staged and unstaged changes. That might sound -noisy, but, since sections are collapsible, it's not. - -To stage or unstage a change one places the cursor on the change and -then types ~s~ or ~u~. The change can be a file or a hunk, or when the -region is active (i.e., when there is a selection) several files or -hunks, or even just part of a hunk. The change or changes that these -commands - and many others - would act on are highlighted. - -Magit also implements several other "apply variants" in addition to -staging and unstaging. One can discard or reverse a change, or -apply it to the working tree. Git's own porcelain only supports this -for staging and unstaging and you would have to do something like ~git -diff ... | ??? | git apply ...~ to discard, revert, or apply a single -hunk on the command line. In fact that's exactly what Magit does -internally (which is what lead to the term "apply variants"). - -Magit isn't just for Git experts, but it does assume some prior -experience with Git as well as Emacs. That being said, many users -have reported that using Magit was what finally taught them what Git -is capable of and how to use it to its fullest. Other users -wished they had switched to Emacs sooner so that they would have -gotten their hands on Magit earlier. - -While one has to know the basic features of Emacs to be able to make -full use of Magit, acquiring just enough Emacs skills doesn't take -long and is worth it, even for users who prefer other editors. Vim -users are advised to give [[https://github.com/emacs-evil/evil][Evil]], the "Extensible VI Layer for Emacs", -and [[https://github.com/syl20bnr/spacemacs][Spacemacs]], an "Emacs starter-kit focused on Evil" a try. - -Magit provides a consistent and efficient Git porcelain. After a -short learning period, you will be able to perform most of your daily -version control tasks faster than you would on the command line. You -will likely also start using features that seemed too daunting in the -past. - -Magit fully embraces Git. It exposes many advanced features using a -simple but flexible interface instead of only wrapping the trivial -ones like many GUI clients do. Of course Magit supports logging, -cloning, pushing, and other commands that usually don't fail in -spectacular ways; but it also supports tasks that often cannot be -completed in a single step. Magit fully supports tasks such as -merging, rebasing, cherry-picking, reverting, and blaming by not only -providing a command to initiate these tasks but also by displaying -context sensitive information along the way and providing commands -that are useful for resolving conflicts and resuming the sequence -after doing so. - -Magit wraps and in many cases improves upon at least the following Git -porcelain commands: ~add~, ~am~, ~bisect~, ~blame~, ~branch~, ~checkout~, ~cherry~, -~cherry-pick~, ~clean~, ~clone~, ~commit~, ~config~, ~describe~, ~diff~, ~fetch~, -~format-patch~, ~init~, ~log~, ~merge~, ~merge-tree~, ~mv~, ~notes~, ~pull~, ~rebase~, -~reflog~, ~remote~, ~request-pull~, ~reset~, ~revert~, ~rm~, ~show~, ~stash~, -~submodule~, ~subtree~, ~tag~, and ~worktree.~ Many more Magit porcelain -commands are implemented on top of Git plumbing commands. - -* Installation - -Magit can be installed using Emacs' package manager or manually from -its development repository. - -** Installing from Melpa - -Magit is available from Melpa and Melpa-Stable. If you haven't used -Emacs' package manager before, then it is high time you familiarize -yourself with it by reading the documentation in the Emacs manual, see -[[info:emacs#Packages]]. Then add one of the archives to -~package-archives~: - -- To use Melpa: - -#+begin_src emacs-lisp - (require 'package) - (add-to-list 'package-archives - '("melpa" . "https://melpa.org/packages/") t) -#+end_src - -- To use Melpa-Stable: - -#+begin_src emacs-lisp - (require 'package) - (add-to-list 'package-archives - '("melpa-stable" . "https://stable.melpa.org/packages/") t) -#+end_src - -Once you have added your preferred archive, you need to update the -local package list using: - -#+begin_example - M-x package-refresh-contents RET -#+end_example - -Once you have done that, you can install Magit and its dependencies -using: - -#+begin_example - M-x package-install RET magit RET -#+end_example - -Now see [[*Post-Installation Tasks]]. - -** Installing from the Git Repository - -Magit depends on the ~compat~, ~cond-let~, ~llama~, ~seq~ (the built-in version -is enough when using Emacs >= 29.1), ~transient~ and ~with-editor~ libraries -which are available from Melpa and Melpa-Stable. Install them using -~M-x package-install RET RET~. Of course you may also install -them manually from their repository. - -Then clone the Magit repository: - -#+begin_src shell-script - $ git clone https://github.com/magit/magit.git ~/.emacs.d/site-lisp/magit - $ cd ~/.emacs.d/site-lisp/magit -#+end_src - -Then compile the libraries and generate the info manuals: - -#+begin_src shell-script - $ make -#+end_src - -If you haven't installed ~compat~, ~cond-let~, ~llama~, ~seq~ -(only for Emacs 28), ~transient~ and ~with-editor~ from Melpa, or at -~/path/to/magit/../~, then you have to tell ~make~ where to find -them. To do so create the file ~/path/to/magit/config.mk~ with the -following content before running ~make~: - -#+begin_src makefile - LOAD_PATH = -L ~/.emacs.d/site-lisp/magit/lisp - LOAD_PATH += -L ~/.emacs.d/site-lisp/compat - LOAD_PATH += -L ~/.emacs.d/site-lisp/cond-let - LOAD_PATH += -L ~/.emacs.d/site-lisp/llama - LOAD_PATH += -L ~/.emacs.d/site-lisp/seq - LOAD_PATH += -L ~/.emacs.d/site-lisp/transient/lisp - LOAD_PATH += -L ~/.emacs.d/site-lisp/with-editor/lisp -#+end_src - -Finally add this to your init file: - -#+begin_src emacs-lisp - (add-to-list 'load-path "~/.emacs.d/site-lisp/magit/lisp") - (require 'magit) - - (with-eval-after-load 'info - (info-initialize) - (add-to-list 'Info-directory-list "~/.emacs.d/site-lisp/magit/docs/")) -#+end_src - -Of course if you installed the dependencies manually as well, then -you have to tell Emacs about them too, by prefixing the above with: - -#+begin_src emacs-lisp - (add-to-list 'load-path "~/.emacs.d/site-lisp/compat") - (add-to-list 'load-path "~/.emacs.d/site-lisp/cond-let") - (add-to-list 'load-path "~/.emacs.d/site-lisp/llama") - (add-to-list 'load-path "~/.emacs.d/site-lisp/seq") - (add-to-list 'load-path "~/.emacs.d/site-lisp/transient/lisp") - (add-to-list 'load-path "~/.emacs.d/site-lisp/with-editor") -#+end_src - -Note that you have to add the ~lisp~ subdirectory to the ~load-path~, not -the top-level of the repository, and that elements of ~load-path~ should -not end with a slash, while those of ~Info-directory-list~ should. - -Instead of requiring the feature ~magit~, you could load just the -autoload definitions, by loading the file ~magit-autoloads.el~. - -#+begin_src emacs-lisp - (load "/path/to/magit/lisp/magit-autoloads") -#+end_src - -Instead of running Magit directly from the repository by adding that -to the ~load-path~, you might want to instead install it in some other -directory using ~sudo make install~ and setting ~load-path~ accordingly. - -To update Magit use: - -#+begin_src shell-script - $ git pull - $ make -#+end_src - -At times it might be necessary to run ~make clean all~ instead. - -To view all available targets use ~make help~. - -Now see [[*Post-Installation Tasks]]. - -** Post-Installation Tasks - -After installing Magit you should verify that you are indeed using the -Magit, Git, and Emacs releases you think you are using. It's best to -restart Emacs before doing so, to make sure you are not using an -outdated value for ~load-path~. - -#+begin_example - M-x magit-version RET -#+end_example - -should display something like - -#+begin_example - Magit 2.8.0, Git 2.10.2, Emacs 25.1.1, gnu/linux -#+end_example - -Then you might also want to read about options that many users likely -want to customize. See [[*Essential Settings]]. - -To be able to follow cross references to Git manpages found in this -manual, you might also have to manually install the ~gitman~ info manual, -or advice ~Info-follow-nearest-node~ to instead open the actual manpage. -See [[*How to install the gitman info manual?]]. - -If you are completely new to Magit then see [[*Getting Started]]. - -If you run into problems, then please see the [[*FAQ]]. Also see the -[[*Debugging Tools]]. - -And last but not least please consider making a donation, to ensure -that I can keep working on Magit. See https://magit.vc/donate. -for various donation options. - -* Getting Started - -This short tutorial describes the most essential features that many -Magitians use on a daily basis. It only scratches the surface but -should be enough to get you started. - -IMPORTANT: It is safest if you clone some repository just for this -tutorial. Alternatively you can use an existing local repository, but -if you do that, then you should commit all uncommitted changes before -proceeding. - -Type ~C-x g~ to display information about the current Git repository in -a dedicated buffer, called the status buffer. - -Most Magit commands are commonly invoked from the status buffer. It -can be considered the primary interface for interacting with Git using -Magit. Many other Magit buffers may exist at a given time, but they -are often created from this buffer. - -Depending on what state your repository is in, this buffer may contain -sections titled "Staged changes", "Unstaged changes", "Unmerged into -origin/master", "Unpushed to origin/master", and many others. - -Since we are starting from a safe state, which you can easily return -to (by doing a ~git reset --hard PRE-MAGIT-STATE~), there currently are -no staged or unstaged changes. Edit some files and save the changes. -Then go back to the status buffer, while at the same time refreshing -it, by typing ~C-x g~. (When the status buffer, or any Magit buffer for -that matter, is the current buffer, then you can also use just ~g~ to -refresh it). - -Move between sections using ~p~ and ~n~. Note that the bodies of some -sections are hidden. Type ~TAB~ to expand or collapse the section at -point. You can also use ~C-tab~ to cycle the visibility of the current -section and its children. Move to a file section inside the section -named "Unstaged changes" and type ~s~ to stage the changes you have made -to that file. That file now appears under "Staged changes". - -Magit can stage and unstage individual hunks, not just complete files. -Move to the file you have just staged, expand it using ~TAB~, move to -one of the hunks using ~n~, and unstage just that by typing ~u~. Note how -the staging (~s~) and unstaging (~u~) commands operate on the change at -point. Many other commands behave the same way. - -You can also un-/stage just part of a hunk. Inside the body of a hunk -section (move there using ~C-n~), set the mark using ~C-SPC~ and move down -until some added and/or removed lines fall inside the region but not -all of them. Again type ~s~ to stage. - -It is also possible to un-/stage multiple files at once. Move to a -file section, type ~C-SPC~, move to the next file using ~n~, and then ~s~ to -stage both files. Note that both the mark and point have to be on the -headings of sibling sections for this to work. If the region looks -like it does in other buffers, then it doesn't select Magit sections -that can be acted on as a unit. - -And then of course you want to commit your changes. Type ~c~. This -shows the available commit commands and arguments in a buffer at the -bottom of the frame. Each command and argument is prefixed with the -key that invokes/sets it. Do not worry about this for now. We want -to create a "normal" commit, which is done by typing ~c~ again. - -Now two new buffers appear. One is for writing the commit message, -the other shows a diff with the changes that you are about to -commit. Write a message and then type ~C-c C-c~ to actually create -the commit. - -You probably don't want to push the commit you just created because -you just committed some random changes, but if that is not the case -you could push it by typing ~P~ to show all the available push commands -and arguments and then ~p~ to push to a branch with the same name as the -local branch onto the remote configured as the push-remote. (If the -push-remote is not configured yet, then you would first be prompted -for the remote to push to.) - -So far we have mentioned the commit and push menu commands. -These are probably among the menus you will be using the most, but -many others exist. To show a menu that lists all other menus (as well -as the various apply commands and some other essential commands), type -~h~. Try a few. (Such menus are also called "transient prefix -commands" or just "transients".) - -The key bindings in that menu correspond to the bindings in Magit -buffers, including but not limited to the status buffer. So you could -type ~h d~ to bring up the diff menu, but once you remember that "d" -stands for "diff", you would usually do so by just typing ~d~. - -This "prefix of prefixes" is useful even once you have memorized all -the bindings, as it can provide easy access to Magit commands from -non-Magit buffers. So, by default, it is globally bound to ~C-x M-g~. - -A similar menu featuring (for the most part) commands that act on just -the file being visited in the current buffer, is globally bound to ~C-c -M-g~. That binding can also be used in buffers, which do not visit a -file, but then only a subset of the commands is available. - -The global key bindings mentioned in the previous two paragraphs are -quite inconvenient. We recommend using ~C-c g~ and ~C-c f~ instead, but -cannot use those key sequences by default because they are strictly -reserved for bindings added by the user. See [[*Global Bindings]], if you -want to explicitly opt-in to the recommended key bindings. - -Magit also provides context menus and other mouse commands, see [[*Mouse -Support]]. - -It is not necessary that you do so now, but if you stick with Magit, -then it is highly recommended that you read the next section too. - -* Interface Concepts -** Modes and Buffers - -Magit provides several major-modes. For each of these modes there -usually exists only one buffer per repository. Separate modes and -thus buffers exist for commits, diffs, logs, and some other things. - -Besides these special purpose buffers, there also exists an overview -buffer, called the *status buffer*. It's usually from this buffer that -the user invokes Git commands, or creates or visits other buffers. - -In this manual we often speak about "Magit buffers". By that we mean -buffers whose major-modes derive from ~magit-mode~. - -- Key: M-x magit-toggle-buffer-lock :: - - This command locks the current buffer to its value or if the buffer - is already locked, then it unlocks it. - - Locking a buffer to its value prevents it from being reused to - display another value. The name of a locked buffer contains its - value, which allows telling it apart from other locked buffers and - the unlocked buffer. - - Not all Magit buffers can be locked to their values; for example, it - wouldn't make sense to lock a status buffer. - - There can only be a single unlocked buffer using a certain - major-mode per repository. So when a buffer is being unlocked and - another unlocked buffer already exists for that mode and repository, - then the former buffer is instead deleted and the latter is - displayed in its place. - -*** Switching Buffers - -- Function: magit-display-buffer buffer &optional display-function :: - - This function is a wrapper around ~display-buffer~ and is used to - display any Magit buffer. It displays BUFFER in some window and, - unlike ~display-buffer~, also selects that window, provided - ~magit-display-buffer-noselect~ is ~nil~. It also runs the hooks - mentioned below. - - If optional DISPLAY-FUNCTION is non-~nil~, then that is used to - display the buffer. Usually that is ~nil~ and the function specified - by ~magit-display-buffer-function~ is used. - -- Variable: magit-display-buffer-noselect :: - - When this is non-~nil~, then ~magit-display-buffer~ only displays the - buffer but forgoes also selecting the window. This variable should - not be set globally, it is only intended to be let-bound, by code - that automatically updates "the other window". This is used for - example when the revision buffer is updated when you move inside the - log buffer. - -- User Option: magit-display-buffer-function :: - - The function specified here is called by ~magit-display-buffer~ with - one argument, a buffer, to actually display that buffer. This - function should call ~display-buffer~ with that buffer as first and a - list of display actions as second argument. - - Magit provides several functions, listed below, that are suitable - values for this option. If you want to use different rules, then a - good way of doing that is to start with a copy of one of these - functions and then adjust it to your needs. - - Instead of using a wrapper around ~display-buffer~, that function - itself can be used here, in which case the display actions have to - be specified by adding them to ~display-buffer-alist~ instead. - - To learn about display actions, see [[info:elisp#Choosing Window]]. - -- Function: magit-display-buffer-traditional buffer :: - - This function is the current default value of the option - ~magit-display-buffer-function~. Before that option and this function - were added, the behavior was hard-coded in many places all over the - code base but now all the rules are contained in this one function - (except for the "noselect" special case mentioned above). - -- Function: magit-display-buffer-same-window-except-diff-v1 :: - - This function displays most buffers in the currently selected - window. If a buffer's mode derives from ~magit-diff-mode~ or - ~magit-process-mode~, it is displayed in another window. - -- Function: magit-display-buffer-fullframe-status-v1 :: - - This function fills the entire frame when displaying a status - buffer. Otherwise, it behaves like - ~magit-display-buffer-traditional~. - -- Function: magit-display-buffer-fullframe-status-topleft-v1 :: - - This function fills the entire frame when displaying a status - buffer. It behaves like ~magit-display-buffer-fullframe-status-v1~ - except that it displays buffers that derive from ~magit-diff-mode~ - or ~magit-process-mode~ to the top or left of the current buffer - rather than to the bottom or right. As a result, Magit buffers tend - to pop up on the same side as they would if - ~magit-display-buffer-traditional~ were in use. - -- Function: magit-display-buffer-fullcolumn-most-v1 :: - - This function displays most buffers so that they fill the entire - height of the frame. However, the buffer is displayed in another - window if (1) the buffer's mode derives from ~magit-process-mode~, - or (2) the buffer's mode derives from ~magit-diff-mode~, provided - that the mode of the current buffer derives from ~magit-log-mode~ or - ~magit-cherry-mode~. - -- User Option: magit-pre-display-buffer-hook :: - - This hook is run by ~magit-display-buffer~ before displaying the - buffer. - -- Function: magit-save-window-configuration :: - - This function saves the current window configuration. Later when - the buffer is buried, it may be restored by - ~magit-restore-window-configuration~. - -- User Option: magit-post-display-buffer-hook :: - - This hook is run by ~magit-display-buffer~ after displaying the - buffer. - -- Function: magit-maybe-set-dedicated :: - - This function remembers if a new window had to be created to display - the buffer, or whether an existing window was reused. This - information is later used by ~magit-mode-quit-window~, to determine - whether the window should be deleted when its last Magit buffer is - buried. - -*** Naming Buffers - -- User Option: magit-generate-buffer-name-function :: - - The function used to generate the names of Magit buffers. - - Such a function should take the options ~magit-uniquify-buffer-names~ - as well as ~magit-buffer-name-format~ into account. If it doesn't, - then should be clearly stated in the doc-string. And if it supports - %-sequences beyond those mentioned in the doc-string of the option - ~magit-buffer-name-format~, then its own doc-string should describe - the additions. - -- Function: magit-generate-buffer-name-default-function mode :: - - This function returns a buffer name suitable for a buffer whose - major-mode is MODE and which shows information about the repository - in which ~default-directory~ is located. - - This function uses ~magit-buffer-name-format~ and supporting all of - the %-sequences mentioned the documentation of that option. It also - respects the option ~magit-uniquify-buffer-names~. - -- User Option: magit-buffer-name-format :: - - The format string used to name Magit buffers. - - At least the following %-sequences are supported: - - - ~%m~ - - The name of the major-mode, but with the ~-mode~ suffix removed. - - - ~%M~ - - Like ~%m~ but abbreviate ~magit-status-mode~ as ~magit~. - - - ~%v~ - - The value the buffer is locked to, in parentheses, or an empty - string if the buffer is not locked to a value. - - - ~%V~ - - Like ~%v~, but the string is prefixed with a space, unless it is an - empty string. - - - ~%t~ - - The top-level directory of the working tree of the repository, or - if ~magit-uniquify-buffer-names~ is non-~nil~ an abbreviation of that. - - - ~%x~ - - If ~magit-uniquify-buffer-names~ is ~nil~ "*", otherwise the empty - string. Due to limitations of the ~uniquify~ package, buffer names - must end with the path. - - The value should always contain ~%m~ or ~%M~, ~%v~ or ~%V~, and ~%t~. If - ~magit-uniquify-buffer-names~ is non-~nil~, then the value must end with - ~%t~ or ~%t%x~. See issue #2841. - -- User Option: magit-uniquify-buffer-names :: - - This option controls whether the names of Magit buffers are - uniquified. If the names are not being uniquified, then they - contain the full path of the top-level of the working tree of the - corresponding repository. If they are being uniquified, then they - end with the basename of the top-level, or if that would conflict - with the name used for other buffers, then the names of all these - buffers are adjusted until they no longer conflict. - - This is done using the ~uniquify~ package; customize its options to - control how buffer names are uniquified. - -*** Quitting Windows - -- Key: q (magit-mode-bury-buffer) :: - - This command buries or kills the current Magit buffer. The function - specified by option ~magit-bury-buffer-function~ is used to bury the - buffer when called without a prefix argument or to kill it when - called with a single prefix argument. - - When called with two or more prefix arguments then it always kills - all Magit buffers, associated with the current project, including - the current buffer. - -- User Option: magit-bury-buffer-function :: - - The function used to actually bury or kill the current buffer. - - ~magit-mode-bury-buffer~ calls this function with one argument. If - the argument is non-~nil~, then the function has to kill the current - buffer. Otherwise it has to bury it alive. The default value - currently is ~magit-mode-quit-window~. - -- Function: magit-restore-window-configuration kill-buffer :: - - Bury or kill the current buffer using ~quit-window~, which is called - with KILL-BUFFER as first and the selected window as second - argument. - - Then restore the window configuration that existed right before the - current buffer was displayed in the selected frame. Unfortunately - that also means that point gets adjusted in all the buffers, which - are being displayed in the selected frame. - -- Function: magit-mode-quit-window kill-buffer :: - - Bury or kill the current buffer using ~quit-window~, which is called - with KILL-BUFFER as first and the selected window as second - argument. - - Then, if the window was originally created to display a Magit buffer - and the buried buffer was the last remaining Magit buffer that was - ever displayed in the window, then that is deleted. - -*** Automatic Refreshing of Magit Buffers - -After running a command which may change the state of the current -repository, the current Magit buffer and the corresponding status -buffer are refreshed. The status buffer can be automatically refreshed -whenever a buffer is saved to a file inside the respective repository -by adding a hook, like so: - -#+begin_src emacs-lisp - (with-eval-after-load 'magit-mode - (add-hook 'after-save-hook 'magit-after-save-refresh-status t)) -#+end_src - -Automatically refreshing Magit buffers ensures that the displayed -information is up-to-date most of the time but can lead to a -noticeable delay in big repositories. Other Magit buffers are not -refreshed to keep the delay to a minimum and also because doing so can -sometimes be undesirable. - -Buffers can also be refreshed explicitly, which is useful in buffers -that weren't current during the last refresh and after changes were -made to the repository outside of Magit. - -- Key: g (magit-refresh) :: - - This command refreshes the current buffer if its major mode derives - from ~magit-mode~ as well as the corresponding status buffer. - - If the option ~magit-revert-buffers~ calls for it, then it also - reverts all unmodified buffers that visit files being tracked in the - current repository. - -- Key: G (magit-refresh-all) :: - - This command refreshes all Magit buffers belonging to the current - repository and also reverts all unmodified buffers that visit files - being tracked in the current repository. - - The file-visiting buffers are always reverted, even if - ~magit-revert-buffers~ is ~nil~. - -- User Option: magit-refresh-buffer-hook :: - - This hook is run in each Magit buffer that was refreshed during the - current refresh - normally the current buffer and the status buffer. - -- User Option: magit-refresh-status-buffer :: - - When this option is non-~nil~, then the status buffer is automatically - refreshed after running git for side-effects, in addition to the - current Magit buffer, which is always refreshed automatically. - - Only set this to ~nil~ after exhausting all other options to improve - performance. - -- Function: magit-after-save-refresh-status :: - - This function is intended to be added to ~after-save-hook~. After - doing that the corresponding status buffer is refreshed whenever a - buffer is saved to a file inside a repository. - - Note that refreshing a Magit buffer is done by re-creating its - contents from scratch, which can be slow in large repositories. If - you are not satisfied with Magit's performance, then you should - obviously not add this function to that hook. - -*** Automatic Saving of File-Visiting Buffers - -File-visiting buffers are by default saved at certain points in time. -This doesn't guarantee that Magit buffers are always up-to-date, but, -provided one only edits files by editing them in Emacs and uses only -Magit to interact with Git, one can be fairly confident. When in -doubt or after outside changes, type ~g~ (~magit-refresh~) to save and -refresh explicitly. - -- User Option: magit-save-repository-buffers :: - - This option controls whether file-visiting buffers are saved before - certain events. - - If this is non-~nil~ then all modified file-visiting buffers belonging - to the current repository may be saved before running commands, - before creating new Magit buffers, and before explicitly refreshing - such buffers. If this is ~dontask~ then this is done without user - intervention. If it is ~t~ then the user has to confirm each save. - -*** Automatic Reverting of File-Visiting Buffers - -By default Magit automatically reverts buffers that are visiting files -that are being tracked in a Git repository, after they have changed on -disk. When using Magit one often changes files on disk by running -Git, i.e., "outside Emacs", making this a rather important feature. - -For example, if you discard a change in the status buffer, then that -is done by running ~git apply --reverse ...~, and Emacs considers the -file to have "changed on disk". If Magit did not automatically revert -the buffer, then you would have to type ~M-x revert-buffer RET RET~ in -the visiting buffer before you could continue making changes. - -- User Option: magit-auto-revert-mode :: - - When this mode is enabled, then buffers that visit tracked files - are automatically reverted after the visited files change on disk. - -- User Option: global-auto-revert-mode :: - - When this mode is enabled, then any file-visiting buffer is - automatically reverted after the visited file changes on disk. - - If you like buffers that visit tracked files to be automatically - reverted, then you might also like any buffer to be reverted, not - just those visiting tracked files. If that is the case, then enable - this mode /instead of/ ~magit-auto-revert-mode~. - -- User Option: magit-auto-revert-immediately :: - - This option controls whether Magit reverts buffers immediately. - - If this is non-~nil~ and either ~global-auto-revert-mode~ or - ~magit-auto-revert-mode~ is enabled, then Magit immediately reverts - buffers by explicitly calling ~auto-revert-buffers~ after running Git - for side-effects. - - If ~auto-revert-use-notify~ is non-~nil~ (and file notifications are - actually supported), then ~magit-auto-revert-immediately~ does not - have to be non-~nil~, because the reverts happen immediately anyway. - - If ~magit-auto-revert-immediately~ and ~auto-revert-use-notify~ are both - ~nil~, then reverts happen after ~auto-revert-interval~ seconds of user - inactivity. That is not desirable. - -- User Option: auto-revert-use-notify :: - - This option controls whether file notification functions should be - used. Note that this variable unfortunately defaults to ~t~ even on - systems on which file notifications cannot be used. - -- User Option: magit-auto-revert-tracked-only :: - - This option controls whether ~magit-auto-revert-mode~ only reverts - tracked files or all files that are located inside Git repositories, - including untracked files and files located inside Git's control - directory. - -- User Option: auto-revert-mode :: - - The global mode ~magit-auto-revert-mode~ works by turning on this - local mode in the appropriate buffers (but ~global-auto-revert-mode~ - is implemented differently). You can also turn it on or off - manually, which might be necessary if Magit does not notice that a - previously untracked file now is being tracked or vice-versa. - -- User Option: auto-revert-stop-on-user-input :: - - This option controls whether the arrival of user input suspends the - automatic reverts for ~auto-revert-interval~ seconds. - -- User Option: auto-revert-interval :: - - This option controls how many seconds Emacs waits for before - resuming suspended reverts. - -- User Option: auto-revert-buffer-list-filter :: - - This option specifies an additional filter used by - ~auto-revert-buffers~ to determine whether a buffer should be reverted - or not. - - This option is provided by Magit, which also advises - ~auto-revert-buffers~ to respect it. Magit users who do not turn on - the local mode ~auto-revert-mode~ themselves, are best served by - setting the value to ~magit-auto-revert-repository-buffer-p~. - - However the default is ~nil~, so as not to disturb users who do use the - local mode directly. If you experience delays when running Magit - commands, then you should consider using one of the predicates - provided by Magit - especially if you also use Tramp. - - Users who do turn on ~auto-revert-mode~ in buffers in which Magit - doesn't do that for them, should likely not use any filter. Users - who turn on ~global-auto-revert-mode~, do not have to worry about this - option, because it is disregarded if the global mode is enabled. - -- User Option: auto-revert-verbose :: - - This option controls whether Emacs reports when a buffer has been - reverted. - -The options with the ~auto-revert-~ prefix are located in the Custom -group named ~auto-revert~. The other, Magit-specific, options are -located in the ~magit~ group. - -**** Risk of Reverting Automatically -:PROPERTIES: -:TEXINFO-NODE: t -:END: - -For the vast majority of users, automatically reverting file-visiting -buffers after they have changed on disk is harmless. - -If a buffer is modified (i.e., it contains changes that haven't been -saved yet), then Emacs will refuse to automatically revert it. If -you save a previously modified buffer, then that results in what is -seen by Git as an uncommitted change. Git will then refuse to carry -out any commands that would cause these changes to be lost. In other -words, if there is anything that could be lost, then either Git or -Emacs will refuse to discard the changes. - -However, if you use file-visiting buffers as a sort of ad hoc -"staging area", then the automatic reverts could potentially cause -data loss. So far I have heard from only one user who uses such a -workflow. - -An example: You visit some file in a buffer, edit it, and save the -changes. Then, outside of Emacs (or at least not using Magit or by -saving the buffer) you change the file on disk again. At this point -the buffer is the only place where the intermediate version still -exists. You have saved the changes to disk, but that has since been -overwritten. Meanwhile Emacs considers the buffer to be unmodified -(because you have not made any changes to it since you last saved it -to the visited file) and therefore would not object to it being -automatically reverted. At this point an Auto-Revert mode would kick -in. It would check whether the buffer is modified and since that is -not the case it would revert it. The intermediate version would be -lost. (Actually you could still get it back using the ~undo~ command.) - -If your workflow depends on Emacs preserving the intermediate version -in the buffer, then you have to disable all Auto-Revert modes. But -please consider that such a workflow would be dangerous even without -using an Auto-Revert mode, and should therefore be avoided. If Emacs -crashes or if you quit Emacs by mistake, then you would also lose the -buffer content. There would be no autosave file still containing the -intermediate version (because that was deleted when you saved the -buffer) and you would not be asked whether you want to save the buffer -(because it isn't modified). - -** Sections - -Magit buffers are organized into nested sections, which can be -collapsed and expanded, similar to how sections are handled in Org -mode. Each section also has a type, and some sections also have a -value. For each section type there can also be a local keymap, shared -by all sections of that type. - -Taking advantage of the section value and type, many commands operate on -the current section, or when the region is active and selects sections -of the same type, all of the selected sections. Commands that only -make sense for a particular section type (as opposed to just behaving -differently depending on the type) are usually bound in section type -keymaps. - -*** Section Movement - -To move within a section use the usual keys (~C-p~, ~C-n~, ~C-b~, ~C-f~ etc), -whose global bindings are not shadowed. To move to another section use -the following commands. - -The section movement commands described here run the hook -~magit-section-movement-hook~. Note that they explicitly run that hook -and that arbitrary other movement, defined in Emacs and other packages, -do not run that hook. That hook, and hook functions that can be added -to it, or are part of its default value, are described below. - -- Key: p (magit-section-backward) :: - - When not at the beginning of a section, then move to the beginning - of the current section. At the beginning of a section, instead move - to the beginning of the previous visible section. - -- Key: n (magit-section-forward) :: - - Move to the beginning of the next visible section. - -- Key: M-p (magit-section-backward-siblings) :: - - Move to the beginning of the previous sibling section. If there is - no previous sibling section, then move to the parent section - instead. - -- Key: M-n (magit-section-forward-siblings) :: - - Move to the beginning of the next sibling section. If there is no - next sibling section, then move to the parent section instead. - -- Key: ^ (magit-section-up) :: - - Move to the beginning of the parent of the current section. - -The above commands all call the hook ~magit-section-movement-hook~. -Any of the functions listed below can be used as members of this hook. - -You might want to remove some of the functions that Magit adds using -~add-hook~. In doing so you have to make sure you do not attempt to -remove function that haven't even been added yet, for example: - -#+begin_src emacs-lisp - (with-eval-after-load 'magit-diff - (remove-hook 'magit-section-movement-hook - 'magit-hunk-set-window-start)) -#+end_src - -- Variable: magit-section-movement-hook :: - - This hook is run by all of the above section movement commands, - after arriving at the destination. It is *not* run by arbitrary other - movement commands (such as ~next-line~), which are provided by Emacs - or third-party packages. - -- Function: magit-hunk-set-window-start :: - - This hook function ensures that the beginning of the current section - is visible, provided it is a ~hunk~ section. Otherwise, it does - nothing. - - Loading ~magit-diff~ adds this function to the hook. - -- Function: magit-section-set-window-start :: - - This hook function ensures that the beginning of the current section - is visible, regardless of the section's type. If you add this to - ~magit-section-movement-hook~, then you must remove the hunk-only - variant in turn. - -- Function: magit-log-maybe-show-more-commits :: - - This hook function only has an effect in log buffers, and ~point~ is - on the "show more" section. If that is the case, then it doubles - the number of commits that are being shown. - - Loading ~magit-log~ adds this function to the hook. - -- Function: magit-log-maybe-update-revision-buffer :: - - When moving inside a log buffer, then this function updates the - revision buffer, provided it is already being displayed in another - window of the same frame. - - Loading ~magit-log~ adds this function to the hook. - -- Function: magit-log-maybe-update-blob-buffer :: - - When moving inside a log buffer and another window of the same frame - displays a blob buffer, then this function instead displays the blob - buffer for the commit at point in that window. - -- Function: magit-status-maybe-update-revision-buffer :: - - When moving inside a status buffer, then this function updates the - revision buffer, provided it is already being displayed in another - window of the same frame. - -- Function: magit-status-maybe-update-stash-buffer :: - - When moving inside a status buffer, then this function updates the - stash buffer, provided it is already being displayed in another - window of the same frame. - -- Function: magit-status-maybe-update-blob-buffer :: - - When moving inside a status buffer and another window of the same - frame displays a blob buffer, then this function instead displays - the blob buffer for the commit at point in that window. - -- Function: magit-stashes-maybe-update-stash-buffer :: - - When moving inside a buffer listing stashes, then this function - updates the stash buffer, provided it is already being displayed - in another window of the same frame. - -- User Option: magit-update-other-window-delay :: - - Delay before automatically updating the other window. - - When moving around in certain buffers using Magit's own section - movement commands (but not other movement commands), then certain - other buffers, which are being displayed in another window, may - optionally be updated to display information about the section at - point. - - When holding down a key to move by more than just one section, then - that would update that buffer for each section on the way. To - prevent that, updating the revision buffer is delayed, and this - option controls for how long. For optimal experience you might have - to adjust this delay and/or the keyboard repeat rate and delay of - your graphical environment or operating system. - -*** Section Visibility - -Magit provides many commands for changing the visibility of sections, -but all you need to get started are the next two. - -- Key: TAB (magit-section-toggle) :: - - Toggle the visibility of the body of the current section. - -- Key: C-c TAB (magit-section-cycle) :: -- Key: C- (magit-section-cycle) :: - - Cycle the visibility of current section and its children. - - If this command is invoked using ~C-~ and that is globally bound - to ~tab-next~, then this command pivots to behave like that command, - and you must instead use ~C-c TAB~ to cycle section visibility. - - If you would like to keep using ~C-~ to cycle section visibility - but also want to use ~tab-bar-mode~, then you have to prevent that mode - from using this key and instead bind another key to ~tab-next~. Because - ~tab-bar-mode~ does not use a mode map but instead manipulates the - global map, this involves advising ~tab-bar--define-keys~. - -- Key: M- (magit-section-cycle-diffs) :: - - Cycle the visibility of diff-related sections in the current buffer. - -- Key: S- (magit-section-cycle-global) :: - - Cycle the visibility of all sections in the current buffer. - -- Key: 1 (magit-section-show-level-1) :: -- Key: 2 (magit-section-show-level-2) :: -- Key: 3 (magit-section-show-level-3) :: -- Key: 4 (magit-section-show-level-4) :: - - Show sections surrounding the current section up to level N. - -- Key: M-1 (magit-section-show-level-1-all) :: -- Key: M-2 (magit-section-show-level-2-all) :: -- Key: M-3 (magit-section-show-level-3-all) :: -- Key: M-4 (magit-section-show-level-4-all) :: - - Show all sections up to level N. - -Some functions, which are used to implement the above commands, are -also exposed as commands themselves. By default no keys are bound to -these commands, as they are generally perceived to be much less -useful. But your mileage may vary. - -- Command: magit-section-show :: - - Show the body of the current section. - -- Command: magit-section-hide :: - - Hide the body of the current section. - -- Command: magit-section-show-headings :: - - Recursively show headings of children of the current section. Only - show the headings. Previously shown text-only bodies are hidden. - -- Command: magit-section-show-children :: - - Recursively show the bodies of children of the current section. - With a prefix argument show children down to the level of the - current section, and hide deeper children. - -- Command: magit-section-hide-children :: - - Recursively hide the bodies of children of the current section. - -- Command: magit-section-toggle-children :: - - Toggle visibility of bodies of children of the current section. - -When a buffer is first created then some sections are shown expanded -while others are not. This is hard coded. When a buffer is refreshed -then the previous visibility is preserved. The initial visibility of -certain sections can also be overwritten using the hook -~magit-section-set-visibility-hook~. - -- User Option: magit-section-initial-visibility-alist :: - - This options can be used to override the initial visibility of - sections. In the future it will also be used to define the - defaults, but currently a section's default is still hardcoded. - - The value is an alist. Each element maps a section type or lineage - to the initial visibility state for such sections. The state has to - be one of ~show~ or ~hide~, or a function that returns one of these - symbols. A function is called with the section as the only argument. - - Use the command ~magit-describe-section-briefly~ to determine a - section's lineage or type. The vector in the output is the section - lineage and the type is the first element of that vector. Wildcards - can be used, see ~magit-section-match~. - -- User Option: magit-section-cache-visibility :: - - This option controls for which sections the previous visibility - state should be restored if a section disappears and later appears - again. The value is a boolean or a list of section types. If ~t~, - then the visibility of all sections is cached. Otherwise this is - only done for sections whose type matches one of the listed types. - - This requires that the function ~magit-section-cached-visibility~ is - a member of ~magit-section-set-visibility-hook~. - -- Variable: magit-section-set-visibility-hook :: - - This hook is run when first creating a buffer and also when - refreshing an existing buffer, and is used to determine the - visibility of the section currently being inserted. - - Each function is called with one argument, the section being - inserted. It should return ~hide~ or ~show~, or to leave the visibility - undefined ~nil~. If no function decides on the visibility and the - buffer is being refreshed, then the visibility is preserved; or if - the buffer is being created, then the hard coded default is used. - - Usually this should only be used to set the initial visibility but - not during refreshes. If ~magit-insert-section--oldroot~ is non-~nil~, - then the buffer is being refreshed and these functions should - immediately return ~nil~. - -- User Option: magit-section-visibility-indicators :: - - This option controls whether and how to indicate that a section can - be expanded/collapsed. - - If ~nil~, then don't show any indicators. Otherwise the value has to - be a list with two elements. The first controls the indicators used - in graphical frames, the second the indicators in terminal frames. - For graphical frames all of the following forms are valid, while - terminal frames do not have fringes and thus do not support the first - form. - - - ~(EXPANDABLE-BITMAP . COLLAPSIBLE-BITMAP)~ - - Both values have to be variables whose values are fringe - bitmaps. In this case every section that can be expanded - or collapsed gets an indicator in the left fringe. - - To provide extra padding around the indicator, set - ~left-fringe-width~ in ~magit-mode-hook~, e.g.: - - #+BEGIN_SRC emacs-lisp - (add-hook 'magit-mode-hook - (lambda () (setq left-fringe-width 20))) - #+END_SRC - - - ~(EXPANDABLE-CHAR . COLLAPSIBLE-CHAR)~ - - In this case every section that can be expanded or collapsed - gets an indicator in the left margin. - - - ~(STRING . BOOLEAN)~ - - In this case STRING (usually an ellipsis) is shown at the end - of the heading of every collapsed section. Expanded sections - get no indicator. The cdr controls whether the appearance of - these ellipsis take section highlighting into account. Doing - so might potentially have an impact on performance, while not - doing so is kinda ugly. - -*** Section Hooks - -Which sections are inserted into certain buffers is controlled with -hooks. This includes the status and the refs buffers. For other -buffers, e.g., log and diff buffers, this is not possible. The -command ~magit-describe-section~ can be used to see which hook (if any) -was responsible for inserting the section at point. - -For buffers whose sections can be customized by the user, a hook -variable called ~magit-TYPE-sections-hook~ exists. This hook should be -changed using ~magit-add-section-hook~. Avoid using ~add-hooks~ or the -Custom interface. - -The various available section hook variables are described later in -this manual along with the appropriate "section inserter functions". - -- Function: magit-add-section-hook hook function &optional at append local :: - - Add the function FUNCTION to the value of section hook HOOK. - - Add FUNCTION at the beginning of the hook list unless optional - APPEND is non-~nil~, in which case FUNCTION is added at the end. If - FUNCTION already is a member then move it to the new location. - - If optional AT is non-~nil~ and a member of the hook list, then add - FUNCTION next to that instead. Add before or after AT, or replace - AT with FUNCTION depending on APPEND. If APPEND is the symbol - ~replace~, then replace AT with FUNCTION. For any other non-~nil~ value - place FUNCTION right after AT. If ~nil~, then place FUNCTION right - before AT. If FUNCTION already is a member of the list but AT is - not, then leave FUNCTION where ever it already is. - - If optional LOCAL is non-~nil~, then modify the hook's buffer-local - value rather than its global value. This makes the hook local by - copying the default value. That copy is then modified. - - HOOK should be a symbol. If HOOK is void, it is first set to ~nil~. - HOOK's value must not be a single hook function. FUNCTION should - be a function that takes no arguments and inserts one or multiple - sections at point, moving point forward. FUNCTION may choose not - to insert its section(s), when doing so would not make sense. It - should not be abused for other side-effects. - -To remove a function from a section hook, use ~remove-hook~. - -*** Section Types and Values - -Each section has a type, for example ~hunk~, ~file~, and ~commit~. -Instances of certain section types also have a value. The value of a -section of type ~file~, for example, is a file name. - -Users usually do not have to worry about a section's type and value, -but knowing them can be handy at times. - -- Key: H (magit-describe-section) :: - - This command shows information about the section at point in a - separate buffer. - -- Command: magit-describe-section-briefly :: - - This command shows information about the section at point in the - echo area, as ~#~. - -Many commands behave differently depending on the type of the section -at point and/or somehow consume the value of that section. But that -is only one of the reasons why the same key may do something different, -depending on what section is current. - -Additionally for each section type a keymap *might* be defined, named -~magit-TYPE-section-map~. That keymap is used as text property keymap -of all text belonging to any section of the respective type. If such -a map does not exist for a certain type, then you can define it -yourself, and it will automatically be used. - -*** Section Options - -This section describes options that have an effect on more than just a -certain type of sections. As you can see there are not many of those. - -- User Option: magit-section-show-child-count :: - - Whether to append the number of children to section headings. This - only affects sections that could benefit from this information. - -** Transient Commands - -Many Magit commands are implemented as *transient* commands. First the -user invokes a *prefix* command, which causes its *infix* arguments and -*suffix* commands to be displayed in the echo area. The user then -optionally sets some infix arguments and finally invokes one of the -suffix commands. - -This is implemented in the library ~transient~. Earlier Magit releases -used the package ~magit-popup~ and even earlier versions library -~magit-key-mode~. - -Transient is documented in [[info:transient]]. - -- Key: C-x M-g (magit-dispatch) :: -- Key: C-c g (magit-dispatch) :: - - This transient prefix command binds most of Magit's other prefix - commands as suffix commands and displays them in a temporary buffer - until one of them is invoked. Invoking such a sub-prefix causes the - suffixes of that command to be bound and displayed instead of those - of ~magit-dispatch~. - - This command is also, or especially, useful outside Magit buffers, - so Magit by default binds it to ~C-c M-g~ in the global keymap. - ~C-c g~ would be a better binding, but we cannot use that by default, - because that key sequence is reserved for the user. See [[*Global - Bindings]] to learn more default and recommended key bindings. - -** Transient Arguments and Buffer Variables - -The infix arguments of many of Magit's transient prefix commands cease -to have an effect once the ~git~ command that is called with those -arguments has returned. Commands that create a commit are a good -example for this. If the user changes the arguments, then that only -affects the next invocation of a suffix command. If the same -transient prefix command is later invoked again, then the arguments -are initially reset to the default value. This default value can be -set for the current Emacs session or saved permanently, see -[[info:transient#Saving Values]]. It is also possible to cycle through -previously used sets of arguments using ~C-M-p~ and ~C-M-n~, see -[[info:transient#Using History]]. - -However the infix arguments of many other transient commands continue -to have an effect even after the ~git~ command that was called with -those arguments has returned. The most important commands like this -are those that display a diff or log in a dedicated buffer. Their -arguments obviously continue to have an effect for as long as the -respective diff or log is being displayed. Furthermore the used -arguments are stored in buffer-local variables for future reference. - -For commands in the second group it isn't always desirable to reset -their arguments to the global value when the transient prefix command -is invoked again. - -As mentioned above, it is possible to cycle through previously used -sets of arguments while a transient popup is visible. That means that -we could always reset the infix arguments to the default because the -set of arguments that is active in the existing buffer is only a few -~C-M-p~ away. Magit can be configured to behave like that, but because I -expect that most users would not find that very convenient, it is not -the default. - -Also note that it is possible to change the diff and log arguments -used in the current buffer (including the status buffer, which -contains both diff and log sections) using the respective "refresh" -transient prefix commands on ~D~ and ~L~. (~d~ and ~l~ on the other hand are -intended to change *what* diff or log is being displayed. It is -possible to also change *how* the diff or log is being displayed at the -same time, but if you only want to do the latter, then you should use -the refresh variants.) Because these secondary diff and log transient -prefixes are about *changing* the arguments used in the current buffer, -they *always* start out with the set of arguments that are currently in -effect in that buffer. - -Some commands are usually invoked directly even though they can also -be invoked as the suffix of a transient prefix command. Most -prominently ~magit-show-commit~ is usually invoked by typing ~RET~ while -point is on a commit in a log, but it can also be invoked from the -~magit-diff~ transient prefix. - -When such a command is invoked directly, then it is important to reuse -the arguments as specified by the respective buffer-local values, -instead of using the default arguments. Imagine you press ~RET~ in a -log to display the commit at point in a different buffer and then use -~D~ to change how the diff is displayed in that buffer. And then you -press ~RET~ on another commit to show that instead and the diff -arguments are reset to the default. Not cool; so Magit does not do -that by default. - -- User Option: magit-prefix-use-buffer-arguments :: - - This option controls whether the infix arguments initially shown in - certain transient prefix commands are based on the arguments that - are currently in effect in the buffer that their suffixes update. - - The ~magit-diff~ and ~magit-log~ transient prefix commands are affected - by this option. - -- User Option: magit-direct-use-buffer-arguments :: - - This option controls whether certain commands, when invoked directly - (i.e., not as the suffix of a transient prefix command), use the - arguments that are currently active in the buffer that they are - about to update. The alternative is to use the default value for - these arguments, which might change the arguments that are used in - the buffer. - -#+texinfo: @noindent -Valid values for both of the above options are: - - - ~always~: Always use the set of arguments that is currently active - in the respective buffer, provided that buffer exists of course. - - ~selected~ or ~t~: Use the set of arguments from the respective - buffer, but only if it is displayed in a window of the current - frame. This is the default for both variables. - - ~current~: Use the set of arguments from the respective buffer, but - only if it is the current buffer. - - ~never~: Never use the set of arguments from the respective buffer. - -#+texinfo: @noindent -I am afraid it gets more complicated still: - -- The global diff and log arguments are set for each supported mode - individually. The diff arguments for example have different values - in ~magit-diff-mode~, ~magit-revision-mode~, ~magit-merge-preview-mode~ - and ~magit-status-mode~ buffers. Setting or saving the value for one - mode does not change the value for other modes. The history however - is shared. - -- When ~magit-show-commit~ is invoked directly from a log buffer, then - the file filter is picked up from that buffer, not from the revision - buffer or the mode's global diff arguments. - -- Even though they are suffixes of the diff prefix ~magit-show-commit~ - and ~magit-stash-show~ do not use the diff buffer used by the diff - commands, instead they use the dedicated revision and stash buffers. - - At the time you invoke the diff prefix it is unknown to Magit which - of the suffix commands you are going to invoke. While not certain, - more often than not users invoke one of the commands that use the - diff buffer, so the initial infix arguments are those used in that - buffer. However if you invoke one of these commands directly, then - Magit knows that it should use the arguments from the revision resp. - stash buffer. - -- The log prefix also features reflog commands, but these commands do - not use the log arguments. - -- If ~magit-show-refs~ is invoked from a ~magit-refs-mode~ buffer, then it - acts as a refresh prefix and therefore unconditionally uses the - buffer's arguments as initial arguments. If it is invoked elsewhere - with a prefix argument, then it acts as regular prefix and therefore - respects ~magit-prefix-use-buffer-arguments~. If it is invoked - elsewhere without a prefix argument, then it acts as a direct - command and therefore respects ~magit-direct-use-buffer-arguments~. - -** Completion, Confirmation and the Selection -*** Action Confirmation - -By default many actions that could potentially lead to data loss have -to be confirmed. This includes many very common actions, so this can -quickly become annoying. Many of these actions can be undone and if -you have thought about how to undo certain mistakes, then it should -be safe to disable confirmation for the respective actions. - -The option ~magit-no-confirm~ can be used to tell Magit to perform -certain actions without the user having to confirm them. Note that -while this option can only be used to disable confirmation for a -specific set of actions, the next section explains another way of -telling Magit to ask fewer questions. - -- User Option: magit-no-confirm :: - - The value of this option is a list of symbols, representing actions - that do not have to be confirmed by the user before being carried - out. - - By default many potentially dangerous commands ask the user for - confirmation. Each of the below symbols stands for an action which, - when invoked unintentionally or without being fully aware of the - consequences, could lead to tears. In many cases there are several - commands that perform variations of a certain action, so we don't - use the command names but more generic symbols. - - - Applying changes: - - - ~discard~ Discarding one or more changes (i.e., hunks or the - complete diff for a file) loses that change, obviously. - - - ~reverse~ Reverting one or more changes can usually be undone by - reverting the reversion. - - - ~stage-all-changes~, ~unstage-all-changes~ When there are both - staged and unstaged changes, then un-/staging everything would - destroy that distinction. Of course that also applies when - un-/staging a single change, but then less is lost and one does - that so often that having to confirm every time would be - unacceptable. - - - Files: - - - ~delete~ When a file that isn't yet tracked by Git is deleted, - then it is completely lost, not just the last changes. Very - dangerous. - - - ~trash~ Instead of deleting a file it can also be move to the - system trash. Obviously much less dangerous than deleting it. - - Also see option ~magit-delete-by-moving-to-trash~. - - - ~resurrect~ A deleted file can easily be resurrected by "deleting" - the deletion, which is done using the same command that was used - to delete the same file in the first place. - - - ~untrack~ Untracking a file can be undone by tracking it again. - - - ~rename~ Renaming a file can easily be undone. - - - Sequences: - - - ~reset-bisect~ Aborting (known to Git as "resetting") a bisect - operation loses all information collected so far. - - - ~abort-cherry-pick~ Aborting a cherry-pick throws away all - conflict resolutions which have already been carried out by the - user. - - - ~abort-revert~ Aborting a revert throws away all conflict - resolutions which have already been carried out by the user. - - - ~abort-rebase~ Aborting a rebase throws away all already modified - commits, but it's possible to restore those from the reflog. - - - ~abort-merge~ Aborting a merge throws away all conflict - resolutions which have already been carried out by the user. - - - ~merge-dirty~ Merging with a dirty worktree can make it hard to go - back to the state before the merge was initiated. - - - References: - - - ~delete-unmerged-branch~ Once a branch has been deleted, it can - only be restored using low-level recovery tools provided by Git. - And even then the reflog is gone. The user always has to - confirm the deletion of a branch by accepting the default choice - (or selecting another branch), but when a branch has not been - merged yet, also make sure the user is aware of that. - - - ~delete-pr-remote~ When deleting a branch that was created from a - pull-request and if no other branches still exist on that - remote, then ~magit-branch-delete~ offers to delete the remote - as well. This should be safe because it only happens if no - other refs exist in the remotes namespace, and you can recreate - the remote if necessary. - - - ~drop-stashes~ Dropping a stash is dangerous because Git stores - stashes in the reflog. Once a stash is removed, there is no - going back without using low-level recovery tools provided by - Git. When a single stash is dropped, then the user always has - to confirm by accepting the default (or selecting another). - This action only concerns the deletion of multiple stashes at - once. - - - Publishing: - - - ~set-and-push~ When pushing to the upstream or the push-remote - and that isn't actually configured yet, then the user can first - set the target. If s/he confirms the default too quickly, then - s/he might end up pushing to the wrong branch and if the remote - repository is configured to disallow fixing such mistakes, then - that can be quite embarrassing and annoying. - - - Edit published history: - - Without adding these symbols here, you will be warned before - editing commits that have already been pushed to one of the - branches listed in ~magit-published-branches~. - - - ~amend-published~ Affects most commands that amend to "HEAD". - - - ~rebase-published~ Affects commands that perform interactive - rebases. This includes commands from the commit transient that - modify a commit other than "HEAD", namely the various fixup and - squash variants. - - - ~edit-published~ Affects the commands ~magit-edit-line-commit~ and - ~magit-diff-edit-hunk-commit~. These two commands make it quite - easy to accidentally edit a published commit, so you should - think twice before configuring them not to ask for confirmation. - - To disable confirmation completely, add all three symbols here or - set ~magit-published-branches~ to ~nil~. - - - Various: - - - ~stash-apply-3way~ When a stash cannot be applied using ~git stash - apply~, then Magit uses ~git apply~ instead, possibly using the - ~--3way~ argument, which isn't always perfectly safe. See also - ~magit-stash-apply~. - - - ~kill-process~ There seldom is a reason to kill a process. - - - Global settings: - - Instead of adding all of the above symbols to the value of this - option, you can also set it to the atom `t', which has the same - effect as adding all of the above symbols. Doing that most - certainly is a bad idea, especially because other symbols might be - added in the future. So even if you don't want to be asked for - confirmation for any of these actions, you are still better of - adding all of the respective symbols individually. - - When ~magit-wip-before-change-mode~ is enabled, then the following - actions can be undone fairly easily: ~discard~, ~reverse~, - ~stage-all-changes~, and ~unstage-all-changes~. If and only if - this mode is enabled, then ~safe-with-wip~ has the same effect as - adding all of these symbols individually. - -*** Completion and Confirmation - -Many Magit commands ask the user to select from a list of possible -things to act on, while offering the most likely choice as the -default. For many of these commands the default is the thing at -point, provided that it actually is a valid thing to act on. For -many commands that act on a branch, the current branch serves as -the default if there is no branch at point. - -These commands combine asking for confirmation and asking for a target -to act on into a single action. The user can confirm the default -target using ~RET~ or abort using ~C-g~. This is similar to a ~y-or-n-p~ -prompt, but the keys to confirm or abort differ. - -At the same time the user is also given the opportunity to select -another target, which is useful because for some commands and/or in -some situations you might want to select the action before selecting -the target by moving to it. - -However you might find that for some commands you always want to use -the default target, if any, or even that you want the command to act -on the default without requiring any confirmation at all. The option -~magit-dwim-selection~ can be used to configure certain commands to that -effect. - -Note that when the region is active then many commands act on the -things that are selected using a mechanism based on the region, in -many cases after asking for confirmation. This region-based mechanism -is called the "selection" and is described in detail in the next -section. When a selection exists that is valid for the invoked -command, then that command never offers to act on something else, and -whether it asks for confirmation is not controlled by this option. - -Also note that Magit asks for confirmation of certain actions that are -not coupled with completion (or the selection). Such dialogs are also -not affected by this option and are described in the previous section. - -- User Option: magit-dwim-selection :: - -This option can be used to tell certain commands to use the thing -at point instead of asking the user to select a candidate to act -on, with or without confirmation. - -The value has the form ~((COMMAND nil|PROMPT DEFAULT)...)~. - -- COMMAND is the command that should not prompt for a choice. - To have an effect, the command has to use the function - ~magit-completing-read~ or a utility function which in turn uses - that function. - -- If the command uses ~magit-completing-read~ multiple times, then - PROMPT can be used to only affect one of these uses. PROMPT, if - non-~nil~, is a regular expression that is used to match against - the PROMPT argument passed to ~magit-completing-read~. - -- DEFAULT specifies how to use the default. If it is ~t~, then - the DEFAULT argument passed to ~magit-completing-read~ is used - without confirmation. If it is ~ask~, then the user is given - a chance to abort. DEFAULT can also be ~nil~, in which case the - entry has no effect. - -*** The Selection - -If the region is active, then many Magit commands act on the things -that are selected using a mechanism based on the region instead of one -single thing. When the region is not active, then these commands act -on the thing at point or read a single thing to act on. This is -described in the previous section — this section only covers how -multiple things are selected, how that is visualized, and how certain -commands behave when that is the case. - -Magit's mechanism for selecting multiple things, or rather sections -that represent these things, is based on the Emacs region, but the -area that Magit considers to be selected is typically larger than the -region and additional restrictions apply. - -Magit makes a distinction between a region that qualifies as forming a -valid Magit selection and a region that does not. If the region does -not qualify, then it is displayed as it is in other Emacs buffers. If -the region does qualify as a Magit selection, then the selection is -always visualized, while the region itself is only visualized if it -begins and ends on the same line. - -For a region to qualify as a Magit selection, it must begin in the -heading of one section and end in the heading of a sibling section. -Note that if the end of the region is at the very beginning of section -heading (i.e., at the very beginning of a line) then that section is -considered to be *inside* the selection. - -This is not consistent with how the region is normally treated in -Emacs — if the region ends at the beginning of a line, then that line -is outside the region. Due to how Magit visualizes the selection, it -should be obvious that this difference exists. - -Not every command acts on every valid selection. Some commands do not -even consider the location of point, others may act on the section at -point but not support acting on the selection, and even commands that -do support the selection of course only do so if it selects things -that they can act on. - -This is the main reason why the selection must include the section at -point. Even if a selection exists, the invoked command may disregard -it, in which case it may act on the current section only. It is much -safer to only act on the current section but not the other selected -sections than it is to act on the current section *instead* of the -selected sections. The latter would be much more surprising and if -the current section always is part of the selection, then that cannot -happen. - -- Variable: magit-keep-region-overlay :: - - This variable controls whether the region is visualized as usual - even when a valid Magit selection or a hunk-internal region exists. - See the doc-string for more information. - -*** The hunk-internal region - -Somewhat related to the Magit selection described in the previous -section is the hunk-internal region. - -Like the selection, the hunk-internal region is based on the Emacs -region but causes that region to not be visualized as it would in -other Emacs buffers, and includes the line on which the region ends -even if it ends at the very beginning of that line. - -Unlike the selection, which is based on a region that must begin in -the heading of one section and ends in the section of a sibling -section, the hunk-internal region must begin inside the *body* of a -hunk section and end in the body of the *same* section. - -The hunk-internal region is honored by "apply" commands, which can, -among other targets, act on a hunk. If the hunk-internal region is -active, then such commands act only on the marked part of the hunk -instead of on the complete hunk. - -*** Support for Completion Frameworks - -The built-in option ~completing-read-function~ specifies the low-level -function used by ~completing-read~ to ask a user to select from a list -of choices. Its default value is ~completing-read-default~. -Alternative completion frameworks typically activate themselves by -substituting their own implementation. - -Mostly for historic reasons Magit provides a similar option named -~magit-completing-read-function~, which only controls the low-level -function used by ~magit-completing-read~. This option also makes it -possible to use a different completing mechanism for Magit than for -the rest of Emacs, but doing that is not recommend. - -You most likely don't have to customize the magit-specific option to -use an alternative completion framework. For example, if you enable -~ivy-mode~, then Magit will respect that, and if you enable ~helm-mode~, -then you are done too. - -- User Option: magit-completing-read-function :: - - The value of this variable is the low-level function used to perform - completion by code that uses ~magit-completing-read~ (as opposed to - the built-in ~completing-read~). - - The default value, ~magit-builtin-completing-read~, is suitable for - the standard completion mechanism, ~ivy-mode~, and ~helm-mode~ at least. - - The built-in ~completing-read~ and ~completing-read-default~ are *not* - suitable to be used here. ~magit-builtin-completing-read~ performs - some additional work, and any function used in its place has to do - the same. - -- Function: magit-builtin-completing-read prompt choices &optional predicate require-match initial-input hist def :: - - This function performs completion using the built-in ~completing-read~ - and does some additional magit-specific work. - -- Function: magit-completing-read prompt choices &optional predicate require-match initial-input hist def fallback :: - - This is the function that Magit commands use when they need the user - to select a single thing to act on. The arguments have the same - meaning as for ~completing-read~, except for FALLBACK, which is unique - to this function and is described below. - - Instead of asking the user to choose from a list of possible - candidates, this function may just return the default specified by - DEF, with or without requiring user confirmation. Whether that is - the case depends on PROMPT, ~this-command~ and ~magit-dwim-selection~. - See the documentation of the latter for more information. - - If it does read a value in the minibuffer, then this function acts - similar to ~completing-read~, except for the following: - - - COLLECTION must be a list of choices. A function is not - supported. - - - If REQUIRE-MATCH is ~nil~ and the user exits without a choice, then - ~nil~ is returned instead of an empty string. - - - If REQUIRE-MATCH is ~any~, then do not require a match but - do require non-empty input (or non-~nil~ DEFAULT, since that - is substituted for empty input). - - - If REQUIRE-MATCH is non-~nil~ and the users exits without a choice, - an user-error is raised. - - - FALLBACK specifies a secondary default that is only used if the - primary default DEF is ~nil~. The secondary default is not subject - to ~magit-dwim-selection~ — if DEF is ~nil~ but FALLBACK is not, then - this function always asks the user to choose a candidate, just as - if both defaults were ~nil~. - - - ~format-prompt~ is called on PROMPT and DEF (or FALLBACK if - DEF is ~nil~). This appends ": " to the prompt and may also - add the default to the prompt, using the format specified by - ~minibuffer-default-prompt-format~ and depending on - ~magit-completing-read-default-prompt-predicate~. - -*** Additional Completion Options - -- User Option: magit-list-refs-sortby :: - - For many commands that read a ref or refs from the user, the value - of this option can be used to control the order of the refs. Valid - values include any key accepted by the ~--sort~ flag of ~git - for-each-ref~. By default, refs are sorted alphabetically by their - full name (e.g., "refs/heads/master"). - -** Mouse Support - -Double clicking on a section heading toggles the visibility of its -body, if any. Likewise clicking in the left fringe toggles the -visibility of the appropriate section. - -A context menu is provided but has to be enabled explicitly. In Emacs -28 and greater, enable the global mode ~context-menu-mode~. If you use an -older Emacs release, set ~magit-section-show-context-menu-for-emacs<28~. - -** Running Git -*** Viewing Git Output - -Magit runs Git either for side-effects (e.g., when pushing) or to get -some value (e.g., the name of the current branch). - -When Git is run for side-effects, the process output is logged in a -per-repository log buffer, which can be consulted using the -~magit-process-buffer~ command, when things don't go as expected. - -The output/errors for up to ~magit-process-log-max~ Git commands are -retained. - -- Key: $ (magit-process-buffer) :: - - This commands displays the process buffer for the current - repository. - -Inside that buffer, the usual key bindings for navigating and showing -sections are available. There is one additional command. - -- Key: k (magit-process-kill) :: - - This command kills the process represented by the section at point. - -- Key: M-x magit-toggle-git-debug :: - - This command toggles whether additional git errors are reported. - - Magit basically calls git for one of these two reasons: for - side-effects or to do something with its standard output. - - When git is run for side-effects then its output, including error - messages, go into the process buffer which is shown when using ~$~. - - When git's output is consumed in some way, then it would be too - expensive to also insert it into this buffer, but with this command - that can be enabled temporarily. In that case, if git returns with - a non-zero exit status, then at least its standard error is inserted - into this buffer. - - Also note that just because git exits with a non-zero status and - prints an error message, that usually doesn't mean that it is an - error as far as Magit is concerned, which is another reason we - usually hide these error messages. Whether some error message is - relevant in the context of some unexpected behavior has to be judged - on a case by case basis. - -*** Git Process Status - -When a Git process is running for side-effects, Magit displays an -indicator in the mode line, using the ~magit-mode-line-process~ face. - -If the Git process exits successfully, the process indicator is -removed from the mode line immediately. - -In the case of a Git error, the process indicator is not removed, but -is instead highlighted with the ~magit-mode-line-process-error~ face, -and the error details from the process buffer are provided as a -tooltip for mouse users. This error indicator persists in the mode -line until the next magit buffer refresh. - -If you do not wish process errors to be indicated in the mode line, -set ~magit-process-display-mode-line-error~ to ~nil~. - -Process errors are displayed at the top of the status buffer and in -the echo area. In both places a hint is appended, which informs users -that they can see the full output in the process buffer and how to -display that buffer. However, once you are aware of that, you might -want to set ~magit-show-process-buffer-hint~ to ~nil~. - -*** Running Git Manually - -While Magit provides many Emacs commands to interact with Git, it does -not cover everything. In those cases your existing Git knowledge will -come in handy. Magit provides some commands for running arbitrary Git -commands by typing them into the minibuffer, instead of having to -switch to a shell. - -- Key: ! (magit-run) :: - - This transient prefix command binds the following suffix commands - and displays them in a temporary buffer until a suffix is invoked. - -- Key: ! ! (magit-git-command-topdir) :: - - This command reads a command from the user and executes it in the - top-level directory of the current working tree. - - The string "git " is used as initial input when prompting the user - for the command. It can be removed to run another command. - -- Key: : (magit-git-command) :: -- Key: ! p :: - - This command reads a command from the user and executes it in - ~default-directory~. With a prefix argument the command is executed - in the top-level directory of the current working tree instead. - - The string "git " is used as initial input when prompting the user - for the command. It can be removed to run another command. - -- Key: ! s (magit-shell-command-topdir) :: - - This command reads a command from the user and executes it in the - top-level directory of the current working tree. - -- Key: ! S (magit-shell-command) :: - - This command reads a command from the user and executes it in - ~default-directory~. With a prefix argument the command is executed - in the top-level directory of the current working tree instead. - -- User Option: magit-shell-command-verbose-prompt :: - - Whether the prompt, used by the above commands when reading a - shell command, shows the directory in which it will be run. - -These suffix commands start external gui tools. - -- Key: ! k (magit-run-gitk) :: - - This command runs ~gitk~ in the current repository. - -- Key: ! a (magit-run-gitk-all) :: - - This command runs ~gitk --all~ in the current repository. - -- Key: ! b (magit-run-gitk-branches) :: - - This command runs ~gitk --branches~ in the current repository. - -- Key: ! g (magit-run-git-gui) :: - - This command runs ~git gui~ in the current repository. - -- Key: ! m (magit-git-mergetool) :: - - This command runs =git mergetool --gui= in the current repository. - - With a prefix argument this acts as a transient prefix command, - allowing the user to select the mergetool and change some settings. - -*** Git Executable - -When Magit calls Git, then it may do so using the absolute path to the -~git~ executable, or using just its name. - -When running ~git~ locally and the ~system-type~ is ~windows-nt~ (any -Windows version) or ~darwin~ (macOS) then ~magit-git-executable~ is set -to an absolute path when Magit is loaded. - -On Windows it is necessary to use an absolute path because Git comes -with several wrapper scripts for the actual ~git~ binary, which are also -placed on ~$PATH~, and using one of these wrappers instead of the binary -would degrade performance horribly. For some macOS users using just -the name of the executable also performs horribly, so we avoid doing -that on that platform as well. On other platforms, using just the -name seems to work just fine. - -Using an absolute path when running ~git~ on a remote machine over -Tramp, would be problematic to use an absolute path that is suitable -on the local machine, so a separate option is used to control the name -or path that is used on remote machines. - -- User Option: magit-git-executable :: - - The ~git~ executable used by Magit on the local host. This should be - either the absolute path to the executable, or the string "git" to - let Emacs find the executable itself, using the standard mechanism - for doing such things. - -- User Option: magit-remote-git-executable :: - - The ~git~ executable used by Magit on remote machines over Tramp. - Normally this should be just the string "git". Consider customizing - ~tramp-remote-path~ instead of this option. - -If Emacs is unable to find the correct executable, then you can -work around that by explicitly setting the value of one of these two -options. Doing that should be considered a kludge; it is better to -make sure that the order in ~exec-path~ or ~tramp-remote-path~ is correct. - -Note that ~exec-path~ is set based on the value of the ~PATH~ environment -variable that is in effect when Emacs is started. If you set ~PATH~ in -your shell's init files, then that only has an effect on Emacs if you -start it from that shell (because the environment of a process is only -passed to its child processes, not to arbitrary other processes). If -that is not how you start Emacs, then the ~exec-path-from-shell~ package -can help; though honestly I consider that a kludge too. - -The command ~magit-debug-git-executable~ can be useful to find out where -Emacs is searching for ~git~. - -- Key: M-x magit-debug-git-executable :: - - This command displays a buffer with information about - ~magit-git-executable~ and ~magit-remote-git-executable~. - -- Key: M-x magit-version :: - - This command shows the currently used versions of Magit, Git, and - Emacs in the echo area. Non-interactively this just returns the - Magit version. - -*** Global Git Arguments - -- User Option: magit-git-global-arguments :: - - The arguments set here are used every time the git executable is run - as a subprocess. They are placed right after the executable itself - and before the git command - as in ~git HERE... COMMAND REST~. For - valid arguments see [[man:git]] - - Be careful what you add here, especially if you are using Tramp to - connect to servers with ancient Git versions. Never remove anything - that is part of the default value, unless you really know what you - are doing. And think very hard before adding something; it will be - used every time Magit runs Git for any purpose. - -* Inspecting - -The functionality provided by Magit can be roughly divided into three -groups: inspecting existing data, manipulating existing data or adding -new data, and transferring data. Of course that is a rather crude -distinction that often falls short, but it's more useful than no -distinction at all. This section is concerned with inspecting data, -the next two with manipulating and transferring it. Then follows a -section about miscellaneous functionality, which cannot easily be fit -into this distinction. - -Of course other distinctions make sense too, e.g., Git's distinction -between porcelain and plumbing commands, which for the most part is -equivalent to Emacs' distinction between interactive commands and -non-interactive functions. All of the sections mentioned before are -mainly concerned with the porcelain -- Magit's plumbing layer is -described later. - -** Status Buffer - -While other Magit buffers contain, e.g., one particular diff or one -particular log, the status buffer contains the diffs for staged and -unstaged changes, logs for unpushed and unpulled commits, lists of -stashes and untracked files, and information related to the current -branch. - -During certain incomplete operations -- for example when a merge -resulted in a conflict -- additional information is displayed that -helps proceeding with or aborting the operation. - -The command ~magit-status~ displays the status buffer belonging to the -current repository in another window. This command is used so often -that it should be bound globally. We recommend using ~C-x g~: - -#+begin_src emacs-lisp - (global-set-key (kbd "C-x g") 'magit-status) -#+end_src - -- Key: C-x g (magit-status) :: - - When invoked from within an existing Git repository, then this - command shows the status of that repository in a buffer. - - If the current directory isn't located within a Git repository, then - this command prompts for an existing repository or an arbitrary - directory, depending on the option ~magit-repository-directories~, and - the status for the selected repository is shown instead. - - - If that option specifies any existing repositories, then the user - is asked to select one of them. - - - Otherwise the user is asked to select an arbitrary directory using - regular file-name completion. If the selected directory is the - top-level directory of an existing working tree, then the status - buffer for that is shown. - - - Otherwise the user is offered to initialize the selected directory - as a new repository. After creating the repository its status - buffer is shown. - - These fallback behaviors can also be forced using one or more - prefix arguments: - - - With two prefix arguments (or more precisely a numeric prefix - value of 16 or greater) an arbitrary directory is read, which is - then acted on as described above. The same could be accomplished - using the command ~magit-init~. - - - With a single prefix argument an existing repository is read from - the user, or if no repository can be found based on the value of - ~magit-repository-directories~, then the behavior is the same as with - two prefix arguments. - -- User Option: magit-repository-directories :: - - List of directories that are Git repositories or contain Git - repositories. - - Each element has the form ~(DIRECTORY . DEPTH)~. DIRECTORY has to be - a directory or a directory file-name, a string. DEPTH, an integer, - specifies the maximum depth to look for Git repositories. If it is - 0, then only add DIRECTORY itself. - - This option controls which repositories are being listed by - ~magit-list-repositories~. It also affects ~magit-status~ (which see) - in potentially surprising ways (see above). - -- Command: magit-status-quick :: - - This command is an alternative to ~magit-status~ that usually avoids - refreshing the status buffer. - - If the status buffer of the current Git repository exists but isn't - being displayed in the selected frame, then it is displayed without - being refreshed. - - If the status buffer is being displayed in the selected frame, - then this command refreshes it. - - Prefix arguments have the same meaning as for ~magit-status~, - and additionally cause the buffer to be refresh. - - To use this command add this to your init file: - - #+BEGIN_SRC emacs-lisp - (global-set-key (kbd "C-x g") 'magit-status-quick). - #+END_SRC - - If you do that and then for once want to redisplay the buffer and - also immediately refresh it, then type ~C-x g~ followed by ~g~. - - A possible alternative command is ~magit-display-repository-buffer~. - It supports displaying any existing Magit buffer that belongs to the - current repository; not just the status buffer. - -*** Status Sections - -The contents of status buffers is controlled using the hook -~magit-status-sections-hook~. See [[*Section Hooks]] to learn about such -hooks and how to customize them. - -- User Option: magit-status-sections-hook :: - - This hook is run to insert sections into a status buffer. - - The functions described in this section, and the functions - ~magit-insert-status-headers~ and ~magit-insert-untracked-files~, - which are described in subsequent sections, are members of this - hook. - - Some additional functions that can be added to this hook, but are by - default added to another hooks, are listed in [[*References Buffer]]. - -- Function: magit-insert-status-headers :: - - Insert header sections appropriate for ~magit-status-mode~ buffers. - The sections are inserted by running the functions on the hook - ~magit-status-headers-hook~. See [[*Status Header Sections]]. - -- Function: magit-insert-merge-log :: - - Insert section for the on-going merge. Display the heads that are - being merged. If no merge is in progress, do nothing. - -- Function: magit-insert-rebase-sequence :: - - Insert section for the on-going rebase sequence. - If no such sequence is in progress, do nothing. - -- Function: magit-insert-am-sequence :: - - Insert section for the on-going patch applying sequence. - If no such sequence is in progress, do nothing. - -- Function: magit-insert-sequencer-sequence :: - - Insert section for the on-going cherry-pick or revert sequence. - If no such sequence is in progress, do nothing. - -- Function: magit-insert-bisect-output :: - - While bisecting, insert section with output from ~git bisect~. - -- Function: magit-insert-bisect-rest :: - - While bisecting, insert section visualizing the bisect state. - -- Function: magit-insert-bisect-log :: - - While bisecting, insert section logging bisect progress. - -- Function: magit-insert-unstaged-changes :: - - Insert section showing unstaged changes. - -- Function: magit-insert-staged-changes :: - - Insert section showing staged changes. - -- Function: magit-insert-stashes &optional ref heading :: - - Insert the ~stashes~ section showing reflog for "refs/stash". - If optional REF is non-~nil~ show reflog for that instead. - If optional HEADING is non-~nil~ use that as section heading - instead of "Stashes:". - -- Function: magit-insert-unpulled-from-upstream :: - - Insert section showing commits that haven't been pulled from the - upstream branch yet. - -- Function: magit-insert-unpulled-from-pushremote :: - - Insert section showing commits that haven't been pulled from the - push-remote branch yet. - -- Function: magit-insert-unpushed-to-upstream-or-recent :: - - Insert section showing unpushed or other recent commits. - If an upstream is configured for the current branch and it is - behind of the current branch, then show the commits that have - not yet been pushed into the upstream branch. If no upstream is - configured or if the upstream is not behind of the current branch, - then show the last ~magit-log-section-commit-count~ commits. - -- Function: magit-insert-unpushed-to-upstream :: - - Insert section showing commits that haven't been pushed to the - upstream yet. - -- Function: magit-insert-unpushed-to-pushremote :: - - Insert section showing commits that haven't been pushed to the - push-remote yet. - -*** Status File List Sections - -These functions honor the buffer's file filter, which can be set using -~D - -~. - -- Function: magit-insert-untracked-files :: - - This function may insert a list of untracked files. Whether it - actually does so, depends on the option described next. - -- User Option: magit-status-show-untracked-files :: - - This option controls whether the above function inserts a list of - untracked files in the status buffer. - - - If ~nil~, do not list any untracked files. - - If ~t~, list untracked files, but if a directory does not contain any - tracked files, then only list that directory, not the contained - untracked files. - - If ~all~, then list each individual untracked files. This is can be - very slow and is discouraged. - - The corresponding values for the Git variable are "no", "normal" - and "all". - - To disable listing untracked files in a specific repository only, - add the following to ~.dir-locals.el~: - - #+begin_src emacs-lisp - ((magit-status-mode - (magit-status-show-untracked-files . "no"))) - #+end_src - - Alternatively (and mostly for historic reasons), it is possible to - use ~git config~ to set the repository-local value: - - #+begin_src shell-script - git config set --local status.showUntrackedFiles no - #+end_src - - This does *not* override the (if any) local value of this Lisp variable, - but it does override its global value. - - See the last section in the git-status(1) manpage, to speed up the part - of the work Git is responsible for. Turning that list into sections is - also not free, so Magit only lists ~magit-status-file-list-limit~ files. - -- User Option: magit-status-file-list-limit :: - - This option controls many files are listed at most in each section - that lists files in the status buffer. For performance reasons, it - is recommended that you do not increase this limit. - -While the above function is a member of ~magit-status-section-hook~ by -default, the following functions have to be explicitly added by the -user. Because that negatively affects performance, it is recommended -that you don't do that. - -- Function: magit-insert-tracked-files :: - - Insert a list of tracked files. - -- Function: magit-insert-ignored-files :: - - Insert a list of ignored files. - -- Function: magit-insert-skip-worktree-files :: - - Insert a list of skip-worktree files. - -- Function: magit-insert-assume-unchanged-files :: - - Insert a list of files that are assumed to be unchanged. - -*** Status Log Sections - -- Function: magit-insert-unpulled-or-recent-commits :: - - Insert section showing unpulled or recent commits. - If an upstream is configured for the current branch and it is - ahead of the current branch, then show the missing commits. - Otherwise, show the last ~magit-log-section-commit-count~ - commits. - -- Function: magit-insert-recent-commits :: - - Insert section showing the last ~magit-log-section-commit-count~ - commits. - -- User Option: magit-log-section-commit-count :: - - How many recent commits ~magit-insert-recent-commits~ and - ~magit-insert-unpulled-or-recent-commits~ (provided there are no - unpulled commits) show. - -- Function: magit-insert-unpulled-cherries :: - - Insert section showing unpulled commits. - Like ~magit-insert-unpulled-commits~ but prefix each commit - that has not been applied yet (i.e., a commit with a patch-id - not shared with any local commit) with "+", and all others - with "-". - -- Function: magit-insert-unpushed-cherries :: - - Insert section showing unpushed commits. - Like ~magit-insert-unpushed-commits~ but prefix each commit - which has not been applied to upstream yet (i.e., a commit with - a patch-id not shared with any upstream commit) with "+" and - all others with "-". - -*** Status Header Sections - -The contents of status buffers is controlled using the hook -~magit-status-sections-hook~ (see [[*Status Sections]]). - -By default ~magit-insert-status-headers~ is the first member of that -hook variable. - -- Function: magit-insert-status-headers :: - - Insert headers sections appropriate for ~magit-status-mode~ buffers. - The sections are inserted by running the functions on the hook - ~magit-status-headers-hook~. - -- User Option: magit-status-headers-hook :: - - Hook run to insert headers sections into the status buffer. - - This hook is run by ~magit-insert-status-headers~, which in turn has - to be a member of ~magit-status-sections-hook~ to be used at all. - -By default the following functions are members of the above hook: - -- Function: magit-insert-error-header :: - - Insert a header line showing the message about the Git error that - just occurred. - - This function is only aware of the last error that occur when Git - was run for side-effects. If, for example, an error occurs while - generating a diff, then that error won't be inserted. Refreshing - the status buffer causes this section to disappear again. - -- Function: magit-insert-diff-filter-header :: - - Insert a header line showing the effective diff filters. - -- Function: magit-insert-head-branch-header :: - - Insert a header line about the current branch or detached ~HEAD~. - -- Function: magit-insert-upstream-branch-header :: - - Insert a header line about the branch that is usually pulled into - the current branch. - -- Function: magit-insert-push-branch-header :: - - Insert a header line about the branch that the current branch is - usually pushed to. - -- Function: magit-insert-tags-header :: - - Insert a header line about the current and/or next tag, along with - the number of commits between the tag and ~HEAD~. - -The following functions can also be added to the above hook: - -- Function: magit-insert-repo-header :: - - Insert a header line showing the path to the repository top-level. - -- Function: magit-insert-remote-header :: - - Insert a header line about the remote of the current branch. - - If no remote is configured for the current branch, then fall back - showing the "origin" remote, or if that does not exist the first - remote in alphabetic order. - -- Function: magit-insert-user-header :: - - Insert a header line about the current user. - -*** Status Module Sections - -The contents of status buffers is controlled using the hook -~magit-status-sections-hook~ (see [[*Status Sections]]). - -By default ~magit-insert-modules~ is /not/ a member of that hook -variable. - -- Function: magit-insert-modules :: - - Insert submodule sections. - - Hook ~magit-module-sections-hook~ controls which module sections are - inserted, and option ~magit-module-sections-nested~ controls whether - they are wrapped in an additional section. - -- User Option: magit-module-sections-hook :: - - Hook run by ~magit-insert-modules~. - -- User Option: magit-module-sections-nested :: - - This option controls whether ~magit-insert-modules~ wraps inserted - sections in an additional section. - - If this is non-~nil~, then only a single top-level section is inserted. - If it is ~nil~, then all sections listed in ~magit-module-sections-hook~ - become top-level sections. - -- Function: magit-insert-modules-overview :: - - Insert sections for all submodules. For each section insert the - path, the branch, and the output of ~git describe --tags~, - or, failing that, the abbreviated HEAD commit hash. - - Press ~RET~ on such a submodule section to show its own status buffer. - Press ~RET~ on the "Modules" section to display a list of submodules - in a separate buffer. This shows additional information not - displayed in the super-repository's status buffer. - -- Function: magit-insert-modules-unpulled-from-upstream :: - - Insert sections for modules that haven't been pulled from the - upstream yet. These sections can be expanded to show the respective - commits. - -- Function: magit-insert-modules-unpulled-from-pushremote :: - - Insert sections for modules that haven't been pulled from the - push-remote yet. These sections can be expanded to show the - respective commits. - -- Function: magit-insert-modules-unpushed-to-upstream :: - - Insert sections for modules that haven't been pushed to the upstream - yet. These sections can be expanded to show the respective commits. - -- Function: magit-insert-modules-unpushed-to-pushremote :: - - Insert sections for modules that haven't been pushed to the - push-remote yet. These sections can be expanded to show the - respective commits. - -*** Status Options - -- User Option: magit-status-margin :: - - This option specifies whether the margin is initially shown in - Magit-Status mode buffers and how it is formatted. - - The value has the form ~(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)~. - - - If INIT is non-~nil~, then the margin is shown initially. - - STYLE controls how to format the author or committer date. It can - be one of ~age~ (to show the age of the commit), ~age-abbreviated~ (to - abbreviate the time unit to a character), or a string (suitable - for ~format-time-string~) to show the actual date. Option - ~magit-log-margin-show-committer-date~ controls which date is being - displayed. - - WIDTH controls the width of the margin. This exists for forward - compatibility and currently the value should not be changed. - - AUTHOR controls whether the name of the author is also shown by - default. - - AUTHOR-WIDTH has to be an integer. When the name of the author - is shown, then this specifies how much space is used to do so. - -Also see the proceeding section for more options concerning status -buffers. - -** Repository List - -- Command: magit-list-repositories :: - - This command displays a list of repositories in a separate buffer. - - The option ~magit-repository-directories~ controls which repositories are - displayed. - -- User Option: magit-repolist-columns :: - - This option controls what columns are displayed by the command - ~magit-list-repositories~ and how they are displayed. - - Each element has the form ~(HEADER WIDTH FORMAT PROPS)~. - - HEADER is the string displayed in the header. WIDTH is the width - of the column. FORMAT is a function that is called with one - argument, the repository identification (usually its basename), - and with ~default-directory~ bound to the toplevel of its working - tree. It has to return a string to be inserted or ~nil~. PROPS is - an alist that supports the keys ~:right-align~, ~:pad-right~ and - ~:sort~. - - The ~:sort~ function has a weird interface described in the - docstring of ~tabulated-list--get-sort~. Alternatively ~<~ and - ~magit-repolist-version<~ can be used as those functions are - automatically replaced with functions that satisfy the interface. - Set ~:sort~ to ~nil~ to inhibit sorting; if unspecified, then the - column is sortable using the default sorter. - - You may wish to display a range of numeric columns using just one - character per column and without any padding between columns, in - which case you should use an appropriate HEADER, set WIDTH to 1, - and set ~:pad-right~ to 9. ~+~ is substituted for numbers higher than 9. - -#+texinfo: @noindent -The following functions can be added to the above option: - -- Function: magit-repolist-column-ident :: - - This function inserts the identification of the repository. Usually - this is just its basename. - -- Function: magit-repolist-column-path :: - - This function inserts the absolute path of the repository. - -- Function: magit-repolist-column-version :: - - This function inserts a description of the repository's ~HEAD~ revision. - -- Function: magit-repolist-column-branch :: - - This function inserts the name of the current branch. - -- Function: magit-repolist-column-upstream :: - - This function inserts the name of the upstream branch of the current - branch. - -- Function: magit-repolist-column-branches :: - - This function inserts the number of branches. - -- Function: magit-repolist-column-stashes :: - - This function inserts the number of stashes. - -- Function: magit-repolist-column-flag :: - - This function inserts a flag as specified by - ~magit-repolist-column-flag-alist~. - - By default this indicates whether there are uncommitted changes. - - - ~N~ if there is at least one untracked file. - - ~U~ if there is at least one unstaged file. - - ~S~ if there is at least one staged file. - - Only the first one of these that applies is shown. - -- Function: magit-repolist-column-flags :: - - This functions insert all flags as specified by - ~magit-repolist-column-flag-alist~. - - This is an alternative to function ~magit-repolist-column-flag~, - which only lists the first one found. - -- Function: magit-repolist-column-unpulled-from-upstream :: - - This function inserts the number of upstream commits not in the - current branch. - -- Function: magit-repolist-column-unpulled-from-pushremote :: - - This function inserts the number of commits in the push branch but - not the current branch. - -- Function: magit-repolist-column-unpushed-to-upstream :: - - This function inserts the number of commits in the current branch - but not its upstream. - -- Function: magit-repolist-column-unpushed-to-pushremote :: - - This function inserts the number of commits in the current branch - but not its push branch. - -#+texinfo: @noindent -The following commands are available in repolist buffers: - -- Key: RET (magit-repolist-status) :: - - This command shows the status for the repository at point. - -- Key: m (magit-repolist-mark) :: - - This command marks the repository at point. - -- Key: u (magit-repolist-unmark) :: - - This command unmarks the repository at point. - -- Key: f (magit-repolist-fetch) :: - - This command fetches all marked repositories. If no repositories - are marked, then it offers to fetch all displayed repositories. - -- Key: 5 (magit-repolist-find-file-other-frame) :: - - This command reads a relative file-name (without completion) and - opens the respective file in each marked repository in a new frame. - If no repositories are marked, then it offers to do this for all - displayed repositories. - -** Logging - -The status buffer contains logs for the unpushed and unpulled commits, -but that obviously isn't enough. The transient prefix command -~magit-log~, on ~l~, features several suffix commands, which show a -specific log in a separate log buffer. - -Like other transient prefix commands, ~magit-log~ also features several -infix arguments that can be changed before invoking one of the suffix -commands. However, in the case of the log transient, these arguments -may be taken from those currently in use in the current repository's -log buffer, depending on the value of ~magit-prefix-use-buffer-arguments~ -(see [[*Transient Arguments and Buffer Variables]]). - -For information about the various arguments, see [[man:git-log]] -The switch ~++order=VALUE~ is converted to one of ~--author-date-order~, -~--date-order~, or ~--topo-order~ before being passed to ~git log~. - -The log transient also features several reflog commands. See [[*Reflog]]. - -- Key: l (magit-log) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - -- Key: l l (magit-log-current) :: - - Show log for the current branch. When ~HEAD~ is detached or with a - prefix argument, show log for one or more revs read from the - minibuffer. - -- Key: l h (magit-log-head) :: - - Show log for ~HEAD~. - -- Key: l u (magit-log-related) :: - - Show log for the current branch, its upstream and its push target. - When the upstream is a local branch, then also show its own - upstream. When ~HEAD~ is detached, then show log for that, the - previously checked out branch and its upstream and push-target. - -- Key: l o (magit-log-other) :: - - Show log for one or more revs read from the minibuffer. The user - can input any revision or revisions separated by a space, or even - ranges, but only branches, tags, and a representation of the - commit at point are available as completion candidates. - -- Key: l L (magit-log-branches) :: - - Show log for all local branches and ~HEAD~. - -- Key: l b (magit-log-all-branches) :: - - Show log for all local and remote branches and ~HEAD~. - -- Key: l a (magit-log-all) :: - - Show log for all references and ~HEAD~. - -Two additional commands that show the log for the file or blob that is -being visited in the current buffer exists, see [[*Commands for Buffers -Visiting Files]]. The command ~magit-cherry~ also shows a log, see -[[*Cherries]]. - -*** Refreshing Logs - -The transient prefix command ~magit-log-refresh~, on ~L~, can be used to -change the log arguments used in the current buffer, without changing -which log is shown. This works in dedicated log buffers, but also in -the status buffer. - -- Key: L (magit-log-refresh) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - -- Key: L g (magit-log-refresh) :: - - This suffix command sets the local log arguments for the current - buffer. - -- Key: L s (magit-log-set-default-arguments) :: - - This suffix command sets the default log arguments for buffers of - the same type as that of the current buffer. Other existing buffers - of the same type are not affected because their local values have - already been initialized. - -- Key: L w (magit-log-save-default-arguments) :: - - This suffix command sets the default log arguments for buffers of - the same type as that of the current buffer, and saves the value for - future sessions. Other existing buffers of the same type are not - affected because their local values have already been initialized. - -- Key: L L (magit-toggle-margin) :: - - Show or hide the margin. - -*** Log Buffer - -- Key: L (magit-log-refresh) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - - See [[*Refreshing Logs]]. - -- Key: q (magit-log-bury-buffer) :: - - Bury the current buffer or the revision buffer in the same frame. - Like ~magit-mode-bury-buffer~ (which see) but with a negative prefix - argument instead bury the revision buffer, provided it is displayed - in the current frame. - -- Key: C-c C-b (magit-go-backward) :: - - Move backward in current buffer's history. - -- Key: C-c C-f (magit-go-forward) :: - - Move forward in current buffer's history. - -- Key: C-c C-n (magit-log-move-to-parent) :: - - Move to a parent of the current commit. By default, this is the - first parent, but a numeric prefix can be used to specify another - parent. - -- Key: j (magit-log-move-to-revision) :: - - Read a revision and move to it in current log buffer. - - If the chosen reference or revision isn't being displayed in - the current log buffer, then inform the user about that and do - nothing else. - - If invoked outside any log buffer, then display the log buffer - of the current repository first; creating it if necessary. - -- Key: SPC (magit-diff-show-or-scroll-up) :: - - Update the commit or diff buffer for the thing at point. - - Either show the commit or stash at point in the appropriate buffer, - or if that buffer is already being displayed in the current frame - and contains information about that commit or stash, then instead - scroll the buffer up. If there is no commit or stash at point, then - prompt for a commit. - -- Key: DEL (magit-diff-show-or-scroll-down) :: - - Update the commit or diff buffer for the thing at point. - - Either show the commit or stash at point in the appropriate buffer, - or if that buffer is already being displayed in the current frame - and contains information about that commit or stash, then instead - scroll the buffer down. If there is no commit or stash at point, - then prompt for a commit. - -- Key: = (magit-log-toggle-commit-limit) :: - - Toggle the number of commits the current log buffer is limited to. - If the number of commits is currently limited, then remove that - limit. Otherwise set it to 256. - -- Key: + (magit-log-double-commit-limit) :: - - Double the number of commits the current log buffer is limited to. - -- Key: - (magit-log-half-commit-limit) :: - - Half the number of commits the current log buffer is limited to. - -- User Option: magit-log-auto-more :: - - Insert more log entries automatically when moving past the last - entry. Only considered when moving past the last entry with - ~magit-goto-*-section~ commands. - -- User Option: magit-log-show-refname-after-summary :: - - Whether to show the refnames after the commit summaries. This is - useful if you use really long branch names. - -- User Option: magit-log-show-color-graph-limit :: - - When showing more commits than specified by this option, then the - ~--color~ argument, if specified, is silently dropped. This is - necessary because the ~ansi-color~ library, which is used to turn - control sequences into faces, is just too slow. - -- User Option: magit-log-show-signatures-limit :: - - When showing more commits than specified by this option, then the - ~--show-signature~ argument, if specified, is silently dropped. This - is necessary because checking the signature of a large number of - commits is just too slow. - -Magit displays references in logs a bit differently from how Git does -it. - -Local branches are blue and remote branches are green. Of course that -depends on the used theme, as do the colors used for other types of -references. The current branch has a box around it, as do remote -branches that are their respective remote's ~HEAD~ branch. - -If a local branch and its push-target point at the same commit, then -their names are combined to preserve space and to make that -relationship visible. For example: - -#+begin_example - origin/feature - [green][blue-] - - instead of - - feature origin/feature - [blue-] [green-------] -#+end_example - -Also note that while the transient features the ~--show-signature~ -argument, that won't actually be used when enabled, because Magit -defaults to use just one line per commit. Instead the commit -colorized to indicate the validity of the signed commit object, -using the faces named ~magit-signature-*~ (which see). - -For a description of ~magit-log-margin~ see [[*Log Margin]]. - -*** Log Margin - -In buffers which show one or more logs, it is possible to show -additional information about each commit in the margin. The options -used to configure the margin are named ~magit-INFIX-margin~, where INFIX -is the same as in the respective major-mode ~magit-INFIX-mode~. In -regular log buffers that would be ~magit-log-margin~. - -- User Option: magit-log-margin :: - - This option specifies whether the margin is initially shown in - Magit-Log mode buffers and how it is formatted. - - The value has the form ~(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)~. - - - If INIT is non-~nil~, then the margin is shown initially. - - STYLE controls how to format the author or committer date. It can - be one of ~age~ (to show the age of the commit), ~age-abbreviated~ (to - abbreviate the time unit to a character), or a string (suitable - for ~format-time-string~) to show the actual date. Option - ~magit-log-margin-show-committer-date~ controls which date is being - displayed. - - WIDTH controls the width of the margin. This exists for forward - compatibility and currently the value should not be changed. - - AUTHOR controls whether the name of the author is also shown by - default. - - AUTHOR-WIDTH has to be an integer. When the name of the author - is shown, then this specifies how much space is used to do so. - -You can change the STYLE and AUTHOR-WIDTH of all ~magit-INFIX-margin~ -options to the same values by customizing ~magit-log-margin~ *before* -~magit~ is loaded. If you do that, then the respective values for the -other options will default to what you have set for that variable. -Likewise if you set INIT in ~magit-log-margin~ to ~nil~, then that is used -in the default of all other options. But setting it to ~t~, i.e. -re-enforcing the default for that option, does not carry to other -options. - -- User Option: magit-log-margin-show-committer-date :: - - This option specifies whether to show the committer date in the - margin. This option only controls whether the committer date is - displayed instead of the author date. Whether some date is - displayed in the margin and whether the margin is displayed at all - is controlled by other options. - -- Key: L (magit-margin-settings) :: - - This transient prefix command binds the following suffix commands, - each of which changes the appearance of the margin in some way. - -In some buffers that support the margin, ~L~ is instead bound to -~magit-log-refresh~, but that transient features the same commands, and -then some other unrelated commands. - -- Key: L L (magit-toggle-margin) :: - - This command shows or hides the margin. - -- Key: L l (magit-cycle-margin-style) :: - - This command cycles the style used for the margin. - -- Key: L d (magit-toggle-margin-details) :: - - This command shows or hides details in the margin. - -*** Select from Log - -When the user has to select a recent commit that is reachable from -~HEAD~, using regular completion would be inconvenient (because most -humans cannot remember hashes or "HEAD~5", at least not without double -checking). Instead a log buffer is used to select the commit, which -has the advantage that commits are presented in order and with the -commit message. - -Such selection logs are used when selecting the beginning of a rebase -and when selecting the commit to be squashed into. - -In addition to the key bindings available in all log buffers, the -following additional key bindings are available in selection log -buffers: - -- Key: C-c C-c (magit-log-select-pick) :: - - Select the commit at point and act on it. Call - ~magit-log-select-pick-function~ with the selected commit as - argument. - -- Key: C-c C-k (magit-log-select-quit) :: - - Abort selecting a commit, don't act on any commit. - -- User Option: magit-log-select-margin :: - - This option specifies whether the margin is initially shown in - Magit-Log-Select mode buffers and how it is formatted. - - The value has the form ~(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)~. - - - If INIT is non-~nil~, then the margin is shown initially. - - STYLE controls how to format the author or committer date. It can - be one of ~age~ (to show the age of the commit), ~age-abbreviated~ (to - abbreviate the time unit to a character), or a string (suitable - for ~format-time-string~) to show the actual date. Option - ~magit-log-margin-show-committer-date~ controls which date is being - displayed. - - WIDTH controls the width of the margin. This exists for forward - compatibility and currently the value should not be changed. - - AUTHOR controls whether the name of the author is also shown by - default. - - AUTHOR-WIDTH has to be an integer. When the name of the author - is shown, then this specifies how much space is used to do so. - -*** Reflog - -Also see [[man:git-reflog]] - -These reflog commands are available from the log transient. See -[[*Logging]]. - -- Key: l r (magit-reflog-current) :: - - Display the reflog of the current branch. - -- Key: l O (magit-reflog-other) :: - - Display the reflog of a branch or another ref. - -- Key: l H (magit-reflog-head) :: - - Display the ~HEAD~ reflog. - -- User Option: magit-reflog-margin :: - - This option specifies whether the margin is initially shown in - Magit-Reflog mode buffers and how it is formatted. - - The value has the form ~(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)~. - - - If INIT is non-~nil~, then the margin is shown initially. - - STYLE controls how to format the author or committer date. It can - be one of ~age~ (to show the age of the commit), ~age-abbreviated~ (to - abbreviate the time unit to a character), or a string (suitable - for ~format-time-string~) to show the actual date. Option - ~magit-log-margin-show-committer-date~ controls which date is being - displayed. - - WIDTH controls the width of the margin. This exists for forward - compatibility and currently the value should not be changed. - - AUTHOR controls whether the name of the author is also shown by - default. - - AUTHOR-WIDTH has to be an integer. When the name of the author - is shown, then this specifies how much space is used to do so. - -*** Cherries - -Cherries are commits that haven't been applied upstream (yet), and are -usually visualized using a log. Each commit is prefixed with ~-~ if it -has an equivalent in the upstream and ~+~ if it does not, i.e., if it is -a cherry. - -The command ~magit-cherry~ shows cherries for a single branch, but the -references buffer (see [[*References Buffer]]) can show cherries for -multiple "upstreams" at once. - -Also see [[man:git-reflog]] - -- Key: Y (magit-cherry) :: - - Show commits that are in a certain branch but that have not been - merged in the upstream branch. - -- User Option: magit-cherry-margin :: - - This option specifies whether the margin is initially shown in - Magit-Cherry mode buffers and how it is formatted. - - The value has the form ~(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)~. - - - If INIT is non-~nil~, then the margin is shown initially. - - STYLE controls how to format the author or committer date. It can - be one of ~age~ (to show the age of the commit), ~age-abbreviated~ (to - abbreviate the time unit to a character), or a string (suitable - for ~format-time-string~) to show the actual date. Option - ~magit-log-margin-show-committer-date~ controls which date is being - displayed. - - WIDTH controls the width of the margin. This exists for forward - compatibility and currently the value should not be changed. - - AUTHOR controls whether the name of the author is also shown by - default. - - AUTHOR-WIDTH has to be an integer. When the name of the author - is shown, then this specifies how much space is used to do so. - -** Diffing - -The status buffer contains diffs for the staged and unstaged commits, -but that obviously isn't enough. The transient prefix command -~magit-diff~, on ~d~, features several suffix commands, which show a -specific diff in a separate diff buffer. - -Like other transient prefix commands, ~magit-diff~ also features several -infix arguments that can be changed before invoking one of the suffix -commands. However, in the case of the diff transient, these arguments may -be taken from those currently in use in the current repository's diff -buffer, depending on the value of ~magit-prefix-use-buffer-arguments~ -(see [[*Transient Arguments and Buffer Variables]]). - -Also see [[man:git-diff]] - -- Key: d (magit-diff) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - -- Key: d d (magit-diff-dwim) :: - - Show changes for the thing at point. - - For example, if point is on a commit, show the changes introduced by - that commit. Likewise if point is on the section titled "Unstaged - changes", then show those changes in a separate buffer. Generally - speaking, compare the thing at point with the most logical, trivial - and (in *any* situation) at least potentially useful other thing it - could be compared to. - - When the region selects commits, then compare the two commits at - either end. There are different ways two commits can be compared. - In the buffer showing the diff, you can control how the comparison, - is done, using "D r" and "D f". - - This function does not always show the changes that you might want - to view in any given situation. You can think of the changes being - shown as the smallest common denominator. There is no AI involved. - If this command never does what you want, then ignore it, and instead - use the commands that allow you to explicitly specify what you need. - -- Key: d r (magit-diff-range) :: - - Show differences between two commits. - - RANGE should be a range (A..B or A...B) but can also be a single - commit. If one side of the range is omitted, then it defaults to - ~HEAD~. If just a commit is given, then changes in the working tree - relative to that commit are shown. - - If the region is active, use the revisions on the first and last - line of the region. With a prefix argument, instead of diffing the - revisions, choose a revision to view changes along, starting at the - common ancestor of both revisions (i.e., use a "..." range). - -- Key: d w (magit-diff-working-tree) :: - - Show changes between the current working tree and the ~HEAD~ commit. - With a prefix argument show changes between the working tree and a - commit read from the minibuffer. - -- Key: d s (magit-diff-staged) :: - - Show changes between the index and the ~HEAD~ commit. With a prefix - argument show changes between the index and a commit read from the - minibuffer. - -- Key: d u (magit-diff-unstaged) :: - - Show changes between the working tree and the index. - -- Key: d p (magit-diff-paths) :: - - Show changes between any two files on disk. - -All of the above suffix commands update the repository's diff buffer. -The diff transient also features two commands which show differences -in another buffer: - -- Key: d c (magit-show-commit) :: - - Show the commit at point. If there is no commit at point or with a - prefix argument, prompt for a commit. - -- Key: d t (magit-stash-show) :: - - Show all diffs of a stash in a buffer. - -Two additional commands that show the diff for the file or blob that -is being visited in the current buffer exists, see [[*Commands for -Buffers Visiting Files]]. - -*** Refreshing Diffs - -The transient prefix command ~magit-diff-refresh~, on ~D~, can be used to -change the diff arguments used in the current buffer, without changing -which diff is shown. This works in dedicated diff buffers, but also -in the status buffer. - -(There is one exception; diff arguments cannot be changed in buffers -created by ~magit-merge-preview~ because the underlying Git command does -not support these arguments.) - -- Key: D (magit-diff-refresh) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - -- Key: D g (magit-diff-refresh) :: - - This suffix command sets the local diff arguments for the current - buffer. - -- Key: D s (magit-diff-set-default-arguments) :: - - This suffix command sets the default diff arguments for buffers of - the same type as that of the current buffer. Other existing buffers - of the same type are not affected because their local values have - already been initialized. - -- Key: D w (magit-diff-save-default-arguments) :: - - This suffix command sets the default diff arguments for buffers of - the same type as that of the current buffer, and saves the value for - future sessions. Other existing buffers of the same type are not - affected because their local values have already been initialized. - -- Key: D t (magit-diff-toggle-refine-hunk) :: - - This command toggles hunk refinement on or off. - -- Key: D r (magit-diff-switch-range-type) :: - - This command converts the diff range type from "revA..revB" to - "revB...revA", or vice versa. - -- Key: D f (magit-diff-flip-revs) :: - - This command swaps revisions in the diff range from "revA..revB" - to "revB..revA", or vice versa. - -- Key: D F (magit-diff-toggle-file-filter) :: - - This command toggles the file restriction of the diffs in the - current buffer, allowing you to quickly switch between viewing all - the changes in the commit and the restricted subset. As a special - case, when this command is called from a log buffer, it toggles the - file restriction in the repository's revision buffer, which is - useful when you display a revision from a log buffer that is - restricted to a file or files. - -In addition to the above transient, which allows changing any of the -supported arguments, there also exist some commands that change only -a particular argument. - -- Key: - (magit-diff-less-context) :: - - This command decreases the context for diff hunks by COUNT lines. - -- Key: + (magit-diff-more-context) :: - - This command increases the context for diff hunks by COUNT lines. - -- Key: 0 (magit-diff-default-context) :: - - This command resets the context for diff hunks to the default height. - -The following commands quickly change what diff is being displayed -without having to using one of the diff transient. - -- Key: C-c C-d (magit-diff-while-committing) :: - - While committing, this command shows the changes that are about to - be committed. While amending, invoking the command again toggles - between showing just the new changes or all the changes that will be - committed. - - This binding is available in the diff buffer as well as the commit - message buffer. - -- Key: C-c C-b (magit-go-backward) :: - - This command moves backward in current buffer's history. - -- Key: C-c C-f (magit-go-forward) :: - - This command moves forward in current buffer's history. - -*** Commands Available in Diffs - -Some commands are only available if point is inside a diff. - -~magit-diff-visit-file~ and related commands visit the appropriate -version of the file that the diff at point is about. Likewise -~magit-diff-visit-worktree-file~ and related commands visit the worktree -version of the file that the diff at point is about. See [[*Visiting -Files and Blobs from a Diff]] for more information and the key bindings. - -- Key: C-c C-t (magit-diff-trace-definition) :: - - This command shows a log for the definition at point. - -- User Option: magit-log-trace-definition-function :: - - The function specified by this option is used by - ~magit-log-trace-definition~ to determine the function at point. For - major-modes that have special needs, you could set the local value - using the mode's hook. - -- Key: C-c C-e (magit-diff-edit-hunk-commit) :: - - From a hunk, this command edits the respective commit and visits - the file. - - First it visits the file being modified by the hunk at the correct - location using ~magit-diff-visit-file~. This actually visits a blob. - When point is on a diff header, not within an individual hunk, then - this visits the blob the first hunk is about. - - Then it invokes ~magit-edit-line-commit~, which uses an interactive - rebase to make the commit editable, or if that is not possible - because the commit is not reachable from ~HEAD~ by checking out that - commit directly. This also causes the actual worktree file to be - visited. - - Neither the blob nor the file buffer are killed when finishing - the rebase. If that is undesirable, then it might be better to - use ~magit-rebase-edit-commit~ instead of this command. - -- Key: j (magit-jump-to-diffstat-or-diff) :: - - This command jumps to the diffstat or diff. When point is on a file - inside the diffstat section, then jump to the respective diff - section. Otherwise, jump to the diffstat section or a child - thereof. - -The next two commands are not specific to Magit-Diff mode (or and -Magit buffer for that matter), but it might be worth pointing out -that they are available here too. - -- Key: SPC (scroll-up) :: - - This command scrolls text upward. - -- Key: DEL (scroll-down) :: - - This command scrolls text downward. - -*** Diff Options - -- User Option: magit-diff-refine-hunk :: - - Whether to show word-granularity differences within diff hunks. - - - ~nil~ Never show fine differences. - - ~all~ Show fine differences for all displayed diff hunks. - - ~t~ Refine each hunk once it becomes the current section. - Keep the refinement when another section is selected. - Refreshing the buffer removes all refinement. This - variant is only provided for performance reasons. - -- User Option: magit-diff-refine-ignore-whitespace :: - - Whether to ignore whitespace changes in word-granularity - differences. - -- User Option: magit-diff-adjust-tab-width :: - - Whether to adjust the width of tabs in diffs. - - Determining the correct width can be expensive if it requires - opening large and/or many files, so the widths are cached in the - variable ~magit-diff--tab-width-cache~. Set that to ~nil~ to invalidate - the cache. - - - ~nil~ Never adjust tab width. Use `tab-width's value from the Magit - buffer itself instead. - - - ~t~ If the corresponding file-visiting buffer exits, then use - ~tab-width~'s value from that buffer. Doing this is cheap, so this - value is used even if a corresponding cache entry exists. - - - ~always~ If there is no such buffer, then temporarily visit the file - to determine the value. - - - NUMBER Like ~always~, but don't visit files larger than NUMBER - bytes. - -- User Option: magit-diff-paint-whitespace :: - - Specify where to highlight whitespace errors. - - See ~magit-diff-highlight-trailing~, - ~magit-diff-highlight-indentation~. The symbol ~t~ means in all - diffs, ~status~ means only in the status buffer, and ~nil~ means - nowhere. - - - ~nil~ Never highlight whitespace errors. - - ~t~ Highlight whitespace errors everywhere. - - ~uncommitted~ Only highlight whitespace errors in diffs showing - uncommitted changes. For backward compatibility ~status~ is treated - as a synonym. - -- User Option: magit-diff-paint-whitespace-lines :: - - Specify in what kind of lines to highlight whitespace errors. - - - ~t~ Highlight only in added lines. - - ~both~ Highlight in added and removed lines. - - ~all~ Highlight in added, removed and context lines. - -- User Option: magit-diff-highlight-trailing :: - - Whether to highlight whitespace at the end of a line in diffs. Used - only when ~magit-diff-paint-whitespace~ is non-~nil~. - -- User Option: magit-diff-highlight-indentation :: - - This option controls whether to highlight the indentation in case it - used the "wrong" indentation style. Indentation is only highlighted - if ~magit-diff-paint-whitespace~ is also non-~nil~. - - The value is an alist of the form ~((REGEXP . INDENT)...)~. The path - to the current repository is matched against each element in reverse - order. Therefore if a REGEXP matches, then earlier elements are not - tried. - - If the used INDENT is ~tabs~, highlight indentation with tabs. If - INDENT is an integer, highlight indentation with at least that many - spaces. Otherwise, highlight neither. - -- User Option: magit-diff-hide-trailing-cr-characters :: - - Whether to hide ^M characters at the end of a line in diffs. - -- User Option: magit-diff-highlight-hunk-region-functions :: - - This option specifies the functions used to highlight the - hunk-internal region. - - ~magit-diff-highlight-hunk-region-dim-outside~ overlays the outside of - the hunk internal selection with a face that causes the added and - removed lines to have the same background color as context lines. - This function should not be removed from the value of this option. - - ~magit-diff-highlight-hunk-region-using-overlays~ and - ~magit-diff-highlight-hunk-region-using-underline~ emphasize the - region by placing delimiting horizontal lines before and after it. - Both of these functions have glitches which cannot be fixed due to - limitations of Emacs' display engine. For more information see - https://github.com/magit/magit/issues/2758 ff. - - Instead of, or in addition to, using delimiting horizontal lines, - to emphasize the boundaries, you may wish to emphasize the text - itself, using ~magit-diff-highlight-hunk-region-using-face~. - - In terminal frames it's not possible to draw lines as the overlay - and underline variants normally do, so there they fall back to - calling the face function instead. - -- User Option: magit-diff-unmarked-lines-keep-foreground :: - - This option controls whether added and removed lines outside the - hunk-internal region only lose their distinct background color or - also the foreground color. Whether the outside of the region is - dimmed at all depends on ~magit-diff-highlight-hunk-region-functions~. - -- User Option: magit-diff-extra-stat-arguments :: - - This option specifies additional arguments to be used alongside - ~--stat~. - - The value is a list of zero or more arguments or a function that - takes no argument and returns such a list. These arguments are - allowed here: ~--stat-width~, ~--stat-name-width~, - ~--stat-graph-width~ and ~--compact-summary~. Also see [[man:git-diff]] - -- User Option: magit-format-file-function :: - - This function is used to format lines representing a file. It is - used for file headings in diffs, in diffstats and for lists of files - (such as the untracked files). Depending on the caller, it receives - either three or five arguments; the signature has to be ~(kind file - face &optional status orig)~. KIND is one of ~diff~, ~module~, ~stat~ and - ~list~. - -*** Revision Buffer - -- User Option: magit-revision-insert-related-refs :: - - Whether to show related branches in revision buffers. - - - ~nil~ Don't show any related branches. - - ~t~ Show related local branches. - - ~all~ Show related local and remote branches. - - ~mixed~ Show all containing branches and local merged branches. - -- User Option: magit-revision-show-gravatars :: - - Whether to show gravatar images in revision buffers. - - If ~nil~, then don't insert any gravatar images. If ~t~, then insert - both images. If ~author~ or ~committer~, then insert only the - respective image. - - If you have customized the option ~magit-revision-headers-format~ - and want to insert the images then you might also have to specify - where to do so. In that case the value has to be a cons-cell of - two regular expressions. The car specifies where to insert the - author's image. The top half of the image is inserted right - after the matched text, the bottom half on the next line in the - same column. The cdr specifies where to insert the committer's - image, accordingly. Either the car or the cdr may be ~nil~." - -- User Option: magit-revision-use-hash-sections :: - - Whether to turn hashes inside the commit message into sections. - - If non-~nil~, then hashes inside the commit message are turned into - ~commit~ sections. There is a trade off to be made between - performance and reliability: - - - ~slow~ calls git for every word to be absolutely sure. - - ~quick~ skips words less than seven characters long. - - ~quicker~ additionally skips words that don't contain a number. - - ~quickest~ uses all words that are at least seven characters long - and which contain at least one number as well as at least one - letter. - - If ~nil~, then no hashes are turned into sections, but you can still - visit the commit at point using "RET". - -The diffs shown in the revision buffer may be automatically restricted -to a subset of the changed files. If the revision buffer is displayed -from a log buffer, the revision buffer will share the same file -restriction as that log buffer (also see the command -~magit-diff-toggle-file-filter~). - -- User Option: magit-revision-filter-files-on-follow :: - - Whether showing a commit from a log buffer honors the log's file - filter when the log arguments include ~--follow~. - - When this option is ~nil~, displaying a commit from a log ignores the - log's file filter if the log arguments include ~--follow~. Doing so - avoids showing an empty diff in revision buffers for commits before - a rename event. In such cases, the ~--patch~ argument of the log - transient can be used to show the file-restricted diffs inline. - - Set this option to non-~nil~ to keep the log's file restriction even - if ~--follow~ is present in the log arguments. - -If the revision buffer is not displayed from a log buffer, the file -restriction is determined as usual (see [[*Transient Arguments and -Buffer Variables]]). - -** Ediffing - -This section describes how to enter Ediff from Magit buffers. For -information on how to use Ediff itself, see info:ediff. - -- Key: e (magit-ediff-dwim) :: - - Compare, stage, or resolve using Ediff. - - This command tries to guess what file, and what commit or range the - user wants to compare, stage, or resolve using Ediff. It might only - be able to guess either the file, or range/commit, in which case - the user is asked about the other. It might not always guess right, - in which case the appropriate ~magit-ediff-*~ command has to be used - explicitly. If it cannot read the user's mind at all, then it asks - the user for a command to run. - -- Key: E (magit-ediff) :: - - This transient prefix command binds the following suffix commands - and displays them in a temporary buffer until a suffix is invoked. - -- Key: E r (magit-ediff-compare) :: - - Compare two revisions of a file using Ediff. - - If the region is active, use the revisions on the first and last - line of the region. With a prefix argument, instead of diffing the - revisions, choose a revision to view changes along, starting at the - common ancestor of both revisions (i.e., use a "..." range). - -- Key: E m (magit-ediff-resolve-rest) :: - - This command allows you to resolve outstanding conflicts in the file - at point using Ediff. If there is no file at point or if it doesn't - have any unmerged changes, then this command prompts for a file. - - Provided that the value of ~merge.conflictstyle~ is ~diff3~, you can - view the file's merge-base revision using ~/~ in the Ediff control - buffer. - - The A, B and Ancestor buffers are constructed from the conflict - markers in the worktree file. Because you and/or Git may have - already resolved some conflicts, that means that these buffers - may not contain the actual versions from the respective blobs. - -- Key: E M (magit-ediff-resolve-all) :: - - This command allows you to resolve all conflicts in the file at - point using Ediff. If there is no file at point or if it doesn't - have any unmerged changes, then this command prompts for a file. - - Provided that the value of ~merge.conflictstyle~ is ~diff3~, you can - view the file's merge-base revision using ~/~ in the Ediff control - buffer. - - First the file in the worktree is moved aside, appending the suffix - =.ORIG=, so that you could later go back to that version. Then it is - reconstructed from the two sides of the conflict and the merge-base, - if available. - - It would be nice if the worktree file were just used as-is, but - Ediff does not support that. This means that all conflicts, that - Git has already resolved, are restored. On the other hand Ediff - also tries to resolve conflicts, and in many cases Ediff and Git - should produce similar results. - - However if you have already resolved some conflicts manually, then - those changes are discarded (though you can recover them from the - backup file). In such cases ~magit-ediff-resolve-rest~ might be more - suitable. - - The advantage that this command has over ~magit-ediff-resolve-rest~ - is that the A, B and Ancestor buffers correspond to blobs from the - respective commits, allowing you to inspect a side in context and - to use Magit commands in these buffers to do so. Blame and log - commands are particularly useful here. - -- Key: E t (magit-git-mergetool) :: - - This command does not actually use Ediff. While it serves the same - purpose as =magit-ediff-resolve-rest=, it uses =git mergetool --gui= to - resolve conflicts. - - With a prefix argument this acts as a transient prefix command, - allowing the user to select the mergetool and change some settings. - -- Key: E s (magit-ediff-stage) :: - - Stage and unstage changes to a file using Ediff, defaulting to the - file at point. - -- Key: E u (magit-ediff-show-unstaged) :: - - Show unstaged changes to a file using Ediff. - -- Key: E i (magit-ediff-show-staged) :: - - Show staged changes to a file using Ediff. - -- Key: E w (magit-ediff-show-working-tree) :: - - Show changes in a file between ~HEAD~ and working tree using Ediff. - -- Key: E c (magit-ediff-show-commit) :: - - Show changes to a file introduced by a commit using Ediff. - -- Key: E z (magit-ediff-show-stash) :: - - Show changes to a file introduced by a stash using Ediff. - -- User Option: magit-ediff-dwim-resolve-function :: - - This option controls which function ~magit-ediff-dwim~ uses to resolve - conflicts. One of ~magit-ediff-resolve-rest~, ~magit-ediff-resolve-all~ - or ~magit-git-mergetool~; which are all discussed above. - -- User Option: magit-ediff-dwim-show-on-hunks :: - - This option controls what command ~magit-ediff-dwim~ calls when - point is on uncommitted hunks. When ~nil~, always run - ~magit-ediff-stage~. Otherwise, use ~magit-ediff-show-staged~ and - ~magit-ediff-show-unstaged~ to show staged and unstaged changes, - respectively. - -- User Option: magit-ediff-show-stash-with-index :: - - This option controls whether ~magit-ediff-show-stash~ includes a - buffer containing the file's state in the index at the time the - stash was created. This makes it possible to tell which changes in - the stash were staged. - -- User Option: magit-ediff-quit-hook :: - - This hook is run after quitting an Ediff session that was created - using a Magit command. The hook functions are run inside the Ediff - control buffer, and should not change the current buffer. - - This is similar to ~ediff-quit-hook~ but takes the needs of Magit into - account. The regular ~ediff-quit-hook~ is ignored by Ediff sessions - that were created using a Magit command. - -** References Buffer - -- Key: y (magit-show-refs) :: - - This command lists branches and tags in a dedicated buffer. - - However if this command is invoked again from this buffer or if it - is invoked with a prefix argument, then it acts as a transient - prefix command, which binds the following suffix commands and some - infix arguments. - -All of the following suffix commands list exactly the same branches -and tags. The only difference the optional feature that can be -enabled by changing the value of ~magit-refs-show-commit-count~ (see -below). These commands specify a different branch or commit against -which all the other references are compared. - -- Key: y y (magit-show-refs-head) :: - - This command lists branches and tags in a dedicated buffer. Each - reference is being compared with ~HEAD~. - -- Key: y c (magit-show-refs-current) :: - - This command lists branches and tags in a dedicated buffer. Each - reference is being compared with the current branch or ~HEAD~ if it - is detached. - -- Key: y o (magit-show-refs-other) :: - - This command lists branches and tags in a dedicated buffer. Each - reference is being compared with a branch read from the user. - -- Key: y r (magit-refs-set-show-commit-count) :: - - This command changes for which refs the commit count is shown. - -- User Option: magit-refs-show-commit-count :: - - Whether to show commit counts in Magit-Refs mode buffers. - - - ~all~ Show counts for branches and tags. - - ~branch~ Show counts for branches only. - - ~nil~ Never show counts. - - The default is ~nil~ because anything else can be very expensive. - -- User Option: magit-refs-pad-commit-counts :: - - Whether to pad all commit counts on all sides in Magit-Refs mode - buffers. - - If this is ~nil~, then some commit counts are displayed right next to - one of the branches that appear next to the count, without any space - in between. This might look bad if the branch name faces look too - similar to ~magit-dimmed~. - - If this is non-~nil~, then spaces are placed on both sides of all - commit counts. - -- User Option: magit-refs-show-remote-prefix :: - - Whether to show the remote prefix in lists of remote branches. - - Showing the prefix is redundant because the name of the remote is - already shown in the heading preceding the list of its branches. - -- User Option: magit-refs-primary-column-width :: - - Width of the primary column in `magit-refs-mode' buffers. The - primary column is the column that contains the name of the branch - that the current row is about. - - If this is an integer, then the column is that many columns wide. - Otherwise it has to be a cons-cell of two integers. The first - specifies the minimal width, the second the maximal width. In that - case the actual width is determined using the length of the names of - the shown local branches. (Remote branches and tags are not taken - into account when calculating to optimal width.) - -- User Option: magit-refs-focus-column-width :: - - Width of the focus column in `magit-refs-mode' buffers. - - The focus column is the first column, which marks one branch - (usually the current branch) as the focused branch using ~*~ or ~@~. - For each other reference, this column optionally shows how many - commits it is ahead of the focused branch and ~<~, or if it isn't - ahead then the commits it is behind and ~>~, or if it isn't behind - either, then a ~=~. - - This column may also display only ~*~ or ~@~ for the focused branch, in - which case this option is ignored. Use ~L v~ to change the verbosity - of this column. - -- User Option: magit-refs-margin :: - - This option specifies whether the margin is initially shown in - Magit-Refs mode buffers and how it is formatted. - - The value has the form ~(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)~. - - - If INIT is non-~nil~, then the margin is shown initially. - - STYLE controls how to format the author or committer date. It can - be one of ~age~ (to show the age of the commit), ~age-abbreviated~ (to - abbreviate the time unit to a character), or a string (suitable - for ~format-time-string~) to show the actual date. Option - ~magit-log-margin-show-committer-date~ controls which date is being - displayed. - - WIDTH controls the width of the margin. This exists for forward - compatibility and currently the value should not be changed. - - AUTHOR controls whether the name of the author is also shown by - default. - - AUTHOR-WIDTH has to be an integer. When the name of the author - is shown, then this specifies how much space is used to do so. - -- User Option: magit-refs-margin-for-tags :: - - This option specifies whether to show information about tags in the - margin. This is disabled by default because it is slow if there are - many tags. - -The following variables control how individual refs are displayed. If -you change one of these variables (especially the "%c" part), then you -should also change the others to keep things aligned. The following -%-sequences are supported: - -- ~%a~ Number of commits this ref has over the one we compare to. -- ~%b~ Number of commits the ref we compare to has over this one. -- ~%c~ Number of commits this ref has over the one we compare to. For - the ref which all other refs are compared this is instead "@", if - it is the current branch, or "#" otherwise. -- ~%C~ For the ref which all other refs are compared this is "@", if it - is the current branch, or "#" otherwise. For all other refs " ". -- ~%h~ Hash of this ref's tip. -- ~%m~ Commit summary of the tip of this ref. -- ~%n~ Name of this ref. -- ~%u~ Upstream of this local branch. -- ~%U~ Upstream of this local branch and additional local vs. upstream - information. - -# new list -- User Option: magit-refs-filter-alist :: - - The purpose of this option is to forgo displaying certain refs - based on their name. If you want to not display any refs of a - certain type, then you should remove the appropriate function - from ~magit-refs-sections-hook~ instead. - - This alist controls which tags and branches are omitted from being - displayed in ~magit-refs-mode~ buffers. If it is ~nil~, then all refs - are displayed (subject to ~magit-refs-sections-hook~). - - All keys are tried in order until one matches. Then its value is - used and subsequent elements are ignored. If the value is non-~nil~, - then the reference is displayed, otherwise it is not. If no element - matches, then the reference is displayed. - - A key can either be a regular expression that the refname has to - match, or a function that takes the refname as only argument and - returns a boolean. A remote branch such as "origin/master" is - displayed as just "master", however for this comparison the - former is used. - -- Key: RET (magit-visit-ref) :: - - This command visits the reference or revision at point in another - buffer. If there is no revision at point or with a prefix argument - then it prompts for a revision. - - This command behaves just like ~magit-show-commit~ as described above, - except if point is on a reference in a ~magit-refs-mode~ buffer, in - which case the behavior may be different, but only if you have - customized the option ~magit-visit-ref-behavior~. - -- User Option: magit-visit-ref-behavior :: - - This option controls how ~magit-visit-ref~ behaves in ~magit-refs-mode~ - buffers. - - By default ~magit-visit-ref~ behaves like ~magit-show-commit~, in all - buffers, including ~magit-refs-mode~ buffers. When the type of the - section at point is ~commit~ then "RET" is bound to ~magit-show-commit~, - and when the type is either ~branch~ or ~tag~ then it is bound to - ~magit-visit-ref~. - - "RET" is one of Magit's most essential keys and at least by default - it should behave consistently across all of Magit, especially - because users quickly learn that it does something very harmless; it - shows more information about the thing at point in another buffer. - - However "RET" used to behave differently in ~magit-refs-mode~ buffers, - doing surprising things, some of which cannot really be described as - "visit this thing". If you've grown accustomed this behavior, you - can restore it by adding one or more of the below symbols to the - value of this option. But keep in mind that by doing so you don't - only introduce inconsistencies, you also lose some functionality and - might have to resort to ~M-x magit-show-commit~ to get it back. - - ~magit-visit-ref~ looks for these symbols in the order in which they - are described here. If the presence of a symbol applies to the - current situation, then the symbols that follow do not affect the - outcome. - - - ~focus-on-ref~ - - With a prefix argument update the buffer to show commit counts - and lists of cherry commits relative to the reference at point - instead of relative to the current buffer or ~HEAD~. - - Instead of adding this symbol, consider pressing "C-u y o RET". - - - ~create-branch~ - - If point is on a remote branch, then create a new local branch - with the same name, use the remote branch as its upstream, and - then check out the local branch. - - Instead of adding this symbol, consider pressing "b c RET RET", - like you would do in other buffers. - - - ~checkout-any~ - - Check out the reference at point. If that reference is a tag - or a remote branch, then this results in a detached ~HEAD~. - - Instead of adding this symbol, consider pressing "b b RET", - like you would do in other buffers. - - - ~checkout-branch~ - - Check out the local branch at point. - - Instead of adding this symbol, consider pressing "b b RET", - like you would do in other buffers. - -*** References Sections - -The contents of references buffers is controlled using the hook -~magit-refs-sections-hook~. See [[*Section Hooks]] to learn about such hooks -and how to customize them. All of the below functions are members of -the default value. Note that it makes much less sense to customize -this hook than it does for the respective hook used for the status -buffer. - -- User Option: magit-refs-sections-hook :: - - Hook run to insert sections into a references buffer. - -- Function: magit-insert-local-branches :: - - Insert sections showing all local branches. - -- Function: magit-insert-remote-branches :: - - Insert sections showing all remote-tracking branches. - -- Function: magit-insert-tags :: - - Insert sections showing all tags. - -** Bisecting - -Also see [[man:git-bisect]] - -- Key: B (magit-bisect) :: - - This transient prefix command binds the following suffix commands - and displays them in a temporary buffer until a suffix is invoked. - -When bisecting is not in progress, then the transient features the -following suffix commands. - -- Key: B B (magit-bisect-start) :: - - Start a bisect session. - - Bisecting a bug means to find the commit that introduced it. - This command starts such a bisect session by asking for a known - good commit and a known bad commit. If you're bisecting a change - that isn't a regression, you can select alternate terms that are - conceptually more fitting than "bad" and "good", but the infix - arguments to do so are disabled by default. - -- Key: B s (magit-bisect-run) :: - - Bisect automatically by running commands after each step. - -When bisecting in progress, then the transient instead features the -following suffix commands. - -- Key: B b (magit-bisect-bad) :: - - Mark the current commit as bad. Use this after you have asserted - that the commit does contain the bug in question. - -- Key: B g (magit-bisect-good) :: - - Mark the current commit as good. Use this after you have asserted - that the commit does not contain the bug in question. - -- Key: B m (magit-bisect-mark) :: - - Mark the current commit with one of the bisect terms. This command - provides an alternative to ~magit-bisect-bad~ and - ~magit-bisect-good~ and is useful when using terms other than "bad" - and "good". This suffix is disabled by default. - -- Key: B k (magit-bisect-skip) :: - - Skip the current commit. Use this if for some reason the current - commit is not a good one to test. This command lets Git choose a - different one. - -- Key: B r (magit-bisect-reset) :: - - After bisecting, cleanup bisection state and return to original - ~HEAD~. - -By default the status buffer shows information about the ongoing -bisect session. - -- User Option: magit-bisect-show-graph :: - - This option controls whether a graph is displayed for the log of - commits that still have to be bisected. - -** Visiting Files and Blobs - -Magit provides several commands that visit a file or blob (the version -of a file that is stored in a certain commit). Actually it provides -several *groups* of such commands and the several *variants* within each -group. - -Also see [[*Commands for Buffers Visiting Files]]. - -*** General-Purpose Visit Commands - -These commands can be used anywhere to open any blob. Currently no -keys are bound to these commands by default, but that is likely to -change. - -- Command: magit-find-file :: - - This command reads a filename and revision from the user and visits - the respective blob in a buffer. The buffer is displayed in the - selected window. - -- Command: magit-find-file-other-window :: - - This command reads a filename and revision from the user and visits - the respective blob in a buffer. The buffer is displayed in another - window. - -- Command: magit-find-file-other-frame :: - - This command reads a filename and revision from the user and visits - the respective blob in a buffer. The buffer is displayed in another - frame. - -*** Visiting Files and Blobs from a Diff - -These commands can only be used when point is inside a diff. -Elsewhere use ~magit-find-file~. - -- Key: RET (magit-diff-visit-file) :: - - This command visits the appropriate version of the file at point. - - Display the buffer in the selected window. With a prefix argument, - OTHER-WINDOW, instead display the buffer in another window. - - In the visited file or blob, go to the location corresponding to the - location in the diff. - - If point is on an added or context line, visit the blob corresponding - to our side (i.e., the new/right side). If point is on a removed line, - visit the blob corresponding to their side (i.e., the old/left side). - - This applies to diffs of staged and unstaged changes as well. For - staged changes the two sides are blobs from the index and the `HEAD' - commit. For unstaged changes the two sides are the actual file in - the worktree and the blob from the index. - - To visit the file in the worktree, regardless of what the current - diff is about, use ~magit-diff-visit-worktree-file~, described next. - -- Key: C- (magit-diff-visit-worktree-file) :: - - This command visits the worktree version of the appropriate file. - The location of point inside the diff determines which file is being - visited. Unlike ~magit-diff-visit-file~ it always visits the "real" - file in the working tree, i.e., the "current version" of the file. - - In the file-visiting buffer this command goes to the line that - corresponds to the line that point is on in the diff. Lines that - were added or removed in the working tree, the index and other - commits in between are automatically accounted for. - - The buffer is displayed in the selected window. With a prefix - argument the buffer is displayed in another window instead. - -Variants of the above two commands exist that instead visit the file -in another window or in another frame. If you prefer such behavior, -then you may want to change the above key bindings, but note that the -above commands also use another window when invoked with a prefix -argument. - -- Command: magit-diff-visit-file-other-window :: -- Command: magit-diff-visit-file-other-frame :: -- Command: magit-diff-visit-worktree-file-other-window :: -- Command: magit-diff-visit-worktree-file-other-frame :: - - These commands behave like the respective commands described above, - except that they display the blob or file in another window or frame. - -- User Option: magit-diff-visit-prefer-worktree :: - - This option controls whether ~magit-diff-visit-file~ always visits the - respective file in the worktree, when invoked anywhere from within a - hunk of staged or unstaged changes. - - By default ~magit-diff-visit-file~ does not do that. Instead it - behaves for staged and unstaged changes as it does for committed - changes, by visiting a blob from the old/left or new/right side, - depending on whether point is on a removed line or not. - - For staged changes the old side is the blob from HEAD and the right - side is the blog from the index. For unstaged changes the left side - is the blob from the index (if there are any changes in the index - for that file, else the blob from HEAD), and the right side is the - file in the worktree. - - Being able to jump to HEAD or the index from a removed line is very - useful, because it allows you to, e.g., use blame to investigate why - some line, which you have already removed, was added in the first - place. - - But if you want to make further changes to already staged changes, - you of course instead need to go to the respective file in the - worktree. The command ~magit-diff-visit-worktree-file~ was created - for that purpose, and it is strongly recommend that you make use of - that command, even if you initially find it inconvenient having to - remember to use ~C-~ instead of ~RET~ in this case. - - While discouraged, you can alternatively set this option to ~t~, - which causes ~magit-diff-visit-file~ itself to go to the file in the - worktree, even when invoked from within a hunk of staged changes. - If you do that, you lose the ability to instantly go to lines you - have already removed. - -- User Option: magit-diff-visit-previous-blob :: - - This option controls whether ~magit-diff-visit-file~ visits the - previous blob when invoked with point on a removed line. - - When this is ~t~ (the default) and point is on a removed line, then - ~magit-diff-visit-file~ visits the blob from the old/left commit, - which still has that line, instead of going to the new/right blob, - which removes that line. - - Setting this to ~nil~, causes ~magit-diff-visit-file~ to always go to - the new/right blob, even when point is on a removed line. This is - very strongly discouraged. Instead place the cursor anywhere else - within the hunk but on a removed line, if you want to visit the new - side. That way you don't lose the ability to visit the old side. - -** Blaming - -Also see [[man:git-blame]] - -To start blaming, invoke the ~magit-file-dispatch~ transient prefix -command. When using the default key bindings, that can be done -by pressing ~C-c M-g~. When using the recommended bindings, this -command is instead bound to ~C-c f~. Also see [[*Global Bindings]]. - -The blaming suffix commands can be invoked directly from the file -dispatch transient. However if you want to set an infix argument, -then you have to enter the blaming sub-prefix first. - -- Key: C-c f B (magit-blame) :: -- Key: C-c f b (magit-blame-addition) :: -- Key: C-c f B b :: -- Key: C-c f r (magit-blame-removal) :: -- Key: C-c f B r :: -- Key: C-c f f (magit-blame-reverse) :: -- Key: C-c f B f :: -- Key: C-c f e (magit-blame-echo) :: -- Key: C-c f B e :: -- Key: C-c f q (magit-blame-quit) :: -- Key: C-c f B q :: - - Each of these commands is documented individually right below, - alongside their default key bindings. The bindings shown above - are the recommended bindings, which you can enable by following - the instructions in [[*Global Bindings]]. - -- Key: C-c M-g B (magit-blame) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - -Note that not all of the following suffixes are available at all -times. For example if ~magit-blame-mode~ is not enabled, then the -command whose purpose is to turn off that mode would not be of any -use and therefore isn't available. - -- Key: C-c M-g b (magit-blame-addition) :: -- Key: C-c M-g B b :: - - This command augments each line or chunk of lines in the current - file-visiting or blob-visiting buffer with information about what - commits last touched these lines. - - If the buffer visits a revision of that file, then history up to - that revision is considered. Otherwise, the file's full history is - considered, including uncommitted changes. - - If Magit-Blame mode is already turned on in the current buffer then - blaming is done recursively, by visiting REVISION:FILE (using - ~magit-find-file~), where REVISION is a parent of the revision that - added the current line or chunk of lines. - -- Key: C-c M-g r (magit-blame-removal) :: -- Key: C-c M-g B r :: - - This command augments each line or chunk of lines in the current - blob-visiting buffer with information about the revision that - removes it. It cannot be used in file-visiting buffers. - - Like ~magit-blame-addition~, this command can be used recursively. - -- Key: C-c M-g f (magit-blame-reverse) :: -- Key: C-c M-g B f :: - - This command augments each line or chunk of lines in the current - file-visiting or blob-visiting buffer with information about the - last revision in which a line still existed. - - Like ~magit-blame-addition~, this command can be used recursively. - -- Key: C-c M-g e (magit-blame-echo) :: -- Key: C-c M-g B e :: - - This command is like ~magit-blame-addition~ except that it doesn't - turn on ~read-only-mode~ and that it initially uses the visualization - style specified by option ~magit-blame-echo-style~. - -The following key bindings are available when Magit-Blame mode is -enabled and Read-Only mode is not enabled. These commands are also -available in other buffers; here only the behavior is described that -is relevant in file-visiting buffers that are being blamed. - -- Key: C-c M-g q (magit-blame-quit) :: -- Key: C-c M-g B q :: - - This command turns off Magit-Blame mode. If the buffer was created - during a recursive blame, then it also kills the buffer. - -- Key: RET (magit-show-commit) :: - - This command shows the commit that last touched the line at point. - -- Key: SPC (magit-diff-show-or-scroll-up) :: - - This command updates the commit buffer. - - This either shows the commit that last touched the line at point in - the appropriate buffer, or if that buffer is already being displayed - in the current frame and if that buffer contains information about - that commit, then the buffer is scrolled up instead. - -- Key: DEL (magit-diff-show-or-scroll-down) :: - - This command updates the commit buffer. - - This either shows the commit that last touched the line at point in - the appropriate buffer, or if that buffer is already being displayed - in the current frame and if that buffer contains information about - that commit, then the buffer is scrolled down instead. - -The following key bindings are available when both Magit-Blame mode -and Read-Only mode are enabled. - -- Key: b (magit-blame) :: - - See above. - -- Key: n (magit-blame-next-chunk) :: - - This command moves to the next chunk. - -- Key: N (magit-blame-next-chunk-same-commit) :: - - This command moves to the next chunk from the same commit. - -- Key: p (magit-blame-previous-chunk) :: - - This command moves to the previous chunk. - -- Key: P (magit-blame-previous-chunk-same-commit) :: - - This command moves to the previous chunk from the same commit. - -- Key: q (magit-blame-quit) :: - - This command turns off Magit-Blame mode. If the buffer was created - during a recursive blame, then it also kills the buffer. - -- Key: M-w (magit-blame-copy-hash) :: - - This command saves the hash of the current chunk's commit to the - kill ring. - - When the region is active, the command saves the region's content - instead of the hash, like ~kill-ring-save~ would. - -- Key: c (magit-blame-cycle-style) :: - - This command changes how blame information is visualized in the - current buffer by cycling through the styles specified using the - option ~magit-blame-styles~. - -Blaming is also controlled using the following options. - -- User Option: magit-blame-styles :: - - This option defines a list of styles used to visualize blame - information. For now see its doc-string to learn more. - -- User Option: magit-blame-echo-style :: - - This option specifies the blame visualization style used by the - command ~magit-blame-echo~. This must be a symbol that is used as the - identifier for one of the styles defined in ~magit-blame-styles~. - -- User Option: magit-blame-time-format :: - - This option specifies the format string used to display times when - showing blame information. - -- User Option: magit-blame-read-only :: - - This option controls whether blaming a buffer also makes temporarily - read-only. - -- User Option: magit-blame-disable-modes :: - - This option lists incompatible minor-modes that should be disabled - temporarily when a buffer contains blame information. They are - enabled again when the buffer no longer shows blame information. - -- User Option: magit-blame-goto-chunk-hook :: - - This hook is run when moving between chunks. - -* Manipulating -** Creating Repository - -- Key: I (magit-init) :: - - This command initializes a repository and then shows the status - buffer for the new repository. - - If the directory is below an existing repository, then the user has - to confirm that a new one should be created inside. If the - directory is the root of the existing repository, then the user has - to confirm that it should be reinitialized. - -** Cloning Repository - -To clone a remote or local repository use ~C~, which is bound to the -command ~magit-clone~. This command either act as a transient prefix -command, which binds several infix arguments and suffix commands, or -it can invoke ~git clone~ directly, depending on whether a prefix -argument is used and on the value of ~magit-clone-always-transient~. - -- User Option: magit-clone-always-transient :: - - This option controls whether the command ~magit-clone~ always acts as - a transient prefix command, regardless of whether a prefix argument - is used or not. If ~t~, then that command always acts as a transient - prefix. If ~nil~, then a prefix argument has to be used for it to act - as a transient. - -- Key: C (magit-clone) :: - - This command either acts as a transient prefix command as described - above or does the same thing as ~transient-clone-regular~ as described - below. - - If it acts as a transient prefix, then it binds the following suffix - commands and several infix arguments. - -- Key: C C (magit-clone-regular) :: - - This command creates a regular clone of an existing repository. - The repository and the target directory are read from the user. - -- Key: C s (magit-clone-shallow) :: - - This command creates a shallow clone of an existing repository. - The repository and the target directory are read from the user. - By default the depth of the cloned history is a single commit, - but with a prefix argument the depth is read from the user. - -- Key: C > (magit-clone-sparse) :: - - This command creates a clone of an existing repository and - initializes a sparse checkout, avoiding a checkout of the full - working tree. To add more directories, use the - ~magit-sparse-checkout~ transient (see [[*Sparse checkouts]]). - -- Key: C b (magit-clone-bare) :: - - This command creates a bare clone of an existing repository. - The repository and the target directory are read from the user. - -- Key: C m (magit-clone-mirror) :: - - This command creates a mirror of an existing repository. - The repository and the target directory are read from the user. - -The following suffixes are disabled by default. See -[[info:transient#Enabling and Disabling Suffixes]] for how to enable them. - -- Key: C d (magit-clone-shallow-since) :: - - This command creates a shallow clone of an existing repository. - Only commits that were committed after a date are cloned, which - is read from the user. The repository and the target directory - are also read from the user. - -- Key: C e (magit-clone-shallow-exclude) :: - - This command creates a shallow clone of an existing repository. - This reads a branch or tag from the user. Commits that are - reachable from that are not cloned. The repository and the target - directory are also read from the user. - -- User Option: magit-clone-set-remote-head :: - - This option controls whether cloning causes the reference - ~refs/remotes//HEAD~ to be created in the clone. The default - is to delete the reference after running ~git clone~, which insists on - creating it. This is because the reference has not been found to be - particularly useful as it is not automatically updated when the ~HEAD~ - of the remote changes. Setting this option to ~t~ preserves Git's - default behavior of creating the reference. - -- User Option: magit-clone-set-remote.pushDefault :: - - This option controls whether the value of the Git variable - ~remote.pushDefault~ is set after cloning. - - - If ~t~, then it is always set without asking. - - If ~ask~, then the users are asked every time they clone a - repository. - - If ~nil~, then it is never set. - -- User Option: magit-clone-default-directory :: - - This option control the default directory name used when reading the - destination for a cloning operation. - - - If ~nil~ (the default), then the value of ~default-directory~ is used. - - If a directory, then that is used. - - If a function, then that is called with the remote url as the only - argument and the returned value is used. - -- User Option: magit-clone-name-alist :: - - This option maps regular expressions, which match repository names, - to repository urls, making it possible for users to enter short - names instead of urls when cloning repositories. - - Each element has the form ~(REGEXP HOSTNAME USER)~. When the user - enters a name when a cloning command asks for a name or url, then - that is looked up in this list. The first element whose REGEXP - matches is used. - - The format specified by option ~magit-clone-url-format~ is used to - turn the name into an url, using HOSTNAME and the repository name. - If the provided name contains a slash, then that is used. Otherwise - if the name omits the owner of the repository, then the default user - specified in the matched entry is used. - - If USER contains a dot, then it is treated as a Git variable and the - value of that is used as the username. Otherwise it is used as the - username itself. - -- User Option: magit-clone-url-format :: - - The format specified by this option is used when turning repository - names into urls. ~%h~ is the hostname and ~%n~ is the repository - name, including the name of the owner. The value can be a string - (representing a single static format) or an alist with elements - ~(HOSTNAME . FORMAT)~ mapping hostnames to formats. When an alist - is used, the ~t~ key represents the default format. - - Example of a single format string: - - #+BEGIN_SRC emacs-lisp - (setq magit-clone-url-format - "git@%h:%n.git") - #+END_SRC - - Example of by-hostname format strings: - - #+BEGIN_SRC emacs-lisp - (setq magit-clone-url-format - '(("git.example.com" . "git@%h:~%n") - (nil . "git@%h:%n.git"))) - #+END_SRC - -- User Option: magit-post-clone-hook :: - - Hook run after the Git process has successfully finished cloning the - repository. When the hook is called, ~default-directory~ is - let-bound to the directory where the repository has been cloned. - -** Staging and Unstaging - -Like Git, Magit can of course stage and unstage complete files. -Unlike Git, it also allows users to gracefully un-/stage -individual hunks and even just part of a hunk. To stage individual -hunks and parts of hunks using Git directly, one has to use the very -modal and rather clumsy interface of a ~git add --interactive~ session. - -With Magit, on the other hand, one can un-/stage individual hunks by -just moving point into the respective section inside a diff displayed -in the status buffer or a separate diff buffer and typing ~s~ or ~u~. To -operate on just parts of a hunk, mark the changes that should be -un-/staged using the region and then press the same key that would be -used to un-/stage. To stage multiple files or hunks at once use a -region that starts inside the heading of such a section and ends -inside the heading of a sibling section of the same type. - -Besides staging and unstaging, Magit also provides several other -"apply variants" that can also operate on a file, multiple files at -once, a hunk, multiple hunks at once, and on parts of a hunk. These -apply variants are described in the next section. - -You can also use Ediff to stage and unstage. See [[*Ediffing]]. - -- Key: s (magit-stage) :: - - Add the change at point to the staging area. - - With a prefix argument and an untracked file (or files) at point, - stage the file but not its content. This makes it possible to stage - only a subset of the new file's changes. - -- Key: S (magit-stage-modified) :: - - Stage all changes to files modified in the worktree. Stage all new - content of tracked files and remove tracked files that no longer - exist in the working tree from the index also. With a prefix - argument also stage previously untracked (but not ignored) files. - -- Key: u (magit-unstage) :: - - Remove the change at point from the staging area. - - Only staged changes can be unstaged. But by default this command - performs an action that is somewhat similar to unstaging, when it is - called on a committed change: it reverses the change in the index - but not in the working tree. - -- Key: U (magit-unstage-all) :: - - Remove all changes from the staging area. - -- User Option: magit-unstage-committed :: - - This option controls whether ~magit-unstage~ "unstages" committed - changes by reversing them in the index but not the working tree. - The alternative is to raise an error. - -- Key: M-x magit-reverse-in-index :: - - This command reverses the committed change at point in the index but - not the working tree. By default no key is bound directly to this - command, but it is indirectly called when ~u~ (~magit-unstage~) is - pressed on a committed change. - - This allows extracting a change from ~HEAD~, while leaving it in the - working tree, so that it can later be committed using a separate - commit. A typical workflow would be: - - 0. Optionally make sure that there are no uncommitted changes. - 1. Visit the ~HEAD~ commit and navigate to the change that should - not have been included in that commit. - 2. Type ~u~ (~magit-unstage~) to reverse it in the index. - This assumes that ~magit-unstage-committed~ is non-~nil~. - 3. Type ~c e~ to extend ~HEAD~ with the staged changes, - including those that were already staged before. - 4. Optionally stage the remaining changes using ~s~ or ~S~ and then - type ~c c~ to create a new commit. - -- Key: M-x magit-reset-index :: - - Reset the index to some commit. The commit is read from the user - and defaults to the commit at point. If there is no commit at - point, then it defaults to ~HEAD~. - -*** Staging from File-Visiting Buffers - -Fine-grained un-/staging has to be done from the status or a diff -buffer, but it's also possible to un-/stage all changes made to the -file visited in the current buffer right from inside that buffer. - -- Key: M-x magit-stage-file :: - - When invoked inside a file-visiting buffer, then stage all changes - to that file. In a Magit buffer, stage the file at point if any. - Otherwise prompt for a file to be staged. With a prefix argument - always prompt the user for a file, even in a file-visiting buffer or - when there is a file section at point. - -- Key: M-x magit-unstage-file :: - - When invoked inside a file-visiting buffer, then unstage all changes - to that file. In a Magit buffer, unstage the file at point if any. - Otherwise prompt for a file to be unstaged. With a prefix argument - always prompt the user for a file, even in a file-visiting buffer or - when there is a file section at point. - -** Applying - -Magit provides several "apply variants": stage, unstage, discard, -reverse, and "regular apply". At least when operating on a hunk they -are all implemented using ~git apply~, which is why they are called -"apply variants". - -- Stage. Apply a change from the working tree to the index. The change - also remains in the working tree. - -- Unstage. Remove a change from the index. The change remains in the - working tree. - -- Discard. On a staged change, remove it from the working tree and the - index. On an unstaged change, remove it from the working tree only. - -- Reverse. Reverse a change in the working tree. Both committed and - staged changes can be reversed. Unstaged changes cannot be - reversed. Discard them instead. - -- Apply. Apply a change to the working tree. Both committed and staged - changes can be applied. Unstaged changes cannot be applied - as - they already have been applied. - -The previous section described the staging and unstaging commands. -What follows are the commands which implement the remaining apply -variants. - -- Key: a (magit-apply) :: - - Apply the change at point to the working tree. - - With a prefix argument fallback to a 3-way merge. Doing so causes - the change to be applied to the index as well. - -- Key: k (magit-discard) :: - - Remove the change at point from the working tree. - - On a hunk or file with unresolved conflicts prompt which side to - keep (while discarding the other). If point is within the text - of a side, then keep that side without prompting. - -- Key: v (magit-reverse) :: - - Reverse the change at point in the working tree. - - With a prefix argument fallback to a 3-way merge. Doing so causes - the change to be applied to the index as well. - -With a prefix argument all apply variants attempt a 3-way merge when -appropriate (i.e., when ~git apply~ is used internally). - -** Committing - -When the user initiates a commit, Magit calls ~git commit~ without the -~--message~ argument, so Git has to get the message from the user. To -do so, it creates a file such as ~.git/COMMIT_EDITMSG~ and then opens -that file in the editor specified by ~$EDITOR~ (or ~$GIT_EDITOR~). - -Magit arranges for that editor to be the Emacsclient. Once the user -finishes the editing session, the Emacsclient exits and Git creates -the commit, using the file's content as the commit message. - -*** Initiating a Commit - -Also see [[man:git-commit]] - -- Key: c (magit-commit) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - -**** Creating a new commit - -- Key: c c (magit-commit-create) :: - - Create a new commit. - -**** Editing the last commit - -These commands modify the last (a.k.a., "HEAD") commit. The commit is -modified (a.k.a., replaced) immediately. Similar commands exist for -modifying other (non-HEAD) commits. Those commands are described in -the following two sections. For each command in this section, we -mention the respective non-HEAD commands, to make the relation -explicit. - -The command descriptions below mention the specific arguments they use -when calling ~git commit~. The arguments specified in the menu are -appended to those arguments. - -- Key: c e (magit-commit-extend) :: - - This command amends the staged changes to the last commit, without - editing its commit message. - - This command calls ~git commit --amend --no-edit~. - - With a prefix argument the committer date is not updated; without an - argument it is updated. - - The option ~magit-commit-extend-override-date~ can be used to inverse - the meaning of the prefix argument. Non-interactively, the optional - OVERRIDE-DATE argument controls this behavior, and the option is of - no relevance. - -- Key: c a (magit-commit-amend) :: - - This command amends the staged changes to the last commit, and pops - up a buffer to let the user edit its commit message. - - This command calls ~git commit --amend --edit~. - -- Key: c w (magit-commit-reword) :: - - This command pops up a buffer to let the user edit the message of - the latest commit. The commit tree remains unchanged and staged - changes remain staged. - - This command calls ~git commit --amend --only --edit~. - - With a prefix argument the committer date is not updated; without an - argument it is updated. - - The option ~magit-commit-reword-override-date~ can be used to inverse - the meaning of the prefix argument. Non-interactively, the optional - OVERRIDE-DATE argument controls this behavior, and the option is of - no relevance. - -**** Editing any reachable commit - -These commands create a new commit, which targets an existing commit, -from the staged changes and/or using a new commit message. Any commit -that is reachable from HEAD, including HEAD itself, can be the target. - -The new commit is intended to be eventually squashed into the targeted -commit, but this is *not* done immediately. The squashing is done at a -later time, when you explicitly call ~magit-rebase-autosquash~, or use -~--autosquash~ with another rebase command. - -Some of these commands require that you immediately write a new commit -message, or that you immediately edit an existing message. - -The new commits are called "squash" and "fixup" commits. The -difference is that when a "squash" commit is squashed into its -targeted commit, the user gets a chance to modify the message to be -used for the final commit; while for "fixup" commits the existing -message of the targeted commit is used as-is and the message of the -"fixup" commit is discarded. - -If point is on a reachable commit, then all of these commands target -that commit, without requiring confirmation. If point is on some -reachable commit, but you want to target another commit, use a prefix -argument, to select a commit in a log buffer dedicated to that task. -The meaning of the prefix argument can be inverted by customizing -~magit-commit-squash-confirm~. - -The command descriptions below mention the specific arguments they use -when calling ~git commit~. The arguments specified in the menu are -appended to those arguments. - -The next two commands also exist in "instant" variants, which are -described in the next section. Those variants behave the same as the -variants described here, except that they immediately initiate an -~--autosquash~ rebase. - -- Key: c f (magit-commit-fixup) :: - - This command creates a new fixup commit from the staged changes, - targeting the reachable commit at point, if any. Otherwise the - user is prompted for a commit. - - Use this variant if you want to correct some minor defect in the - targeted commit, which does not require changes to the existing - message of the targeted commit. - - This command calls ~git commit --fixup=COMMIT --no-edit~. - -- Key: c s (magit-commit-squash) :: - - This command creates a new squash commit from the staged changes, - targeting the reachable commit at point, if any. Otherwise the - user is prompted for a commit. - - Use this variant if you want a chance to make changes to the final - commit message, but not until the two commits are being squashed - into the final combined commit. - - This command calls ~git commit --squash=COMMIT --no-edit~. - -- Key: c A (magit-commit-alter) :: - - This command creates a new fixup commit from the staged changes, - targeting the reachable commit at point, if any. Otherwise the - user is prompted for a commit. - - Use this variant if you want to write the final commit message now, - but (as for all variants in this section) do not want to immediately - squash the fixup and targeted commits into a final combined commit. - - This command calls ~git commit --fixup=amend:COMMIT --edit~. - -- Key: c n (magit-commit-augment) :: - - This command creates a new squash commit from the staged changes, - targeting the reachable commit at point, if any. Otherwise the - user is prompted for a commit. - - Use this variant if you want to describe the new changes now, but - want to delay writing the final message, which describes the changes - in the combined commit, until you actually combine the squash and - target commits into the final commit. You can think of the new - message, which you write here, as a "note", to be integrated once - once you write the final commit message. - - This command calls ~git commit --squash=COMMIT --edit~. - -- Key: c W (magit-commit-revise) :: - - This command pops up a buffer containing the commit message of the - reachable commit at point, if any. Otherwise the user is prompted - for a commit to target. - - Use this variant if you want to correct the message of the targeted - commit, but want to delay performing the ~--autosquash~ rebase, which - actually changes that commit. - - This command calls ~git commit --fixup=reword:COMMIT --edit~. - -**** Editing any reachable commit and rebasing immediately - -These commands create a new commit, which targets an existing commit, -from the staged changes. Any commit that is reachable from HEAD, -including HEAD itself, can be the target. - -The new commit is immediately squashed into its target commit, using -an ~--autosquash~ rebase. - -The command descriptions below mention the specific arguments they use -when calling ~git commit~. The arguments specified in the menu are -appended to those arguments when calling ~git commit~. - -- Key: c F (magit-commit-instant-fixup) :: - - This command creates a fixup commit, targeting the reachable commit - at point, if any. Otherwise the user is prompted for a commit. Then - it instantly performs a rebase, to squash the new commit into the - targeted commit. - - The original commit message of the targeted commit is left untouched. - - This command calls ~git commit --fixup=COMMIT --no-edit~ - and then ~git rebase --autosquash MERGE-BASE~. - -- Key: c S (magit-commit-instant-squash) :: - - This command creates a squash commit, targeting the reachable commit - at point, if any. Otherwise the user is prompted for a commit. Then - it instantly performs a rebase, to squash the new commit into the - targeted commit. - - During the rebase phase the user is asked to author the final commit - message, based on the original message of the targeted commit. - - This command calls ~git commit --squash=COMMIT --no-edit~ - and then ~git rebase --autosquash MERGE-BASE~. - -**** Options used by commit commands -***** Used by all or most commit commands - -- User Option: magit-commit-show-diff :: - - Whether the relevant diff is automatically shown when committing. - -- User Option: magit-commit-ask-to-stage :: - - Whether to ask to stage all unstaged changes when committing and - nothing is staged. - -- User Option: magit-post-commit-hook :: - - Hook run after creating a commit without the user editing a message. - - This hook is run by ~magit-refresh~ if ~this-command~ is a member - of ~magit-post-commit-hook-commands~. This only includes commands - named ~magit-commit-*~ that do *not* require that the user edits - the commit message in a buffer. - - Also see ~git-commit-post-finish-hook~. - -- User Option: magit-commit-diff-inhibit-same-window :: - - Whether to inhibit use of same window when showing diff while - committing. - - When writing a commit, then a diff of the changes to be committed - is automatically shown. The idea is that the diff is shown in a - different window of the same frame and for most users that just - works. In other words most users can completely ignore this - option because its value doesn't make a difference for them. - - However for users who configured Emacs to never create a new - window even when the package explicitly tries to do so, then - displaying two new buffers necessarily means that the first is - immediately replaced by the second. In our case the message - buffer is immediately replaced by the diff buffer, which is of - course highly undesirable. - - A workaround is to suppress this user configuration in this - particular case. Users have to explicitly opt-in by toggling - this option. We cannot enable the workaround unconditionally - because that again causes issues for other users: if the frame - is too tiny or the relevant settings too aggressive, then the - diff buffer would end up being displayed in a new frame. - - Also see https://github.com/magit/magit/issues/4132. - -***** Used by all squash and fixup commands - -- User Option: magit-commit-squash-confirm :: - - Whether the commit targeted by squash and fixup has to be confirmed. - When non-~nil~ then the commit at point (if any) is used as default - choice. Otherwise it has to be confirmed. This option only affects - ~magit-commit-squash~ and ~magit-commit-fixup~. The "instant" variants - always require confirmation because making an error while using - those is harder to recover from. - -***** Used by specific commit commands - -- User Option: magit-commit-extend-override-date :: - - Whether using ~magit-commit-extend~ changes the committer date. - -- User Option: magit-commit-reword-override-date :: - - Whether using ~magit-commit-reword~ changes the committer date. - -*** Editing Commit Messages - -After initiating a commit as described in the previous section, two new -buffers appear. One shows the changes that are about to be committed, -while the other is used to write the message. - -Commit messages are edited in an edit session - in the background ~git~ -is waiting for the editor, in our case ~emacsclient~, to save the commit -message in a file (in most cases ~.git/COMMIT_EDITMSG~) and then return. -If the editor returns with a non-zero exit status then ~git~ does not -create the commit. So the most important commands are those for -finishing and aborting the commit. - -- Key: C-c C-c (with-editor-finish) :: - - Finish the current editing session by returning with exit code 0. - Git then creates the commit using the message it finds in the file. - -- Key: C-c C-k (with-editor-cancel) :: - - Cancel the current editing session by returning with exit code 1. - Git then cancels the commit, but leaves the file untouched. - -In addition to being used by ~git commit~, messages may also be stored -in a ring that persists until Emacs is closed. By default the message -is stored at the beginning and the end of an edit session (regardless -of whether the session is finished successfully or was canceled). It -is sometimes useful to bring back messages from that ring. - -- Key: C-c M-s (git-commit-save-message) :: - - Save the current buffer content to the commit message ring. - -- Key: M-p (git-commit-prev-message) :: - - Cycle backward through the commit message ring, after saving the - current message to the ring. With a numeric prefix ARG, go back - ARG comments. - -- Key: M-n (git-commit-next-message) :: - - Cycle forward through the commit message ring, after saving the - current message to the ring. With a numeric prefix ARG, go back - ARG comments. - -By default the diff for the changes that are about to be committed are -automatically shown when invoking the commit. To prevent that, remove -~magit-commit-diff~ from ~server-switch-hook~. - -When amending to an existing commit it may be useful to show either -the changes that are about to be added to that commit or to show those -changes alongside those that have already been committed. - -- Key: C-c C-d (magit-diff-while-committing) :: - - While committing, show the changes that are about to be committed. - While amending, invoking the command again toggles between showing - just the new changes or all the changes that will be committed. - -**** Using the Revision Stack - -- Key: C-c C-w (magit-pop-revision-stack) :: - - This command inserts a representation of a revision into the current - buffer. It can be used inside buffers used to write commit messages - but also in other buffers such as buffers used to edit emails or - ChangeLog files. - - By default this command pops the revision which was last added to - the ~magit-revision-stack~ and inserts it into the current buffer - according to ~magit-pop-revision-stack-format~. Revisions can be put - on the stack using ~magit-copy-section-value~ and - ~magit-copy-buffer-revision~. - - If the stack is empty or with a prefix argument it instead reads a - revision in the minibuffer. By using the minibuffer history this - allows selecting an item which was popped earlier or to insert an - arbitrary reference or revision without first pushing it onto the - stack. - - When reading the revision from the minibuffer, then it might not - be possible to guess the correct repository. When this command - is called inside a repository (e.g., while composing a commit - message), then that repository is used. Otherwise (e.g., while - composing an email) then the repository recorded for the top - element of the stack is used (even though we insert another - revision). If not called inside a repository and with an empty - stack, or with two prefix arguments, then read the repository in - the minibuffer too. - -- User Option: magit-pop-revision-stack-format :: - - This option controls how the command ~magit-pop-revision-stack~ - inserts a revision into the current buffer. - - The entries on the stack have the format ~(HASH TOPLEVEL)~ and this - option has the format ~(POINT-FORMAT EOB-FORMAT INDEX-REGEXP)~, all - of which may be ~nil~ or a string (though either one of EOB-FORMAT - or POINT-FORMAT should be a string, and if INDEX-REGEXP is - non-~nil~, then the two formats should be too). - - First INDEX-REGEXP is used to find the previously inserted entry, - by searching backward from point. The first submatch must match - the index number. That number is incremented by one, and becomes - the index number of the entry to be inserted. If you don't want - to number the inserted revisions, then use ~nil~ for INDEX-REGEXP. - - If INDEX-REGEXP is non-~nil~ then both POINT-FORMAT and EOB-FORMAT - should contain \"%N\", which is replaced with the number that was - determined in the previous step. - - Both formats, if non-~nil~ and after removing %N, are then expanded - using ~git show --format=FORMAT ...~ inside TOPLEVEL. - - The expansion of POINT-FORMAT is inserted at point, and the - expansion of EOB-FORMAT is inserted at the end of the buffer (if the - buffer ends with a comment, then it is inserted right before that). - -**** Commit Pseudo Headers - -Some projects use pseudo headers in commit messages. Magit colorizes -such headers and provides some commands to insert such headers. - -- User Option: git-commit-known-pseudo-headers :: - - A list of Git pseudo headers to be highlighted. - -- Key: C-c C-i (git-commit-insert-pseudo-header) :: - - Insert a commit message pseudo header. - -- Key: C-c C-a (git-commit-ack) :: - - Insert a header acknowledging that you have looked at the commit. - -- Key: C-c C-r (git-commit-review) :: - - Insert a header acknowledging that you have reviewed the commit. - -- Key: C-c C-s (git-commit-signoff) :: - - Insert a header to sign off the commit. - -- Key: C-c C-t (git-commit-test) :: - - Insert a header acknowledging that you have tested the commit. - -- Key: C-c C-o (git-commit-cc) :: - - Insert a header mentioning someone who might be interested. - -- Key: C-c C-p (git-commit-reported) :: - - Insert a header mentioning the person who reported the issue being - fixed by the commit. - -- Key: C-c M-i (git-commit-suggested) :: - - Insert a header mentioning the person who suggested the change. - -**** Commit Mode and Hooks - -~git-commit-mode~ is a minor mode that is only used to establish certain -key bindings. This makes it possible to use an arbitrary major mode -in buffers used to edit commit messages. It is even possible to use -different major modes in different repositories, which is useful when -different projects impose different commit message conventions. - -- User Option: git-commit-major-mode :: - - The value of this option is the major mode used to edit Git commit - messages. - -Because ~git-commit-mode~ is a minor mode, we don't use its mode hook -to setup the buffer, except for the key bindings. All other setup -happens in the function ~git-commit-setup~, which among other things runs -the hook ~git-commit-setup-hook~. - -- User Option: git-commit-setup-hook :: - - Hook run at the end of ~git-commit-setup~. - -#+texinfo: @noindent -The following functions are suitable for this hook: - -- Function: git-commit-save-message :: - - Save the current buffer content to the commit message ring. - -- Function: git-commit-setup-changelog-support :: - - After this function is called, ChangeLog entries are treated as - paragraphs. - -- Function: git-commit-turn-on-auto-fill :: - - Turn on ~auto-fill-mode~. - -- Function: git-commit-turn-on-flyspell :: - - Turn on Flyspell mode. Also prevent comments from being checked and - finally check current non-comment text. - -- Function: git-commit-propertize-diff :: - - Propertize the diff shown inside the commit message buffer. Git - inserts such diffs into the commit message template when the - ~--verbose~ argument is used. ~magit-commit~ by default does not offer - that argument because the diff that is shown in a separate buffer is - more useful. But some users disagree, which is why this function - exists. - -- Function: bug-reference-mode :: - - Hyperlink bug references in the buffer. - -- Function: with-editor-usage-message :: - - Show usage information in the echo area. - -- User Option: git-commit-post-finish-hook :: - - Hook run after the user finished writing a commit message. - - This hook is only run after pressing ~C-c C-c~ in a buffer used to - edit a commit message. If a commit is created without the user - typing a message into a buffer, then this hook is not run. - - This hook is not run until the new commit has been created. If - doing so takes Git longer than one second, then this hook isn't run - at all. For certain commands such as ~magit-rebase-continue~ this - hook is never run because doing so would lead to a race condition. - - This hook is only run if ~magit~ is available. - - Also see ~magit-post-commit-hook~. - -**** Commit Message Conventions - -Git-Commit highlights certain violations of commonly accepted commit -message conventions. Certain violations even cause Git-Commit to ask -you to confirm that you really want to do that. This nagging can of -course be turned off, but the result of doing that usually is that -instead of some code it's now the human who is reviewing your commits -who has to waste some time telling you to fix your commits. - -- User Option: git-commit-summary-max-length :: - - The intended maximal length of the summary line of commit messages. - Characters beyond this column are colorized to indicate that this - preference has been violated. - -- User Option: git-commit-finish-query-functions :: - - List of functions called to query before performing commit. - - The commit message buffer is current while the functions are called. - If any of them returns ~nil~, then the commit is not performed and the - buffer is not killed. The user should then fix the issue and try - again. - - The functions are called with one argument. If it is non-~nil~ then - that indicates that the user used a prefix argument to force - finishing the session despite issues. Functions should usually - honor this wish and return non-~nil~. - - By default the only member is ~git-commit-check-style-conventions~. - -- Function: git-commit-check-style-conventions :: - - This function checks for violations of certain basic style - conventions. For each violation it asks users if they want to - proceed anyway. - -- User Option: git-commit-style-convention-checks :: - - This option controls what conventions the function by the same name - tries to enforce. The value is a list of self-explanatory symbols - identifying certain conventions; ~non-empty-second-line~ and - ~overlong-summary-line~. - -** Branching -*** The Two Remotes - -The upstream branch of some local branch is the branch into which the -commits on that local branch should eventually be merged, usually -something like ~origin/master~. For the ~master~ branch itself the -upstream branch and the branch it is being pushed to, are usually the -same remote branch. But for a feature branch the upstream branch and -the branch it is being pushed to should differ. - -The commits on feature branches too should /eventually/ end up in a -remote branch such as ~origin/master~ or ~origin/maint~. Such a branch -should therefore be used as the upstream. But feature branches -shouldn't be pushed directly to such branches. Instead a feature -branch ~my-feature~ is usually pushed to ~my-fork/my-feature~ or if you -are a contributor ~origin/my-feature~. After the new feature has been -reviewed, the maintainer merges the feature into ~master~. And finally -~master~ (not ~my-feature~ itself) is pushed to ~origin/master~. - -But new features seldom are perfect on the first try, and so feature -branches usually have to be reviewed, improved, and re-pushed several -times. Pushing should therefore be easy to do, and for that reason -many Git users have concluded that it is best to use the remote branch -to which the local feature branch is being pushed as its upstream. - -But luckily Git has long ago gained support for a push-remote which -can be configured separately from the upstream branch, using the -variables ~branch..pushRemote~ and ~remote.pushDefault~. So we no -longer have to choose which of the two remotes should be used as "the -remote". - -Each of the fetching, pulling, and pushing transient commands features -three suffix commands that act on the current branch and some other -branch. Of these, ~p~ is bound to a command which acts on the -push-remote, ~u~ is bound to a command which acts on the upstream, and ~e~ -is bound to a command which acts on any other branch. The status -buffer shows unpushed and unpulled commits for both the push-remote -and the upstream. - -It's fairly simple to configure these two remotes. The values of all -the variables that are related to fetching, pulling, and pushing (as -well as some other branch-related variables) can be inspected and -changed using the command ~magit-branch-configure~, which is available -from many transient prefix commands that deal with branches. It is -also possible to set the push-remote or upstream while pushing (see -[[*Pushing]]). - -*** Branch Commands - -The transient prefix command ~magit-branch~ is used to create and -checkout branches, and to make changes to existing branches. It is -not used to fetch, pull, merge, rebase, or push branches, i.e., this -command deals with branches themselves, not with the commits reachable -from them. Those features are available from separate transient -commands. - -- Key: b (magit-branch) :: - - This transient prefix command binds the following suffix commands - and displays them in a temporary buffer until a suffix is invoked. - - By default it also binds and displays the values of some - branch-related Git variables and allows changing their values. - -- User Option: magit-branch-direct-configure :: - - This option controls whether the transient command ~magit-branch~ can - be used to directly change the values of Git variables. This defaults - to ~t~ (to avoid changing key bindings). When set to ~nil~, then no - variables are displayed by that transient command, and its suffix - command ~magit-branch-configure~ has to be used instead to view and - change branch related variables. - -- Key: b C (magit-branch-configure) :: -- Key: f C :: -- Key: F C :: -- Key: P C :: - - This transient prefix command binds commands that set the value of - branch-related variables and displays them in a temporary buffer - until the transient is exited. - - With a prefix argument, this command always prompts for a branch. - - Without a prefix argument this depends on whether it was invoked as - a suffix of ~magit-branch~ and on the ~magit-branch-direct-configure~ - option. If ~magit-branch~ already displays the variables for the - current branch, then it isn't useful to invoke another transient - that displays them for the same branch. In that case this command - prompts for a branch. - -The variables are described in [[*Branch Git Variables]]. - -- Key: b b (magit-checkout) :: - - Checkout a revision read in the minibuffer and defaulting to the - branch or arbitrary revision at point. If the revision is a local - branch then that becomes the current branch. If it is something - else then ~HEAD~ becomes detached. Checkout fails if the working tree - or the staging area contain changes. - -- Key: b n (magit-branch-create) :: - - Create a new branch. The user is asked for a branch or arbitrary - revision to use as the starting point of the new branch. When a - branch name is provided, then that becomes the upstream branch of - the new branch. The name of the new branch is also read in the - minibuffer. - - Also see option ~magit-branch-prefer-remote-upstream~. - -- Key: b c (magit-branch-and-checkout) :: - - This command creates a new branch like ~magit-branch-create~, but then - also checks it out. - - Also see option ~magit-branch-prefer-remote-upstream~. - -- Key: b l (magit-branch-checkout) :: - - This command checks out an existing or new local branch. It reads a - branch name from the user offering all local branches and a subset - of remote branches as candidates. Remote branches for which a local - branch by the same name exists are omitted from the list of - candidates. The user can also enter a completely new branch name. - - - If the user selects an existing local branch, then that is checked - out. - - - If the user selects a remote branch, then it creates and checks - out a new local branch with the same name, and configures the - selected remote branch as the push target. - - - If the user enters a new branch name, then it creates and checks - that out, after also reading the starting-point from the user. - - In the latter two cases the upstream is also set. Whether it is set - to the chosen starting point or something else depends on the value - of ~magit-branch-adjust-remote-upstream-alist~. - -- Key: b s (magit-branch-spinoff) :: - - This command creates and checks out a new branch starting at and - tracking the current branch. That branch in turn is reset to the - last commit it shares with its upstream. If the current branch has - no upstream or no unpushed commits, then the new branch is created - anyway and the previously current branch is not touched. - - This is useful to create a feature branch after work has already - begun on the old branch (likely but not necessarily "master"). - - If the current branch is a member of the value of option - ~magit-branch-prefer-remote-upstream~ (which see), then the current - branch will be used as the starting point as usual, but the upstream - of the starting-point may be used as the upstream of the new branch, - instead of the starting-point itself. - - If optional FROM is non-~nil~, then the source branch is reset - to ~FROM~~, instead of to the last commit it shares with its - upstream. Interactively, FROM is only ever non-~nil~, if the - region selects some commits, and among those commits, FROM is - the commit that is the fewest commits ahead of the source - branch. - - The commit at the other end of the selection actually does not - matter, all commits between FROM and ~HEAD~ are moved to the new - branch. If FROM is not reachable from ~HEAD~ or is reachable from the - source branch's upstream, then an error is raised. - -- Key: b S (magit-branch-spinout) :: - - This command behaves like ~magit-branch-spinoff~, except that it does - not change the current branch. If there are any uncommitted changes, - then it behaves exactly like ~magit-branch-spinoff~. - -- Key: b x (magit-branch-reset) :: - - This command resets a branch, defaulting to the branch at point, to - the tip of another branch or any other commit. - - When the branch being reset is the current branch, then a hard reset - is performed. If there are any uncommitted changes, then the user - has to confirm the reset because those changes would be lost. - - This is useful when you have started work on a feature branch but - realize it's all crap and want to start over. - - When resetting to another branch and a prefix argument is used, then - the target branch is set as the upstream of the branch that is being - reset. - -- Key: b k (magit-branch-delete) :: - - Delete one or multiple branches. If the region marks multiple - branches, then offer to delete those. Otherwise, prompt for a single - branch to be deleted, defaulting to the branch at point. - - Require confirmation when deleting branches is dangerous in some - way. Option ~magit-no-confirm~ can be customized to not require - confirmation in certain cases. See its docstring to learn why - confirmation is required by default in certain cases or if a - prompt is confusing. - -- Key: b m (magit-branch-rename) :: - - Rename a branch. The branch and the new name are read in the - minibuffer. With prefix argument the branch is renamed even if that - name conflicts with an existing branch. - -- User Option: magit-branch-read-upstream-first :: - - When creating a branch, whether to read the upstream branch before - the name of the branch that is to be created. The default is ~t~, - and I recommend you leave it at that. - -- User Option: magit-branch-prefer-remote-upstream :: - - This option specifies whether remote upstreams are favored over - local upstreams when creating new branches. - - When a new branch is created, then the branch, commit, or stash at - point is suggested as the starting point of the new branch, or if - there is no such revision at point the current branch. In either - case the user may choose another starting point. - - If the chosen starting point is a branch, then it may also be set - as the upstream of the new branch, depending on the value of the - Git variable `branch.autoSetupMerge'. By default this is done - for remote branches, but not for local branches. - - You might prefer to always use some remote branch as upstream. - If the chosen starting point is (1) a local branch, (2) whose - name matches a member of the value of this option, (3) the - upstream of that local branch is a remote branch with the same - name, and (4) that remote branch can be fast-forwarded to the - local branch, then the chosen branch is used as starting point, - but its own upstream is used as the upstream of the new branch. - - Members of this option's value are treated as branch names that - have to match exactly unless they contain a character that makes - them invalid as a branch name. Recommended characters to use - to trigger interpretation as a regexp are "*" and "^". Some - other characters which you might expect to be invalid, actually - are not, e.g., ".+$" are all perfectly valid. More precisely, - if ~git check-ref-format --branch STRING~ exits with a non-zero - status, then treat STRING as a regexp. - - Assuming the chosen branch matches these conditions you would end - up with with e.g.: - - #+BEGIN_SRC text - feature --upstream--> origin/master - #+END_SRC - - instead of - - #+BEGIN_SRC text - feature --upstream--> master --upstream--> origin/master - #+END_SRC - - Which you prefer is a matter of personal preference. If you do - prefer the former, then you should add branches such as ~master~, - ~next~, and ~maint~ to the value of this options. - -- User Option: magit-branch-adjust-remote-upstream-alist :: - - The value of this option is an alist of branches to be used as - the upstream when branching a remote branch. - - When creating a local branch from an ephemeral branch located on a - remote, e.g., a feature or hotfix branch, then that remote branch - should usually not be used as the upstream branch, since the - push-remote already allows accessing it and having both the upstream - and the push-remote reference the same related branch would be - wasteful. Instead a branch like "maint" or "master" should be used - as the upstream. - - This option allows specifying the branch that should be used as the - upstream when branching certain remote branches. The value is an - alist of the form ~((UPSTREAM . RULE)...)~. The first matching - element is used, the following elements are ignored. - - UPSTREAM is the branch to be used as the upstream for branches - specified by RULE. It can be a local or a remote branch. - - RULE can either be a regular expression, matching branches whose - upstream should be the one specified by UPSTREAM. Or it can be a - list of the only branches that should *not* use UPSTREAM; all other - branches will. Matching is done after stripping the remote part of - the name of the branch that is being branched from. - - If you use a finite set of non-ephemeral branches across all your - repositories, then you might use something like: - - #+BEGIN_SRC emacs-lisp - (("origin/master" . ("master" "next" "maint"))) - #+END_SRC - - Or if the names of all your ephemeral branches contain a slash, - at least in some repositories, then a good value could be: - - #+BEGIN_SRC emacs-lisp - (("origin/master" . "/")) - #+END_SRC - - Of course you can also fine-tune: - - #+BEGIN_SRC emacs-lisp - (("origin/maint" . "\\`hotfix/") - ("origin/master" . "\\`feature/")) - #+END_SRC - - UPSTREAM can be a local branch: - - #+BEGIN_SRC emacs-lisp - (("master" . ("master" "next" "maint"))) - #+END_SRC - -Because the main branch is no longer almost always named "master" -you should also account for other common names: - - #+BEGIN_SRC emacs-lisp - (("main" . ("main" "master" "next" "maint")) - ("master" . ("main" "master" "next" "maint"))) - #+END_SRC - -- Command: magit-branch-orphan :: - - This command creates and checks out a new orphan branch with - contents from a given revision. - -- Command: magit-branch-or-checkout :: - - This command is a hybrid between ~magit-checkout~ and - ~magit-branch-and-checkout~ and is intended as a replacement for the - former in ~magit-branch~. - - It first asks the user for an existing branch or revision. If the - user input actually can be resolved as a branch or revision, then it - checks that out, just like ~magit-checkout~ would. - - Otherwise it creates and checks out a new branch using the input as - its name. Before doing so it reads the starting-point for the new - branch. This is similar to what ~magit-branch-and-checkout~ does. - - To use this command instead of ~magit-checkout~ add this to your init - file: - - #+BEGIN_SRC emacs-lisp - (transient-replace-suffix 'magit-branch 'magit-checkout - '("b" "dwim" magit-branch-or-checkout)) - #+END_SRC - -*** Branch Git Variables - -These variables can be set from the transient prefix command -~magit-branch-configure~. By default they can also be set from -~magit-branch~. See [[*Branch Commands]]. - -- Variable: branch.NAME.merge :: - - Together with ~branch.NAME.remote~ this variable defines the upstream - branch of the local branch named NAME. The value of this variable - is the full reference of the upstream /branch/. - -- Variable: branch.NAME.remote :: - - Together with ~branch.NAME.merge~ this variable defines the upstream - branch of the local branch named NAME. The value of this variable - is the name of the upstream /remote/. - -- Variable: branch.NAME.rebase :: - - This variable controls whether pulling into the branch named NAME is - done by rebasing or by merging the fetched branch. - - - When ~true~ then pulling is done by rebasing. - - When ~false~ then pulling is done by merging. - - When undefined then the value of ~pull.rebase~ is used. The default - of that variable is ~false~. - -- Variable: branch.NAME.pushRemote :: - - This variable specifies the remote that the branch named NAME is - usually pushed to. The value has to be the name of an existing - remote. - - It is not possible to specify the name of /branch/ to push the local - branch to. The name of the remote branch is always the same as the - name of the local branch. - - If this variable is undefined but ~remote.pushDefault~ is defined, - then the value of the latter is used. By default ~remote.pushDefault~ - is undefined. - -- Variable: branch.NAME.description :: - - This variable can be used to describe the branch named NAME. That - description is used, e.g., when turning the branch into a series of - patches. - -The following variables specify defaults which are used if the above -branch-specific variables are not set. - -- Variable: pull.rebase :: - - This variable specifies whether pulling is done by rebasing or by - merging. It can be overwritten using ~branch.NAME.rebase~. - - - When ~true~ then pulling is done by rebasing. - - When ~false~ (the default) then pulling is done by merging. - - Since it is never a good idea to merge the upstream branch into a - feature or hotfix branch and most branches are such branches, you - should consider setting this to ~true~, and ~branch.master.rebase~ to - ~false~. - -- Variable: remote.pushDefault :: - - This variable specifies what remote the local branches are usually - pushed to. This can be overwritten per branch using - ~branch.NAME.pushRemote~. - -The following variables are used during the creation of a branch and -control whether the various branch-specific variables are -automatically set at this time. - -- Variable: branch.autoSetupMerge :: - - This variable specifies under what circumstances creating a branch - NAME should result in the variables ~branch.NAME.merge~ and - ~branch.NAME.remote~ being set according to the starting point used to - create the branch. If the starting point isn't a branch, then these - variables are never set. - - - When ~always~ then the variables are set regardless of whether the - starting point is a local or a remote branch. - - When ~true~ (the default) then the variables are set when the starting - point is a remote branch, but not when it is a local branch. - - When ~false~ then the variables are never set. - -- Variable: branch.autoSetupRebase :: - - This variable specifies whether creating a branch NAME should result - in the variable ~branch.NAME.rebase~ being set to ~true~. - - - When ~always~ then the variable is set regardless of whether the - starting point is a local or a remote branch. - - When ~local~ then the variable are set when the starting point is a - local branch, but not when it is a remote branch. - - When ~remote~ then the variable are set when the starting point is a - remote branch, but not when it is a local branch. - - When ~never~ (the default) then the variable is never set. - -Note that the respective commands always change the repository-local -values. If you want to change the global value, which is used when -the local value is undefined, then you have to do so on the command -line, e.g.: - -#+begin_src shell-script - git config --global remote.autoSetupMerge always -#+end_src - -For more information about these variables you should also see -man:git-config Also see [[man:git-branch]], [[man:git-checkout]] and [[*Pushing]]. - -- User Option: magit-prefer-remote-upstream :: - - This option controls whether commands that read a branch from the - user and then set it as the upstream branch, offer a local or a - remote branch as default completion candidate, when they have the - choice. - - This affects all commands that use ~magit-read-upstream-branch~ or - ~magit-read-starting-point~, which includes all commands that change - the upstream and many which create new branches. - -*** Auxiliary Branch Commands - -These commands are not available from the transient ~magit-branch~ by -default. - -- Command: magit-branch-shelve :: - - This command shelves a branch. This is done by deleting the branch, - and creating a new reference "refs/shelved/BRANCH-NAME" pointing at - the same commit as the branch pointed at. If the deleted branch had - a reflog, then that is preserved as the reflog of the new reference. - - This is useful if you want to move a branch out of sight, but are - not ready to completely discard it yet. - -- Command: magit-branch-unshelve :: - - This command unshelves a branch that was previously shelved using - ~magit-branch-shelve~. This is done by deleting the reference - "refs/shelved/BRANCH-NAME" and creating a branch "BRANCH-NAME" - pointing at the same commit as the deleted reference pointed at. - If the deleted reference had a reflog, then that is restored as - the reflog of the branch. - -** Merging - -Also see [[man:git-merge]] For information on how to resolve -merge conflicts see the next section. - -- Key: m (magit-merge) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - -When no merge is in progress, then the transient features the -following suffix commands. - -- Key: m m (magit-merge-plain) :: - - This command merges another branch or an arbitrary revision into the - current branch. The branch or revision to be merged is read in the - minibuffer and defaults to the branch at point. - - Unless there are conflicts or a prefix argument is used, then the - resulting merge commit uses a generic commit message, and the user - does not get a chance to inspect or change it before the commit is - created. With a prefix argument this does not actually create the - merge commit, which makes it possible to inspect how conflicts were - resolved and to adjust the commit message. - -- Key: m e (magit-merge-editmsg) :: - - This command merges another branch or an arbitrary revision into the - current branch and opens a commit message buffer, so that the user - can make adjustments. The commit is not actually created until the - user finishes with ~C-c C-c~. - -- Key: m n (magit-merge-nocommit) :: - - This command merges another branch or an arbitrary revision into the - current branch, but does not actually create the merge commit. The - user can then further adjust the merge, even when automatic conflict - resolution succeeded and/or adjust the commit message. - -- Key: m a (magit-merge-absorb) :: - - This command merges another local branch into the current branch and - then removes the former. - - Before the source branch is merged, it is first force pushed to its - push-remote, provided the respective remote branch already exists. - This ensures that the respective pull-request (if any) won't get - stuck on some obsolete version of the commits that are being merged. - Finally, if ~magit-branch-pull-request~ was used to create the merged - branch, then the respective remote branch is also removed. - -- Key: m d (magit-merge-dissolve) :: - - This command merges the current branch into another local branch and - then removes the former. The latter becomes the new current branch. - - Before the source branch is merged, it is first force pushed to its - push-remote, provided the respective remote branch already exists. - This ensures that the respective pull-request (if any) won't get - stuck on some obsolete version of the commits that are being merged. - Finally, if ~magit-branch-pull-request~ was used to create the merged - branch, then the respective remote branch is also removed. - -- Key: m s (magit-merge-squash) :: - - This command squashes the changes introduced by another branch or an - arbitrary revision into the current branch. This only applies the - changes made by the squashed commits. No information is preserved - that would allow creating an actual merge commit. Instead of this - command you should probably use a command from the apply transient. - -- Key: m p (magit-merge-preview) :: - - This command shows a preview of merging another branch or an - arbitrary revision into the current branch. - - Note that commands, that normally change how a diff is displayed, do - not work in buffers created by this command, because the underlying - Git command does not support diff arguments. - -When a merge is in progress, then the transient instead features the -following suffix commands. - -- Key: m m (magit-merge) :: - - After the user resolved conflicts, this command proceeds with the - merge. If some conflicts weren't resolved, then this command fails. - -- Key: m a (magit-merge-abort) :: - - This command aborts the current merge operation. - -** Resolving Conflicts - -When merging branches (or otherwise combining or changing history) -conflicts can occur. If you edited two completely different parts of -the same file in two branches and then merge one of these branches -into the other, then Git can resolve that on its own, but if you edit -the same area of a file, then a human is required to decide how the -two versions, or "sides of the conflict", are to be combined into one. - -Here we can only provide a brief introduction to the subject and point -you toward some tools that can help. If you are new to this, then -please also consult Git's own documentation as well as other -resources. - -If a file has conflicts and Git cannot resolve them by itself, then it -puts both versions into the affected file along with special markers -whose purpose is to denote the boundaries of the unresolved part of -the file and between the different versions. These boundary lines -begin with the strings consisting of seven times the same character, -one of ~<~, ~|~, ~=~ and ~>~, and are followed by information about the source -of the respective versions, e.g.: - -#+begin_example - <<<<<<< HEAD - Take the blue pill. - ======= - Take the red pill. - >>>>>>> feature -#+end_example - -In this case you have chosen to take the red pill on one branch and on -another you picked the blue pill. Now that you are merging these two -diverging branches, Git cannot possibly know which pill you want to -take. - -To resolve that conflict you have to create a version of the affected -area of the file by keeping only one of the sides, possibly by editing -it in order to bring in the changes from the other side, remove the -other versions as well as the markers, and then stage the result. A -possible resolution might be: - -#+begin_example - Take both pills. -#+end_example - -Often it is useful to see not only the two sides of the conflict but -also the "original" version from before the same area of the file was -modified twice on different branches. Instruct Git to insert that -version as well by running this command once: - -#+begin_src shell-script - git config --global merge.conflictStyle diff3 -#+end_src - -The above conflict might then have looked like this: - -#+begin_example - <<<<<<< HEAD - Take the blue pill. - ||||||| merged common ancestors - Take either the blue or the red pill, but not both. - ======= - Take the red pill. - >>>>>>> feature -#+end_example - -If that were the case, then the above conflict resolution would not -have been correct, which demonstrates why seeing the original version -alongside the conflicting versions can be useful. - -You can perform the conflict resolution completely by hand, but Emacs -also provides some packages that help in the process: Smerge, Ediff -(info:ediff), and Emerge (info:emacs#Emerge). Magit does not provide -its own tools for conflict resolution, but it does make using Smerge -and Ediff more convenient. (Ediff supersedes Emerge, so you probably -don't want to use the latter anyway.) - -In the Magit status buffer, files with unresolved conflicts are listed -in the "Unstaged changes" and/or "Staged changes" sections. They are -prefixed with the word "unmerged", which in this context essentially -is a synonym for "unresolved". - -Pressing ~RET~ while point is on such a file section shows a buffer -visiting that file, turns on ~smerge-mode~ in that buffer, and places -point inside the first area with conflicts. You should then resolve -that conflict using regular edit commands and/or Smerge commands. - -Unfortunately Smerge does not have a manual, but you can get a list of -commands and binding ~C-c ^ C-h~ and press ~RET~ while point is on a -command name to read its documentation. - -Normally you would edit one version and then tell Smerge to keep only -that version. Use ~C-c ^ m~ (~smerge-keep-mine~) to keep the ~HEAD~ -version or ~C-c ^ o~ (~smerge-keep-other~) to keep the version that -follows "|||||||". Then use ~C-c ^ n~ to move to the next conflicting -area in the same file. Once you are done resolving conflicts, return -to the Magit status buffer. The file should now be shown as -"modified", no longer as "unmerged", because Smerge automatically -stages the file when you save the buffer after resolving the last -conflict. - -Magit now wraps the mentioned Smerge commands, allowing you to use -these key bindings without having to go to the file-visiting buffer. -Additionally ~k~ (~magit-discard~) on a hunk with unresolved conflicts -asks which side to keep or, if point is on a side, then it keeps it -without prompting. Similarly ~k~ on a unresolved file ask which side -to keep. - -Alternatively you could use Ediff, which uses separate buffers for the -different versions of the file. To resolve conflicts in a file using -Ediff press ~e~ while point is on such a file in the status buffer. - -Ediff can be used for other purposes as well. For more information on -how to enter Ediff from Magit, see [[*Ediffing]]. Explaining how to use -Ediff is beyond the scope of this manual, instead see info:ediff. - -If you are unsure whether you should Smerge or Ediff, then use the -former. It is much easier to understand and use, and except for -truly complex conflicts, the latter is usually overkill. - -** Rebasing - -Also see [[man:git-rebase]] For information on how to resolve -conflicts that occur during rebases see the preceding section. - -- Key: r (magit-rebase) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - -When no rebase is in progress, then the transient features the -following suffix commands. - -Using one of these commands /starts/ a rebase sequence. Git might then -stop somewhere along the way, either because you told it to do so, or -because applying a commit failed due to a conflict. When that -happens, then the status buffer shows information about the rebase -sequence which is in progress in a section similar to a log section. -See [[*Information About In-Progress Rebase]]. - -For information about the upstream and the push-remote, see [[*The Two -Remotes]]. - -- Key: r p (magit-rebase-onto-pushremote) :: - - This command rebases the current branch onto its push-remote. - - With a prefix argument or when the push-remote is either not - configured or unusable, then let the user first configure the - push-remote. - -- Key: r u (magit-rebase-onto-upstream) :: - - This command rebases the current branch onto its upstream branch. - - With a prefix argument or when the upstream is either not - configured or unusable, then let the user first configure - the upstream. - -- Key: r e (magit-rebase-branch) :: - - This command rebases the current branch onto a branch read in the - minibuffer. All commits that are reachable from head but not from - the selected branch TARGET are being rebased. - -- Key: r s (magit-rebase-subset) :: - - This command starts a non-interactive rebase sequence to transfer - commits from START to ~HEAD~ onto NEWBASE. START has to be selected - from a list of recent commits. - -By default Magit uses the ~--autostash~ argument, which causes -uncommitted changes to be stored in a stash before the rebase begins. -These changes are restored after the rebase completes and if possible -the stash is removed. If the stash does not apply cleanly, then the -stash is not removed. In case something goes wrong when resolving -the conflicts, this allows you to start over. - -Even though one of the actions is dedicated to interactive rebases, -the transient also features the infix argument ~--interactive~. This -can be used to turn one of the other, non-interactive rebase variants -into an interactive rebase. - -For example if you want to clean up a feature branch and at the same -time rebase it onto ~master~, then you could use ~r-iu~. But we recommend -that you instead do that in two steps. First use ~ri~ to cleanup the -feature branch, and then in a second step ~ru~ to rebase it onto ~master~. -That way if things turn out to be more complicated than you thought -and/or you make a mistake and have to start over, then you only have -to redo half the work. - -Explicitly enabling ~--interactive~ won't have an effect on the -following commands as they always use that argument anyway, even if it -is not enabled in the transient. - -- Key: r i (magit-rebase-interactive) :: - - This command starts an interactive rebase sequence. - -- Key: r f (magit-rebase-autosquash) :: - - This command combines squash and fixup commits with their intended - targets. - - By default only commits that are not reachable from the upstream - branch are potentially squashed into. If no upstream is configured - or with a prefix argument, the user is prompted for the first commit - to potentially squash into. - -- Key: r m (magit-rebase-edit-commit) :: - - This command starts an interactive rebase sequence that lets the - user edit a single older commit. - -- Key: r w (magit-rebase-reword-commit) :: - - This command starts an interactive rebase sequence that lets the - user reword a single older commit. - -- Key: r k (magit-rebase-remove-commit) :: - - This command removes a single older commit using rebase. - -When a rebase is in progress, then the transient instead features -the following suffix commands. - -- Key: r r (magit-rebase-continue) :: - - This command restart the current rebasing operation. - - In some cases this pops up a commit message buffer for you do edit. - With a prefix argument the old message is reused as-is. - -- Key: r s (magit-rebase-skip) :: - - This command skips the current commit and restarts the current - rebase operation. - -- Key: r e (magit-rebase-edit) :: - - This command lets the user edit the todo list of the current rebase - operation. - -- Key: r a (magit-rebase-abort) :: - - This command aborts the current rebase operation, restoring the - original branch. - -*** Editing Rebase Sequences - -- Key: C-c C-c (with-editor-finish) :: - - Finish the current editing session by returning with exit code 0. - Git then uses the rebase instructions it finds in the file. - -- Key: C-c C-k (with-editor-cancel) :: - - Cancel the current editing session by returning with exit code 1. - Git then forgoes starting the rebase sequence. - -- Key: RET (git-rebase-show-commit) :: - - Show the commit on the current line in another buffer and select - that buffer. - -- Key: SPC (git-rebase-show-or-scroll-up) :: - - Show the commit on the current line in another buffer without - selecting that buffer. If the revision buffer is already visible in - another window of the current frame, then instead scroll that window - up. - -- Key: DEL (git-rebase-show-or-scroll-down) :: - - Show the commit on the current line in another buffer without - selecting that buffer. If the revision buffer is already visible in - another window of the current frame, then instead scroll that window - down. - -- Key: p (git-rebase-backward-line) :: - - Move to previous line. - -- Key: n (forward-line) :: - - Move to next line. - -- Key: M-p (git-rebase-move-line-up) :: - - Move the current commit (or command) up. - -- Key: M-n (git-rebase-move-line-down) :: - - Move the current commit (or command) down. - -- Key: r (git-rebase-reword) :: - - Edit message of commit on current line. - -- Key: e (git-rebase-edit) :: - - Stop at the commit on the current line. - -- Key: s (git-rebase-squash) :: - - This command folds the commit on the current line into the previous - commit, giving the user a change to manually merge the two messages. - -- Key: S (git-rebase-squish) :: - - This command folds the commit on the current line into the previous - commit, discarding the message of the previous commit but giving the - user a change to edit the final message, based on the message of the - current commit. - - This action's indicator, shown in the list of commits, is ~fixup -c~ - (with a lower-case c). - -- Key: f (git-rebase-fixup) :: - - This command folds the commit on the current line into the previous - commit, using only the message of the previous commit as-is and - discarding the message of the current commit. - -- Key: F (git-rebase-alter) :: - - This command folds the commit on the current into the previous - commit, discarding the message of the previous commit and instead - using the message of the current commit as-is. - - This is like ~git-rebase-alter~, except that it uses the other - message. This is also like ~git-rebase-squish~, except that it lets - the user edit the message. - - This action's indicator, shown in the list of commits, is ~fixup -C~ - (with a upper-case C). - -- Key: k (git-rebase-kill-line) :: - - Comment the current action line, or if it is already commented, then - uncomment it. - -- Key: c (git-rebase-pick) :: - - Use commit on current line. - -- Key: x (git-rebase-exec) :: - - Insert a shell command to be run after the proceeding commit. - - If there already is such a command on the current line, then edit - that instead. With a prefix argument insert a new command even when - there already is one on the current line. With empty input remove - the command on the current line, if any. - -- Key: b (git-rebase-break) :: - - Insert a break action before the current line, instructing Git to - return control to the user. - -- Key: y (git-rebase-insert) :: - - Read an arbitrary commit and insert it below current line. - -- Key: C-x u (git-rebase-undo) :: - - Undo some previous changes. Like ~undo~ but works in read-only - buffers. - -- User Option: git-rebase-auto-advance :: - - Whether to move to next line after changing a line. - -- User Option: git-rebase-show-instructions :: - - Whether to show usage instructions inside the rebase buffer. - -- User Option: git-rebase-confirm-cancel :: - - Whether confirmation is required to cancel. - -When a rebase is performed with the ~--rebase-merges~ option, the -sequence will include a few other types of actions and the following -commands become relevant. - -- Key: l (git-rebase-label) :: - - This commands inserts a label action or edits the one at point. - -- Key: t (git-rebase-reset) :: - - This command inserts a reset action or edits the one at point. The - prompt will offer the labels that are currently present in the - buffer. - -- Key: MM (git-rebase-merge) :: - - The command inserts a merge action or edits the one at point. The - prompt will offer the labels that are currently present in the - buffer. Specifying a message to reuse via ~-c~ or ~-C~ is not - supported; an editor will always be invoked for the merge. - -- Key: Mt (git-rebase-merge-toggle-editmsg) :: - - This command toggles between the ~-C~ and ~-c~ options of the merge - action at point. These options both specify a commit whose message - should be reused. The lower-case variant instructs Git to invoke - the editor when creating the merge, allowing the user to edit the - message. - -*** Information About In-Progress Rebase - -While a rebase sequence is in progress, the status buffer features a -section that lists the commits that have already been applied as well -as the commits that still have to be applied. - -The commits are split in two halves. When rebase stops at a commit, -either because the user has to deal with a conflict or because s/he -explicitly requested that rebase stops at that commit, then point is -placed on the commit that separates the two groups, i.e., on ~HEAD~. -The commits above it have not been applied yet, while the ~HEAD~ and the -commits below it have already been applied. In between these two -groups of applied and yet-to-be applied commits, there sometimes is a -commit which has been dropped. - -Each commit is prefixed with a word and these words are additionally -shown in different colors to indicate the status of the commits. - -The following colors are used: - -- Commits that use the same foreground color as the ~default~ face have - not been applied yet. - -- Yellow commits have some special relationship to the commit rebase - stopped at. This is used for the words "join", "goal", "same" and - "work" (see below). - -- Gray commits have already been applied. - -- The blue commit is the ~HEAD~ commit. - -- The green commit is the commit the rebase sequence stopped at. If - this is the same commit as ~HEAD~ (e.g., because you haven't done - anything yet after rebase stopped at the commit, then this commit is - shown in blue, not green). There can only be a green *and* a blue - commit at the same time, if you create one or more new commits after - rebase stops at a commit. - -- Red commits have been dropped. They are shown for reference only, - e.g., to make it easier to diff. - -Of course these colors are subject to the color-theme in use. - -The following words are used: - -- Commits prefixed with ~pick~, ~reword~, ~edit~, ~squash~, and ~fixup~ have not - been applied yet. These words have the same meaning here as they do - in the buffer used to edit the rebase sequence. See [[*Editing Rebase - Sequences]]. When the ~--rebase-merges~ option was specified, - ~reset~, ~label~, and ~merge~ lines may also be present. - -- Commits prefixed with ~done~ and ~onto~ have already been applied. - It is possible for such a commit to be the ~HEAD~, in which case it - is blue. Otherwise it is grey. - - - The commit prefixed with ~onto~ is the commit on top of which all - the other commits are being re-applied. This commit itself did - not have to be re-applied, it is the commit rebase did rewind to - before starting to re-apply other commits. - - - Commits prefixed with ~done~ have already been re-applied. This - includes commits that have been re-applied but also new commits - that you have created during the rebase. - -- All other commits, those not prefixed with any of the above words, - are in some way related to the commit at which rebase stopped. - - To determine whether a commit is related to the stopped-at commit - their hashes, trees and patch-ids [fn:patch-id] are being compared. - The commit message is not used for this purpose. - - Generally speaking commits that are related to the stopped-at commit - can have any of the used colors, though not all color/word - combinations are possible. - - Words used for stopped-at commits are: - - - When a commit is prefixed with ~void~, then that indicates that - Magit knows for sure that all the changes in that commit have been - applied using several new commits. This commit is no longer - reachable from ~HEAD~, and it also isn't one of the commits that - will be applied when resuming the session. - - - When a commit is prefixed with ~join~, then that indicates that the - rebase sequence stopped at that commit due to a conflict - you now - have to join (merge) the changes with what has already been - applied. In a sense this is the commit rebase stopped at, but - while its effect is already in the index and in the worktree (with - conflict markers), the commit itself has not actually been applied - yet (it isn't the ~HEAD~). So it is shown in yellow, like the other - commits that still have to be applied. - - - When a commit is prefixed with ~stop~ or a /blue/ or /green/ ~same~, then - that indicates that rebase stopped at this commit, that it is - still applied or has been applied again, and that at least its - patch-id is unchanged. - - - When a commit is prefixed with ~stop~, then that indicates that - rebase stopped at that commit because you requested that - earlier, and its patch-id is unchanged. It might even still be - the exact same commit. - - - When a commit is prefixed with a /blue/ or /green/ ~same~, then that - indicates that while its tree or hash changed, its patch-id did - not. If it is blue, then it is the ~HEAD~ commit (as always for - blue). When it is green, then it no longer is ~HEAD~ because - other commit have been created since (but before continuing the - rebase). - - - When a commit is prefixed with ~goal~, a /yellow/ ~same,~ or ~work~, then - that indicates that rebase applied that commit but that you then - reset ~HEAD~ to an earlier commit (likely to split it up into - multiple commits), and that there are some uncommitted changes - remaining which likely (but not necessarily) originate from that - commit. - - - When a commit is prefixed with ~goal~, then that indicates that it - is still possible to create a new commit with the exact same - tree (the "goal") without manually editing any files, by - committing the index, or by staging all changes and then - committing that. This is the case when the original tree still - exists in the index or worktree in untainted form. - - - When a commit is prefixed with a yellow ~same~, then that - indicates that it is no longer possible to create a commit with - the exact same tree, but that it is still possible to create a - commit with the same patch-id. This would be the case if you - created a new commit with other changes, but the changes from - the original commit still exist in the index or working tree in - untainted form. - - - When a commit is prefixed with ~work~, then that indicates that - you reset ~HEAD~ to an earlier commit, and that there are some - staged and/or unstaged changes (likely, but not necessarily) - originating from that commit. However it is no longer possible - to create a new commit with the same tree or at least the same - patch-id because you have already made other changes. - - - When a commit is prefixed with ~poof~ or ~gone~, then that indicates - that rebase applied that commit but that you then reset ~HEAD~ to an - earlier commit (likely to split it up into multiple commits), and - that there are no uncommitted changes. - - - When a commit is prefixed with ~poof~, then that indicates that it - is no longer reachable from ~HEAD~, but that it has been replaced - with one or more commits, which together have the exact same - effect. - - - When a commit is prefixed with ~gone~, then that indicates that it - is no longer reachable from ~HEAD~ and that we also cannot - determine whether its changes are still in effect in one or more - new commits. They might be, but if so, then there must also be - other changes which makes it impossible to know for sure. - -Do not worry if you do not fully understand the above. That's okay, -you will acquire a good enough understanding through practice. - -For other sequence operations such as cherry-picking, a similar section -is displayed, but they lack some of the features described above, due -to limitations in the git commands used to implement them. Most -importantly these sequences only support "picking" a commit but not -other actions such as "rewording", and they do not keep track of the -commits which have already been applied. - -[fn:patch-id] The patch-id is a hash of the /changes/ introduced by a -commit. It differs from the hash of the commit itself, which is a -hash of the result of applying that change (i.e., the resulting trees -and blobs) as well as author and committer information, the commit -message, and the hashes of the parents of the commit. The patch-id -hash on the other hand is created only from the added and removed -lines, even line numbers and whitespace changes are ignored when -calculating this hash. The patch-ids of two commits can be used to -answer the question "Do these commits make the same change?". - -** Cherry Picking - -Also see [[man:git-cherry-pick]] - -- Key: A (magit-cherry-pick) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - -When no cherry-pick or revert is in progress, then the transient -features the following suffix commands. - -- Key: A A (magit-cherry-copy) :: - - This command copies COMMITS from another branch onto the current - branch. If the region selects multiple commits, then those are - copied, without prompting. Otherwise the user is prompted for a - commit or range, defaulting to the commit at point. - -- Key: A a (magit-cherry-apply) :: - - This command applies the changes in COMMITS from another branch onto - the current branch. If the region selects multiple commits, then - those are used, without prompting. Otherwise the user is prompted - for a commit or range, defaulting to the commit at point. - - This command also has a top-level binding, which can be invoked - without using the transient by typing ~a~ at the top-level. - -The following commands not only apply some commits to some branch, but -also remove them from some other branch. The removal is performed -using either ~git-update-ref~ or if necessary ~git-rebase~. Both applying -commits as well as removing them using ~git-rebase~ can lead to -conflicts. If that happens, then these commands abort and you not -only have to resolve the conflicts but also finish the process the -same way you would have to if these commands didn't exist at all. - -- Key: A h (magit-cherry-harvest) :: - - This command moves the selected COMMITS that must be located on - another BRANCH onto the current branch instead, removing them from - the former. When this command succeeds, then the same branch is - current as before. - - Applying the commits on the current branch or removing them from the - other branch can lead to conflicts. When that happens, then this - command stops and you have to resolve the conflicts and then finish - the process manually. - -- Key: A d (magit-cherry-donate) :: - - This command moves the selected COMMITS from the current branch onto - another existing BRANCH, removing them from the former. When this - command succeeds, then the same branch is current as before. ~HEAD~ - is allowed to be detached initially. - - Applying the commits on the other branch or removing them from the - current branch can lead to conflicts. When that happens, then this - command stops and you have to resolve the conflicts and then finish - the process manually. - -- Key: A n (magit-cherry-spinout) :: - - This command moves the selected COMMITS from the current branch onto - a new branch BRANCH, removing them from the former. When this - command succeeds, then the same branch is current as before. - - Applying the commits on the other branch or removing them from the - current branch can lead to conflicts. When that happens, then this - command stops and you have to resolve the conflicts and then finish - the process manually. - -- Key: A s (magit-cherry-spinoff) :: - - This command moves the selected COMMITS from the current branch onto - a new branch BRANCH, removing them from the former. When this - command succeeds, then the new branch is checked out. - - Applying the commits on the other branch or removing them from the - current branch can lead to conflicts. When that happens, then this - command stops and you have to resolve the conflicts and then finish - the process manually. - -When a cherry-pick or revert is in progress, then the transient -instead features the following suffix commands. - -- Key: A A (magit-sequence-continue) :: - - Resume the current cherry-pick or revert sequence. - -- Key: A s (magit-sequence-skip) :: - - Skip the stopped at commit during a cherry-pick or revert sequence. - -- Key: A a (magit-sequence-abort) :: - - Abort the current cherry-pick or revert sequence. This discards all - changes made since the sequence started. - -*** Reverting - -- Key: V (magit-revert) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - -When no cherry-pick or revert is in progress, then the transient -features the following suffix commands. - -- Key: V V (magit-revert-and-commit) :: - - Revert a commit by creating a new commit. Prompt for a commit, - defaulting to the commit at point. If the region selects multiple - commits, then revert all of them, without prompting. - -- Key: V v (magit-revert-no-commit) :: - - Revert a commit by applying it in reverse to the working tree. - Prompt for a commit, defaulting to the commit at point. If the - region selects multiple commits, then revert all of them, without - prompting. - -When a cherry-pick or revert is in progress, then the transient -instead features the following suffix commands. - -- Key: V V (magit-sequence-continue) :: - - Resume the current cherry-pick or revert sequence. - -- Key: V s (magit-sequence-skip) :: - - Skip the stopped at commit during a cherry-pick or revert sequence. - -- Key: V a (magit-sequence-abort) :: - - Abort the current cherry-pick or revert sequence. This discards all - changes made since the sequence started. - -** Resetting - -Also see [[man:git-reset]] - -- Key: x (magit-reset-quickly) :: - - Reset the ~HEAD~ and index to some commit read from the user and - defaulting to the commit at point, and possibly also reset the - working tree. With a prefix argument reset the working tree - otherwise don't. - -- Key: X m (magit-reset-mixed) :: - - Reset the ~HEAD~ and index to some commit read from the user and - defaulting to the commit at point. The working tree is kept as-is. - -- Key: X s (magit-reset-soft) :: - - Reset the ~HEAD~ to some commit read from the user and defaulting - to the commit at point. The index and the working tree are kept - as-is. - -- Key: X h (magit-reset-hard) :: - - Reset the ~HEAD~, index, and working tree to some commit read from the - user and defaulting to the commit at point. - -- Key: X k (magit-reset-keep) :: - - Reset the ~HEAD~, index, and working tree to some commit read from the - user and defaulting to the commit at point. Uncommitted changes are - kept as-is. - -- Key: X i (magit-reset-index) :: - - Reset the index to some commit read from the user and defaulting to - the commit at point. Keep the ~HEAD~ and working tree as-is, so if - the commit refers to the ~HEAD~, then this effectively unstages all - changes. - -- Key: X w (magit-reset-worktree) :: - - Reset the working tree to some commit read from the user and - defaulting to the commit at point. Keep the ~HEAD~ and index as-is. - -- Key: X f (magit-file-checkout) :: - - Update file in the working tree and index to the contents from a - revision. Both the revision and file are read from the user. - -** Stashing - -Also see [[man:git-stash]] - -- Key: z (magit-stash) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - -- Key: z z (magit-stash-both) :: - - Create a stash of the index and working tree. Untracked files are - included according to infix arguments. One prefix argument is - equivalent to ~--include-untracked~ while two prefix arguments are - equivalent to ~--all~. - -- Key: z i (magit-stash-index) :: - - Create a stash of the index only. Unstaged and untracked changes - are not stashed. - -- Key: z w (magit-stash-worktree) :: - - Create a stash of unstaged changes in the working tree. Untracked - files are included according to infix arguments. One prefix - argument is equivalent to ~--include-untracked~ while two prefix - arguments are equivalent to ~--all~. - -- Key: z x (magit-stash-keep-index) :: - - Create a stash of the index and working tree, keeping index intact. - Untracked files are included according to infix arguments. One - prefix argument is equivalent to ~--include-untracked~ while two - prefix arguments are equivalent to ~--all~. - -- Key: z Z (magit-snapshot-both) :: - - Create a snapshot of the index and working tree. Untracked files - are included according to infix arguments. One prefix argument is - equivalent to ~--include-untracked~ while two prefix arguments are - equivalent to ~--all~. - -- Key: z I (magit-snapshot-index) :: - - Create a snapshot of the index only. Unstaged and untracked changes - are not stashed. - -- Key: z W (magit-snapshot-worktree) :: - - Create a snapshot of unstaged changes in the working tree. - Untracked files are included according to infix arguments. One - prefix argument is equivalent to ~--include-untracked~ while two - prefix arguments are equivalent to ~--all~-. - -- Key: z a (magit-stash-apply) :: - - Apply a stash to the working tree. - - When using a Git release before v2.38.0, simply run ~git stash apply~ - or with a prefix argument ~git stash apply --index~. - - When using Git v2.38.0 or later, behave more intelligently: - - First try ~git stash apply --index~, which tries to preserve the - index stored in the stash, if any. This may fail because applying - the stash could result in conflicts and those have to be stored in - the index, making it impossible to also store the stash's index - there. - - If ~git stash~ fails, then potentially fall back to using ~git apply~. - If the stash does not touch any unstaged files, then pass ~--3way~ to - that command. Otherwise ask the user whether to use that argument - or ~--reject~. Customize ~magit-no-confirm~ if you want to fall back - to using ~--3way~, without being prompted. - -- Key: z p (magit-stash-pop) :: - - Apply a stash to the working tree. On complete success (if the - stash can be applied without any conflicts, and while preserving - the stash's index) then remove the stash from stash list. - - When using a Git release before v2.38.0, simply run ~git stash pop~ - or with a prefix argument ~git stash pop --index~. - - When using Git v2.38.0 or later, behave more intelligently: - - First try ~git stash pop --index~, which tries to preserve the index - stored in the stash, if any. This may fail because applying the - stash could result in conflicts and those have to be stored in the - index, making it impossible to also store the stash's index there. - - If ~git stash~ fails, then potentially fall back to using ~git apply~. - If the stash does not touch any unstaged files, then pass ~--3way~ to - that command. Otherwise ask the user whether to use that argument - or ~--reject~. Customize ~magit-no-confirm~ if you want to fall back - to using ~--3way~, without being prompted. - -- Key: z k (magit-stash-drop) :: - - Remove a stash from the stash list. When the region is active, offer - to drop all contained stashes. - -- Key: z v (magit-stash-show) :: - - Show all diffs of a stash in a buffer. - -- Key: z b (magit-stash-branch) :: - - Create and checkout a new branch from an existing stash. The new - branch starts at the commit that was current when the stash was - created. - -- Key: z B (magit-stash-branch-here) :: - - Create and checkout a new branch from an existing stash. Use the - current branch or ~HEAD~ as the starting-point of the new branch. - Then apply the stash, dropping it if it applies cleanly. - -- Key: z f (magit-stash-format-patch) :: - - Create a patch from STASH. - -- Key: k (magit-stash-clear) :: - - Remove all stashes saved in REF's reflog by deleting REF. - -- Key: z l (magit-stash-list) :: - - List all stashes in a buffer. - -- User Option: magit-stashes-margin :: - - This option specifies whether the margin is initially shown in - stashes buffers and how it is formatted. - - The value has the form ~(INIT STYLE WIDTH AUTHOR AUTHOR-WIDTH)~. - - - If INIT is non-~nil~, then the margin is shown initially. - - STYLE controls how to format the author or committer date. It can - be one of ~age~ (to show the age of the commit), ~age-abbreviated~ (to - abbreviate the time unit to a character), or a string (suitable - for ~format-time-string~) to show the actual date. Option - ~magit-log-margin-show-committer-date~ controls which date is being - displayed. - - WIDTH controls the width of the margin. This exists for forward - compatibility and currently the value should not be changed. - - AUTHOR controls whether the name of the author is also shown by - default. - - AUTHOR-WIDTH has to be an integer. When the name of the author - is shown, then this specifies how much space is used to do so. - -* Transferring -** Remotes -*** Remote Commands - -The transient prefix command ~magit-remote~ is used to add remotes and -to make changes to existing remotes. This command only deals with -remotes themselves, not with branches or the transfer of commits. -Those features are available from separate transient commands. - -Also see [[man:git-remote]] - -- Key: M (magit-remote) :: - - This transient prefix command binds the following suffix commands - and displays them in a temporary buffer until a suffix is invoked. - - By default it also binds and displays the values of some - remote-related Git variables and allows changing their values. - -- User Option: magit-remote-direct-configure :: - - This option controls whether remote-related Git variables are - accessible directly from the transient ~magit-remote~. - - If ~t~ (the default) and a local branch is checked out, then - ~magit-remote~ features the variables for the upstream remote of that - branch, or if ~HEAD~ is detached, for ~origin~, provided that exists. - - If ~nil~, then ~magit-remote-configure~ has to be used to do so. - -- Key: M C (magit-remote-configure) :: - - This transient prefix command binds commands that set the value of - remote-related variables and displays them in a temporary buffer - until the transient is exited. - - With a prefix argument, this command always prompts for a remote. - - Without a prefix argument this depends on whether it was invoked as - a suffix of ~magit-remote~ and on the ~magit-remote-direct-configure~ - option. If ~magit-remote~ already displays the variables for the - upstream, then it does not make sense to invoke another transient - that displays them for the same remote. In that case this command - prompts for a remote. - -The variables are described in [[*Remote Git Variables]]. - -- Key: M a (magit-remote-add) :: - - This command add a remote and fetches it. The remote name and url - are read in the minibuffer. - -- Key: M r (magit-remote-rename) :: - - This command renames a remote. Both the old and the new names are - read in the minibuffer. - -- Key: M u (magit-remote-set-url) :: - - This command changes the url of a remote. Both the remote and the - new url are read in the minibuffer. - -- Key: M k (magit-remote-remove) :: - - This command deletes a remote, read in the minibuffer. - -- Key: M p (magit-remote-prune) :: - - This command removes stale remote-tracking branches for a remote - read in the minibuffer. - -- Key: M P (magit-remote-prune-refspecs) :: - - This command removes stale refspecs for a remote read in the - minibuffer. - - A refspec is stale if there no longer exists at least one branch - on the remote that would be fetched due to that refspec. A stale - refspec is problematic because its existence causes Git to refuse - to fetch according to the remaining non-stale refspecs. - - If only stale refspecs remain, then this command offers to either - delete the remote or to replace the stale refspecs with the default - refspec ("+refs/heads/*:refs/remotes/REMOTE/*"). - - This command also removes the remote-tracking branches that were - created due to the now stale refspecs. Other stale branches are - not removed. - -- User Option: magit-remote-add-set-remote.pushDefault :: - - This option controls whether the user is asked whether they want to - set ~remote.pushDefault~ after adding a remote. - - If ~ask~, then users is always ask. If ~ask-if-unset~, then the user is - only if the variable isn't set already. If ~nil~, then the user isn't - asked and the variable isn't set. If the value is a string, then - the variable is set without the user being asked, provided that the - name of the added remote is equal to that string and the variable - isn't already set. - -*** Remote Git Variables - -These variables can be set from the transient prefix command -~magit-remote-configure~. By default they can also be set from -~magit-remote~. See [[*Remote Commands]]. - -- Variable: remote.NAME.url :: - - This variable specifies the url of the remote named NAME. It can - have multiple values. - -- Variable: remote.NAME.fetch :: - - The refspec used when fetching from the remote named NAME. It can - have multiple values. - -- Variable: remote.NAME.pushurl :: - - This variable specifies the url used for pushing to the remote - named NAME. If it is not specified, then ~remote.NAME.url~ is used - instead. It can have multiple values. - -- Variable: remote.NAME.push :: - - The refspec used when pushing to the remote named NAME. It can - have multiple values. - -- Variable: remote.NAME.tagOpts :: - - This variable specifies what tags are fetched by default. If the - value is ~--no-tags~ then no tags are fetched. If the value is - ~--tags~, then all tags are fetched. If this variable has no value, - then only tags are fetched that are reachable from fetched branches. - -** Fetching - -Also see [[man:git-fetch]] For information about the upstream and the -push-remote, see [[*The Two Remotes]]. - -- Key: f (magit-fetch) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - -- Key: f p (magit-fetch-from-pushremote) :: - - This command fetches from the current push-remote. - - With a prefix argument or when the push-remote is either not - configured or unusable, then let the user first configure the - push-remote. - -- Key: f u (magit-fetch-from-upstream) :: - - This command fetch from the upstream of the current branch. - - If the upstream is configured for the current branch and names - an existing remote, then use that. Otherwise try to use another - remote: If only a single remote is configured, then use that. - Otherwise if a remote named "origin" exists, then use that. - - If no remote can be determined, then this command is not available - from the ~magit-fetch~ transient prefix and invoking it directly - results in an error. - -- Key: f e (magit-fetch-other) :: - - This command fetch from a repository read from the minibuffer. - -- Key: f o (magit-fetch-branch) :: - - This command fetches a branch from a remote, both of which are read - from the minibuffer. - -- Key: f r (magit-fetch-refspec) :: - - This command fetches from a remote using an explicit refspec, both - of which are read from the minibuffer. - -- Key: f a (magit-fetch-all) :: - - This command fetches from all remotes. - -- Key: f m (magit-fetch-modules) :: - - This command fetches all submodules. With a prefix argument, it - acts as a transient prefix command, allowing the caller to set - options. - -- User Option: magit-pull-or-fetch :: - - By default fetch and pull commands are available from separate - transient prefix command. Setting this to ~t~ adds some (but not all) - of the above suffix commands to the ~magit-pull~ transient. - - If you do that, then you might also want to change the key binding - for these prefix commands, e.g.: - - #+BEGIN_SRC emacs-lisp - (setq magit-pull-or-fetch t) - (define-key magit-mode-map "f" 'magit-pull) ; was magit-fetch - (define-key magit-mode-map "F" nil) ; was magit-pull - #+END_SRC - -** Pulling - -Also see [[man:git-pull]] For information about the upstream and the -push-remote, see [[*The Two Remotes]]. - -- Key: F (magit-pull) :: - - This transient prefix command binds the following suffix commands - and displays them in a temporary buffer until a suffix is invoked. - -- Key: F p (magit-pull-from-pushremote) :: - - This command pulls from the push-remote of the current branch. - - With a prefix argument or when the push-remote is either not - configured or unusable, then let the user first configure the - push-remote. - -- Key: F u (magit-pull-from-upstream) :: - - This command pulls from the upstream of the current branch. - - With a prefix argument or when the upstream is either not - configured or unusable, then let the user first configure - the upstream. - -- Key: F e (magit-pull-branch) :: - - This command pulls from a branch read in the minibuffer. - -** Pushing - -Also see [[man:git-push]] For information about the upstream and the -push-remote, see [[*The Two Remotes]]. - -- Key: P (magit-push) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - -- Key: P p (magit-push-current-to-pushremote) :: - - This command pushes the current branch to its push-remote. - - With a prefix argument or when the push-remote is either not - configured or unusable, then let the user first configure the - push-remote. - -- Key: P u (magit-push-current-to-upstream) :: - - This command pushes the current branch to its upstream branch. - - With a prefix argument or when the upstream is either not - configured or unusable, then let the user first configure - the upstream. - -- Key: P e (magit-push-current) :: - - This command pushes the current branch to a branch read in the - minibuffer. - -- Key: P o (magit-push-other) :: - - This command pushes an arbitrary branch or commit somewhere. Both - the source and the target are read in the minibuffer. - -- Key: P r (magit-push-refspecs) :: - - This command pushes one or multiple refspecs to a remote, both of - which are read in the minibuffer. - - To use multiple refspecs, separate them with commas. Completion is - only available for the part before the colon, or when no colon is - used. - -- Key: P m (magit-push-matching) :: - - This command pushes all matching branches to another repository. - - If only one remote exists, then push to that. Otherwise prompt for - a remote, offering the remote configured for the current branch as - default. - -- Key: P t (magit-push-tags) :: - - This command pushes all tags to another repository. - - If only one remote exists, then push to that. Otherwise prompt for - a remote, offering the remote configured for the current branch as - default. - -- Key: P T (magit-push-tag) :: - - This command pushes a tag to another repository. - -One of the infix arguments, ~--force-with-lease~, deserves a word of -caution. It is passed without a value, which means "permit a force -push as long as the remote-tracking branches match their counterparts -on the remote end". If you've set up a tool to do automatic fetches -(Magit itself does not provide such functionality), using -~--force-with-lease~ can be dangerous because you don't actually -control or know the state of the remote-tracking refs. In that case, -you should consider setting ~push.useForceIfIncludes~ to ~true~ -(available since Git 2.30). - -Two more push commands exist, which by default are not available from -the push transient. See their doc-strings for instructions on how to -add them to the transient. - -- Command: magit-push-implicitly args :: - - This command pushes somewhere without using an explicit refspec. - - This command simply runs ~git push -v [ARGS]~. ARGS are the infix - arguments. No explicit refspec arguments are used. Instead the - behavior depends on at least these Git variables: ~push.default~, - ~remote.pushDefault~, ~branch..pushRemote~, - ~branch..remote~, ~branch..merge~, and - ~remote..push~. - - If you add this suffix to a transient prefix without explicitly - specifying the description, then an attempt is made to predict - what this command will do. For example: - - #+BEGIN_SRC emacs-lisp - (transient-insert-suffix 'magit-push \"p\" - '(\"i\" magit-push-implicitly))" - #+END_SRC - -- Command: magit-push-to-remote remote args :: - - This command pushes to the remote REMOTE without using an explicit - refspec. The remote is read in the minibuffer. - - This command simply runs ~git push -v [ARGS] REMOTE~. ARGS are the - infix arguments. No refspec arguments are used. Instead the - behavior depends on at least these Git variables: ~push.default~, - ~remote.pushDefault~, ~branch..pushRemote~, - ~branch..remote~, ~branch..merge~, and - ~remote..push~. - -** Plain Patches - -- Key: W (magit-patch) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - -- Key: W c (magit-patch-create) :: - - This command creates patches for a set commits. If the region marks - several commits, then it creates patches for all of them. Otherwise - it functions as a transient prefix command, which features several - infix arguments and binds itself as a suffix command. When this - command is invoked as a suffix of itself, then it creates a patch - using the specified infix arguments. - -- Key: w a (magit-patch-apply) :: - - This command applies a patch. This is a transient prefix command, - which features several infix arguments and binds itself as a suffix - command. When this command is invoked as a suffix of itself, then - it applies a patch using the specified infix arguments. - -- Key: W s (magit-patch-save) :: - - This command creates a patch from the current diff. - - Inside ~magit-diff-mode~ or ~magit-revision-mode~ buffers, ~C-x C-w~ is - also bound to this command. - -It is also possible to save a plain patch file by using ~C-x C-w~ inside -a ~magit-diff-mode~ or ~magit-revision-mode~ buffer. - -** Maildir Patches - -Also see [[man:git-am]] and [[man:git-apply]] - -- Key: w (magit-am) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - -- Key: w w (magit-am-apply-patches) :: - - This command applies one or more patches. If the region marks - files, then those are applied as patches. Otherwise this command - reads a file-name in the minibuffer, defaulting to the file at - point. - -- Key: w m (magit-am-apply-maildir) :: - - This command applies patches from a maildir. - -- Key: w a (magit-patch-apply) :: - - This command applies a plain patch. For a longer description see - [[*Plain Patches]]. This command is only available from the ~magit-am~ - transient for historic reasons. - -When an "am" operation is in progress, then the transient instead -features the following suffix commands. - -- Key: w w (magit-am-continue) :: - - This command resumes the current patch applying sequence. - -- Key: w s (magit-am-skip) :: - - This command skips the stopped at patch during a patch applying - sequence. - -- Key: w a (magit-am-abort) :: - - This command aborts the current patch applying sequence. This - discards all changes made since the sequence started. - -* Miscellaneous -** Tagging - -Also see [[man:git-tag]] - -- Key: t (magit-tag) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - -- Key: t t (magit-tag-create) :: - - This command creates a new tag with the given NAME at REV. With a - prefix argument it creates an annotated tag. - -- Key: t r (magit-tag-release) :: - - This commands creates a release tag. It assumes that release tags - match ~magit-release-tag-regexp~. - - First it prompts for the name of the new tag using the highest - existing tag as initial input and leaving it to the user to - increment the desired part of the version string. If you use - unconventional release tags or version numbers (e.g., - ~v1.2.3-custom.1~), you can set the ~magit-release-tag-regexp~ and - ~magit-tag-version-regexp-alist~ variables. - - If ~--annotate~ is enabled then it prompts for the message of the - new tag. The proposed tag message is based on the message of the - highest tag, provided that that contains the corresponding version - string and substituting the new version string for that. Otherwise - it proposes something like "Foo-Bar 1.2.3", given, for example, a - TAG "v1.2.3" and a repository located at something like - "/path/to/foo-bar". - -- Key: t k (magit-tag-delete) :: - - This command deletes one or more tags. If the region marks multiple - tags (and nothing else), then it offers to delete those. Otherwise, - it prompts for a single tag to be deleted, defaulting to the tag at - point. - -- Key: t p (magit-tag-prune) :: - - This command offers to delete tags missing locally from REMOTE, and - vice versa. - -** Notes - -Also see [[man:git-notes]] - -- Key: T (magit-notes) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - -- Key: T T (magit-notes-edit) :: - - Edit the note attached to a commit, defaulting to the commit at - point. - - By default use the value of Git variable ~core.notesRef~ or - "refs/notes/commits" if that is undefined. - -- Key: T r (magit-notes-remove) :: - - Remove the note attached to a commit, defaulting to the commit at - point. - - By default use the value of Git variable ~core.notesRef~ or - "refs/notes/commits" if that is undefined. - -- Key: T p (magit-notes-prune) :: - - Remove notes about unreachable commits. - -It is possible to merge one note ref into another. That may result in -conflicts which have to resolved in the temporary worktree -".git/NOTES_MERGE_WORKTREE". - -- Key: T m (magit-notes-merge) :: - - Merge the notes of a ref read from the user into the current notes - ref. The current notes ref is the value of Git variable - ~core.notesRef~ or "refs/notes/commits" if that is undefined. - -When a notes merge is in progress then the transient features the -following suffix commands, instead of those listed above. - -- Key: T c (magit-notes-merge-commit) :: - - Commit the current notes ref merge, after manually resolving - conflicts. - -- Key: T a (magit-notes-merge-abort) :: - - Abort the current notes ref merge. - -The following variables control what notes reference ~magit-notes-*~, -~git notes~ and ~git show~ act on and display. Both the local and global -values are displayed and can be modified. - -- Variable: core.notesRef :: - - This variable specifies the notes ref that is displayed by default - and which commands act on by default. - -- Variable: notes.displayRef :: - - This variable specifies additional notes ref to be displayed in - addition to the ref specified by ~core.notesRef~. It can have - multiple values and may end with ~*~ to display all refs in the - ~refs/notes/~ namespace (or ~**~ if some names contain slashes). - -** Submodules - -Also see [[man:git-submodule]] - -*** Listing Submodules - -The command ~magit-list-submodules~ displays a list of the current -repository's submodules in a separate buffer. It's also possible to -display information about submodules directly in the status buffer of -the super-repository by adding ~magit-insert-modules~ to the hook -~magit-status-sections-hook~ as described in [[*Status Module Sections]]. - -- Command: magit-list-submodules :: - - This command displays a list of the current repository's populated - submodules in a separate buffer. - - It can be invoked by pressing ~RET~ on the section titled "Modules". - -- User Option: magit-submodule-list-columns :: - - This option controls what columns are displayed by the command - ~magit-list-submodules~ and how they are displayed. - - Each element has the form ~(HEADER WIDTH FORMAT PROPS)~. - - HEADER is the string displayed in the header. WIDTH is the width - of the column. FORMAT is a function that is called with one - argument, the repository identification (usually its basename), - and with ~default-directory~ bound to the toplevel of its working - tree. It has to return a string to be inserted or ~nil~. PROPS is - an alist that supports the keys ~:right-align~, ~:pad-right~ and - ~:sort~. - - The ~:sort~ function has a weird interface described in the - docstring of ~tabulated-list--get-sort~. Alternatively ~<~ and - ~magit-repolist-version<~ can be used as those functions are - automatically replaced with functions that satisfy the interface. - Set ~:sort~ to ~nil~ to inhibit sorting; if unspecified, then the - column is sortable using the default sorter. - - You may wish to display a range of numeric columns using just one - character per column and without any padding between columns, in - which case you should use an appropriate HEADER, set WIDTH to 1, - and set ~:pad-right~ to 9. ~+~ is substituted for numbers higher than 9. - -*** Submodule Transient - -- Key: o (magit-submodule) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - -Some of the below commands default to act on the modules that are -selected using the region. For brevity their description talk about -"the selected modules", but if no modules are selected, then they act -on the current module instead, or if point isn't on a module, then the -read a single module to act on. With a prefix argument these commands -ignore the selection and the current module and instead act on all -suitable modules. - -- Key: o a (magit-submodule-add) :: - - This commands adds the repository at URL as a module. Optional PATH - is the path to the module relative to the root of the super-project. - If it is ~nil~ then the path is determined based on URL. - -- Key: o r (magit-submodule-register) :: - - This command registers the selected modules by copying their urls - from ".gitmodules" to "$GIT_DIR/config". These values can then be - edited before running ~magit-submodule-populate~. If you don't need - to edit any urls, then use the latter directly. - -- Key: o p (magit-submodule-populate) :: - - This command creates the working directory or directories of the - selected modules, checking out the recorded commits. - -- Key: o u (magit-submodule-update) :: - - This command updates the selected modules checking out the recorded - commits. - -- Key: o s (magit-submodule-synchronize) :: - - This command synchronizes the urls of the selected modules, copying - the values from ".gitmodules" to the ".git/config" of the - super-project as well those of the modules. - -- Key: o d (magit-submodule-unpopulate) :: - - This command removes the working directory of the selected modules. - -- Key: o l (magit-list-submodules) :: - - This command displays a list of the current repository's modules. - -- Key: o f (magit-fetch-modules) :: - - This command fetches all populated modules. With a prefix argument, - it acts as a transient prefix command, allowing the caller to set - options. - - Also fetch the super-repository, because ~git fetch~ does not - support not doing that. - -** Subtree - -Also see [[man:git-subtree]] - -- Key: O (magit-subtree) :: - - This transient prefix command binds the two sub-transients; one for - importing a subtree and one for exporting a subtree. - -- Key: O i (magit-subtree-import) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - - The suffixes of this command import subtrees. - - If the ~--prefix~ argument is set, then the suffix commands use that - prefix without prompting the user. If it is unset, then they read - the prefix in the minibuffer. - -- Key: O i a (magit-subtree-add) :: - - This command adds COMMIT from REPOSITORY as a new subtree at PREFIX. - -- Key: O i c (magit-subtree-add-commit) :: - - This command add COMMIT as a new subtree at PREFIX. - -- Key: O i m (magit-subtree-merge) :: - - This command merges COMMIT into the PREFIX subtree. - -- Key: O i f (magit-subtree-pull) :: - - This command pulls COMMIT from REPOSITORY into the PREFIX subtree. - -- Key: O e (magit-subtree-export) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - - The suffixes of this command export subtrees. - - If the ~--prefix~ argument is set, then the suffix commands use that - prefix without prompting the user. If it is unset, then they read - the prefix in the minibuffer. - -- Key: O e p (magit-subtree-push) :: - - This command extract the history of the subtree PREFIX and pushes it - to REF on REPOSITORY. - -- Key: O e s (magit-subtree-split) :: - - This command extracts the history of the subtree PREFIX. - -** Worktree - -Also see [[man:git-worktree]] - -- Key: Z (magit-worktree) :: - - This transient prefix command binds the following suffix commands - and displays them in a temporary buffer until a suffix is invoked. - -- Key: Z b (magit-worktree-checkout) :: - - Checkout BRANCH in a new worktree at PATH. - -- Key: Z c (magit-worktree-branch) :: - - Create a new BRANCH and check it out in a new worktree at PATH. - -- Key: Z m (magit-worktree-move) :: - - Move an existing worktree to a new PATH. - -- Key: Z k (magit-worktree-delete) :: - - Delete a worktree, defaulting to the worktree at point. - The primary worktree cannot be deleted. - -- Key: Z g (magit-worktree-status) :: - - Show the status for the worktree at point. - - If there is no worktree at point, then read one in the minibuffer. - If the worktree at point is the one whose status is already being - displayed in the current buffer, then show it in Dired instead. - -If you want the status buffer to list worktrees, add the function -~magit-insert-worktrees~ to ~magit-status-sections-hook~ as described -in [[*Status Sections]]. If there is only one worktree, this function -inserts nothing. - -** Sparse checkouts - -Sparse checkouts provide a way to restrict the working tree to a -subset of directories. See [[man:git-sparse-checkout]] - -*Warning*: Git introduced the ~git sparse-checkout~ command in version -2.25 and still advertises it as experimental and subject to change. -Magit's interface should be considered the same. In particular, if -Git introduces a backward incompatible change, Magit's sparse checkout -functionality may be updated in a way that requires a more recent Git -version. - -- Key: > (magit-sparse-checkout) :: - - This transient prefix command binds the following suffix commands - and displays them in a temporary buffer until a suffix is invoked. - -- Key: > e (magit-sparse-checkout-enable) :: - - This command initializes a sparse checkout that includes only the - files in the top-level directory. - - Note that ~magit-sparse-checkout-set~ and - ~magit-sparse-checkout-add~ automatically initialize a sparse - checkout if necessary. However, you may want to call - ~magit-sparse-checkout-enable~ explicitly to re-initialize a sparse - checkout after calling ~magit-sparse-checkout-disable~, to pass - additional arguments to ~git sparse-checkout init~, or to execute - the initialization asynchronously. - -- Key: > s (magit-sparse-checkout-set) :: - - This command takes a list of directories and configures the sparse - checkout to include only files in those subdirectories. Any - previously included directories are excluded unless they are in the - provided list of directories. - -- Key: > a (magit-sparse-checkout-add) :: - - This command is like ~magit-sparse-checkout-set~, but instead adds - the specified list of directories to the set of directories that is - already included in the sparse checkout. - -- Key: > r (magit-sparse-checkout-reapply) :: - - This command applies the currently configured sparse checkout - patterns to the working tree. This is useful to call if excluded - files have been checked out after operations such as merging or - rebasing. - -- Key: > d (magit-sparse-checkout-disable) :: - - This command restores the full checkout. To return to the previous - sparse checkout, call ~magit-sparse-checkout-enable~. - -A sparse checkout can also be initiated when cloning a repository by -using the ~magit-clone-sparse~ command in the ~magit-clone~ transient -(see [[*Cloning Repository]]). - -If you want the status buffer to indicate when a sparse checkout is -enabled, add the function ~magit-sparse-checkout-insert-header~ to -~magit-status-headers-hook~. - -** Bundle - -Also see [[man:git-bundle]] - -- Command: magit-bundle :: - - This transient prefix command binds several suffix commands for - running ~git bundle~ subcommands and displays them in a temporary - buffer until a suffix is invoked. - -** Common Commands - -- Command: magit-switch-to-repository-buffer :: -+ Command: magit-switch-to-repository-buffer-other-window :: -+ Command: magit-switch-to-repository-buffer-other-frame :: -+ Command: magit-display-repository-buffer :: - - These commands read any existing Magit buffer that belongs to the - current repository from the user and then switch to the selected - buffer (without refreshing it). - - The last variant uses ~magit-display-buffer~ to do so and thus - respects ~magit-display-buffer-function~. - -These are some of the commands that can be used in all buffers whose -major-modes derive from ~magit-mode~. There are other common commands -beside the ones below, but these didn't fit well anywhere else. - -- Key: C-w (magit-copy-section-value) :: - - This command saves the value of the current section to the - ~kill-ring~, and, provided that the current section is a commit, - branch, or tag section, it also pushes the (referenced) revision to - the ~magit-revision-stack~. - - When the current section is a branch or a tag, and a prefix argument - is used, then it saves the revision at its tip to the ~kill-ring~ - instead of the reference name. - - When the region is active, this command saves that to the - ~kill-ring~, like ~kill-ring-save~ would, instead of behaving as - described above. If a prefix argument is used and the region is - within a hunk, then it strips the diff marker column and keeps - only either the added or removed lines, depending on the sign of - the prefix argument. - -- Key: M-w (magit-copy-buffer-revision) :: - - This command saves the revision being displayed in the current buffer - to the ~kill-ring~ and also pushes it to the ~magit-revision-stack~. It - is mainly intended for use in ~magit-revision-mode~ buffers, the only - buffers where it is always unambiguous exactly which revision should - be saved. - - Most other Magit buffers usually show more than one revision, in - some way or another, so this command has to select one of them, and - that choice might not always be the one you think would have been - the best pick. - -Outside of Magit ~M-w~ and ~C-w~ are usually bound to ~kill-ring-save~ and -~kill-region~, and these commands would also be useful in Magit buffers. -Therefore when the region is active, then both of these commands -behave like ~kill-ring-save~ instead of as described above. - -** Wip Modes - -Git keeps *committed* changes around long enough for users to recover -changes they have accidentally deleted. It does so by not garbage -collecting any committed but no longer referenced objects for a -certain period of time, by default 30 days. - -But Git does *not* keep track of *uncommitted* changes in the working tree -and not even the index (the staging area). Because Magit makes it so -convenient to modify uncommitted changes, it also makes it easy to -shoot yourself in the foot in the process. - -For that reason Magit provides a global mode that saves *tracked* files -to work-in-progress references after or before certain actions. (At -present untracked files are never saved and for technical reasons -nothing is saved before the first commit has been created). - -Two separate work-in-progress references are used to track the state -of the index and of the working tree: ~refs/wip/index/~ and -~refs/wip/wtree/~, where ~~ is the full ref of the -current branch, e.g., ~refs/heads/master~. When the ~HEAD~ is detached -then ~HEAD~ is used in place of ~~. - -Checking out another branch (or detaching ~HEAD~) causes the use of -different wip refs for subsequent changes. - -- User Option: magit-wip-mode :: - - When this mode is enabled, then uncommitted changes are committed - to dedicated work-in-progress refs whenever appropriate (i.e., when - dataloss would be a possibility otherwise). - - Setting this variable directly does not take effect; either use the - Custom interface to do so or call the respective mode function. - -To view the log for a branch and its wip refs use the commands -~magit-wip-log~ and ~magit-wip-log-current~. You should use ~--graph~ when -using these commands. - -- Command: magit-wip-log :: - - This command shows the log for a branch and its wip refs. - With a negative prefix argument only the worktree wip ref is shown. - - The absolute numeric value of the prefix argument controls how many - "branches" of each wip ref are shown. This is only relevant if the - value of ~magit-wip-merge-branch~ is ~nil~. - -- Command: magit-wip-log-current :: - - This command shows the log for the current branch and its wip refs. - With a negative prefix argument only the worktree wip ref is shown. - - The absolute numeric value of the prefix argument controls how many - "branches" of each wip ref are shown. This is only relevant if the - value of ~magit-wip-merge-branch~ is ~nil~. - -- Key: X w (magit-reset-worktree) :: - - This command resets the working tree to some commit read from the - user and defaulting to the commit at point, while keeping the ~HEAD~ - and index as-is. - - This can be used to restore files to the state committed to a wip - ref. Note that this will discard any unstaged changes that might - have existed before invoking this command (but of course only after - committing that to the working tree wip ref). - -Note that even if you enable ~magit-wip-mode~ this won't give you -perfect protection. The most likely scenario for losing changes -despite the use of ~magit-wip-mode~ is making a change outside Emacs and -then destroying it also outside Emacs. In some such a scenario, -Magit, being an Emacs package, didn't get the opportunity to keep you -from shooting yourself in the foot. - -When you are unsure whether Magit did commit a change to the wip refs, -then you can explicitly request that all changes to all tracked files -are being committed. - -- Key: M-x magit-wip-commit :: - - This command commits all changes to all tracked files to the index - and working tree work-in-progress refs. Like the modes described above, - it does not commit untracked files, but it does check all tracked - files for changes. Use this command when you suspect that the modes - might have overlooked a change made outside Emacs/Magit. - -- User Option: magit-wip-namespace :: - - The namespace used for work-in-progress refs. It has to end with - a slash. The wip refs are named ~index/~ and - ~wtree/~. When snapshots are created while - the ~HEAD~ is detached then ~HEAD~ is used in place of ~~. - -- User Option: magit-wip-mode-lighter :: - - Mode-line lighter for ~magit-wip--mode~. - -*** Wip Graph - -- User Option: magit-wip-merge-branch :: - - This option controls whether the current branch is merged into the - wip refs after a new commit was created on the branch. - - If non-~nil~ and the current branch has new commits, then it is - merged into the wip ref before creating a new wip commit. This - makes it easier to inspect wip history and the wip commits are - never garbage collected. - - If ~nil~ and the current branch has new commits, then the wip ref - is reset to the tip of the branch before creating a new wip - commit. With this setting wip commits are eventually garbage - collected. - - If ~immediately~, then use ~git-commit-post-finish-hook~ to - create the merge commit. This is discouraged because it can - lead to a race condition, e.g., during rebases. - -When ~magit-wip-merge-branch~ is ~t~, then the history looks like this: - -#+begin_example - ,*--*--*--*--*--* refs/wip/index/refs/heads/master - / / / -A-----B-----C refs/heads/master -#+end_example - -When ~magit-wip-merge-branch~ is ~nil~, then creating a commit on the real -branch and then making a change causes the wip refs to be recreated to -fork from the new commit. But the old commits on the wip refs are not -lost. They are still available from the reflog. To make it easier to -see when the fork point of a wip ref was changed, an additional commit -with the message "restart autosaving" is created on it (~xxO~ commits -below are such boundary commits). - -Starting with - -#+begin_example - BI0---BI1 refs/wip/index/refs/heads/master - / -A---B refs/heads/master - \ - BW0---BW1 refs/wip/wtree/refs/heads/master -#+end_example - -and committing the staged changes and editing and saving a file would -result in - -#+begin_example - BI0---BI1 refs/wip/index/refs/heads/master - / -A---B---C refs/heads/master - \ \ - \ CW0---CW1 refs/wip/wtree/refs/heads/master - \ - BW0---BW1 refs/wip/wtree/refs/heads/master@{2} -#+end_example - -The fork-point of the index wip ref is not changed until some change -is being staged. Likewise just checking out a branch or creating a -commit does not change the fork-point of the working tree wip ref. The -fork-points are not adjusted until there actually is a change that -should be committed to the respective wip ref. - -** Commands for Buffers Visiting Files - -By default Magit defines a few global key bindings. These bindings -are a compromise between providing no bindings at all and providing -the better bindings I would have liked to use instead. Magit cannot -provide the set of recommended bindings by default because those key -sequences are strictly reserved for bindings added by the user. -Also see [[*Global Bindings]] and [[info:elisp#Key Binding Conventions]]. - -To use the recommended bindings, add this to your init file and -restart Emacs. - -#+begin_src emacs-lisp - (setq magit-define-global-key-bindings 'recommended) -#+end_src - -If you don't want Magit to add any bindings to the global keymap at -all, add this to your init file and restart Emacs. - -#+begin_src emacs-lisp - (setq magit-define-global-key-bindings nil) -#+end_src - -- Key: C-c f (magit-file-dispatch) :: -- Key: C-c f s (magit-stage-file) :: -- Key: C-c f s (magit-stage-buffer-file) :: -- Key: C-c f u (magit-unstage-file) :: -- Key: C-c f u (magit-unstage-buffer-file) :: -- Key: C-c f , x (magit-file-untrack) :: -- Key: C-c f , r (magit-file-rename) :: -- Key: C-c f , k (magit-file-delete) :: -- Key: C-c f , c (magit-file-checkout) :: -- Key: C-c f D (magit-diff) :: -- Key: C-c f d (magit-diff-buffer-file) :: -- Key: C-c f L (magit-log) :: -- Key: C-c f l (magit-log-buffer-file) :: -- Key: C-c f t (magit-log-trace-definition) :: -- Key: C-c f M (magit-log-merged) :: -- Key: C-c f B (magit-blame) :: -- Key: C-c f b (magit-blame-additions) :: -- Key: C-c f r (magit-blame-removal) :: -- Key: C-c f f (magit-blame-reverse) :: -- Key: C-c f m (magit-blame-echo) :: -- Key: C-c f q (magit-blame-quit) :: -- Key: C-c f p (magit-blob-previous) :: -- Key: C-c f n (magit-blob-next) :: -- Key: C-c f v (magit-find-file) :: -- Key: C-c f V (magit-blob-visit-file) :: -- Key: C-c f g (magit-status-here) :: -- Key: C-c f G (magit-display-repository-buffer) :: -- Key: C-c f c (magit-commit) :: -- Key: C-c f e (magit-edit-line-commit) :: - - Each of these commands is documented individually right below, - alongside their default key bindings. The bindings shown above - are the recommended bindings, which you can enable by following - the instructions further up. - -- Key: C-c M-g (magit-file-dispatch) :: - - This transient prefix command binds the following suffix commands - and displays them in a temporary buffer until a suffix is invoked. - -- Key: C-c M-g s (magit-stage-file) :: -- Key: C-c M-g s (magit-stage-buffer-file) :: - - Stage all changes to the file being visited in the current buffer. - When not visiting a file, then the first command is used, which - prompts for a file. - -- Key: C-c M-g u (magit-unstage-file) :: -- Key: C-c M-g u (magit-unstage-buffer-file) :: - - Unstage all changes to the file being visited in the current buffer. - When not visiting a file, then the first command is used, which - prompts for a file. - -- Key: C-c M-g , x (magit-file-untrack) :: - - This command untracks a file read from the user, defaulting to the - visited file. - -- Key: C-c M-g , r (magit-file-rename) :: - - This command renames a file read from the user, defaulting to the - visited file. - -- Key: C-c M-g , k (magit-file-delete) :: - - This command deletes a file read from the user, defaulting to the - visited file. - -- Key: C-c M-g , c (magit-file-checkout) :: - - This command updates a file in the working tree and index to the - contents from a revision. Both the revision and file are read - from the user. - -- Key: C-c M-g D (magit-diff) :: - - This transient prefix command binds several diff suffix commands and - infix arguments and displays them in a temporary buffer until a - suffix is invoked. See [[*Diffing]]. - - This is the same command that ~d~ is bound to in Magit buffers. - If this command is invoked from a file-visiting buffer, then the - initial value of the option (~--~) that limits the diff to certain - file(s) is set to the visited file. - -- Key: C-c M-g d (magit-diff-buffer-file) :: - - This command shows the diff for the file of blob that the current - buffer visits. - -- User Option: magit-diff-buffer-file-locked :: - - This option controls whether ~magit-diff-buffer-file~ uses a dedicated - buffer. See [[*Modes and Buffers]]. - -- Key: C-c M-g L (magit-log) :: - - This transient prefix command binds several log suffix commands and - infix arguments and displays them in a temporary buffer until a - suffix is invoked. See [[*Logging]]. - - This is the same command that ~l~ is bound to in Magit buffers. - If this command is invoked from a file-visiting buffer, then the - initial value of the option (~--~) that limits the log to certain - file(s) is set to the visited file. - -- Key: C-c M-g l (magit-log-buffer-file) :: - - This command shows the log for the file of blob that the current - buffer visits. Renames are followed when a prefix argument is used - or when ~--follow~ is an active log argument. When the region is - active, the log is restricted to the selected line range. - -- User Option: magit-log-buffer-file-locked :: - - This option controls whether ~magit-log-buffer-file~ uses a dedicated - buffer. See [[*Modes and Buffers]]. - -- Key: C-c M-g t (magit-log-trace-definition) :: - - This command shows the log for the definition at point. - -- Key: C-c M-g M (magit-log-merged) :: - - This command reads a commit and a branch in shows a log concerning - the merge of the former into the latter. This shows multiple commits - even in case of a fast-forward merge. - -- Key: C-c M-g B (magit-blame) :: - - This transient prefix command binds all blaming suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. - - For more information about this and the following commands also see - [[*Blaming]]. - - In addition to the ~magit-blame~ sub-transient, the dispatch transient - also binds several blaming suffix commands directly. See [[*Blaming]] - for information about those commands and bindings. - -- Key: C-c M-g p (magit-blob-previous) :: - - This command visits the previous blob which modified the current - file. - -- Key: C-c M-g n (magit-blob-next) :: - - This command visits the next blob which modified the current file. - -- Key: C-c M-g v (magit-find-file) :: - - This command reads a revision and file and visits the respective - blob. - -- Key: C-c M-g V (magit-blob-visit-file) :: - - This command visits the file from the working tree, corresponding - to the current blob. When visiting a blob or the version from the - index, then it goes to the same location in the respective file in - the working tree. - -- Key: C-c M-g g (magit-status-here) :: - - This command displays the status of the current repository in a - buffer, like ~magit-status~ does. Additionally it tries to go to - the position in that buffer, which corresponds to the position - in the current file-visiting buffer (if any). - - Before doing so, save all file-visiting buffers belonging to the - current repository without prompting. - -- Key: C-c M-g G (magit-display-repository-buffer) :: - - This command reads and displays a Magit buffer belonging to the - current repository, without refreshing it. - -- Key: C-c M-g c (magit-commit) :: - - This transient prefix command binds the following suffix commands - along with the appropriate infix arguments and displays them in a - temporary buffer until a suffix is invoked. See [[*Initiating a - Commit]]. - -- Key: C-c M-g e (magit-edit-line-commit) :: - - This command makes the commit editable that added the current line. - - With a prefix argument it makes the commit editable that removes the - line, if any. The commit is determined using ~git blame~ and made - editable using ~git rebase --interactive~ if it is reachable from - ~HEAD~, or by checking out the commit (or a branch that points at it) - otherwise. - -** Minor Mode for Buffers Visiting Blobs - -The ~magit-blob-mode~ enables certain Magit features in blob-visiting -buffers. Such buffers can be created using ~magit-find-file~ and some -of the commands mentioned below, which also take care of turning on -this minor mode. Currently this mode only establishes a few key -bindings, but this might be extended. - -- Key: p (magit-blob-previous) :: - - This command visits the previous blob that modified the current - file. - -- Key: n (magit-blob-next) :: - - This command visit the next blob that modified the current file. - -- Key: q (magit-bury-or-kill-buffer) :: - - This command buries the current buffer, if that is being displayed - in multiple windows and/or when a prefix argument is used. If - neither is the case, it instead kills the current buffer. - -You might want to bind ~u~ to another command. Suitable commands -include ~bury-buffer~, ~magit-bury-buffer~ and ~magit-kill-this-buffer~. - -* Customizing - -Both Git and Emacs are highly customizable. Magit is both a Git -porcelain as well as an Emacs package, so it makes sense to customize -it using both Git variables as well as Emacs options. However this -flexibility doesn't come without problems, including but not limited -to the following. - -- Some Git variables automatically have an effect in Magit without - requiring any explicit support. Sometimes that is desirable - in - other cases, it breaks Magit. - - When a certain Git setting breaks Magit but you want to keep using - that setting on the command line, then that can be accomplished by - overriding the value for Magit only by appending something like - ~("-c" "some.variable=compatible-value")~ to - ~magit-git-global-arguments~. - -- Certain settings like ~fetch.prune=true~ are respected by Magit - commands (because they simply call the respective Git command) but - their value is not reflected in the respective transient buffers. - In this case the ~--prune~ argument in ~magit-fetch~ might be active or - inactive, but that doesn't keep the Git variable from being honored - by the suffix commands anyway. So pruning might happen despite the - ~--prune~ arguments being displayed in a way that seems to indicate - that no pruning will happen. - -I intend to address these and similar issues in a future release. - -** Per-Repository Configuration - -Magit can be configured on a per-repository level using both Git -variables as well as Emacs options. - -To set a Git variable for one repository only, simply set it in -~/path/to/repo/.git/config~ instead of ~$HOME/.gitconfig~ or -~/etc/gitconfig~. See [[man:git-config]] - -Similarly, Emacs options can be set for one repository only by editing -~/path/to/repo/.dir-locals.el~. See [[info:emacs#Directory Variables]]. -For example to disable automatic refreshes of file-visiting buffers in -just one huge repository use this: - -- ~/path/to/huge/repo/.dir-locals.el~ - - #+BEGIN_SRC emacs-lisp - ((nil . ((magit-refresh-buffers . nil)))) - #+END_SRC - -It might only be costly to insert certain information into Magit -buffers for repositories that are exceptionally large, in which case -you can disable the respective section inserters just for that -repository: - -- ~/path/to/tag/invested/repo/.dir-locals.el~ - - #+BEGIN_SRC emacs-lisp - ((magit-status-mode - . ((eval . (magit-disable-section-inserter 'magit-insert-tags-header))))) - #+END_SRC - -# new list -- Function: magit-disable-section-inserter fn :: - - This function disables the section inserter FN in the current - repository. It is only intended for use in ~.dir-locals.el~ and - ~.dir-locals-2.el~. - -If you want to apply the same settings to several, but not all, -repositories then keeping the repository-local config files in sync -would quickly become annoying. To avoid that you can create config -files for certain classes of repositories (e.g., "huge repositories") -and then include those files in the per-repository config files. -For example: - -- ~/path/to/huge/repo/.git/config~ - - #+BEGIN_SRC conf - [include] - path = /path/to/huge-gitconfig - #+END_SRC - -- ~/path/to/huge-gitconfig~ - - #+BEGIN_SRC conf - [status] - showUntrackedFiles = no - #+END_SRC - -- ~$HOME/.emacs.d/init.el~ - - #+BEGIN_SRC emacs-lisp - (dir-locals-set-class-variables 'huge-git-repository - '((nil . ((magit-refresh-buffers . nil))))) - - (dir-locals-set-directory-class - "/path/to/huge/repo/" 'huge-git-repository) - #+END_SRC - -** Essential Settings - -The next three sections list and discuss several variables that many -users might want to customize, for safety and/or performance reasons. - -*** Safety - -This section discusses various variables that you might want to -change (or *not* change) for safety reasons. - -Git keeps *committed* changes around long enough for users to recover -changes they have accidentally been deleted. It does not do the same -for *uncommitted* changes in the working tree and not even the index -(the staging area). Because Magit makes it so easy to modify -uncommitted changes, it also makes it easy to shoot yourself in the -foot in the process. For that reason Magit provides three global -modes that save *tracked* files to work-in-progress references after or -before certain actions. See [[*Wip Modes]]. - -These modes are not enabled by default because of performance -concerns. Instead a lot of potentially destructive commands require -confirmation every time they are used. In many cases this can be -disabled by adding a symbol to ~magit-no-confirm~ (see [[*Completion and -Confirmation]]). If you enable the various wip modes then you should -add ~safe-with-wip~ to this list. - -Similarly it isn't necessary to require confirmation before moving a -file to the system trash - if you trashed a file by mistake then you -can recover it from there. Option ~magit-delete-by-moving-to-trash~ -controls whether the system trash is used, which is the case by default. -Nevertheless, ~trash~ isn't a member of ~magit-no-confirm~ - you -might want to change that. - -By default buffers visiting files are automatically reverted when the -visited file changes on disk. This isn't as risky as it might seem, -but to make an informed decision you should see [[*Risk of Reverting -Automatically]]. - -*** Performance - -After Magit has run ~git~ for side-effects, it also refreshes the -current Magit buffer and the respective status buffer. This is -necessary because otherwise outdated information might be displayed -without the user noticing. Magit buffers are updated by recreating -their content from scratch, which makes updating simpler and less -error-prone, but also more costly. Keeping it simple and just -re-creating everything from scratch is an old design decision and -departing from that will require major refactoring. - -Meanwhile you can tell Magit to only automatically refresh the current -Magit buffer, but not the status buffer. If you do that, then the -status buffer is only refreshed automatically if it is the -current buffer. - -#+begin_src emacs-lisp - (setq magit-refresh-status-buffer nil) -#+end_src - -You should also check whether any third-party packages have added -anything to ~magit-refresh-buffer-hook~, ~magit-pre-refresh-hook~, and -~magit-post-refresh-hook~. If so, then check whether those additions -impact performance significantly. - -Magit can be told to refresh buffers verbosely using ~M-x -magit-toggle-verbose-refresh~. Enabling this helps figuring out which -sections are bottlenecks. Each line printed to the ~*Messages*~ buffer -contains a section name, the number of seconds it took to show this -section, and from 0 to 2 exclamation marks: the more exclamation marks -the slower the section is. - -Magit also reverts buffers for visited files located inside the -current repository when the visited file changes on disk. That is -implemented on top of ~auto-revert-mode~ from the built-in library -~autorevert~. To figure out whether that impacts performance, check -whether performance is significantly worse, when many buffers exist -and/or when some buffers visit files using TRAMP. If so, then this -should help. - -#+begin_src emacs-lisp - (setq auto-revert-buffer-list-filter - 'magit-auto-revert-repository-buffer-p) -#+end_src - -For alternative approaches see [[*Automatic Reverting of File-Visiting -Buffers]]. - -If you have enabled any features that are disabled by default, then -you should check whether they impact performance significantly. It's -likely that they were not enabled by default because it is known that -they reduce performance at least in large repositories. - -If performance is only slow inside certain unusually large -repositories, then you might want to disable certain features on a -per-repository or per-repository-class basis only. See -[[*Per-Repository Configuration]]. For example it takes a long time to -determine the next and current tag in repository with exceptional -numbers of tags. It would therefore be a good idea to disable -~magit-insert-tags-headers~, as explained at the mentioned node. - -**** Log Performance -:PROPERTIES: -:UNNUMBERED: notoc -:END: - -When showing logs, Magit limits the number of commits initially shown -in the hope that this avoids unnecessary work. When ~--graph~ is -used, then this unfortunately does not have the desired effect for -large histories. Junio, Git's maintainer, said on the Git mailing -list (https://www.spinics.net/lists/git/msg232230.html): "~--graph~ wants -to compute the whole history and the max-count only affects the output -phase after ~--graph~ does its computation". - -In other words, it's not that Git is slow at outputting the -differences, or that Magit is slow at parsing the output - the problem -is that Git first goes outside and has a smoke. - -We actually work around this issue by limiting the number of commits -not only by using ~-~ but by also using a range. But unfortunately -that's not always possible. - -When more than a few thousand commits are shown, then the use of -~--graph~ can slow things down. - -Using ~--color --graph~ is even slower. Magit uses code that is part of -Emacs to turn control characters into faces. That code is pretty slow -and this is quite noticeable when showing a log with many branches and -merges. For that reason ~--color~ is not enabled by default anymore. -Consider leaving it at that. - -**** Diff Performance -:PROPERTIES: -:UNNUMBERED: notoc -:END: - -If diffs are slow, then consider turning off some optional diff -features by setting all or some of the following variables to ~nil~: -~magit-diff-highlight-indentation~, ~magit-diff-highlight-trailing~, -~magit-diff-paint-whitespace~, ~magit-diff-highlight-hunk-body~, and -~magit-diff-refine-hunk~. - -When showing a commit instead of some arbitrary diff, then some -additional information is displayed. Calculating this information -can be quite expensive given certain circumstances. If looking at -a commit using ~magit-revision-mode~ takes considerably more time than -looking at the same commit in ~magit-diff-mode~, then consider setting -~magit-revision-insert-related-refs~ to ~nil~. - -When you are often confronted with diffs that contain deleted files, -then you might want to enable the ~--irreversible-delete~ argument. If -you do that then diffs still show that a file was deleted but without -also showing the complete deleted content of the file. This argument -is not available by default, see [[info:transient#Enabling and Disabling -Suffixes]]. Once you have done that you should enable it and save that -setting, see [[info:transient#Saving Values]]. You should do this in both -the diff (~d~) and the diff refresh (~D~) transient popups. - -**** Refs Buffer Performance -:PROPERTIES: -:UNNUMBERED: notoc -:END: - -When refreshing the "references buffer" is slow, then that's usually -because several hundred refs are being displayed. The best way to -address that is to display fewer refs, obviously. - -If you are not, or only mildly, interested in seeing the list of tags, -then start by not displaying them: - -#+begin_src emacs-lisp - (remove-hook 'magit-refs-sections-hook 'magit-insert-tags) -#+end_src - -Then you should also make sure that the listed remote branches -actually all exist. You can do so by pruning branches which no longer -exist using ~f-pa~. - -**** Committing Performance -:PROPERTIES: -:UNNUMBERED: notoc -:END: - -When you initiate a commit, then Magit by default automatically shows -a diff of the changes you are about to commit. For large commits this -can take a long time, which is especially distracting when you are -committing large amounts of generated data which you don't actually -intend to inspect before committing. This behavior can be turned off -using: - -#+begin_src emacs-lisp - (remove-hook 'server-switch-hook 'magit-commit-diff) - (remove-hook 'with-editor-filter-visit-hook 'magit-commit-diff) -#+end_src - -Then you can type ~C-c C-d~ to show the diff when you actually want to -see it, but only then. Alternatively you can leave the hook alone and -just type ~C-g~ in those cases when it takes too long to generate the -diff. If you do that, then you will end up with a broken diff buffer, -but doing it this way has the advantage that you usually get to see -the diff, which is useful because it increases the odds that you spot -potential issues. - -**** Microsoft Windows Performance - -In order to update the status buffer, ~git~ has to be run a few dozen -times. That is problematic on Microsoft Windows, because that -operating system is exceptionally slow at starting processes. Sadly -this is an issue that can only be fixed by Microsoft itself, and they -don't appear to be particularly interested in doing so. - -Beside the subprocess issue, there are also other Windows-specific -performance issues. Some of these have workarounds. The -maintainers of "Git for Windows" try to improve performance on Windows. -Always use the latest release in order to benefit from the latest -performance tweaks. Magit too tries to work around some -Windows-specific issues. - -According to some sources, setting the following Git variables can also -help. - -#+begin_src shell-script - git config --global core.preloadindex true # default since v2.1 - git config --global core.fscache true # default since v2.8 - git config --global gc.auto 256 -#+end_src - -You should also check whether an anti-virus program is affecting -performance. - -**** MacOS Performance - -Before Emacs 26.1 child processes were created using ~fork~ on macOS. -That needlessly copied GUI resources, which is expensive. The result -was that forking took about 30 times as long on Darwin than on Linux, -and because Magit starts many ~git~ processes that made quite a -difference. - -So make sure that you are using at least Emacs 26.1, in which case the -faster ~vfork~ will be used. (The creation of child processes still -takes about twice as long on Darwin compared to Linux.) See [fn:mac1] -for more information. - -Additionally, ~git~ installed from a package manager like ~brew~ or ~nix~ -seems to be slower than the native executable. Profile the ~git~ -executable you're running against the one at ~/usr/bin/git~, and if -you notice a notable difference try using the latter as -~magit-git-executable~. - -[fn:mac1] https://lists.gnu.org/archive/html/bug-gnu-emacs/2017-04/msg00201.html - -*** Global Bindings - -- User Option: magit-define-global-key-bindings :: - - This option controls which set of Magit key bindings, if any, may - be added to the global keymap, even before Magit is first used in - the current Emacs session. - - - If the value is ~nil~, no bindings are added. - - - If ~default~, maybe add: - - | ~C-x g~ | ~magit-status~ | - | ~C-x M-g~ | ~magit-dispatch~ | - | ~C-c M-g~ | ~magit-file-dispatch~ | - - - If ~recommended~, maybe add: - - | ~C-x g~ | ~magit-status~ | - | ~C-c g~ | ~magit-dispatch~ | - | ~C-c f~ | ~magit-file-dispatch~ | - - These bindings are strongly recommended, but we cannot use - them by default, because the ~C-c ~ namespace is - strictly reserved for bindings added by the user (see - [[info:elisp#Key Binding Conventions]]). - - The bindings in the chosen set may be added when - ~after-init-hook~ is run. Each binding is added if, and only - if, at that time no other key is bound to the same command, - and no other command is bound to the same key. In other words - we try to avoid adding bindings that are unnecessary, as well - as bindings that conflict with other bindings. - - Adding these bindings is delayed until ~after-init-hook~ is - run to allow users to set the variable anywhere in their init - file (without having to make sure to do so before ~magit~ is - loaded or autoloaded) and to increase the likelihood that all - the potentially conflicting user bindings have already been - added. - - To set this variable use either ~setq~ or the Custom interface. - Do not use the function ~customize-set-variable~ because doing - that would cause Magit to be loaded immediately, when that form - is evaluated (this differs from ~custom-set-variables~, which - doesn't load the libraries that define the customized variables). - - Setting this variable has no effect if ~after-init-hook~ has - already been run. - -* Plumbing - -The following sections describe how to use several of Magit's core -abstractions to extend Magit itself or implement a separate extension. - -A few of the low-level features used by Magit have been factored out -into separate libraries/packages, so that they can be used by other -packages, without having to depend on Magit. See [[info:with-editor]] for -information about ~with-editor~. ~transient~ doesn't have a manual yet. - -If you are trying to find an unused key that you can bind to a -command provided by your own Magit extension, then checkout -https://github.com/magit/magit/wiki/Plugin-Dispatch-Key-Registry. - -** Calling Git - -Magit provides many specialized functions for calling Git. All of -these functions are defined in either ~magit-git.el~ or ~magit-process.el~ -and have one of the prefixes ~magit-run-~, ~magit-call-~, ~magit-start-~, -or ~magit-git-~ (which is also used for other things). - -All of these functions accept an indefinite number of arguments, which -are strings that specify command line arguments for Git (or in some -cases an arbitrary executable). These arguments are flattened before -being passed on to the executable; so instead of strings they can also -be lists of strings and arguments that are ~nil~ are silently dropped. -Some of these functions also require a single mandatory argument -before these command line arguments. - -Roughly speaking, these functions run Git either to get some value or -for side-effects. The functions that return a value are useful to -collect the information necessary to populate a Magit buffer, while -the others are used to implement Magit commands. - -The functions in the value-only group always run synchronously, and -they never trigger a refresh. The function in the side-effect group -can be further divided into subgroups depending on whether they run -Git synchronously or asynchronously, and depending on whether they -trigger a refresh when the executable has finished. - -*** Getting a Value from Git - -These functions run Git in order to get a value, an exit -status, or output. Of course you could also use them to run Git -commands that have side-effects, but that should be avoided. - -- Function: magit-git-exit-code &rest args :: - - Executes git with ARGS and returns its exit code. - -- Function: magit-git-success &rest args :: - - Executes git with ARGS and returns ~t~ if the exit code is ~0~, ~nil~ - otherwise. - -- Function: magit-git-failure &rest args :: - - Executes git with ARGS and returns ~t~ if the exit code is ~1~, ~nil~ - otherwise. - -- Function: magit-git-true &rest args :: - - Executes git with ARGS and returns ~t~ if the first line printed by - git is the string "true", ~nil~ otherwise. - -- Function: magit-git-false &rest args :: - - Executes git with ARGS and returns ~t~ if the first line printed by - git is the string "false", ~nil~ otherwise. - -- Function: magit-git-insert &rest args :: - - Executes git with ARGS and inserts its output at point. - -- Function: magit-git-string &rest args :: - - Executes git with ARGS and returns the first line of its output. If - there is no output or if it begins with a newline character, then - this returns ~nil~. - -- Function: magit-git-lines &rest args :: - - Executes git with ARGS and returns its output as a list of lines. - Empty lines anywhere in the output are omitted. - -- Function: magit-git-items &rest args :: - - Executes git with ARGS and returns its null-separated output as a - list. Empty items anywhere in the output are omitted. - - If the value of option ~magit-git-debug~ is non-~nil~ and git exits with - a non-zero exit status, then warn about that in the echo area and - add a section containing git's standard error in the current - repository's process buffer. - -- Function: magit-process-git destination &rest args :: - - Calls Git synchronously in a separate process, returning its exit - code. DESTINATION specifies how to handle the output, like for - ~call-process~, except that file handlers are supported. Enables - Cygwin's "noglob" option during the call and ensures unix eol - conversion. - -- Function: magit-process-file process &optional infile buffer display &rest args :: - - Processes files synchronously in a separate process. Identical to - ~process-file~ but temporarily enables Cygwin's "noglob" option during - the call and ensures unix eol conversion. - -If an error occurs when using one of the above functions, then that -is usually due to a bug, i.e., using an argument which is not -actually supported. Such errors are usually not reported, but when -they occur we need to be able to debug them. - -- User Option: magit-git-debug :: - - Whether to report errors that occur when using ~magit-git-insert~, - ~magit-git-string~, ~magit-git-lines~, or ~magit-git-items~. This does - not actually raise an error. Instead a message is shown in the echo - area, and git's standard error is insert into a new section in the - current repository's process buffer. - -- Function: magit-git-str &rest args :: - - This is a variant of ~magit-git-string~ that ignores the option - ~magit-git-debug~. It is mainly intended to be used while handling - errors in functions that do respect that option. Using such a - function while handing an error could cause yet another error and - therefore lead to an infinite recursion. You probably won't ever - need to use this function. - -*** Calling Git for Effect - -These functions are used to run git to produce some effect. Most -Magit commands that actually run git do so by using such a function. - -Because we do not need to consume git's output when using these -functions, their output is instead logged into a per-repository -buffer, which can be shown using ~$~ from a Magit buffer or ~M-x -magit-process~ elsewhere. - -These functions can have an effect in two distinct ways. Firstly, -running git may change something, i.e., create or push a new commit. -Secondly, that change may require that Magit buffers are refreshed to -reflect the changed state of the repository. But refreshing isn't -always desirable, so only some of these functions do perform such a -refresh after git has returned. - -Sometimes it is useful to run git asynchronously. For example, when -the user has just initiated a push, then there is no reason to make -her wait until that has completed. In other cases it makes sense to -wait for git to complete before letting the user do something else. -For example after staging a change it is useful to wait until after -the refresh because that also automatically moves to the next change. - -The synchronous functions return the exit code, while the asynchronous -functions return the process object. - -- Function: magit-call-git &rest args :: - - Calls git synchronously with ARGS. - -- Function: magit-call-process program &rest args :: - - Calls PROGRAM synchronously with ARGS. - -- Function: magit-run-git &rest args :: - - Calls git synchronously with ARGS and then refreshes. - -- Function: magit-run-git-with-input &rest args :: - - Calls git synchronously with ARGS and sends it the content of the - current buffer on standard input. - - If the current buffer's ~default-directory~ is on a remote - filesystem, this function actually runs git asynchronously. But - then it waits for the process to return, so the function itself is - synchronous. - -- Function: magit-git &rest args :: - - Calls git synchronously with ARGS for side-effects only. This - function does not refresh the buffer. - -- Function: magit-git-wash washer &rest args :: - - Execute Git with ARGS, inserting washed output at point. Actually - first insert the raw output at point. If there is no output call - ~magit-cancel-section~. Otherwise temporarily narrow the buffer to - the inserted text, move to its beginning, and then call function - WASHER with ARGS as its sole argument. - -And now for the asynchronous variants. - -- Function: magit-run-git-async &rest args :: - - Start Git, prepare for refresh, and return the process object. - ARGS is flattened and then used as arguments to Git. - - Display the command line arguments in the echo area. - - After Git returns some buffers are refreshed: the buffer that was - current when this function was called (if it is a Magit buffer and - still alive), as well as the respective Magit status buffer. - Unmodified buffers visiting files that are tracked in the current - repository are reverted if ~magit-revert-buffers~ is non-~nil~. - -- Function: magit-run-git-with-editor &rest args :: - - Export GIT_EDITOR and start Git. Also prepare for refresh and - return the process object. ARGS is flattened and then used as - arguments to Git. - - Display the command line arguments in the echo area. - - After Git returns some buffers are refreshed: the buffer that was - current when this function was called (if it is a Magit buffer and - still alive), as well as the respective Magit status buffer. - -- Function: magit-start-git input &rest args :: - - Start Git, prepare for refresh, and return the process object. - - If INPUT is non-~nil~, it has to be a buffer or the name of an - existing buffer. The buffer content becomes the processes - standard input. - - Option ~magit-git-executable~ specifies the Git executable and option - ~magit-git-global-arguments~ specifies constant arguments. The - remaining arguments ARGS specify arguments to Git. They are - flattened before use. - - After Git returns, some buffers are refreshed: the buffer that was - current when this function was called (if it is a Magit buffer and - still alive), as well as the respective Magit status buffer. - Unmodified buffers visiting files that are tracked in the current - repository are reverted if ~magit-revert-buffers~ is non-~nil~. - -- Function: magit-start-process &rest args :: - - Start PROGRAM, prepare for refresh, and return the process object. - - If optional argument INPUT is non-~nil~, it has to be a buffer or - the name of an existing buffer. The buffer content becomes the - processes standard input. - - The process is started using ~start-file-process~ and then setup to - use the sentinel ~magit-process-sentinel~ and the filter - ~magit-process-filter~. Information required by these functions is - stored in the process object. When this function returns the - process has not started to run yet so it is possible to override the - sentinel and filter. - - After the process returns, ~magit-process-sentinel~ refreshes the - buffer that was current when ~magit-start-process~ was called (if it - is a Magit buffer and still alive), as well as the respective Magit - status buffer. Unmodified buffers visiting files that are tracked - in the current repository are reverted if ~magit-revert-buffers~ is - non-~nil~. - -- Variable: magit-this-process :: - - The child process which is about to start. This can be used to - change the filter and sentinel. - -- Variable: magit-process-raise-error :: - - When this is non-~nil~, then ~magit-process-sentinel~ raises an error if - git exits with a non-zero exit status. For debugging purposes. - -** Section Plumbing -*** Creating Sections - -- Macro: magit-insert-section &rest args :: - - Insert a section at point. - - TYPE is the section type, a symbol. Many commands that act on the - current section behave differently depending on that type. Also if - a variable ~magit-TYPE-section-map~ exists, then use that as the - text-property ~keymap~ of all text belonging to the section (but this - may be overwritten in subsections). TYPE can also have the form - ~(eval FORM)~ in which case FORM is evaluated at runtime. - - Optional VALUE is the value of the section, usually a string that is - required when acting on the section. - - When optional HIDE is non-~nil~ collapse the section body by default, - i.e., when first creating the section, but not when refreshing the - buffer. Otherwise, expand it by default. This can be overwritten using - ~magit-section-set-visibility-hook~. When a section is recreated - during a refresh, then the visibility of predecessor is inherited - and HIDE is ignored (but the hook is still honored). - - BODY is any number of forms that actually insert the section's - heading and body. Optional NAME, if specified, has to be a symbol, - which is then bound to the struct of the section being inserted. - - Before BODY is evaluated the ~start~ of the section object is set to - the value of ~point~ and after BODY was evaluated its ~end~ is set to - the new value of ~point~; BODY is responsible for moving ~point~ - forward. - - If it turns out inside BODY that the section is empty, then - ~magit-cancel-section~ can be used to abort and remove all traces of - the partially inserted section. This can happen when creating a - section by washing Git's output and Git didn't actually output - anything this time around. - -- Function: magit-insert-heading &rest args :: - - Insert the heading for the section currently being inserted. - - This function should only be used inside ~magit-insert-section~. - - When called without any arguments, then just set the ~content~ slot of - the object representing the section being inserted to a marker at - ~point~. The section should only contain a single line when this - function is used like this. - - When called with arguments ARGS, which have to be strings, then - insert those strings at point. The section should not contain any - text before this happens and afterwards it should again only contain - a single line. If the ~face~ property is set anywhere inside any of - these strings, then insert all of them unchanged. Otherwise use the - ~magit-section-heading~ face for all inserted text. - - The ~content~ property of the section struct is the end of the heading - (which lasts from ~start~ to ~content~) and the beginning of the body - (which lasts from ~content~ to ~end~). If the value of ~content~ is ~nil~, - then the section has no heading and its body cannot be collapsed. - If a section does have a heading then its height must be exactly one - line, including a trailing newline character. This isn't enforced; - you are responsible for getting it right. The only exception is - that this function does insert a newline character if necessary. - -- Function: magit-cancel-section :: - - Cancel the section currently being inserted. This exits the - innermost call to ~magit-insert-section~ and removes all traces of - what has already happened inside that call. - -- Function: magit-define-section-jumper sym title &optional value :: - - Define an interactive function to go to section SYM. TITLE is the - displayed title of the section. - -*** Section Selection - -- Function: magit-current-section :: - - Return the section at point. - -- Function: magit-region-sections &optional condition multiple :: - - Return a list of the selected sections. - - When the region is active and constitutes a valid section - selection, then return a list of all selected sections. This is - the case when the region begins in the heading of a section and - ends in the heading of the same section or in that of a sibling - section. If optional MULTIPLE is non-~nil~, then the region cannot - begin and end in the same section. - - When the selection is not valid, then return ~nil~. In this case, - most commands that can act on the selected sections will instead - act on the section at point. - - When the region looks like it would in any other buffer then - the selection is invalid. When the selection is valid then the - region uses the ~magit-section-highlight~ face. This does not - apply to diffs where things get a bit more complicated, but even - here if the region looks like it usually does, then that's not - a valid selection as far as this function is concerned. - - If optional CONDITION is non-~nil~, then the selection not only - has to be valid; all selected sections additionally have to match - CONDITION, or ~nil~ is returned. See ~magit-section-match~ for the - forms CONDITION can take. - -- Function: magit-region-values &optional condition multiple :: - - Return a list of the values of the selected sections. - - Return the values that themselves would be returned by - ~magit-region-sections~ (which see). - -*** Matching Sections - -- Key: M-x magit-describe-section-briefly :: - - Show information about the section at point. This command is - intended for debugging purposes. - -- Function: magit-section-ident section :: - - Return an unique identifier for SECTION. The return value has the - form ~((TYPE . VALUE)...)~. - -- Function: magit-get-section ident &optional root :: - - Return the section identified by IDENT. IDENT has to be a list as - returned by ~magit-section-ident~. - -- Function: magit-section-match condition &optional section :: - - Return ~t~ if SECTION matches CONDITION. - SECTION defaults to the section at point. If SECTION is not - specified and there also is no section at point, then return - ~nil~. - - CONDITION can take the following forms: - - ~(CONDITION...)~ - - matches if any of the CONDITIONs matches. - - - ~[CLASS...]~ - - matches if the section's class is the same - as the first CLASS or a subclass of that; - the section's parent class matches the - second CLASS; and so on. - - - ~[* CLASS...]~ - - matches sections that match ~[CLASS...]~ and - also recursively all their child sections. - - - ~CLASS~ - - matches if the section's class is the same - as CLASS or a subclass of that; regardless - of the classes of the parent sections. - - Each CLASS should be a class symbol, identifying a class that - derives from ~magit-section~. For backward compatibility CLASS - can also be a "type symbol". A section matches such a symbol - if the value of its ~type~ slot is ~eq~. If a type symbol has - an entry in ~magit--section-type-alist~, then a section also - matches that type if its class is a subclass of the class that - corresponds to the type as per that alist. - - Note that it is not necessary to specify the complete section - lineage as printed by ~magit-describe-section-briefly~, unless - of course you want to be that precise. - -- Function: magit-section-value-if condition &optional section :: - - If the section at point matches CONDITION, then return its value. - - If optional SECTION is non-~nil~ then test whether that matches - instead. If there is no section at point and SECTION is ~nil~, - then return ~nil~. If the section does not match, then return - ~nil~. - - See ~magit-section-match~ for the forms CONDITION can take. - -- Function: magit-section-case &rest clauses :: - - Choose among clauses on the type of the section at point. - - Each clause looks like (CONDITION BODY...). The type of the - section is compared against each CONDITION; the BODY forms of the - first match are evaluated sequentially and the value of the last - form is returned. Inside BODY the symbol ~it~ is bound to the - section at point. If no clause succeeds or if there is no - section at point return ~nil~. - - See ~magit-section-match~ for the forms CONDITION can take. - Additionally a CONDITION of ~t~ is allowed in the final clause and - matches if no other CONDITION match, even if there is no section at - point. - -- Variable: magit-root-section :: - - The root section in the current buffer. All other sections are - descendants of this section. The value of this variable is set by - ~magit-insert-section~ and you should never modify it. - -For diff related sections a few additional tools exist. - -- Function: magit-diff-type &optional section :: - - Return the diff type of SECTION. - - The returned type is one of the symbols ~staged~, ~unstaged~, ~committed~, - or ~undefined~. This type serves a similar purpose as the general - type common to all sections (which is stored in the ~type~ slot of the - corresponding ~magit-section~ struct) but takes additional information - into account. When the SECTION isn't related to diffs and the - buffer containing it also isn't a diff-only buffer, then return ~nil~. - - Currently the type can also be one of ~tracked~ and ~untracked~, but - these values are not handled explicitly in every place they should - be. A possible fix could be to just return ~nil~ here. - - The section has to be a ~diff~ or ~hunk~ section, or a section whose - children are of type ~diff~. If optional SECTION is ~nil~, return the - diff type for the current section. In buffers whose major mode is - ~magit-diff-mode~ SECTION is ignored and the type is determined using - other means. In ~magit-revision-mode~ buffers the type is always - ~committed~. - -- Function: magit-diff-scope &optional section strict :: - - Return the diff scope of SECTION or the selected section(s). - - A diff's "scope" describes what part of a diff is selected, it is a - symbol, one of ~region~, ~hunk~, ~hunks~, ~file~, ~files~, or ~list~. Do not - confuse this with the diff "type", as returned by ~magit-diff-type~. - - If optional SECTION is non-~nil~, then return the scope of that, - ignoring the sections selected by the region. Otherwise return the - scope of the current section, or if the region is active and selects - a valid group of diff related sections, the type of these sections, - i.e., ~hunks~ or ~files~. If SECTION (or if the current section that - is ~nil~) is a ~hunk~ section and the region starts and ends inside - the body of a that section, then the type is ~region~. - - If optional STRICT is non-~nil~ then return ~nil~ if the diff type of - the section at point is ~untracked~ or the section at point is not - actually a ~diff~ but a ~diffstat~ section. - -** Refreshing Buffers - -All commands that create a new Magit buffer or change what is being -displayed in an existing buffer do so by calling ~magit-mode-setup~. -Among other things, that function sets the buffer local values of -~default-directory~ (to the top-level of the repository), -~magit-refresh-function~, and ~magit-refresh-args~. - -Buffers are refreshed by calling the function that is the local value -of ~magit-refresh-function~ (a function named ~magit-*-refresh-buffer~, -where ~*~ may be something like ~diff~) with the value of -~magit-refresh-args~ as arguments. - -- Macro: magit-mode-setup buffer switch-func mode refresh-func &optional refresh-args :: - - This function displays and selects BUFFER, turns on MODE, and - refreshes a first time. - - This function displays and optionally selects BUFFER by calling - ~magit-mode-display-buffer~ with BUFFER, MODE and SWITCH-FUNC as - arguments. Then it sets the local value of ~magit-refresh-function~ - to REFRESH-FUNC and that of ~magit-refresh-args~ to REFRESH-ARGS. - Finally it creates the buffer content by calling REFRESH-FUNC with - REFRESH-ARGS as arguments. - - All arguments are evaluated before switching to BUFFER. - -- Function: magit-mode-display-buffer buffer mode &optional switch-function :: - - This function display BUFFER in some window and select it. BUFFER - may be a buffer or a string, the name of a buffer. The buffer is - returned. - - Unless BUFFER is already displayed in the selected frame, store the - previous window configuration as a buffer local value, so that it - can later be restored by ~magit-mode-bury-buffer~. - - The buffer is displayed and selected using SWITCH-FUNCTION. If that - is ~nil~ then ~pop-to-buffer~ is used if the current buffer's major mode - derives from ~magit-mode~. Otherwise ~switch-to-buffer~ is used. - -- Variable: magit-refresh-function :: - - The value of this buffer-local variable is the function used to - refresh the current buffer. It is called with ~magit-refresh-args~ as - arguments. - -- Variable: magit-refresh-args :: - - The list of arguments used by ~magit-refresh-function~ to refresh the - current buffer. ~magit-refresh-function~ is called with these - arguments. - - The value is usually set using ~magit-mode-setup~, but in some cases - it's also useful to provide commands that can change the value. For - example, the ~magit-diff-refresh~ transient can be used to change any - of the arguments used to display the diff, without having to specify - again which differences should be shown, but ~magit-diff-more-context~, - ~magit-diff-less-context~ and ~magit-diff-default-context~ change just - the ~-U~ argument. In both case this is done by changing the value - of this variable and then calling this ~magit-refresh-function~. - -** Conventions - -Also see [[*Completion and Confirmation]]. - -*** Theming Faces - -The default theme uses blue for local branches, green for remote -branches, and goldenrod (brownish yellow) for tags. When creating a -new theme, you should probably follow that example. If your theme -already uses other colors, then stick to that. - -In older releases these reference faces used to have a background -color and a box around them. The basic default faces no longer do so, -to make Magit buffers much less noisy, and you should follow that -example at least with regards to boxes. (Boxes were used in the past -to work around a conflict between the highlighting overlay and text -property backgrounds. That's no longer necessary because highlighting no -longer causes other background colors to disappear.) Alternatively -you can keep the background color and/or box, but then have to take -special care to adjust ~magit-branch-current~ accordingly. By default -it looks mostly like ~magit-branch-local~, but with a box (by default -the former is the only face that uses a box, exactly so that it sticks -out). If the former also uses a box, then you have to make sure that -it differs in some other way from the latter. - -The most difficult faces to theme are those related to diffs, -headings, highlighting, and the region. There are faces that fall -into all four groups - expect to spend some time getting this right. - -The ~region~ face in the default theme, in both the light and dark -variants, as well as in many other themes, distributed with Emacs or -by third-parties, is very ugly. It is common to use a background -color that really sticks out, which is ugly but if that were the only -problem then it would be acceptable. Unfortunately many themes also -set the foreground color, which ensures that all text within the -region is readable. Without doing that there might be cases where -some foreground color is too close to the region background color to -still be readable. But it also means that text within the region -loses all syntax highlighting. - -I consider the work that went into getting the ~region~ face right to be -a good indicator for the general quality of a theme. My -recommendation for the ~region~ face is this: use a background color -slightly different from the background color of the ~default~ face, and -do not set the foreground color at all. So for a light theme you -might use a light (possibly tinted) gray as the background color of -~default~ and a somewhat darker gray for the background of ~region~. -That should usually be enough to not collide with the foreground color -of any other face. But if some other faces also set a light gray as -background color, then you should also make sure it doesn't collide -with those (in some cases it might be acceptable though). - -Magit only uses the ~region~ face when the region is "invalid" by its -own definition. In a Magit buffer the region is used to either select -multiple sibling sections, so that commands which support it act on -all of these sections instead of just the current section, or to -select lines within a single hunk section. In all other cases, the -section is considered invalid and Magit won't act on it. But such -invalid sections happen, either because the user has not moved point -enough yet to make it valid or because she wants to use a non-magit -command to act on the region, e.g., ~kill-region~. - -So using the regular ~region~ face for invalid sections is a feature. It -tells the user that Magit won't be able to act on it. It's acceptable -if that face looks a bit odd and even (but less so) if it collides -with the background colors of section headings and other things that -have a background color. - -Magit highlights the current section. If a section has subsections, -then all of them are highlighted. This is done using faces that have -"highlight" in their names. For most sections, ~magit-section-highlight~ -is used for both the body and the heading. Like the ~region~ face, it -should only set the background color to something similar to that of -~default~. The highlight background color must be different from both -the ~region~ background color and the ~default~ background color. - -For diff related sections Magit uses various faces to -highlight different parts of the selected section(s). Note that hunk -headings, unlike all other section headings, by default have a -background color, because it is useful to have very visible separators -between hunks. That face ~magit-diff-hunk-heading~, should be different -from both ~magit-diff-hunk-heading-highlight~ and -~magit-section-highlight~, as well as from ~magit-diff-context~ and -~magit-diff-context-highlight~. By default we do that by changing the -foreground color. Changing the background color would lead to -complications, and there are already enough we cannot get around. -(Also note that it is generally a good idea for section headings to -always be bold, but only for sections that have subsections). - -When there is a valid region selecting diff-related sibling sections, -i.e., multiple files or hunks, then the bodies of all these sections -use the respective highlight faces, but additionally the headings -instead use one of the faces ~magit-diff-file-heading-selection~ or -~magit-diff-hunk-heading-selection~. These faces have to be different -from the regular highlight variants to provide explicit visual -indication that the region is active. - -When theming diff related faces, start by setting the option -~magit-diff-refine-hunk~ to ~all~. You might personally prefer to only -refine the current hunk or not use hunk refinement at all, but some of -the users of your theme want all hunks to be refined, so you have to -cater to that. - -(Also turn on ~magit-diff-highlight-indentation~, -~magit-diff-highlight-trailing~, and ~magit-diff-paint-whitespace~; and -insert some whitespace errors into the code you use for testing.) - -For added lines you have to adjust three faces: -~magit-diff-added~, ~magit-diff-added-highlight~, and -~diff-refined-added~. Make sure that the latter works well with both -of the former, as well as ~smerge-other~ and ~diff-added~. Then do the -same for the removed lines, context lines, lines added by us, and -lines added by them. Also make sure the respective added, removed, -and context faces use approximately the same saturation for both the -highlighted and unhighlighted variants. Also make sure the file and -diff headings work nicely with context lines (e.g., make them look -different). Line faces should set both the foreground and the -background color. For example, for added lines use two different -greens. - -It's best if the foreground color of both the highlighted and the -unhighlighted variants are the same, so you will need to have to find -a color that works well on the highlight and unhighlighted background, -the refine background, and the highlight context background. When -there is an hunk internal region, then the added- and removed-lines -background color is used only within that region. Outside the region -the highlighted context background color is used. This makes it -easier to see what is being staged. With an hunk internal region the -hunk heading is shown using ~magit-diff-hunk-heading-selection~, and so -are the thin lines that are added around the lines that fall within -the region. The background color of that has to be distinct enough -from the various other involved background colors. - -Nobody said this would be easy. If your theme restricts itself to a -certain set of colors, then you should make an exception here. -Otherwise it would be impossible to make the diffs look good in each -and every variation. Actually you might want to just stick to the -default definitions for these faces. You have been warned. Also -please note that if you do not get this right, this will in some cases -look to users like bugs in Magit - so please do it right or not at -all. - -* FAQ -:PROPERTIES: -:APPENDIX: t -:END: - -The next two nodes lists frequently asked questions. For a list of -frequently *and recently* asked questions, i.e., questions that haven't -made it into the manual yet, see -https://github.com/magit/magit/wiki/FAQ. - -Please also see [[*Debugging Tools]]. - -** FAQ - How to ...? -*** How to pronounce Magit? - -Either ~mu[m's] git~ or ~magi{c => t}~ is fine. - -The slogan is "It's Magit! The magical Git client", so it makes sense -to pronounce Magit like magic, while taking into account that C and T -do not sound the same. - -The German "Magie" is not pronounced the same as the English "magic", -so if you speak German, then you can use the above rationale to justify -using the former pronunciation; ~Mag{ie => it}~. - -You can also choose to use the former pronunciation just because you -like it better. - -Also see https://magit.vc/assets/videos/magic.mp4. -Also see https://emacs.stackexchange.com/questions/13696. - -*** How to show git's output? - -To show the output of recently run git commands, press ~$~ (or, if that -isn't available, use ~M-x magit-process-buffer~). This shows a buffer -containing a section per git invocation; as always press ~TAB~ to expand -or collapse them. - -By default, git's output is only inserted into the process buffer if -it is run for side-effects. When the output is consumed in some way, -also inserting it into the process buffer would be too expensive. -For debugging purposes, it's possible to do so anyway, using ~M-x -magit-toggle-git-debug~. - -*** How to install the gitman info manual? - -Git's manpages can be exported as an info manual called ~gitman~. -Magit's own info manual links to nodes in that manual instead of the -actual manpages, simply because Info doesn't support linking to -manpages. - -Unfortunately some distributions do not install the ~gitman~ manual by -default and you would have to install a separate documentation package -to get it. - -Magit patches info, adding the ability to visit links to the ~gitman~ -info manual, by instead viewing the respective manpage. If you prefer -that approach, then set the value of ~magit-view-git-manual-method~ to -one of the supported Emacs packages ~man~ or ~woman~, e.g.: - -#+begin_src emacs-lisp - (setq magit-view-git-manual-method 'man) -#+end_src - -*** How to show diffs for gpg-encrypted files? - -Git supports showing diffs for encrypted files, but has to be told to -do so. Since Magit just uses Git to get the diffs, configuring Git -also affects the diffs displayed inside Magit. - -#+begin_src shell-script - git config --global diff.gpg.textconv "gpg --no-tty --decrypt" - echo "*.gpg filter=gpg diff=gpg" > .gitattributes -#+end_src - -*** How does branching and pushing work? - -Please see [[*Branching]] and https://emacsair.me/2016/01/18/magit-2.4 - -*** Should I disable VC? - -If you don't use VC (the built-in version control interface) then -you might be tempted to disable it, not least because we used to -recommend that you do that. - -We no longer recommend that you disable VC. Doing so would break -useful third-party packages (such as ~diff-hl~), which depend on VC -being enabled. - -If you choose to disable VC anyway, then you can do so by changing -the value of ~vc-handled-backends~. - -** FAQ - Issues and Errors -*** Magit is slow - -See [[*Performance]] and [[*I changed several thousand files at once and -now Magit is unusable]]. - -*** I changed several thousand files at once and now Magit is unusable - -Magit is currently not expected to work well under such conditions. -It sure would be nice if it did. Reaching satisfactory performance -under such conditions will require some heavy refactoring. This is no -small task but I hope to eventually find the time to make it happen. - -But for now we recommend you use the command line to complete this one -commit. Also see [[*Performance]]. - -*** I am having problems committing - -That likely means that Magit is having problems finding an appropriate -~emacsclient~ executable. See [[info:with-editor#Configuring With-Editor]] -and [[info:with-editor#Debugging]]. - -*** I am using MS Windows and cannot push with Magit - -It's almost certain that Magit is only incidental to this issue. It -is much more likely that this is a configuration issue, even if you -can push on the command line. - -Detailed setup instructions can be found at -https://github.com/magit/magit/wiki/Pushing-with-Magit-from-Windows. - -*** I am using macOS and SOMETHING works in shell, but not in Magit - -This usually occurs because Emacs doesn't have the same environment -variables as your shell. Try installing and configuring -https://github.com/purcell/exec-path-from-shell. By default it -synchronizes ~$PATH~, which helps Magit find the same ~git~ as the one you -are using on the shell. - -If SOMETHING is "passphrase caching with gpg-agent for commit and/or -tag signing", then you'll also need to synchronize ~$GPG_AGENT_INFO~. - -*** Expanding a file to show the diff causes it to disappear - -This is probably caused by a customization of a ~diff.*~ Git variable. -You probably set that variable for a reason, and should therefore only -undo that setting in Magit by customizing ~magit-git-global-arguments~. - -*** Point is wrong in the ~COMMIT_EDITMSG~ buffer - -Neither Magit nor ~git-commit.el~ fiddle with point in the buffer used -to write commit messages, so something else must be doing it. - -You have probably globally enabled a mode, which restores point in -file-visiting buffers. It might be a bit surprising, but when you -write a commit message, then you are actually editing a file. - -So you have to figure out which package is doing it. ~saveplace~, -~pointback~, and ~session~ are likely candidates. These snippets might -help: - -#+begin_src emacs-lisp - (setq session-name-disable-regexp "\\(?:\\`'\\.git/[A-Z_]+\\'\\)") - - (with-eval-after-load 'pointback - (lambda () - (when (or git-commit-mode git-rebase-mode) - (pointback-mode -1)))) -#+end_src - -*** The mode-line information isn't always up-to-date - -Magit is not responsible for the version control information that is -being displayed in the mode-line and looks something like ~Git-master~. -The built-in "Version Control" package, also known as "VC", updates -that information, and can be told to do so more often: - -#+begin_src emacs-lisp - (setq auto-revert-check-vc-info t) -#+end_src - -But doing so isn't good for performance. For more (overly optimistic) -information see [[info:emacs#VC Mode Line]]. - -If you don't really care about seeing this information in the -mode-line, but just don't want to see /incorrect/ information, -then consider simply not displaying it in the mode-line: - -#+begin_src emacs-lisp - (setq-default mode-line-format - (delete '(vc-mode vc-mode) mode-line-format)) -#+end_src - -*** A branch and tag sharing the same name breaks SOMETHING - -Or more generally, ambiguous refnames break SOMETHING. - -Magit assumes that refs are named non-ambiguously across the -"refs/heads/", "refs/tags/", and "refs/remotes/" namespaces (i.e., all -the names remain unique when those prefixes are stripped). We -consider ambiguous refnames unsupported and recommend that you use a -non-ambiguous naming scheme. However, if you do work with a -repository that has ambiguous refnames, please report any issues you -encounter, so that we can investigate whether there is a simple fix. - -*** My Git hooks work on the command-line but not inside Magit - -When Magit calls ~git~ it adds a few global arguments including -~--literal-pathspecs~ and the ~git~ process started by Magit then passes -that setting on to other ~git~ process it starts itself. It does so by -setting the environment variable ~GIT_LITERAL_PATHSPECS~, not by calling -subprocesses with the ~--literal-pathspecs~ argument. You can therefore -override this setting in hook scripts using ~unset -GIT_LITERAL_PATHSPECS~. - -*** ~git-commit-mode~ isn't used when committing from the command-line - -The reason for this is that ~git-commit.el~ has not been loaded yet -and/or that the server has not been started yet. These things have -always already been taken care of when you commit from Magit because -in order to do so, Magit has to be loaded and doing that involves -loading ~git-commit~ and starting the server. - -If you want to commit from the command-line, then you have to take -care of these things yourself. Your ~init.el~ file should contain: - -#+begin_src emacs-lisp - (require 'git-commit) - (server-mode) -#+end_src - -Instead of `(require 'git-commit)` you may also use: - -#+begin_src emacs-lisp - (load "/path/to/magit-autoloads.el") -#+end_src - -You might want to do that because loading ~git-commit~ causes large -parts of Magit to be loaded. - -There are also some variations of ~(server-mode)~ that you might want to -try. Personally I use: - -#+begin_src emacs-lisp - (use-package server - :config (or (server-running-p) (server-mode))) -#+end_src - -Now you can use: - -#+begin_src shell-script - $ emacs& - $ EDITOR=emacsclient git commit -#+end_src - -However you cannot use: - -#+begin_src shell-script - $ killall emacs - $ EDITOR="emacsclient --alternate-editor emacs" git commit -#+end_src - -This will actually end up using ~emacs~, not ~emacsclient~. If you do -this, then you can still edit the commit message but ~git-commit-mode~ -won't be used and you have to exit ~emacs~ to finish the process. - -Tautology ahead. If you want to be able to use ~emacsclient~ to connect -to a running ~emacs~ instance, even though no ~emacs~ instance is running, -then you cannot use ~emacsclient~ directly. - -Instead you have to create a script that does something like this: - -Try to use ~emacsclient~ (without using ~--alternate-editor~). If that -succeeds, do nothing else. Otherwise start ~emacs &~ (and ~init.el~ must -call ~server-start~) and try to use ~emacsclient~ again. - -*** Point ends up inside invisible text when jumping to a file-visiting buffer - -This can happen when you type ~RET~ on a hunk to visit the respective -file at the respective position. One solution to this problem is to -use ~global-reveal-mode~. It makes sure that text around point is -always visible. If that is too drastic for your taste, then you may -instead use ~magit-diff-visit-file-hook~ to reveal the text, possibly -using ~reveal-post-command~ or for Org buffers ~org-reveal~. - -*** I am no longer able to save popup defaults - -Magit used to use Magit-Popup to implement the transient popup menus. -Now it used Transient instead, which is Magit-Popup's successor. - -In the older Magit-Popup menus, it was possible to save user settings -(e.g., setting the gpg signing key for commits) by using ~C-c C-c~ in -the popup buffer. This would dismiss the popup, but save the settings -as the defaults for future popups. - -When switching to Transient menus, this functionality is now available -via ~C-x C-s~ instead; the ~C-x~ prefix has other options as well when -using Transient, which will be displayed when it is typed. See -https://docs.magit.vc/transient/Saving-Values.html#Saving-Values for -more details. - -* Debugging Tools - -Magit and its dependencies provide a few debugging tools, and we -appreciate it very much if you use those tools before reporting an -issue. Please include all relevant output when reporting an -issue. - -- Key: M-x magit-version :: - - This command shows the currently used versions of Magit, Git, and - Emacs in the echo area. Non-interactively this just returns the - Magit version. - -- Key: M-x magit-emacs-Q-command :: - - This command shows a debugging shell command in the echo area and - adds it to the kill ring. Paste that command into a shell and run - it. - - This shell command starts ~emacs~ with only ~magit~ and its - dependencies loaded. Neither your configuration nor other installed - packages are loaded. This makes it easier to determine whether some - issue lays with Magit or something else. - - If you run Magit from its Git repository, then you should be able to - use ~make emacs-Q~ instead of the output of this command. - -- Key: M-x magit-toggle-git-debug :: - - This command toggles whether additional git errors are reported. - - Magit basically calls git for one of these two reasons: for - side-effects or to do something with its standard output. - - When git is run for side-effects then its output, including error - messages, go into the process buffer which is shown when using ~$~. - - When git's output is consumed in some way, then it would be too - expensive to also insert it into this buffer, but with this command - that can be enabled temporarily. In that case, if git returns with - a non-zero exit status, then at least its standard error is inserted - into this buffer. - - Also note that just because git exits with a non-zero status and - prints an error message, that usually doesn't mean that it is an - error as far as Magit is concerned, which is another reason we - usually hide these error messages. Whether some error message is - relevant in the context of some unexpected behavior has to be judged - on a case by case basis. - -- Key: M-x magit-toggle-verbose-refresh :: - - This command toggles whether Magit refreshes buffers verbosely. - Enabling this helps figuring out which sections are bottlenecks. - The additional output can be found in the ~*Messages*~ buffer. - -- Key: M-x magit-toggle-subprocess-record :: - - This command toggles whether subprocess invocations are recorded. - - When enabled, all subprocesses started by ~magit-process-file~ are - logged into the buffer specified by ~magit-process-record-buffer-name~ - using the format ~magit-process-record-entry-format~. This is for - debugging purposes. - - This is in addition to and distinct from the default logging done by - default, and additional logging enabled with ~magit-toggle-git-debug~. - -- Key: M-x magit-debug-git-executable :: - - This command displays a buffer containing information about the - available and used ~git~ executable(s), and can be useful when - investigating ~exec-path~ issues. - - Also see [[*Git Executable]]. - -- Key: M-x magit-profile-refresh-buffer :: - - This command profiles refreshing the current Magit buffer and then - displays the results. - -- Key: M-x magit-toggle-profiling :: - - This command starts profiling Magit and Forge, or if profiling is - already in progress, it instead stops that and displays the results. - -- Key: M-x with-editor-debug :: - - This command displays a buffer containing information about the - available and used ~emacsclient~ executable(s), and can be useful - when investigating why Magit (or rather ~with-editor~) cannot find - an appropriate ~emacsclient~ executable. - - Also see [[info:with-editor#Debugging]]. - -#+texinfo: @noindent -Please also see [[*FAQ]]. - -* Keystroke Index -:PROPERTIES: -:APPENDIX: t -:INDEX: ky -:COOKIE_DATA: recursive -:END: -* Function and Command Index -:PROPERTIES: -:APPENDIX: t -:INDEX: fn -:END: -* Variable Index -:PROPERTIES: -:APPENDIX: t -:INDEX: vr -:END: - -* Copying -:PROPERTIES: -:COPYING: t -:END: - -#+begin_quote -Copyright (C) 2015-{{{year}}} Jonas Bernoulli - -You can redistribute this document and/or modify it under the terms -of the GNU General Public License as published by the Free Software -Foundation, either version 3 of the License, or (at your option) any -later version. - -This document is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. -#+end_quote - -# LocalWords: ARG ARGS CONDITIONs ChangeLog DNS Dired Ediff Ediffing -# LocalWords: Elpa Emacsclient FUNC Flyspell Git Git's Gitk HOOK's -# LocalWords: IDENT Junio LocalWords Magit Magit's Magitian Magitians -# LocalWords: Melpa Propertize REF REF's RET Reflog SPC SYM Spacemacs -# LocalWords: Submodules TODO TYPEs Theming Unpulled Unpushed Unstaged -# LocalWords: Untracked WORKTREE Wip ack args async autoloads autosaving -# LocalWords: autosquash backport basename branchref builtin -# LocalWords: cdr changelog committer config customizable diff's diffstat -# LocalWords: dwim ediff ediffing editmsg emacsclient filename fixup -# LocalWords: flyspell func git's gitk gitman gitmodule gitmodules goto -# LocalWords: gpg gui ident init inserter inserters keymap keymaps -# LocalWords: logfile magit maildir manpage manpages minibuffer multi mv -# LocalWords: namespace newbase nocommit notesRef posix prev -# LocalWords: propertize rebase rebased rebasing reflog repo signoff str -# LocalWords: struct subcommand submodule submodule's submodules subprocess -# LocalWords: sym texinfo theming todo topdir un unhighlighted unpulled -# LocalWords: unpushed unstage unstaged unstages unstaging untracked url -# LocalWords: versa whitespace wip workflow worktree wtree -# LocalWords: backported macOS - -# IMPORTANT: Also update ORG_ARGS and ORG_EVAL in the Makefile. -# Local Variables: -# eval: (require 'magit-base nil t) -# eval: (require 'ol-man nil t) -# indent-tabs-mode: nil -# org-src-preserve-indentation: nil -# End: diff --git a/.config/emacs/lisp/magit/git-hooks/applypatch-msg b/.config/emacs/lisp/magit/git-hooks/applypatch-msg deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/applypatch-msg +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/commit-msg b/.config/emacs/lisp/magit/git-hooks/commit-msg deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/commit-msg +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/fallthrough b/.config/emacs/lisp/magit/git-hooks/fallthrough deleted file mode 100755 index 51928e7..0000000 --- a/.config/emacs/lisp/magit/git-hooks/fallthrough +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -hook="$SHADOWED_GITHOOK_DIRECTORY/$(basename $0)" - -if [[ -x "$hook" ]] -then - "$hook" "$@" -fi diff --git a/.config/emacs/lisp/magit/git-hooks/fsmonitor-watchman b/.config/emacs/lisp/magit/git-hooks/fsmonitor-watchman deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/fsmonitor-watchman +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/p4-changelist b/.config/emacs/lisp/magit/git-hooks/p4-changelist deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/p4-changelist +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/p4-post-changelist b/.config/emacs/lisp/magit/git-hooks/p4-post-changelist deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/p4-post-changelist +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/p4-pre-submit b/.config/emacs/lisp/magit/git-hooks/p4-pre-submit deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/p4-pre-submit +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/p4-prepare-changelist b/.config/emacs/lisp/magit/git-hooks/p4-prepare-changelist deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/p4-prepare-changelist +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/post-applypatch b/.config/emacs/lisp/magit/git-hooks/post-applypatch deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/post-applypatch +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/post-checkout b/.config/emacs/lisp/magit/git-hooks/post-checkout deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/post-checkout +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/post-commit b/.config/emacs/lisp/magit/git-hooks/post-commit deleted file mode 100755 index 79b9aa0..0000000 --- a/.config/emacs/lisp/magit/git-hooks/post-commit +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -if [[ "$INSIDE_EMACS" == *magit ]] -then - for arg in "$@"; do args+="\"$arg\""; done - $GIT_EDITOR --eval \ - "(magit-run-git-hook '(common-post-commit post-commit) ${args[@]})" -fi - -if [[ -x "$SHADOWED_GITHOOK_DIRECTORY" ]] -then - "$SHADOWED_GITHOOK_DIRECTORY/$(basename $0)" "$@" -fi diff --git a/.config/emacs/lisp/magit/git-hooks/post-index-change b/.config/emacs/lisp/magit/git-hooks/post-index-change deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/post-index-change +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/post-merge b/.config/emacs/lisp/magit/git-hooks/post-merge deleted file mode 100755 index 5716dee..0000000 --- a/.config/emacs/lisp/magit/git-hooks/post-merge +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -if [[ "$INSIDE_EMACS" == *magit ]] -then - for arg in "$@"; do args+="\"$arg\""; done - $GIT_EDITOR --eval \ - "(magit-run-git-hook '(common-post-commit post-merge) ${args[@]})" -fi - -if [[ -x "$SHADOWED_GITHOOK_DIRECTORY" ]] -then - "$SHADOWED_GITHOOK_DIRECTORY/$(basename $0)" "$@" -fi diff --git a/.config/emacs/lisp/magit/git-hooks/post-receive b/.config/emacs/lisp/magit/git-hooks/post-receive deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/post-receive +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/post-rewrite b/.config/emacs/lisp/magit/git-hooks/post-rewrite deleted file mode 100755 index 128ddaa..0000000 --- a/.config/emacs/lisp/magit/git-hooks/post-rewrite +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -if [[ "$INSIDE_EMACS" == *magit ]] -then - for arg in "$@"; do args+="\"$arg\""; done - $GIT_EDITOR --eval \ - "(magit-run-git-hook '(common-post-commit post-rewrite) ${args[@]})" -fi - -if [[ -x "$SHADOWED_GITHOOK_DIRECTORY" ]] -then - "$SHADOWED_GITHOOK_DIRECTORY/$(basename $0)" "$@" -fi diff --git a/.config/emacs/lisp/magit/git-hooks/post-update b/.config/emacs/lisp/magit/git-hooks/post-update deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/post-update +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/pre-applypatch b/.config/emacs/lisp/magit/git-hooks/pre-applypatch deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/pre-applypatch +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/pre-auto-gc b/.config/emacs/lisp/magit/git-hooks/pre-auto-gc deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/pre-auto-gc +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/pre-commit b/.config/emacs/lisp/magit/git-hooks/pre-commit deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/pre-commit +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/pre-merge-commit b/.config/emacs/lisp/magit/git-hooks/pre-merge-commit deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/pre-merge-commit +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/pre-push b/.config/emacs/lisp/magit/git-hooks/pre-push deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/pre-push +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/pre-rebase b/.config/emacs/lisp/magit/git-hooks/pre-rebase deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/pre-rebase +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/pre-receive b/.config/emacs/lisp/magit/git-hooks/pre-receive deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/pre-receive +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/prepare-commit-msg b/.config/emacs/lisp/magit/git-hooks/prepare-commit-msg deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/prepare-commit-msg +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/proc-receive b/.config/emacs/lisp/magit/git-hooks/proc-receive deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/proc-receive +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/push-to-checkout b/.config/emacs/lisp/magit/git-hooks/push-to-checkout deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/push-to-checkout +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/reference-transaction b/.config/emacs/lisp/magit/git-hooks/reference-transaction deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/reference-transaction +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/sendemail-validate b/.config/emacs/lisp/magit/git-hooks/sendemail-validate deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/sendemail-validate +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/git-hooks/update b/.config/emacs/lisp/magit/git-hooks/update deleted file mode 120000 index 833950e..0000000 --- a/.config/emacs/lisp/magit/git-hooks/update +++ /dev/null @@ -1 +0,0 @@ -fallthrough \ No newline at end of file diff --git a/.config/emacs/lisp/magit/lisp/Makefile b/.config/emacs/lisp/magit/lisp/Makefile deleted file mode 100644 index 599d05a..0000000 --- a/.config/emacs/lisp/magit/lisp/Makefile +++ /dev/null @@ -1,133 +0,0 @@ --include ../config.mk -include ../default.mk - -## ################################################################### - -.PHONY: magit-version.el check-declare install - -all: lisp - -## Build order ####################################################### - -magit-section.elc: -magit-base.elc: magit-section.elc -magit-git.elc: magit-base.elc -magit-mode.elc: magit-base.elc magit-git.elc -magit-margin.elc: magit-base.elc magit-mode.elc -magit-process.elc: magit-base.elc magit-git.elc magit-mode.elc -git-commit.elc: magit-git.elc magit-mode.elc magit-process.elc -magit-transient.elc: magit-git.elc magit-mode.elc magit-process.elc -magit-autorevert.elc: magit-git.elc magit-process.elc -magit-core.elc: magit-base.elc magit-git.elc magit-mode.elc \ - magit-margin.elc magit-process.elc \ - magit-transient.elc magit-autorevert.elc -magit-diff.elc: git-commit.elc magit-core.elc -magit-log.elc: magit-core.elc magit-diff.elc -magit-wip.elc: magit-core.elc magit-log.elc -magit-reflog.elc: magit-core.elc magit-log.elc -magit-apply.elc: magit-core.elc magit-diff.elc magit-wip.elc -magit-repos.elc: magit-core.elc -magit.elc: git-commit.elc magit-core.elc magit-diff.elc \ - magit-log.elc magit-apply.elc magit-repos.elc -magit-status.elc: magit.elc -magit-refs.elc: magit.elc -magit-files.elc: magit.elc -magit-reset.elc: magit.elc -magit-branch.elc: magit.elc magit-reset.elc -magit-merge.elc: magit.elc magit-diff.elc -magit-tag.elc: magit.elc -magit-worktree.elc: magit.elc -magit-notes.elc: magit.elc -magit-sequence.elc: magit.elc -magit-commit.elc: magit.elc magit-sequence.elc -magit-remote.elc: magit.elc -magit-clone.elc: magit.elc -magit-fetch.elc: magit.elc -magit-pull.elc: magit.elc magit-remote.elc -magit-push.elc: magit.elc -magit-bisect.elc: magit.elc -magit-stash.elc: magit.elc magit-sequence.elc magit-reflog.elc -magit-blame.elc: magit.elc -magit-submodule.elc: magit.elc -magit-patch.elc: magit.elc -magit-subtree.elc: magit.elc -magit-ediff.elc: magit.elc -magit-gitignore.elc: magit.elc -magit-sparse-checkout.elc: magit.elc -magit-bundle.elc: magit.elc -magit-extras.elc: magit.elc magit-merge.elc -magit-dired.elc: magit.elc -git-rebase.elc: magit.elc -magit-bookmark.elc: magit.elc - -## Build ############################################################# - -lisp: $(ELCS) autoloads $(LISP_EXTRA_TARGETS) -autoloads: $(PKG)-autoloads.el -versionlib: $(PKG)-version.el - -%.elc: %.el - @printf "Compiling $<\n" - @$(EMACS_BATCH) --eval "(progn\ - (when (file-exists-p \"$@\")\ - (delete-file \"$@\"))\ - (setq with-editor-emacsclient-executable nil)\ - (when (< emacs-major-version 30)\ - (require 'transient)))" \ - -f batch-byte-compile $< - -$(PKG)-autoloads.el: $(ELS) - @printf " Creating $@\n" - @$(EMACS_BATCH) --load autoload --eval "\ -(let* ((file (expand-file-name \"$@\"))\ - (generated-autoload-file file)\ - (coding-system-for-write 'utf-8-emacs-unix)\ - (backup-inhibited t)\ - (version-control 'never)\ - (inhibit-message t))\ - (write-region (autoload-rubric file \"package\" t) nil file)\ - (update-directory-autoloads default-directory))" \ - 2>&1 | sed "/^Package autoload is deprecated$$/d" - -$(PKG)-version.el: - @printf " Creating $@\n" - @printf "%s" "$$VERSIONLIB_TMPL" > $@ - -check-declare: - @printf "Checking function declarations\n" - @$(EMACS_BATCH) -L $(TOP)../borg -L $(TOP)../forge/lisp \ - --eval "(check-declare-directory default-directory)" - -## Install ########################################################### - -install: lisp versionlib - @$(MKDIR) $(DESTDIR)$(lispdir) - $(CP) $(ELS) magit-autoloads.el magit-version.el $(ELCS) $(DESTDIR)$(lispdir) - -## Clean ############################################################# - -clean: - @printf " Cleaning lisp/*...\n" - @$(RM) *.elc $(ELGS) - @$(RM) ../test/magit-tests.elc - -## Templates ######################################################### - -define VERSIONLIB_TMPL -;;; $(PKG)-version.el --- The Magit version you are using -*- lexical-binding:t -*- - -(setq $(PKG)-version "$(VERSION)") - -(provide '$(PKG)-version) - -;; Local Variables: -;; version-control: never -;; no-byte-compile: t -;; no-update-autoloads: t -;; coding: utf-8 -;; End: -;;; $(PKG)-version.el ends here - -endef -export VERSIONLIB_TMPL -#' diff --git a/.config/emacs/lisp/magit/lisp/git-commit.el b/.config/emacs/lisp/magit/lisp/git-commit.el deleted file mode 100644 index 8f2444d..0000000 --- a/.config/emacs/lisp/magit/lisp/git-commit.el +++ /dev/null @@ -1,1240 +0,0 @@ -;;; git-commit.el --- Edit Git commit messages -*- lexical-binding:t; coding:utf-8 -*- - -;; Copyright (C) 2008-2026 The Magit Project Contributors - -;; Author: Jonas Bernoulli -;; Sebastian Wiesner -;; Florian Ragwitz -;; Marius Vollmer -;; Maintainer: Jonas Bernoulli - -;; SPDX-License-Identifier: GPL-3.0-or-later - -;; Magit is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation, either version 3 of the License, -;; or (at your option) any later version. -;; -;; Magit is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Magit. If not, see . - -;; You should have received a copy of the AUTHORS.md file, which -;; lists all contributors. If not, see https://magit.vc/authors. - -;;; Commentary: - -;; This package assists the user in writing good Git commit messages. - -;; While Git allows for the message to be provided on the command -;; line, it is preferable to tell Git to create the commit without -;; actually passing it a message. Git then invokes the `$GIT_EDITOR' -;; (or if that is undefined `$EDITOR') asking the user to provide the -;; message by editing the file ".git/COMMIT_EDITMSG" (or another file -;; in that directory, e.g., ".git/MERGE_MSG" for merge commits). - -;; When `global-git-commit-mode' is enabled, which it is by default, -;; then opening such a file causes the features described below, to -;; be enabled in that buffer. Normally this would be done using a -;; major-mode but to allow the use of any major-mode, as the user sees -;; fit, it is done here by running a setup function, which among other -;; things turns on the preferred major-mode, by default `text-mode'. - -;; Git waits for the `$EDITOR' to finish and then either creates the -;; commit using the contents of the file as commit message, or, if the -;; editor process exited with a non-zero exit status, aborts without -;; creating a commit. Unfortunately Emacsclient (which is what Emacs -;; users should be using as `$EDITOR' or at least as `$GIT_EDITOR') -;; does not differentiate between "successfully" editing a file and -;; aborting; not out of the box that is. - -;; By making use of the `with-editor' package this package provides -;; both ways of finish an editing session. In either case the file -;; is saved, but Emacseditor's exit code differs. -;; -;; C-c C-c Finish the editing session successfully by returning -;; with exit code 0. Git then creates the commit using -;; the message it finds in the file. -;; -;; C-c C-k Aborts the edit editing session by returning with exit -;; code 1. Git then aborts the commit. - -;; Aborting the commit does not cause the message to be lost, but -;; relying solely on the file not being tampered with is risky. This -;; package additionally stores all aborted messages for the duration -;; of the current session (i.e., until you close Emacs). To get back -;; an aborted message use M-p and M-n while editing a message. -;; -;; M-p Replace the buffer contents with the previous message -;; from the message ring. Of course only after storing -;; the current content there too. -;; -;; M-n Replace the buffer contents with the next message from -;; the message ring, after storing the current content. - -;; Support for inserting Git trailers (as described in the manpage -;; git-interpret-trailers(1)) is available. -;; -;; C-c C-i Insert a trailer selected from a transient menu. - -;; When Git requests a commit message from the user, it does so by -;; having her edit a file which initially contains some comments, -;; instructing her what to do, and providing useful information, such -;; as which files were modified. These comments, even when left -;; intact by the user, do not become part of the commit message. This -;; package ensures these comments are propertizes as such and further -;; prettifies them by using different faces for various parts, such as -;; files. - -;; Finally this package highlights style errors, like lines that are -;; too long, or when the second line is not empty. It may even nag -;; you when you attempt to finish the commit without having fixed -;; these issues. The style checks and many other settings can easily -;; be configured: -;; -;; M-x customize-group RET git-commit RET - -;;; Code: - -(require 'magit-git) -(require 'magit-mode) -(require 'magit-process) - -(require 'log-edit) -(require 'ring) -(require 'server) -(require 'transient) -(require 'with-editor) - -(defvar diff-default-read-only) -(defvar flyspell-generic-check-word-predicate) -(defvar font-lock-beg) -(defvar font-lock-end) -(defvar recentf-exclude) - -(defvar git-commit-need-summary-line) - -(define-obsolete-variable-alias - 'git-commit-known-pseudo-headers - 'git-commit-trailers - "git-commit 4.0.0") - -;;; Options -;;;; Variables - -(defgroup git-commit nil - "Edit Git commit messages." - :prefix "git-commit-" - :link '(info-link "(magit)Editing Commit Messages") - :group 'tools) - -(define-minor-mode global-git-commit-mode - "Edit Git commit messages. - -This global mode arranges for `git-commit-setup' to be called -when a Git commit message file is opened. That usually happens -when Git uses the Emacsclient as $GIT_EDITOR to have the user -provide such a commit message. - -Loading the library `git-commit' by default enables this mode, -but the library is not automatically loaded because doing that -would pull in many dependencies and increase startup time too -much. You can either rely on `magit' loading this library or -you can load it explicitly. Autoloading is not an alternative -because in this case autoloading would immediately trigger -full loading." - :group 'git-commit - :type 'boolean - :global t - :init-value t - :initialize - (lambda (symbol exp) - (custom-initialize-default symbol exp) - (when global-git-commit-mode - (add-hook 'find-file-hook #'git-commit-setup-check-buffer) - (remove-hook 'after-change-major-mode-hook - #'git-commit-setup-font-lock-in-buffer))) - (cond - (global-git-commit-mode - (add-hook 'find-file-hook #'git-commit-setup-check-buffer) - (add-hook 'after-change-major-mode-hook - #'git-commit-setup-font-lock-in-buffer)) - (t - (remove-hook 'find-file-hook #'git-commit-setup-check-buffer) - (remove-hook 'after-change-major-mode-hook - #'git-commit-setup-font-lock-in-buffer)))) - -(defcustom git-commit-major-mode #'text-mode - "Major mode used to edit Git commit messages. - -The major mode configured here is turned on by the minor mode -`git-commit-mode'." - :group 'git-commit - :type '(radio (function-item text-mode) - (function-item markdown-mode) - (function-item org-mode) - (function-item fundamental-mode) - (function-item log-edit-mode) - (function-item git-commit-elisp-text-mode) - (function :tag "Another mode") - (const :tag "No major mode"))) -;;;###autoload(put 'git-commit-major-mode 'safe-local-variable -;;;###autoload (lambda (val) -;;;###autoload (memq val '(text-mode -;;;###autoload markdown-mode -;;;###autoload org-mode -;;;###autoload fundamental-mode -;;;###autoload log-edit-mode -;;;###autoload git-commit-elisp-text-mode)))) - -(defvaralias 'git-commit-mode-hook 'git-commit-setup-hook - "This variable is an alias for `git-commit-setup-hook' (which see). -Also note that `git-commit-mode' (which see) is not a major-mode.") - -(defcustom git-commit-setup-hook - (list #'git-commit-ensure-comment-gap - #'git-commit-save-message - #'git-commit-setup-changelog-support - #'git-commit-turn-on-auto-fill - #'git-commit-propertize-diff - #'bug-reference-mode) - "Hook run at the end of `git-commit-setup'." - :group 'git-commit - :type 'hook - :get #'magit-hook-custom-get - :options '(git-commit-ensure-comment-gap - git-commit-save-message - git-commit-setup-changelog-support - magit-generate-changelog - git-commit-turn-on-auto-fill - git-commit-turn-on-orglink - git-commit-turn-on-flyspell - git-commit-propertize-diff - bug-reference-mode)) - -(defcustom git-commit-finish-query-functions - (list #'git-commit-check-style-conventions) - "List of functions called to query before performing commit. - -The commit message buffer is current while the functions are -called. If any of them returns nil, then the commit is not -performed and the buffer is not killed. The user should then -fix the issue and try again. - -The functions are called with one argument. If it is non-nil, -then that indicates that the user used a prefix argument to -force finishing the session despite issues. Functions should -usually honor this wish and return non-nil." - :options '(git-commit-check-style-conventions) - :type 'hook - :group 'git-commit) - -(defcustom git-commit-style-convention-checks '(non-empty-second-line) - "List of checks performed by `git-commit-check-style-conventions'. - -Valid members are `non-empty-second-line' and `overlong-summary-line'. -That function is a member of `git-commit-finish-query-functions'." - :options '(non-empty-second-line overlong-summary-line) - :type '(list :convert-widget custom-hook-convert-widget) - :group 'git-commit) - -(defcustom git-commit-summary-max-length 68 - "Column beyond which characters in the summary lines are highlighted. - -The highlighting indicates that the summary is getting too long -by some standards. It does in no way imply that going over the -limit a few characters or in some cases even many characters is -anything that deserves shaming. It's just a friendly reminder -that if you can make the summary shorter, then you might want -to consider doing so." - :group 'git-commit - :safe 'numberp - :type 'number) - -(defcustom git-commit-trailers - '("Acked-by" - "Modified-by" - "Reviewed-by" - "Signed-off-by" - "Tested-by" - "Cc" - "Reported-by" - "Suggested-by" - "Co-authored-by" - "Co-developed-by") - "A list of Git trailers to be highlighted. - -See also manpage git-interpret-trailer(1). This package does -not use that Git command, but the initial description still -serves as a good introduction." - :group 'git-commit - :safe (##and (listp %) (seq-every-p #'stringp %)) - :type '(repeat string)) - -(defcustom git-commit-use-local-message-ring nil - "Whether to use a local message ring instead of the global one. - -This can be set globally, in which case every repository gets its -own commit message ring, or locally for a single repository." - :group 'git-commit - :safe 'booleanp - :type 'boolean) - -(defcustom git-commit-cd-to-toplevel nil - "Whether to set `default-directory' to the worktree in message buffer. - -Editing a commit message is done by visiting a file located in the git -directory, usually \"COMMIT_EDITMSG\". As is done when visiting any -file, the local value of `default-directory' is set to the directory -that contains the file. - -If this option is non-nil, then the local `default-directory' is changed -to the working tree from which the commit command was invoked. You may -wish to do that, to make it easier to open a file that is located in the -working tree, directly from the commit message buffer. - -If the git variable `safe.bareRepository' is set to \"explicit\", then -you have to enable this, to be able to commit at all. See issue #5100. - -This option only has an effect if the commit was initiated from Magit." - :group 'git-commit - :type 'boolean) - -;;;; Faces - -(defgroup git-commit-faces nil - "Faces used for highlighting Git commit messages." - :prefix "git-commit-" - :group 'git-commit - :group 'faces) - -(defface git-commit-summary - '((t :inherit font-lock-type-face)) - "Face used for the summary in commit messages." - :group 'git-commit-faces) - -(defface git-commit-overlong-summary - '((t :inherit font-lock-warning-face)) - "Face used for the tail of overlong commit message summaries." - :group 'git-commit-faces) - -(defface git-commit-nonempty-second-line - '((t :inherit font-lock-warning-face)) - "Face used for non-whitespace on the second line of commit messages." - :group 'git-commit-faces) - -(defface git-commit-keyword - '((t :inherit font-lock-string-face)) - "Face used for keywords in commit messages. -In this context a \"keyword\" is text surrounded by brackets." - :group 'git-commit-faces) - -(defface git-commit-trailer-token - '((t :inherit font-lock-keyword-face)) - "Face used for Git trailer tokens in commit messages." - :group 'git-commit-faces) - -(defface git-commit-trailer-value - '((t :inherit font-lock-string-face)) - "Face used for Git trailer values in commit messages." - :group 'git-commit-faces) - -(defface git-commit-comment-branch-local - '((t :inherit magit-branch-local)) - "Face used for names of local branches in commit message comments." - :group 'git-commit-faces) - -(defface git-commit-comment-branch-remote - '((t :inherit magit-branch-remote)) - "Face used for names of remote branches in commit message comments." - :group 'git-commit-faces) - -(defface git-commit-comment-detached - '((t :inherit git-commit-comment-branch-local)) - "Face used for detached `HEAD' in commit message comments." - :group 'git-commit-faces) - -(defface git-commit-comment-heading - '((t :inherit git-commit-trailer-token)) - "Face used for headings in commit message comments." - :group 'git-commit-faces) - -(defface git-commit-comment-file - '((t :inherit git-commit-trailer-value)) - "Face used for file names in commit message comments." - :group 'git-commit-faces) - -(defface git-commit-comment-action - '((t :inherit bold)) - "Face used for actions in commit message comments." - :group 'git-commit-faces) - -;;; Keymap - -(defvar-keymap git-commit-redundant-bindings - :doc "Bindings made redundant by `git-commit-insert-trailer'. -This keymap is used as the parent of `git-commit-mode-map', -to avoid upsetting muscle-memory. If you would rather avoid -the redundant bindings, then set this to nil, before loading -`git-commit'." - "C-c C-a" #'git-commit-ack - "C-c M-i" #'git-commit-suggested - "C-c C-m" #'git-commit-modified - "C-c C-o" #'git-commit-cc - "C-c C-p" #'git-commit-reported - "C-c C-r" #'git-commit-review - "C-c C-s" #'git-commit-signoff - "C-c C-t" #'git-commit-test) - -(defvar-keymap git-commit-mode-map - :doc "Keymap used by `git-commit-mode'." - :parent git-commit-redundant-bindings - "M-p" #'git-commit-prev-message - "M-n" #'git-commit-next-message - "C-c M-p" #'git-commit-search-message-backward - "C-c M-n" #'git-commit-search-message-forward - "C-c C-i" #'git-commit-insert-trailer - "C-c M-s" #'git-commit-save-message - "C-c C-d" 'magit-diff-while-committing - "C-c C-w" 'magit-pop-revision-stack) - -;;; Menu - -(require 'easymenu) -(easy-menu-define git-commit-mode-menu git-commit-mode-map - "Git Commit Mode Menu." - '("Commit" - ["Previous" git-commit-prev-message t] - ["Next" git-commit-next-message t] - "-" - ["Ack" git-commit-ack t - :help "Insert an 'Acked-by' trailer"] - ["Modified-by" git-commit-modified t - :help "Insert a 'Modified-by' trailer"] - ["Reviewed-by" git-commit-review t - :help "Insert a 'Reviewed-by' trailer"] - ["Sign-Off" git-commit-signoff t - :help "Insert a 'Signed-off-by' trailer"] - ["Tested-by" git-commit-test t - :help "Insert a 'Tested-by' trailer"] - "-" - ["CC" git-commit-cc t - :help "Insert a 'Cc' trailer"] - ["Reported" git-commit-reported t - :help "Insert a 'Reported-by' trailer"] - ["Suggested" git-commit-suggested t - :help "Insert a 'Suggested-by' trailer"] - ["Co-authored-by" git-commit-co-authored t - :help "Insert a 'Co-authored-by' trailer"] - ["Co-developed-by" git-commit-co-developed t - :help "Insert a 'Co-developed-by' trailer"] - "-" - ["Save" git-commit-save-message t] - ["Cancel" with-editor-cancel t] - ["Commit" with-editor-finish t])) - -;;; Hooks - -(defconst git-commit-filename-regexp "/\\(\ -\\(\\(COMMIT\\|NOTES\\|PULLREQ\\|MERGEREQ\\|TAG\\)_EDIT\\|MERGE_\\|\\)MSG\ -\\|\\(BRANCH\\|EDIT\\)_DESCRIPTION\\)\\'") - -(with-eval-after-load 'recentf - (add-to-list 'recentf-exclude git-commit-filename-regexp)) - -(add-to-list 'with-editor-file-name-history-exclude git-commit-filename-regexp) - -(defun git-commit-setup-font-lock-in-buffer () - (when (and buffer-file-name - (string-match-p git-commit-filename-regexp buffer-file-name)) - (git-commit-setup-font-lock))) - -(defun git-commit-setup-check-buffer () - (when (and buffer-file-name - (string-match-p git-commit-filename-regexp buffer-file-name)) - (git-commit-setup))) - -(defvar git-commit-mode) - -(defun git-commit-file-not-found () - ;; cygwin git will pass a cygwin path (/cygdrive/c/foo/.git/...), - ;; try to handle this in window-nt Emacs. - (when-let* - ((file (and (or (string-match-p git-commit-filename-regexp - buffer-file-name) - (and (boundp 'git-rebase-filename-regexp) - (string-match-p git-rebase-filename-regexp - buffer-file-name))) - (not (file-accessible-directory-p - (file-name-directory buffer-file-name))) - (magit-expand-git-file-name (substring buffer-file-name 2)))) - (_(file-accessible-directory-p (file-name-directory file))) - (inhibit-read-only t)) - (insert-file-contents file t) - t)) - -(when (eq system-type 'windows-nt) - (add-hook 'find-file-not-found-functions #'git-commit-file-not-found)) - -(defconst git-commit-default-usage-message "\ -Type \\[with-editor-finish] to finish, \ -\\[with-editor-cancel] to cancel, and \ -\\[git-commit-prev-message] and \\[git-commit-next-message] \ -to recover older messages") - -(defvar git-commit-usage-message git-commit-default-usage-message - "Message displayed when editing a commit message. -When this is nil, then `with-editor-usage-message' is displayed -instead. One of these messages has to be displayed; otherwise -the user gets to see the message displayed by `server-execute'. -That message is misleading and because we cannot prevent it from -being displayed, we have to immediately show another message to -prevent the user from seeing it.") - -(defvar git-commit-header-line-format nil - "If non-nil, header line format used by `git-commit-mode'. -Used as the local value of `header-line-format', in buffer using -`git-commit-mode'. If it is a string, then it is passed through -`substitute-command-keys' first. A useful setting may be: - (setq git-commit-header-line-format git-commit-default-usage-message) - (setq git-commit-usage-message nil) ; show a shorter message") - -(defun git-commit-setup () - (let ((gitdir default-directory) - (cd (and git-commit-cd-to-toplevel - (or (car (rassoc default-directory magit--separated-gitdirs)) - (magit-toplevel))))) - ;; Pretend that git-commit-mode is a major-mode, - ;; so that directory-local settings can be used. - (let ((default-directory - (or (and (not (file-exists-p - (expand-file-name ".dir-locals.el" gitdir))) - ;; When $GIT_DIR/.dir-locals.el doesn't exist, - ;; fallback to $GIT_WORK_TREE/.dir-locals.el, - ;; because the maintainer can use the latter - ;; to enforce conventions, while s/he has no - ;; control over the former. - (or cd (magit-toplevel))) - gitdir))) - (let ((buffer-file-name nil) ; trick hack-dir-local-variables - (major-mode 'git-commit-mode)) ; trick dir-locals-collect-variables - (hack-dir-local-variables) - (hack-local-variables-apply))) - (when cd - (setq default-directory cd))) - (when git-commit-major-mode - (let ((auto-mode-alist - ;; `set-auto-mode--apply-alist' removes the remote part from - ;; the file-name before looking it up in `auto-mode-alist'. - ;; For our temporary entry to be found, we have to modify the - ;; file-name the same way. - (list (cons (concat "\\`" - (regexp-quote - (or (file-remote-p buffer-file-name 'localname) - buffer-file-name)) - "\\'") - git-commit-major-mode))) - ;; The major-mode hook might want to consult these minor - ;; modes, while the minor-mode hooks might want to consider - ;; the major mode. - (git-commit-mode t) - (with-editor-mode t)) - (normal-mode t))) - ;; Below we instead explicitly show a message. - (setq with-editor-show-usage nil) - (unless with-editor-mode - ;; Maybe already enabled when using `shell-command' or an Emacs shell. - (with-editor-mode 1)) - (add-hook 'with-editor-finish-query-functions - #'git-commit-finish-query-functions nil t) - (add-hook 'with-editor-pre-finish-hook #'git-commit-save-message nil t) - (add-hook 'with-editor-pre-cancel-hook #'git-commit-save-message nil t) - (when (fboundp 'magit-commit--reset-command) - (add-hook 'with-editor-post-finish-hook #'magit-commit--reset-command) - (add-hook 'with-editor-post-cancel-hook #'magit-commit--reset-command)) - (git-commit-add-post-finish-hook) - (setq with-editor-cancel-message - #'git-commit-cancel-message) - (git-commit-setup-font-lock) - (git-commit-prepare-message-ring) - (when (boundp 'save-place) - (setq save-place nil)) - (let ((git-commit-mode-hook nil)) - (git-commit-mode 1)) - (with-demoted-errors "Error running git-commit-setup-hook: %S" - (run-hooks 'git-commit-setup-hook)) - (set-buffer-modified-p nil) - (when-let ((format git-commit-header-line-format)) - (setq header-line-format - (if (stringp format) (substitute-command-keys format) format))) - (when git-commit-usage-message - (setq with-editor-usage-message git-commit-usage-message)) - (with-editor-usage-message)) - -(define-minor-mode git-commit-mode - "Auxiliary minor mode used when editing Git commit messages. -This mode is only responsible for setting up some key bindings. -Don't use it directly; instead enable `global-git-commit-mode'. -Variable `git-commit-major-mode' controls which major-mode is -used." - :lighter "") - -(put 'git-commit-mode 'permanent-local t) - -(defun git-commit-ensure-comment-gap () - "Separate initial empty line from initial comment. -If the buffer begins with an empty line followed by a comment, insert -an additional newline in between, so that once the users start typing, -the input isn't tacked to the comment." - (save-excursion - (goto-char (point-min)) - (when (looking-at (format "\\`\n%s" comment-start)) - (open-line 1)))) - -(defun git-commit-setup-changelog-support () - "Treat ChangeLog entries as unindented paragraphs." - (setq-local fill-paragraph-function #'log-edit-fill-entry) - (setq-local fill-indent-according-to-mode t) - (setq-local paragraph-start (concat paragraph-start "\\|\\*\\|("))) - -(defun git-commit-turn-on-auto-fill () - "Unconditionally turn on Auto Fill mode. -Ensure auto filling happens everywhere, except in the summary line." - (auto-fill-mode 1) - (setq-local comment-auto-fill-only-comments nil) - (when git-commit-need-summary-line - (setq-local auto-fill-function #'git-commit-auto-fill-except-summary))) - -(defun git-commit-auto-fill-except-summary () - (unless (eq (line-beginning-position) 1) - (do-auto-fill))) - -(defun git-commit-turn-on-orglink () - "Turn on Orglink mode if it is available. -If `git-commit-major-mode' is `org-mode', then silently forgo -turning on `orglink-mode'." - (when (and (not (derived-mode-p 'org-mode)) - (boundp 'orglink-match-anywhere) - (fboundp 'orglink-mode)) - (setq-local orglink-match-anywhere t) - (orglink-mode 1))) - -(defun git-commit-turn-on-flyspell () - "Unconditionally turn on Flyspell mode. -Also check text that is already in the buffer, while avoiding to check -most text that Git will strip from the final message, such as the last -comment and anything below the cut line (\"--- >8 ---\")." - (require 'flyspell) - (flyspell-mode 1) - (setq flyspell-generic-check-word-predicate - #'git-commit-flyspell-verify) - (let ((end nil) - ;; The "cut line" is defined in "git/wt-status.c". It appears - ;; in the commit message when `commit.verbose' is set to true. - (cut-line-regex (format "^%s -\\{8,\\} >8 -\\{8,\\}$" comment-start)) - (comment-start-regex (format "^\\(%s\\|$\\)" comment-start))) - (save-excursion - (goto-char (or (re-search-forward cut-line-regex nil t) - (point-max))) - (while (and (not (bobp)) (looking-at comment-start-regex)) - (forward-line -1)) - (unless (looking-at comment-start-regex) - (forward-line)) - (setq end (point))) - (flyspell-region (point-min) end))) - -(defun git-commit-flyspell-verify () - (not (= (char-after (line-beginning-position)) - (aref comment-start 0)))) - -(defun git-commit-finish-query-functions (force) - (run-hook-with-args-until-failure - 'git-commit-finish-query-functions force)) - -(defun git-commit-check-style-conventions (force) - "Check for violations of certain basic style conventions. - -For each violation ask the user if she wants to proceed anyway. -Option `git-commit-style-convention-checks' controls which -conventions are checked." - (or force - (save-excursion - (goto-char (point-min)) - (re-search-forward (git-commit-summary-regexp) nil t) - (if (equal (match-str 1) "") - t ; Just try; we don't know whether --allow-empty-message was used. - (and (or (not (memq 'overlong-summary-line - git-commit-style-convention-checks)) - (equal (match-str 2) "") - (y-or-n-p "Summary line is too long. Commit anyway? ")) - (or (not (memq 'non-empty-second-line - git-commit-style-convention-checks)) - (not (match-str 3)) - (y-or-n-p "Second line is not empty. Commit anyway? "))))))) - -(defun git-commit-cancel-message () - (message - (concat "Commit canceled" - (and (memq 'git-commit-save-message with-editor-pre-cancel-hook) - ". Message saved to `log-edit-comment-ring'")))) - -;;; History - -(defun git-commit-prev-message (arg) - "Cycle backward through message history, after saving current message. -With a numeric prefix ARG, go back ARG messages." - (interactive "*p") - (let ((len (ring-length log-edit-comment-ring))) - (if (<= len 0) - (progn (message "Empty comment ring") (ding)) - ;; Unlike `log-edit-previous-comment' we save the current - ;; non-empty and newly written comment, because otherwise - ;; it would be irreversibly lost. - (when-let* ((message (git-commit-buffer-message)) - (_(not (ring-member log-edit-comment-ring message)))) - (ring-insert log-edit-comment-ring message) - (cl-incf arg) - (setq len (ring-length log-edit-comment-ring))) - ;; Delete the message but not the instructions at the end. - (save-restriction - (goto-char (point-min)) - (narrow-to-region - (point) - (if (re-search-forward (concat "^" comment-start) nil t) - (max 1 (- (point) 2)) - (point-max))) - (delete-region (point-min) (point))) - (setq log-edit-comment-ring-index (log-edit-new-comment-index arg len)) - (message "Comment %d" (1+ log-edit-comment-ring-index)) - (insert (ring-ref log-edit-comment-ring log-edit-comment-ring-index))))) - -(defun git-commit-next-message (arg) - "Cycle forward through message history, after saving current message. -With a numeric prefix ARG, go forward ARG messages." - (interactive "*p") - (git-commit-prev-message (- arg))) - -(defun git-commit-search-message-backward (string) - "Search backward through message history for a match for STRING. -Save current message first." - (interactive - (list (read-string (format-prompt "Comment substring" - log-edit-last-comment-match) - nil nil log-edit-last-comment-match))) - (cl-letf (((symbol-function #'log-edit-previous-comment) - (symbol-function #'git-commit-prev-message))) - (log-edit-comment-search-backward string))) - -(defun git-commit-search-message-forward (string) - "Search forward through message history for a match for STRING. -Save current message first." - (interactive - (list (read-string (format-prompt "Comment substring" - log-edit-last-comment-match) - nil nil log-edit-last-comment-match))) - (cl-letf (((symbol-function #'log-edit-previous-comment) - (symbol-function #'git-commit-prev-message))) - (log-edit-comment-search-forward string))) - -(defun git-commit-save-message () - "Save current message to `log-edit-comment-ring'." - (interactive) - (cond-let - ([message (git-commit-buffer-message)] - (when-let ((index (ring-member log-edit-comment-ring message))) - (ring-remove log-edit-comment-ring index)) - (ring-insert log-edit-comment-ring message) - (when git-commit-use-local-message-ring - (magit-repository-local-set 'log-edit-comment-ring - log-edit-comment-ring)) - (message "Message saved")) - ((message "Only whitespace and/or comments; message not saved")))) - -(defun git-commit-prepare-message-ring () - (make-local-variable 'log-edit-comment-ring-index) - (when git-commit-use-local-message-ring - (setq-local log-edit-comment-ring - (magit-repository-local-get - 'log-edit-comment-ring - (make-ring log-edit-maximum-comment-ring-size))))) - -(defun git-commit-buffer-message () - (let ((flush (concat "^" comment-start)) - (str (buffer-substring-no-properties (point-min) (point-max)))) - (with-temp-buffer - (insert str) - (goto-char (point-min)) - (when (re-search-forward (concat flush " -+ >8 -+$") nil t) - (delete-region (line-beginning-position) (point-max))) - (goto-char (point-min)) - (flush-lines flush) - (goto-char (point-max)) - (unless (eq (char-before) ?\n) - (insert ?\n)) - (setq str (buffer-string))) - (and (not (string-match "\\`[ \t\n\r]*\\'" str)) - (progn - (when (string-match "\\`\n\\{2,\\}" str) - (setq str (replace-match "\n" t t str))) - (when (string-match "\n\\{2,\\}\\'" str) - (setq str (replace-match "\n" t t str))) - str)))) - -;;; Trailers - -(transient-define-prefix git-commit-insert-trailer () - "Insert a commit message trailer. - -See also manpage git-interpret-trailer(1). This command does -not use that Git command, but the initial description still -serves as a good introduction." - [[:description (##cond (prefix-arg - "Insert ... by someone ") - ("Insert ... by yourself")) - ("a" "Ack" git-commit-ack) - ("m" "Modified" git-commit-modified) - ("r" "Reviewed" git-commit-review) - ("s" "Signed-off" git-commit-signoff) - ("t" "Tested" git-commit-test)] - ["Insert ... by someone" - ("C-c" "Cc" git-commit-cc) - ("C-r" "Reported" git-commit-reported) - ("C-i" "Suggested" git-commit-suggested) - ("C-a" "Co-authored" git-commit-co-authored) - ("C-d" "Co-developed" git-commit-co-developed)]]) - -(defun git-commit-ack (name mail) - "Insert a trailer acknowledging that you have looked at the commit." - (interactive (git-commit-get-ident "Acked-by")) - (git-commit--insert-ident-trailer "Acked-by" name mail)) - -(defun git-commit-modified (name mail) - "Insert a trailer to signal that you have modified the commit." - (interactive (git-commit-get-ident "Modified-by")) - (git-commit--insert-ident-trailer "Modified-by" name mail)) - -(defun git-commit-review (name mail) - "Insert a trailer acknowledging that you have reviewed the commit. -With a prefix argument, prompt for another person who performed a -review." - (interactive (git-commit-get-ident "Reviewed-by")) - (git-commit--insert-ident-trailer "Reviewed-by" name mail)) - -(defun git-commit-signoff (name mail) - "Insert a trailer to sign off the commit. -With a prefix argument, prompt for another person who signed off." - (interactive (git-commit-get-ident "Signed-off-by")) - (git-commit--insert-ident-trailer "Signed-off-by" name mail)) - -(defun git-commit-test (name mail) - "Insert a trailer acknowledging that you have tested the commit. -With a prefix argument, prompt for another person who tested." - (interactive (git-commit-get-ident "Tested-by")) - (git-commit--insert-ident-trailer "Tested-by" name mail)) - -(defun git-commit-cc (name mail) - "Insert a trailer mentioning someone who might be interested." - (interactive (git-commit-read-ident "Cc")) - (git-commit--insert-ident-trailer "Cc" name mail)) - -(defun git-commit-reported (name mail) - "Insert a trailer mentioning the person who reported the issue." - (interactive (git-commit-read-ident "Reported-by")) - (git-commit--insert-ident-trailer "Reported-by" name mail)) - -(defun git-commit-suggested (name mail) - "Insert a trailer mentioning the person who suggested the change." - (interactive (git-commit-read-ident "Suggested-by")) - (git-commit--insert-ident-trailer "Suggested-by" name mail)) - -(defun git-commit-co-authored (name mail) - "Insert a trailer mentioning the person who co-authored the commit." - (interactive (git-commit-read-ident "Co-authored-by")) - (git-commit--insert-ident-trailer "Co-authored-by" name mail)) - -(defun git-commit-co-developed (name mail) - "Insert a trailer mentioning the person who co-developed the commit." - (interactive (git-commit-read-ident "Co-developed-by")) - (git-commit--insert-ident-trailer "Co-developed-by" name mail)) - -(defun git-commit-get-ident (&optional prompt) - "Return name and email of the user or read another name and email. -If PROMPT and `current-prefix-arg' are both non-nil, read name -and email using `git-commit-read-ident' (which see), otherwise -return name and email of the current user (you)." - (if (and prompt current-prefix-arg) - (git-commit-read-ident prompt) - (list (or (getenv "GIT_AUTHOR_NAME") - (getenv "GIT_COMMITTER_NAME") - (with-demoted-errors "Error running 'git config user.name': %S" - (magit-get "user.name")) - user-full-name - (read-string "Name: ")) - (or (getenv "GIT_AUTHOR_EMAIL") - (getenv "GIT_COMMITTER_EMAIL") - (getenv "EMAIL") - (with-demoted-errors "Error running 'git config user.email': %S" - (magit-get "user.email")) - (read-string "Email: "))))) - -(defalias 'git-commit-self-ident #'git-commit-get-ident) - -(defvar git-commit-read-ident-history nil) - -(defun git-commit-read-ident (prompt) - "Read a name and email, prompting with PROMPT, and return them. -Read them using a single prompt, offering past commit authors as -completion candidates. The input must have the form \"NAME \"." - (let ((str (magit-completing-read - prompt - (sort (delete-dups - (magit-git-lines "log" "-n9999" "--format=%aN <%ae>")) - #'string<) - nil 'any nil 'git-commit-read-ident-history))) - (save-match-data - (if (string-match "\\`\\([^<]+\\) *<\\([^>]+\\)>\\'" str) - (list (save-match-data (string-trim (match-str 1 str))) - (string-trim (match-str 2 str))) - (user-error "Invalid input"))))) - -(defun git-commit--insert-ident-trailer (trailer name email) - (git-commit--insert-trailer trailer (format "%s <%s>" name email))) - -(defun git-commit--insert-trailer (trailer value) - (save-excursion - (let ((string (format "%s: %s" trailer value)) - (leading-comment-end nil)) - ;; Make sure we skip forward past any leading comments. - (goto-char (point-min)) - (while (looking-at comment-start) - (forward-line)) - (setq leading-comment-end (point)) - (goto-char (point-max)) - (cond - ;; Look backwards for existing trailers. - ((re-search-backward (git-commit--trailer-regexp) nil t) - (end-of-line) - (insert ?\n string) - (unless (= (char-after) ?\n) - (insert ?\n))) - ;; Or place the new trailer right before the first non-leading - ;; comments. - (t - (while (re-search-backward (concat "^" comment-start) - leading-comment-end t)) - (unless (looking-back "\n\n" nil) - (insert ?\n)) - (insert string ?\n)))) - (unless (or (eobp) (= (char-after) ?\n)) - (insert ?\n)))) - -;;; Font-Lock - -(defvar-local git-commit-need-summary-line t - "Whether the text should have a heading that is separated from the body. - -For commit messages that is a convention that should not -be violated. For notes it is up to the user. If you do -not want to insist on an empty second line here, then use -something like: - - (add-hook \\='git-commit-setup-hook - (lambda () - (when (equal (file-name-nondirectory (buffer-file-name)) - \"NOTES_EDITMSG\") - (setq git-commit-need-summary-line nil))))") - -(defun git-commit--trailer-regexp () - (format - "^\\(?:\\(%s:\\)\\( .*\\)\\|\\([-a-zA-Z]+\\): \\([^<\n]+? <[^>\n]+>\\)\\)" - (regexp-opt git-commit-trailers))) - -(defun git-commit-summary-regexp () - (if git-commit-need-summary-line - (concat - ;; Leading empty lines and comments - (format "\\`\\(?:^\\(?:\\s-*\\|%s.*\\)\n\\)*" comment-start) - ;; Summary line - (format "\\(.\\{0,%d\\}\\)\\(.*\\)" git-commit-summary-max-length) - ;; Non-empty non-comment second line - (format "\\(?:\n%s\\|\n\\(.+\\)\\)?" comment-start)) - "\\(EASTER\\) \\(EGG\\)")) - -(defun git-commit-extend-region-summary-line () - "Identify the multiline summary-regexp construct. -Added to `font-lock-extend-region-functions'." - (save-excursion - (save-match-data - (goto-char (point-min)) - (when (looking-at (git-commit-summary-regexp)) - (let ((summary-beg (match-beginning 0)) - (summary-end (match-end 0))) - (when (or (< summary-beg font-lock-beg summary-end) - (< summary-beg font-lock-end summary-end)) - (setq font-lock-beg (min font-lock-beg summary-beg)) - (setq font-lock-end (max font-lock-end summary-end)))))))) - -(defvar-local git-commit--branch-name-regexp nil) - -(defconst git-commit-comment-headings - '("Changes to be committed:" - "Untracked files:" - "Changed but not updated:" - "Changes not staged for commit:" - "Unmerged paths:" - "Author:" - "Date:") - "Also fontified outside of comments in `git-commit-font-lock-keywords-2'.") - -(defconst git-commit-font-lock-keywords-1 - '(;; Trailers - (eval . `(,(git-commit--trailer-regexp) - (1 'git-commit-trailer-token nil t) - (2 'git-commit-trailer-value nil t) - (3 'git-commit-trailer-token nil t) - (4 'git-commit-trailer-value nil t))) - ;; Summary - (eval . `(,(git-commit-summary-regexp) - (1 'git-commit-summary))) - ;; - Keyword [aka "text in brackets"] (overrides summary) - ("\\[[^][]+?\\]" - (0 'git-commit-keyword t)) - ;; - Non-empty second line (overrides summary and note) - (eval . `(,(git-commit-summary-regexp) - (2 'git-commit-overlong-summary t t) - (3 'git-commit-nonempty-second-line t t))))) - -(defconst git-commit-font-lock-keywords-2 - `(,@git-commit-font-lock-keywords-1 - ;; Comments - (eval . `(,(format "^%s.*" comment-start) - (0 'font-lock-comment-face append))) - (eval . `(,(format "^%s On branch \\(.*\\)" comment-start) - (1 'git-commit-comment-branch-local t))) - (eval . `(,(format "^%s \\(HEAD\\) detached at" comment-start) - (1 'git-commit-comment-detached t))) - (eval . `(,(format "^%s %s" comment-start - (regexp-opt git-commit-comment-headings t)) - (1 'git-commit-comment-heading t))) - (eval . `(,(format "^%s\t\\(?:\\([^:\n]+\\):\\s-+\\)?\\(.*\\)" comment-start) - (1 'git-commit-comment-action t t) - (2 'git-commit-comment-file t))) - ;; "commit HASH" - (eval . '("^commit [[:alnum:]]+$" - (0 'git-commit-trailer-value))) - ;; `git-commit-comment-headings' (but not in commented lines) - (eval . `(,(format "\\(?:^%s[[:blank:]]+.+$\\)" - (regexp-opt git-commit-comment-headings)) - (0 'git-commit-trailer-value))))) - -(defconst git-commit-font-lock-keywords-3 - `(,@git-commit-font-lock-keywords-2 - ;; More comments - (eval - ;; Your branch is ahead of 'master' by 3 commits. - ;; Your branch is behind 'master' by 2 commits, and can be fast-forwarded. - . `(,(format - "^%s Your branch is \\(?:ahead\\|behind\\) of '%s' by \\([0-9]*\\)" - comment-start git-commit--branch-name-regexp) - (1 'git-commit-comment-branch-local t) - (2 'git-commit-comment-branch-remote t) - (3 'bold t))) - (eval - ;; Your branch is up to date with 'master'. - ;; Your branch and 'master' have diverged, - . `(,(format - "^%s Your branch \\(?:is up[- ]to[- ]date with\\|and\\) '%s'" - comment-start git-commit--branch-name-regexp) - (1 'git-commit-comment-branch-local t) - (2 'git-commit-comment-branch-remote t))) - (eval - ;; and have 1 and 2 different commits each, respectively. - . `(,(format - "^%s and have \\([0-9]*\\) and \\([0-9]*\\) commits each" - comment-start) - (1 'bold t) - (2 'bold t))))) - -(defvar git-commit-font-lock-keywords git-commit-font-lock-keywords-3 - "Font-Lock keywords for Git-Commit mode.") - -(defun git-commit-setup-font-lock () - (with-demoted-errors "Error running git-commit-setup-font-lock: %S" - (let ((table (make-syntax-table (syntax-table)))) - (when comment-start - (modify-syntax-entry (string-to-char comment-start) "." table)) - (modify-syntax-entry ?# "." table) - (modify-syntax-entry ?\" "." table) - (modify-syntax-entry ?\' "." table) - (modify-syntax-entry ?` "." table) - (set-syntax-table table)) - (setq-local comment-start (or (magit-get "core.commentchar") "#")) - (setq-local comment-start-skip (format "^%s+[\s\t]*" comment-start)) - (setq-local comment-end "") - (setq-local comment-end-skip "\n") - (setq-local comment-use-syntax nil) - (when (and (derived-mode-p 'markdown-mode) - (fboundp 'markdown-fill-paragraph)) - (setq-local fill-paragraph-function - (lambda (&optional justify) - (and (not (= (char-after (line-beginning-position)) - (aref comment-start 0))) - (markdown-fill-paragraph justify))))) - (setq-local git-commit--branch-name-regexp - ;; When using cygwin git, we may end up in a - ;; non-existing directory, which would cause - ;; any git calls to signal an error. - (if (file-accessible-directory-p default-directory) - ;; Font-Lock wants every submatch to succeed, so - ;; also match the empty string. Avoid listing - ;; remote branches and using `regexp-quote', - ;; because in repositories that have thousands of - ;; branches that would be very slow. See #4353. - (format "\\(\\(?:%s\\)\\|\\)\\([^']+\\)" - (string-join (magit-list-local-branch-names) "\\|")) - "\\([^']*\\)")) - (setq-local font-lock-multiline t) - (add-hook 'font-lock-extend-region-functions - #'git-commit-extend-region-summary-line - t t) - (font-lock-add-keywords nil git-commit-font-lock-keywords))) - -(defun git-commit-propertize-diff () - (require 'diff-mode) - (save-excursion - (goto-char (point-min)) - (when (re-search-forward "^diff --git" nil t) - (beginning-of-line) - (let ((buffer (current-buffer))) - (insert - (with-temp-buffer - (insert - (with-current-buffer buffer - (prog1 (buffer-substring-no-properties (point) (point-max)) - (delete-region (point) (point-max))))) - (let ((diff-default-read-only nil)) - (diff-mode)) - ;; These won't survive copying to another buffer, - ;; so let's not waste any time. See #5483. - (setq-local diff-refine nil) - (setq-local diff-font-lock-syntax nil) - (setq-local diff-font-lock-prettify nil) - (let ((font-lock-verbose nil) - (font-lock-support-mode nil)) - (font-lock-ensure)) - (let ((pos (point-min))) - (while-let ((next (next-single-property-change pos 'face))) - (put-text-property pos next 'font-lock-face - (get-text-property pos 'face)) - (setq pos next)) - (put-text-property pos (point-max) 'font-lock-face - (get-text-property pos 'face))) - (buffer-string))))))) - -;;; Elisp Text Mode - -(define-derived-mode git-commit-elisp-text-mode text-mode "ElText" - "Major mode for editing commit messages of elisp projects. -This is intended for use as `git-commit-major-mode' for projects -that expect `symbols' to look like this. I.e., like they look in -Elisp doc-strings, including this one. Unlike in doc-strings, -\"strings\" also look different than the other text." - (setq font-lock-defaults '(git-commit-elisp-text-mode-keywords))) - -(defvar git-commit-elisp-text-mode-keywords - `((,(concat "[`‘]\\(" lisp-mode-symbol-regexp "\\)['’]") - (1 font-lock-constant-face prepend)) - ("\"[^\"]*\"" (0 font-lock-string-face prepend)))) - -;;; Post Hook - -(defcustom git-commit-post-finish-hook nil - "Hook run after the user finished writing a commit message. - -\\\ -This hook is only run after pressing \\[with-editor-finish] in a buffer used -to edit a commit message. If a commit is created without the -user typing a message into a buffer, then this hook is not run. - -This hook is not run until the new commit has been created. If -that takes Git longer than `git-commit-post-finish-hook-timeout' -seconds, then this hook isn't run at all. For certain commands -such as `magit-rebase-continue' this hook is never run because -doing so would lead to a race condition. - -Also see `magit-post-commit-hook'." - :group 'git-commit - :type 'hook - :get #'magit-hook-custom-get) - -(defcustom git-commit-post-finish-hook-timeout 2 - "Time in seconds to wait for git to create a commit. - -The hook `git-commit-post-finish-hook' (which see) is run only -after git is done creating a commit. If it takes longer than -`git-commit-post-finish-hook-timeout' seconds to create the -commit, then the hook is not run at all." - :group 'git-commit - :safe 'numberp - :type 'number) - -(defun git-commit-add-post-finish-hook () - (unless (memq last-command - '(magit-sequencer-continue - magit-sequencer-skip - magit-am-continue - magit-am-skip - magit-rebase-continue - magit-rebase-skip)) - (add-hook 'with-editor-post-finish-hook - (apply-partially #'git-commit-run-post-finish-hook - (magit-rev-parse "HEAD")) - nil t))) - -(defun git-commit-run-post-finish-hook (previous) - (when git-commit-post-finish-hook - (if (with-timeout (git-commit-post-finish-hook-timeout) - (while (equal (magit-rev-parse "HEAD") previous) - (sit-for 0.01)) - t) - (run-hooks 'git-commit-post-finish-hook) - (message "No commit created after %s second. Not running %s." - git-commit-post-finish-hook-timeout - 'git-commit-post-finish-hook)))) - -;;; _ - -(define-obsolete-function-alias - 'git-commit-insert-pseudo-header - 'git-commit-insert-trailer - "git-commit 4.0.0") -(define-obsolete-function-alias - 'git-commit-insert-header - 'git-commit--insert-ident-trailer - "git-commit 4.0.0") -(define-obsolete-face-alias - 'git-commit-pseudo-header - 'git-commit-trailer-value - "git-commit 4.0.0") -(define-obsolete-face-alias - 'git-commit-known-pseudo-header - 'git-commit-trailer-token - "git-commit 4.0.0") - -(provide 'git-commit) -;; Local Variables: -;; read-symbol-shorthands: ( -;; ("and$" . "cond-let--and$") -;; ("and>" . "cond-let--and>") -;; ("and-let" . "cond-let--and-let") -;; ("if-let" . "cond-let--if-let") -;; ("when-let" . "cond-let--when-let") -;; ("while-let" . "cond-let--while-let") -;; ("match-string" . "match-string") -;; ("match-str" . "match-string-no-properties")) -;; End: -;;; git-commit.el ends here diff --git a/.config/emacs/lisp/magit/lisp/git-rebase.el b/.config/emacs/lisp/magit/lisp/git-rebase.el deleted file mode 100644 index 07c11d9..0000000 --- a/.config/emacs/lisp/magit/lisp/git-rebase.el +++ /dev/null @@ -1,956 +0,0 @@ -;;; git-rebase.el --- Edit Git rebase files -*- lexical-binding:t -*- - -;; Copyright (C) 2008-2026 The Magit Project Contributors - -;; Author: Phil Jackson -;; Maintainer: Jonas Bernoulli - -;; SPDX-License-Identifier: GPL-3.0-or-later - -;; Magit is free software: you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Magit is distributed in the hope that it will be useful, but WITHOUT -;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -;; License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with Magit. If not, see . - -;;; Commentary: - -;; This package assists the user in editing the list of commits to be -;; rewritten during an interactive rebase. - -;; When the user initiates an interactive rebase, e.g., using "r e" in -;; a Magit buffer or on the command line using "git rebase -i REV", -;; Git invokes the `$GIT_SEQUENCE_EDITOR' (or if that is undefined -;; `$GIT_EDITOR' or even `$EDITOR') letting the user rearrange, drop, -;; reword, edit, and squash commits. - -;; This package provides the major-mode `git-rebase-mode' which makes -;; doing so much more fun, by making the buffer more colorful and -;; providing the following commands: -;; -;; C-c C-c Tell Git to make it happen. -;; C-c C-k Tell Git that you changed your mind, i.e., abort. -;; -;; p Move point to previous line. -;; n Move point to next line. -;; -;; M-p Move the commit at point up. -;; M-n Move the commit at point down. -;; -;; d Drop the commit at point. -;; c Keep the commit at point. -;; r Change the message of the commit at point. -;; e Edit the commit at point. -;; s Squash the commit at point, into the one above. -;; f Like "s" but don't also edit the commit message. -;; b Break for editing at this point in the sequence. -;; x Add a script to be run with the commit at point -;; being checked out. -;; k Un-/comment current line. -;; z Add noop action at point. -;; -;; SPC Show the commit at point in another buffer. -;; RET Show the commit at point in another buffer and -;; select its window. -;; C-/ Undo last change. -;; -;; Commands for --rebase-merges: -;; l Associate label with current HEAD in sequence. -;; MM Merge specified revisions into HEAD. -;; Mt Toggle whether the merge will invoke an editor -;; before committing. -;; t Reset HEAD to the specified label. - -;; You should probably also read the `git-rebase' manpage. - -;;; Code: - -(require 'magit) - -(require 'easymenu) -(require 'server) -(require 'with-editor) - -(defvar recentf-exclude) - -;;; Options -;;;; Variables - -(defgroup git-rebase nil - "Edit Git rebase sequences." - :link '(info-link "(magit)Editing Rebase Sequences") - :group 'tools) - -(defcustom git-rebase-auto-advance t - "Whether to move to next line after changing a line." - :group 'git-rebase - :type 'boolean) - -(defcustom git-rebase-show-instructions t - "Whether to show usage instructions inside the rebase buffer." - :group 'git-rebase - :type 'boolean) - -(defcustom git-rebase-confirm-cancel t - "Whether confirmation is required to cancel." - :group 'git-rebase - :type 'boolean) - -;;;; Faces - -(defgroup git-rebase-faces nil - "Faces used by Git-Rebase mode." - :group 'faces - :group 'git-rebase) - -(defface git-rebase-hash '((t :inherit magit-hash)) - "Face for commit hashes." - :group 'git-rebase-faces) - -(defface git-rebase-label '((t :inherit magit-refname)) - "Face for labels in label, merge, and reset lines." - :group 'git-rebase-faces) - -(defface git-rebase-description '((t nil)) - "Face for commit descriptions." - :group 'git-rebase-faces) - -(defface git-rebase-action - '((t :inherit font-lock-keyword-face)) - "Face for action keywords." - :group 'git-rebase-faces) - -(defface git-rebase-killed-action - '((t :inherit font-lock-comment-face :strike-through t)) - "Face for commented commit action lines." - :group 'git-rebase-faces) - -(defface git-rebase-comment-hash - '((t :inherit git-rebase-hash :weight bold)) - "Face for commit hashes in commit message comments." - :group 'git-rebase-faces) - -(defface git-rebase-comment-heading - '((t :inherit font-lock-keyword-face)) - "Face for headings in rebase message comments." - :group 'git-rebase-faces) - -;;; Keymaps - -(defvar-keymap git-rebase-mode-map - :doc "Keymap for Git-Rebase mode." - :parent special-mode-map - "C-m" #'git-rebase-show-commit - "p" #'git-rebase-backward-line - "n" #'forward-line - "M-p" #'git-rebase-move-line-up - "M-n" #'git-rebase-move-line-down - "c" #'git-rebase-pick - "d" #'git-rebase-drop - "k" #'git-rebase-kill-line - "C-k" #'git-rebase-kill-line - "b" #'git-rebase-break - "e" #'git-rebase-edit - "l" #'git-rebase-label - "M M" #'git-rebase-merge - "M t" #'git-rebase-merge-toggle-editmsg - "m" #'git-rebase-edit - "s" #'git-rebase-squash - "S" #'git-rebase-squish - "f" #'git-rebase-fixup - "F" #'git-rebase-alter - "A" #'git-rebase-alter - "q" #'undefined - "r" #'git-rebase-reword - "w" #'git-rebase-reword - "t" #'git-rebase-reset - "u" #'git-rebase-update-ref - "x" #'git-rebase-exec - "y" #'git-rebase-insert - "z" #'git-rebase-noop - "SPC" #'git-rebase-show-or-scroll-up - "DEL" #'git-rebase-show-or-scroll-down - "C-x C-t" #'git-rebase-move-line-up - "M-" #'git-rebase-move-line-up - "M-" #'git-rebase-move-line-down - " " #'git-rebase-undo) -(put 'git-rebase-alter :advertised-binding (kbd "F")) -(put 'git-rebase-reword :advertised-binding (kbd "r")) -(put 'git-rebase-move-line-up :advertised-binding (kbd "M-p")) -(put 'git-rebase-kill-line :advertised-binding (kbd "k")) - -(easy-menu-define git-rebase-mode-menu git-rebase-mode-map - "Git-Rebase mode menu." - '("Rebase" - ["Pick" git-rebase-pick t] - ["Drop" git-rebase-drop t] - ["Reword" git-rebase-reword t] - ["Edit" git-rebase-edit t] - ["Squash" git-rebase-squash t] - ["Fixup" git-rebase-fixup t] - ["Kill" git-rebase-kill-line t] - ["Noop" git-rebase-noop t] - ["Execute" git-rebase-exec t] - ["Move Down" git-rebase-move-line-down t] - ["Move Up" git-rebase-move-line-up t] - "---" - ["Cancel" with-editor-cancel t] - ["Finish" with-editor-finish t])) - -(defvar git-rebase-command-descriptions - '((with-editor-finish . "tell Git to make it happen") - (with-editor-cancel . "tell Git that you changed your mind, i.e., abort") - (git-rebase-backward-line . "move point to previous line") - (forward-line . "move point to next line") - (git-rebase-move-line-up . "move the commit at point up") - (git-rebase-move-line-down . "move the commit at point down") - (git-rebase-show-or-scroll-up . "show the commit at point in another buffer") - (git-rebase-show-commit - . "show the commit at point in another buffer and select its window") - (undo . "undo last change") - (git-rebase-drop . "drop the commit at point") - (git-rebase-kill-line . "un-/comment current line") - (git-rebase-insert . "insert a line for an arbitrary commit") - (git-rebase-noop . "add noop action at point"))) - -(defvar git-rebase-fixup-descriptions - '((git-rebase-squish - . "fixup -c = use commit, but meld into previous commit,\n#\ - dropping previous commit's message, and open the editor") - (git-rebase-fixup - . "fixup = use commit, but meld into previous commit,\n#\ - dropping 's message") - (git-rebase-alter - . "fixup -C = use commit, but meld into previous commit,\n#\ - dropping previous commit's message"))) - -;;; Commands - -(defun git-rebase-pick () - "Use commit on current line. -If the region is active, act on all lines touched by the region." - (interactive) - (git-rebase-set-action "pick")) - -(defun git-rebase-drop () - "Drop commit on current line. -If the region is active, act on all lines touched by the region." - (interactive) - (git-rebase-set-action "drop")) - -(defun git-rebase-reword () - "Edit message of commit on current line. -If the region is active, act on all lines touched by the region." - (interactive) - (git-rebase-set-action "reword")) - -(defun git-rebase-edit () - "Stop at the commit on the current line. -If the region is active, act on all lines touched by the region." - (interactive) - (git-rebase-set-action "edit")) - -(defun git-rebase-squash () - "Fold commit on current line into previous commit, edit combined message. -If the region is active, act on all lines touched by the region." - (interactive) - (git-rebase-set-action "squash")) - -(defun git-rebase-squish () - "Fold current into previous commit, discard previous message and edit current. -This is like `git-rebase-squash', except that the other message is kept. -The action indicatore shown in the list commits is \"fixup -c\". If the -region is active, act on all lines touched by the region." - (interactive) - (git-rebase-set-action "fixup -c")) - -(defun git-rebase-fixup () - "Fold commit on current line into previous commit, discard current message. -If the region is active, act on all lines touched by the region." - (interactive) - (git-rebase-set-action "fixup")) - -(defun git-rebase-alter () - "Meld current into previous commit, discard previous message and use current. -This is like `git-rebase-fixup', except that the other message is kept. -The action indicatore shown in the list commits is \"fixup -C\". If the -region is active, act on all lines touched by the region." - (interactive) - (git-rebase-set-action "fixup -C")) - -(defvar-local git-rebase-comment-re nil) - -(defvar git-rebase-short-options - '((?b . "break") - (?d . "drop") - (?e . "edit") - (?f . "fixup") - (?l . "label") - (?m . "merge") - (?p . "pick") - (?r . "reword") - (?s . "squash") - (?t . "reset") - (?u . "update-ref") - (?x . "exec")) - "Alist mapping single key of an action to the full name.") - -(defclass git-rebase-action () - (;; action-type: commit, exec, bare, label, merge - (action-type :initarg :action-type :initform nil) - ;; Examples for each action type: - ;; | action | action options | target | trailer | - ;; |--------+----------------+---------+---------| - ;; | pick | | hash | subject | - ;; | exec | | command | | - ;; | noop | | | | - ;; | reset | | name | subject | - ;; | merge | -C hash | name | subject | - (action :initarg :action :initform nil) - (action-options :initarg :action-options :initform nil) - (target :initarg :target :initform nil) - (trailer :initarg :trailer :initform nil) - (comment-p :initarg :comment-p :initform nil) - (abbrev))) - -(defvar git-rebase-line-regexps - ;; 1: action, 2: option, 3: target, 4: "#", 5: description. - ;; - ;; [[# ] ] - ;; fixup [-C|-c] [[# ] ] - `((commit . ,(concat - (regexp-opt '("d" "drop" - "e" "edit" - "f" "fixup" - "f -C" "fixup -C" - "f -c" "fixup -c" - "p" "pick" - "r" "reword" - "s" "squash") - "\\(?1:") - " \\(?3:[^ \n]+\\)" - "\\(?: \\(?4:# \\)?\\(?5:.*\\)\\)?")) - (exec . "\\(?1:x\\|exec\\) \\(?3:.*\\)") - (bare . ,(concat (regexp-opt '("b" "break" "noop") "\\(?1:") - " *$")) - (label . ,(concat (regexp-opt '("l" "label" - "t" "reset" - "u" "update-ref") - "\\(?1:") - " \\(?3:[^ \n]+\\)" - "\\(?: \\(?4:# \\)?\\(?5:.*\\)\\)?")) - ;; merge [-C | -c ]

- homepage | - manual | - faq | - wiki | - mastodon -