diff options
-rw-r--r-- | init.el | 96 | ||||
-rw-r--r-- | lisp/km-util.el | 8 |
2 files changed, 48 insertions, 56 deletions
@@ -101,7 +101,7 @@ :init (require 'org-loaddefs) (add-to-list 'load-path "~/src/emacs/org-mode/contrib/lisp/" t) - (after 'info + (with-eval-after-load 'info (info-initialize) (add-to-list 'Info-directory-list "~/src/emacs/org-mode/doc/")) (bind-keys :map km/global-org-map @@ -320,7 +320,7 @@ (define-key ctl-x-4-map "o" #'km/org-switch-to-buffer-other-window) - (after 'org + (with-eval-after-load 'org (define-key org-mode-map (kbd "C-c C-x B") #'km/org-tree-to-indirect-buffer-current-window) (define-key org-mode-map [remap org-tree-to-indirect-buffer] @@ -339,7 +339,7 @@ (add-hook 'org-after-refile-insert-hook #'km/org-maybe-sort-parent) (org-add-link-type "pmid" #'km/org-pmid-open)) - (after 'ox-md + (with-eval-after-load 'ox-md (advice-add 'org-md-paragraph :filter-return #'km/org-md-fill-string))) (use-package km-org-agenda @@ -348,7 +348,7 @@ ("j" . km/org-goto-agenda-heading) ("m" . km/org-open-default-notes-file-inbox) ("n" . km/org-agenda-add-or-remove-file)) - (after 'org + (with-eval-after-load 'org (define-key org-mode-map [remap org-agenda-set-restriction-lock] #'km/org-agenda-set-restriction-lock)) @@ -513,54 +513,54 @@ (use-package ace-link :init - (after 'org + (with-eval-after-load 'org (define-key org-mode-map (kbd "C-c m o") #'ace-link-org)) - (after 'info + (with-eval-after-load 'info (define-key Info-mode-map "o" #'ace-link-info)) - (after 'compile + (with-eval-after-load 'compile (define-key compilation-mode-map "o" #'ace-link-compilation)) - (after 'help-mode + (with-eval-after-load 'help-mode (define-key help-mode-map "o" #'ace-link-help)) - (after 'woman + (with-eval-after-load 'woman (define-key woman-mode-map "o" #'ace-link-woman)) - (after 'eww + (with-eval-after-load 'eww (define-key eww-link-keymap "o" #'ace-link-eww) (define-key eww-mode-map "o" #'ace-link-eww))) (use-package km-ace-link :init - (after 'dired + (with-eval-after-load 'dired ;; This overrides the binding for `dired-find-file-other-window'. (define-key dired-mode-map "o" #'km/ace-link-dired) (define-key dired-mode-map "r" #'dired-find-file-other-window)) - (after 'notmuch + (with-eval-after-load 'notmuch (define-key notmuch-hello-mode-map "o" #'km/ace-link-widget)) - (after 'gnus-sum + (with-eval-after-load 'gnus-sum (define-key gnus-summary-mode-map "o" #'km/ace-link-widget)) - (after 'gnus-art + (with-eval-after-load 'gnus-art (define-key gnus-article-mode-map "o" #'km/ace-link-widget))) (use-package km-avy :init - (after 'elfeed-search + (with-eval-after-load 'elfeed-search (define-key elfeed-search-mode-map "j" #'km/elfeed-avy-goto-subword-1)) - (after 'gnus-sum + (with-eval-after-load 'gnus-sum (define-key gnus-summary-mode-map "j" #'km/gnus-avy-goto-subword-and-select)) - (after 'grep + (with-eval-after-load 'grep (define-key grep-mode-map "j" #'km/grep-avy-goto-subword-1)) - (after 'org-agenda + (with-eval-after-load 'org-agenda (define-key org-agenda-mode-map "j" #'km/org-agenda-avy-goto-subword-1)) - (after 'magit + (with-eval-after-load 'magit (define-key magit-refs-mode-map "j" #'km/magit-avy-goto-subword-1)) - (after 'magit-log + (with-eval-after-load 'magit-log (define-key magit-log-mode-map "j" #'km/magit-avy-goto-subword-1) (define-key magit-cherry-mode-map "j" #'km/magit-avy-goto-subword-1)) - (after 'notmuch + (with-eval-after-load 'notmuch (define-key notmuch-common-keymap "j" #'km/notmuch-avy-goto-subword-1)) (define-key occur-mode-map "j" #'km/occur-avy-goto-subword-1) :config - (after 'avy + (with-eval-after-load 'avy (add-to-list 'avy-dispatch-alist (cons ?w #'km/avy-action-copy-line)))) (use-package ivy @@ -648,7 +648,7 @@ :load-path "~/src/emacs/cpinfo/" :init (require 'cpinfo-autoloads nil t) - (after 'dired + (with-eval-after-load 'dired (define-key km/dired-prefix-map "f" #'cpinfo-copy))) (use-package view @@ -806,7 +806,7 @@ (define-key km/projectile-ctl-x-4-map "v" #'km/projectile-view-file-other-window) - (after 'projectile + (with-eval-after-load 'projectile (bind-keys :map projectile-command-map ("4 v" . km/projectile-view-file-other-window) ("." . km/projectile-copy-project-filename-as-kill) @@ -832,13 +832,13 @@ "Save thing." (call-interactively #'km/projectile-save-thing))) :config - (after 'elisp-mode + (with-eval-after-load 'elisp-mode (add-hook 'emacs-lisp-mode-hook #'km/projectile-maybe-activate-xref-etags-mode)) - (after 'scheme + (with-eval-after-load 'scheme (add-hook 'scheme-mode-hook #'km/projectile-maybe-activate-xref-etags-mode)) - (after 'python + (with-eval-after-load 'python (add-hook 'python-mode-hook #'km/projectile-maybe-activate-xref-etags-mode))) @@ -1108,7 +1108,7 @@ (define-key km/magit-wip-map "w" #'km/magit-commit-wip-with-file) - (after 'git-rebase + (with-eval-after-load 'git-rebase (bind-keys :map git-rebase-mode-map ("d" . km/git-rebase-fixup-duplicates) ("j" . km/git-rebase-join-repeats) @@ -1162,7 +1162,7 @@ (transient-append-suffix 'magit-branch "c" '("m" "Checkout master" km/magit-checkout-master)) - (after 'magit-patch + (with-eval-after-load 'magit-patch (transient-append-suffix 'magit-patch-create "c" '("u" "@{upstream}.." km/magit-patch-create-from-upstream)) @@ -1259,7 +1259,7 @@ ("o" . hydra-multiple-cursors/body)) (define-key km/git-map "m" #'hydra-smerge/body) (define-key km/file-map "s" #'hydra-file-search-map/body) - (after 'org + (with-eval-after-load 'org (define-key km/org-prefix-map "." #'hydra-org-link-edit/body))) @@ -1279,7 +1279,7 @@ (use-package km-abbrev :init - (after 'abbrev + (with-eval-after-load 'abbrev (bind-keys :map abbrev-map ("c" . km/abbrev-add-case-global) ("iu" . km/abbrev-inverse-add-uppercase-global)))) @@ -1386,7 +1386,7 @@ (use-package km-dired :bind ("C-x C-d" . km/dired-switch-to-buffer) :init - (after 'projectile + (with-eval-after-load 'projectile (define-key km/dired-copy-filename-map "p" #'km/dired-copy-project-filename-as-kill)) (define-key km/dired-copy-filename-map "o" @@ -1396,7 +1396,7 @@ (define-key km/dired-prefix-map "t" #'km/dired-copy-last-mtime-as-kill) - (after 'dired + (with-eval-after-load 'dired (bind-keys :map dired-mode-map ;; This overrides `dired-clean-directory'. ("." . km/dired-beginning-of-buffer) @@ -1414,7 +1414,7 @@ (use-package dired-narrow :init - (after 'dired + (with-eval-after-load 'dired (bind-keys :map km/dired-narrow-prefix-map ("f" . dired-narrow-fuzzy) ("n" . dired-narrow) @@ -1424,7 +1424,7 @@ (use-package dired-subtree :init - (after 'dired + (with-eval-after-load 'dired (bind-keys :map km/dired-subtree-prefix-map ("@" . dired-subtree-mark-subtree) ("." . dired-subtree-unmark-subtree) @@ -1573,9 +1573,9 @@ ("c" . km/diff-current-buffer-with-file) ("o" . km/diff-with-other-window) ("O" . km/ediff-with-other-window)) - (after 'diff-mode + (with-eval-after-load 'diff-mode (define-key diff-mode-map (kbd "C-c C-l") #'km/diff-lock-buffer)) - (after 'ediff + (with-eval-after-load 'ediff (add-hook 'ediff-before-setup-hook #'km/ediff-save-window-config) (add-hook 'ediff-quit-hook #'km/ediff-restore-window-config))) @@ -1652,7 +1652,7 @@ (setq font-latex-fontify-sectioning 'color) (setq TeX-electric-math '("$" . "$")) - (after 'latex + (with-eval-after-load 'latex (put 'LaTeX-narrow-to-environment 'disabled nil) (add-hook 'LaTeX-mode-hook #'turn-on-reftex) (add-hook 'LaTeX-mode-hook #'flyspell-mode))) @@ -1931,7 +1931,7 @@ :init (require 'snakemake-autoloads nil t) (define-key km/compile-map "s" #'snakemake-popup) - (after 'dired + (with-eval-after-load 'dired (define-key dired-mode-map "b" #'snakemake-popup)) :config (setq snakemake-root-dir-function #'projectile-project-root) @@ -1945,7 +1945,7 @@ ;; version. (add-hook 'snakemake-mode-hook #'km/snakemake-set-local-vars) - (after 'snakemake + (with-eval-after-load 'snakemake (magit-change-popup-key 'snakemake-popup :action ?p ?o))) @@ -1978,11 +1978,11 @@ (use-package km-ess :init - (after 'ess-mode + (with-eval-after-load 'ess-mode (bind-keys :map ess-mode-map ("C-c C-." . km/ess-eval-buffer-up-to-line) ("|" . km/ess-insert-dplyr-pipe))) - (after 'ess-inf + (with-eval-after-load 'ess-inf (define-key inferior-ess-mode-map "|" #'km/ess-insert-dplyr-pipe))) @@ -2203,13 +2203,13 @@ km/gnus-group-sort-by-topic gnus-group-sort-by-level)) - (after 'gnus-sum + (with-eval-after-load 'gnus-sum (bind-keys :map gnus-summary-mode-map ("|" . km/gnus-pipe-to-project) ("c" . km/gnus-summary-catchup) ("l" . km/gnus-copy-message-link) ("o" . km/ace-link-widget))) - (after 'gnus-art + (with-eval-after-load 'gnus-art (bind-keys :map gnus-article-mode-map ("|" . km/gnus-pipe-to-project) ("C-c l" . km/gnus-follow-last-message-link) @@ -2243,7 +2243,7 @@ (use-package km-elfeed :init - (after 'elfeed + (with-eval-after-load 'elfeed (bind-keys :map elfeed-search-mode-map ("c" . km/elfeed-catchup) ("d" . km/elfeed-default-filter) @@ -2293,7 +2293,7 @@ (use-package server :config - (after 'magit-commit + (with-eval-after-load 'magit-commit (remove-hook 'server-switch-hook 'magit-commit-diff)) (unless (server-running-p) (server-start)) @@ -2302,12 +2302,12 @@ ;; Remove all mail map bindings except notmuch-related ones. (global-set-key (kbd "C-x m n") #'notmuch) (global-set-key (kbd "C-x m .") #'km/notmuch-show-at-point) - (after 'km-python + (with-eval-after-load 'km-python (add-hook 'kill-emacs-hook #'km/pydoc-save-names-file)) (savehist-mode 1) (setq save-abbrevs 'silently bookmark-save-flag 1) - (after 'notmuch-lib + (with-eval-after-load 'notmuch-lib (define-key notmuch-common-keymap "0" #'km/notmuch-sync-mail))))) ;;; init.el ends here diff --git a/lisp/km-util.el b/lisp/km-util.el index 7d6febe..13629eb 100644 --- a/lisp/km-util.el +++ b/lisp/km-util.el @@ -22,14 +22,6 @@ (require 'seq) -;; Taken from -;; http://milkbox.net/note/single-file-master-emacs-configuration/. -(defmacro after (mode &rest body) - "`eval-after-load' MODE evaluate BODY." - (declare (indent defun)) - `(eval-after-load ,mode - '(progn ,@body))) - (defun km/mode-buffers (mode) (seq-filter (lambda (buf) (with-current-buffer buf |