Merge branch 'develop' into add-keymap-description-for-ruby

This commit is contained in:
Henrik Lissner 2020-05-18 02:46:15 -04:00 committed by GitHub
commit 896cefb579
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
87 changed files with 2183 additions and 1611 deletions

View file

@ -5,7 +5,7 @@
(use-package! flycheck
:commands flycheck-list-errors flycheck-buffer
:after-call doom-switch-buffer-hook after-find-file
:hook (doom-first-buffer . global-flycheck-mode)
:config
(setq flycheck-emacs-lisp-load-path 'inherit)
@ -39,9 +39,7 @@
:n "j" #'flycheck-error-list-next-error
:n "k" #'flycheck-error-list-previous-error
:n "RET" #'flycheck-error-list-goto-error
:n [return] #'flycheck-error-list-goto-error)
(global-flycheck-mode +1))
:n [return] #'flycheck-error-list-goto-error))
(use-package! flycheck-popup-tip

View file

@ -2,7 +2,7 @@
(use-package! company
:commands company-complete-common company-manual-begin company-grab-line
:after-call pre-command-hook after-find-file
:hook (doom-first-input . global-company-mode)
:init
(setq company-idle-delay 0.25
company-minimum-prefix-length 2
@ -10,7 +10,7 @@
company-tooltip-align-annotations t
company-require-match 'never
company-global-modes
'(not erc-mode message-mode help-mode gud-mode eshell-mode)
'(not erc-mode message-mode help-mode gud-mode)
company-frontends '(company-pseudo-tooltip-frontend
company-echo-metadata-frontend)
@ -37,7 +37,14 @@
(unless (featurep! +childframe)
;; Don't persist company popups when switching back to normal mode.
;; `company-box' aborts on mode switch so it doesn't need this.
(add-hook 'evil-normal-state-entry-hook #'company-abort))
(add-hook! 'evil-normal-state-entry-hook
(defun +company-abort-h ()
;; HACK `company-abort' doesn't no-op if company isn't active; causing
;; unwanted side-effects, like the suppression of messages in the
;; echo-area.
;; REVIEW Revisit this to refactor; shouldn't be necessary!
(when company-candidates
(company-abort)))))
;; Allow users to switch between backends on the fly. E.g. C-x C-s followed
;; by C-x C-n, will switch from `company-yasnippet' to
;; `company-dabbrev-code'.
@ -45,8 +52,7 @@
:before #'company-begin-backend
(company-abort)))
(add-hook 'after-change-major-mode-hook #'+company-init-backends-h 'append)
(global-company-mode +1))
(add-hook 'after-change-major-mode-hook #'+company-init-backends-h 'append))
(use-package! company-tng
@ -137,8 +143,7 @@
"This disables the company-box scrollbar, because:
https://github.com/sebastiencs/company-box/issues/44"
:around #'company-box--update-scrollbar
(cl-letf (((symbol-function #'display-buffer-in-side-window)
(symbol-function #'ignore)))
(letf! ((#'display-buffer-in-side-window #'ignore))
(apply orig-fn args))))

View file

@ -23,8 +23,7 @@ be negative.")
;;; Packages
(use-package! helm-mode
:defer t
:after-call pre-command-hook
:hook (doom-first-input . helm-mode)
:init
(map! [remap apropos] #'helm-apropos
[remap find-library] #'helm-locate-library
@ -43,7 +42,6 @@ be negative.")
[remap recentf-open-files] #'helm-recentf
[remap yank-pop] #'helm-show-kill-ring)
:config
(helm-mode +1)
;; helm is too heavy for `find-file-at-point'
(add-to-list 'helm-completing-read-handlers-alist (cons #'find-file-at-point nil)))

View file

@ -8,12 +8,12 @@
;;; Packages
(use-package! ido
:after-call pre-command-hook
:hook (doom-first-input . ido-mode)
:hook (ido-mode . ido-everywhere)
:hook (ido-mode . ido-ubiquitous-mode)
:preface
;; HACK `ido' is a really old package. It defines `ido-mode' manually and
;; doesn't define a hook, so we define one for it.")
;; doesn't define a hook, so we define one for it, so we can use it!
(defadvice! +ido-run-hooks-a (&rest _)
:after #'ido-mode
(run-hooks 'ido-mode-hook))
@ -42,9 +42,7 @@
;; Go to $HOME with ~
"~" (λ! (if (looking-back "/" (point-min))
(insert "~/")
(call-interactively #'self-insert-command))))
(ido-mode +1))
(call-interactively #'self-insert-command)))))
(use-package! ido-vertical-mode

View file

@ -178,7 +178,7 @@ If ARG (universal argument), open selection in other-window."
(user-error "%S doesn't support wgrep" caller)))))
;;;###autoload
(defun +ivy-yas-prompt (prompt choices &optional display-fn)
(defun +ivy-yas-prompt-fn (prompt choices &optional display-fn)
(yas-completing-prompt prompt choices display-fn #'ivy-completing-read))
;;;###autoload

View file

@ -19,7 +19,7 @@ results buffer.")
;;; Packages
(use-package! ivy
:after-call pre-command-hook
:hook (doom-first-input . ivy-mode)
:init
(let ((standard-search-fn
(if (featurep! +prescient)
@ -88,7 +88,7 @@ results buffer.")
(setq +ivy--origin nil)))
(after! yasnippet
(add-hook 'yas-prompt-functions #'+ivy-yas-prompt))
(add-hook 'yas-prompt-functions #'+ivy-yas-prompt-fn))
(defadvice! +ivy--inhibit-completion-in-region-a (orig-fn &rest args)
"`ivy-completion-in-region' struggles with completing certain
@ -98,12 +98,10 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
(apply orig-fn args)))
(define-key! ivy-minibuffer-map
"C-c C-e" #'+ivy/woccur
[remap doom/delete-backward-word] #'ivy-backward-kill-word
"C-c C-e" #'+ivy/woccur
"C-o" #'ivy-dispatching-done
"M-o" #'hydra-ivy/body)
(ivy-mode +1))
"M-o" #'hydra-ivy/body))
(use-package! ivy-rich
@ -116,12 +114,12 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
(cadr (plist-get ivy-rich-display-transformers-list
'ivy-switch-buffer))))
;; Include variable value in `counsel-describe-variable'
;; Enahnce the appearance of a couple counsel commands
(plist-put! ivy-rich-display-transformers-list
'counsel-describe-variable
'(:columns
((counsel-describe-variable-transformer (:width 40)) ; the original transformer
(+ivy-rich-describe-variable-transformer (:width 50))
(+ivy-rich-describe-variable-transformer (:width 50)) ; display variable value
(ivy-rich-counsel-variable-docstring (:face font-lock-doc-face))))
'counsel-M-x
'(:columns
@ -141,10 +139,9 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
;; Highlight buffers differently based on whether they're in the same project
;; as the current project or not.
(let* ((plist (plist-get ivy-rich-display-transformers-list 'ivy-switch-buffer))
(switch-buffer-alist (assq 'ivy-rich-candidate (plist-get plist :columns))))
(when switch-buffer-alist
(setcar switch-buffer-alist '+ivy-rich-buffer-name)))
(when-let* ((plist (plist-get ivy-rich-display-transformers-list 'ivy-switch-buffer))
(switch-buffer-alist (assq 'ivy-rich-candidate (plist-get plist :columns))))
(setcar switch-buffer-alist '+ivy-rich-buffer-name))
(ivy-rich-mode +1))
@ -265,9 +262,10 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
:override #'counsel--find-return-list
(cl-destructuring-bind (find-program . args)
(cond ((executable-find doom-projectile-fd-binary)
(cons doom-projectile-fd-binary
(list "--color=never" "-E" ".git"
"--type" "file" "--type" "symlink" "--follow")))
(append (list doom-projectile-fd-binary
"--color=never" "-E" ".git"
"--type" "file" "--type" "symlink" "--follow")
(if IS-WINDOWS '("--path-separator=/"))))
((executable-find "rg")
(append (list "rg" "--files" "--follow" "--color=never" "--hidden" "--no-messages")
(cl-loop for dir in projectile-globally-ignored-directories
@ -284,8 +282,8 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
(let ((offset (if (member find-program (list "rg" doom-projectile-fd-binary)) 0 2))
files)
(while (< (point) (point-max))
(push (buffer-substring
(+ offset (line-beginning-position)) (line-end-position)) files)
(push (buffer-substring (+ offset (line-beginning-position)) (line-end-position))
files)
(forward-line 1))
(nreverse files)))))))

View file

@ -1,18 +1,18 @@
;; -*- no-byte-compile: t; -*-
;;; completion/ivy/packages.el
(package! swiper :pin "84efa3a2cbb9c5b0bbcc8d2e90671434eed74f94")
(package! swiper :pin "04ca16420053a3a6d34a96f0d680dd449c2e5851")
(package! ivy)
(package! ivy-hydra)
(package! counsel)
(package! amx :pin "7fb7b874291e0cdeb1f0acb18564a686ec86788d")
(package! counsel-projectile :pin "b556ed8995f375e57496f3482aef4b0def565de8")
(package! counsel-projectile :pin "126e825bbab872b3befd9ef88660571391ebfdc3")
(package! ivy-rich :pin "3f818b201769bc13cc75aa73645217e374136aca")
(package! wgrep :pin "5977b8e00051c9003ca96e9d35133e0dea68db2c")
(package! wgrep :pin "f0ef9bfa44db503cdb2f83fcfbd2fa4e2382ef1f")
(if (featurep! +prescient)
(package! ivy-prescient :pin "0f4a89bdec61395138d968a38d375e63ccfbed63")
(package! ivy-prescient :pin "3ab7605d997fb8337bf5ded2ad960b98ac0e1fd7")
(when (featurep! +fuzzy)
(package! flx :pin "17f5c9cb2af18aa6f52910ff4a5a63591261ced5")))

View file

@ -202,7 +202,14 @@
:desc "Send to Launchbar" "l" #'+macos/send-to-launchbar
:desc "Send project to Launchbar" "L" #'+macos/send-project-to-launchbar)
(:when (featurep! :tools docker)
:desc "Docker" "D" #'docker))
:desc "Docker" "D" #'docker)
(:when (featurep! :email mu4e)
:desc "mu4e" "m" #'=mu4e)
(:when (featurep! :email notmuch)
:desc "notmuch" "m" #'=notmuch)
(:when (featurep! :email wanderlust)
:desc "wanderlust" "m" #'=wanderlust))
;;; <leader> p --- project
(:prefix ("p" . "project")

View file

@ -4,12 +4,12 @@
;; NOTE SPC u replaces C-u as the universal argument.
;; Minibuffer
(define-key! :keymaps '(evil-ex-completion-map evil-ex-search-keymap)
"C-a" #'evil-beginning-of-line
"C-b" #'evil-backward-char
"C-f" #'evil-forward-char
"C-j" #'next-complete-history-element
"C-k" #'previous-complete-history-element)
(map! :map (evil-ex-completion-map evil-ex-search-keymap)
"C-a" #'evil-beginning-of-line
"C-b" #'evil-backward-char
"C-f" #'evil-forward-char
:gi "C-j" #'next-complete-history-element
:gi "C-k" #'previous-complete-history-element)
(define-key! :keymaps +default-minibuffer-maps
[escape] #'abort-recursive-edit
@ -26,6 +26,7 @@
"C-k" #'previous-line
"C-S-j" #'scroll-up-command
"C-S-k" #'scroll-down-command)
;; For folks with `evil-collection-setup-minibuffer' enabled
(define-key! :states 'insert :keymaps +default-minibuffer-maps
"C-j" #'next-line
"C-k" #'previous-line)
@ -549,7 +550,13 @@
:desc "Send to Launchbar" "l" #'+macos/send-to-launchbar
:desc "Send project to Launchbar" "L" #'+macos/send-project-to-launchbar)
(:when (featurep! :tools docker)
:desc "Docker" "D" #'docker))
:desc "Docker" "D" #'docker)
(:when (featurep! :email mu4e)
:desc "mu4e" "m" #'=mu4e)
(:when (featurep! :email notmuch)
:desc "notmuch" "m" #'=notmuch)
(:when (featurep! :email wanderlust)
:desc "wanderlust" "m" #'=wanderlust))
;;; <leader> p --- project
(:prefix-map ("p" . "project")

View file

@ -28,13 +28,15 @@
(defun +default/browse-notes ()
"Browse files from `org-directory'."
(interactive)
(require 'org)
(unless (bound-and-true-p org-directory)
(require 'org))
(doom-project-browse org-directory))
;;;###autoload
(defun +default/find-in-notes ()
"Find a file under `org-directory', recursively."
(interactive)
(require 'org)
(unless (bound-and-true-p org-directory)
(require 'org))
(doom-project-find-file org-directory))
;;;###autoload

View file

@ -50,8 +50,8 @@ If `buffer-file-name' isn't set, uses `default-directory'."
(abbreviate-file-name path)
(file-name-nondirectory path)))))
(defun doom--backward-delete-whitespace-to-column ()
;;;###autoload
(defun doom/backward-delete-whitespace-to-column ()
"Delete back to the previous column of whitespace, or as much whitespace as
possible, or just one char if that's not possible."
(interactive)
@ -74,7 +74,7 @@ possible, or just one char if that's not possible."
;; point and bol.
((and (not indent-tabs-mode)
(not (bolp))
(not (sp-point-in-string))
(not (doom-point-in-string-p))
(save-excursion (>= (- (skip-chars-backward " \t")) tab-width)))
(let ((movement (% (current-column) tab-width)))
(when (= movement 0)
@ -97,7 +97,7 @@ possible, or just one char if that's not possible."
{
|
} => {|}
+ Otherwise, resort to `doom--backward-delete-whitespace-to-column'.
+ Otherwise, resort to `doom/backward-delete-whitespace-to-column'.
+ Resorts to `delete-char' if n > 1"
(interactive "p\nP")
(or (integerp n)
@ -120,12 +120,14 @@ possible, or just one char if that's not possible."
(save-excursion
(insert-char ?\s (- ocol (current-column)) nil))))
;;
((and (= n 1) (bound-and-true-p smartparens-mode))
(cond ((and (memq (char-before) (list ?\ ?\t))
(save-excursion
(and (/= (skip-chars-backward " \t" (line-beginning-position)) 0)
(bolp))))
(doom--backward-delete-whitespace-to-column))
((= n 1)
(cond ((or (not (featurep! +smartparens))
(not (bound-and-true-p smartparens-mode))
(and (memq (char-before) (list ?\ ?\t))
(save-excursion
(and (/= (skip-chars-backward " \t" (line-beginning-position)) 0)
(bolp)))))
(doom/backward-delete-whitespace-to-column))
((let* ((pair (ignore-errors (sp-get-thing)))
(op (plist-get pair :op))
(cl (plist-get pair :cl))
@ -144,6 +146,6 @@ possible, or just one char if that's not possible."
(sp-insert-pair op)
t)
((run-hook-with-args-until-success 'doom-delete-backward-functions))
((doom--backward-delete-whitespace-to-column)))))))
((doom/backward-delete-whitespace-to-column)))))))
;; Otherwise, do simple deletion.
((delete-char (- n) killflag))))

View file

@ -204,52 +204,52 @@
;; This keybind allows * to skip over **.
(map! :map markdown-mode-map
:ig "*" (λ! (if (looking-at-p "\\*\\* *$")
(forward-char 2)
(call-interactively 'self-insert-command)))))
;; Highjacks backspace to:
;; a) balance spaces inside brackets/parentheses ( | ) -> (|)
;; b) delete up to nearest column multiple of `tab-width' at a time
;; c) close empty multiline brace blocks in one step:
;; {
;; |
;; }
;; becomes {|}
;; d) refresh smartparens' :post-handlers, so SPC and RET expansions work
;; even after a backspace.
;; e) properly delete smartparen pairs when they are encountered, without
;; the need for strict mode.
;; f) do none of this when inside a string
(advice-add #'delete-backward-char :override #'+default--delete-backward-char-a))
;; HACK Makes `newline-and-indent' continue comments (and more reliably).
;; Consults `doom-point-in-comment-functions' to detect a commented
;; region and uses that mode's `comment-line-break-function' to continue
;; comments. If neither exists, it will fall back to the normal behavior
;; of `newline-and-indent'.
;;
;; We use an advice here instead of a remapping because many modes define
;; and remap to their own newline-and-indent commands, and tackling all
;; those cases was judged to be more work than dealing with the edge
;; cases on a case by case basis.
(defadvice! +default--newline-indent-and-continue-comments-a (&rest _)
"A replacement for `newline-and-indent'.
Continues comments if executed from a commented line. Consults
`doom-point-in-comment-functions' to determine if in a comment."
:before-until #'newline-and-indent
(interactive "*")
(when (and +default-want-RET-continue-comments
(doom-point-in-comment-p)
(fboundp comment-line-break-function))
(funcall comment-line-break-function nil)
t)))
:ig "*" (general-predicate-dispatch nil
(looking-at-p "\\*\\* *")
(λ! (forward-char 2)))))))
;;
;;; Keybinding fixes
;; Highjacks backspace to delete up to nearest column multiple of `tab-width' at
;; a time. If you have smartparens enabled, it will also:
;; a) balance spaces inside brackets/parentheses ( | ) -> (|)
;; b) close empty multiline brace blocks in one step:
;; {
;; |
;; }
;; becomes {|}
;; c) refresh smartparens' :post-handlers, so SPC and RET expansions work even
;; after a backspace.
;; d) properly delete smartparen pairs when they are encountered, without the
;; need for strict mode.
;; e) do none of this when inside a string
(advice-add #'delete-backward-char :override #'+default--delete-backward-char-a)
;; HACK Makes `newline-and-indent' continue comments (and more reliably).
;; Consults `doom-point-in-comment-functions' to detect a commented region
;; and uses that mode's `comment-line-break-function' to continue comments.
;; If neither exists, it will fall back to the normal behavior of
;; `newline-and-indent'.
;;
;; We use an advice here instead of a remapping because many modes define
;; and remap to their own newline-and-indent commands, and tackling all
;; those cases was judged to be more work than dealing with the edge cases
;; on a case by case basis.
(defadvice! +default--newline-indent-and-continue-comments-a (&rest _)
"A replacement for `newline-and-indent'.
Continues comments if executed from a commented line. Consults
`doom-point-in-comment-functions' to determine if in a comment."
:before-until #'newline-and-indent
(interactive "*")
(when (and +default-want-RET-continue-comments
(doom-point-in-comment-p)
(fboundp comment-line-break-function))
(funcall comment-line-break-function nil)
t))
;; This section is dedicated to "fixing" certain keys so that they behave
;; sensibly (and consistently with similar contexts).
@ -353,7 +353,7 @@ Continues comments if executed from a commented line. Consults
"dL" #'doom/help-search-loaded-files
"dm" #'doom/help-modules
"dn" #'doom/help-news
"dN" #'doom/help-news-search
"dN" #'doom/help-search-news
"dpc" #'doom/help-package-config
"dpd" #'doom/goto-private-packages-file
"dph" #'doom/help-package-homepage

View file

@ -1,13 +1,10 @@
;;; editor/evil/config.el -*- lexical-binding: t; -*-
;; I'm a vimmer at heart. Its modal philosophy suits me better, and this module
;; strives to make Emacs a much better vim than vim was.
(defvar +evil-repeat-keys (cons ";" ",")
"The keys to use for universal repeating motions.
This is a cons cell whose CAR is the key for repeating a motion forward, and
whose CDR is for repeating backward. They should both be kbd-able strings.")
whose CDR is for repeating backward. They should both be `kbd'-able strings.")
(defvar +evil-want-o/O-to-continue-comments t
"If non-nil, the o/O keys will continue comment lines if the point is on a
@ -137,8 +134,8 @@ directives. By default, this only recognizes C directives.")
(and (>= char ?2) (<= char ?9)))
;; REVIEW Fix #2493: dir-locals cannot target fundamental-mode when evil-mode
;; is active. See https://github.com/hlissner/doom-emacs/issues/2493.
;; Revert this if this is ever fixed upstream.
;; is active. See hlissner/doom-emacs#2493. Revert this if
;; emacs-evil/evil#1268 is resolved upstream.
(defadvice! +evil--fix-local-vars-a (&rest _)
:before #'turn-on-evil-mode
(when (eq major-mode 'fundamental-mode)
@ -227,12 +224,12 @@ directives. By default, this only recognizes C directives.")
(use-package! evil-embrace
:commands embrace-add-pair embrace-add-pair-regexp
:hook (LaTeX-mode . embrace-LaTeX-mode-hook)
:hook (LaTeX-mode . +evil-embrace-latex-mode-hook-h)
:hook (org-mode . embrace-org-mode-hook)
:hook (ruby-mode . embrace-ruby-mode-hook)
:hook (emacs-lisp-mode . embrace-emacs-lisp-mode-hook)
:hook ((lisp-mode emacs-lisp-mode clojure-mode racket-mode hy-mode)
. +evil-embrace-lisp-mode-hook-h)
:hook ((org-mode LaTeX-mode) . +evil-embrace-latex-mode-hook-h)
:hook ((c++-mode rustic-mode csharp-mode java-mode swift-mode typescript-mode)
. +evil-embrace-angle-bracket-modes-hook-h)
:init
@ -369,14 +366,12 @@ directives. By default, this only recognizes C directives.")
(defmacro set-repeater! (command next-func prev-func)
"Makes ; and , the universal repeat-keys in evil-mode.
To change these keys see `+evil-repeat-keys'."
(let ((fn-sym (intern (format "+evil/repeat-%s" (doom-unquote command)))))
`(progn
(defun ,fn-sym (&rest _)
(when +evil-repeat-keys
(evil-define-key* 'motion 'local
(kbd (car +evil-repeat-keys)) #',next-func
(kbd (cdr +evil-repeat-keys)) #',prev-func)))
(advice-add #',command :after-while #',fn-sym))))
`(defadvice! ,(intern (format "+evil--repeat-%s-a" (doom-unquote command))) (&rest _)
:after-while #',command
(when +evil-repeat-keys
(evil-define-key* 'motion 'local
(kbd (car +evil-repeat-keys)) #',next-func
(kbd (cdr +evil-repeat-keys)) #',prev-func))))
;; n/N
(set-repeater! evil-ex-search-next evil-ex-search-next evil-ex-search-previous)

View file

@ -1,5 +1,7 @@
;;; editor/evil/init.el -*- lexical-binding: t; -*-
(defvar evil-collection-key-blacklist)
;; We load evil-collection ourselves for these reasons:
;;
;; 1. To truly lazy load it. Some of its modules, like

View file

@ -56,6 +56,7 @@ PATTERN as literal. PATTERN is a delimited regexp (the same that :g or :s uses).
FLAGS can be g and/or i; which mean the same thing they do in
`evil-ex-substitute'."
:evil-mc t
:keep-visual t
(interactive "<R><//!><!>")
(unless (and (stringp pattern)
(not (string-empty-p pattern)))

View file

@ -40,7 +40,7 @@
This is because there's no guarantee the remote system has GNU ls, which is the
only variant that supports --group-directories-first."
(when (file-remote-p default-directory)
(setq-local dired-listing-switches (car args))))))
(setq-local dired-actual-switches (car args))))))
;; Don't complain about this command being disabled when we use it
(put 'dired-find-alternate-file 'disabled nil)

View file

@ -42,16 +42,16 @@
(when (featurep! :ui workspaces)
(define-ibuffer-filter workspace-buffers
"Filter for workspace buffers"
(:reader
(+workspace-get (read-string "workspace name: ")) :description "workspace")
(:reader (+workspace-get (read-string "workspace name: "))
:description "workspace")
(memq buf (+workspace-buffer-list qualifier)))
(defun +ibuffer/workspace (workspace-name)
(defun +ibuffer-workspace (workspace-name)
"Open an ibuffer window for a workspace"
(ibuffer nil (format "%s buffers" workspace-name)
(list (cons 'workspace-buffers (+workspace-get workspace-name)))))
(defun +ibuffer-current-workspace ()
(defun +ibuffer/open-for-current-workspace ()
"Open an ibuffer window for the current workspace"
(interactive)
(+ibuffer/workspace (+workspace-current-name))))

View file

@ -2,8 +2,9 @@
(use-package! undo-fu
:unless (featurep! +tree)
:after-call doom-switch-buffer after-find-file
:after-call pre-command-hook after-find-file
:init
;; `evil' activates undo-tree, so we must pre-emptively disable it.
(after! undo-tree
(global-undo-tree-mode -1))
:config

View file

@ -3,5 +3,5 @@
(if (featurep! +tree)
(package! undo-tree :pin "5b6df03781495d8a25695d846b0cce496d3d3058")
(package! undo-fu :pin "0ce9ac36144e80316fff50bfe1bc5dd7e5e7ded6")
(package! undo-fu-session :pin "b808ef0cdcdd2eef221c67eda567eed7fcb3d4af"))
(package! undo-fu :pin "2b1e53285a55ce50ca6fd60b050f2171e235d8f9")
(package! undo-fu-session :pin "0400f15f2a0cfcedb69c06c3ff62f3f8814b62fb"))

View file

@ -80,7 +80,7 @@ environment.systemPackages = with pkgs; [
];
#+END_SRC
[[https://github.com/Emiller88/dotfiles/blob/master/modules/shell/mail.nix][An example of setting up mbsync with home-manager]]
[[https://github.com/Emiller88/dotfiles/blob/5eaabedf1b141c80a8d32e1b496055231476f65e/modules/shell/mail.nix][An example of setting up mbsync and mu with home-manager]]
** openSUSE
Remove ~#~ in ~#sync_program=offlineimap~ to choose ~offlineimap~ instead of

View file

@ -0,0 +1,110 @@
#+TITLE: email/notmuch
#+DATE: May 5, 2019
#+SINCE: v2.0
#+STARTUP: inlineimages
* Table of Contents :TOC:
- [[#description][Description]]
- [[#module-flags][Module Flags]]
- [[#plugins][Plugins]]
- [[#prerequisites][Prerequisites]]
- [[#macos][MacOS]]
- [[#arch-linux][Arch Linux]]
- [[#nixos][NixOS]]
- [[#opensuse][openSUSE]]
- [[#debianubuntu][Debian/Ubuntu]]
- [[#features][Features]]
- [[#configuration][Configuration]]
- [[#gmailier][Gmailier]]
- [[#offlineimap][offlineimap]]
- [[#mbsync][mbsync]]
- [[#notmuch][notmuch]]
- [[#troubleshooting][Troubleshooting]]
* Description
This module makes Emacs an email client, using ~notmuch~.
** Module Flags
+ This module install no module flags.
** Plugins
+ [[https://notmuchmail.org/][notmuch]]
+ [[https://github.com/org-mime/org-mime][org-mime]]
* Prerequisites
This module requires:
+ Either ~gmailieer~ (default), ~mbsync~ or ~offlineimap~ (to sync mail with)
+ ~notmuch~, to index and tag your downloaded messages.
+ ~afew~, optionally to initially tag your downloaded messages.
** TODO MacOS
** TODO Arch Linux
** NixOS
#+BEGIN_SRC nix
environment.systemPackages = with pkgs; [
notmuch
# And one of the following
gmailieer
isync
offlineimap
];
#+END_SRC
[[https://github.com/Emiller88/dotfiles/blob/319841bd3b89e59b01d169137cceee3183aba4fc/modules/shell/mail.nix][An example of setting up mbsync and notmuch with home-manager]]
** TODO openSUSE
** TODO Debian/Ubuntu
* TODO Features
* Configuration
** TODO Gmailier
** offlineimap
This module uses =Gmailier= by default. To use =offlineimap=, change ~+notmuch-sync-backend~:
#+BEGIN_SRC emacs-lisp
(setq +notmuch-sync-backend 'offlineimap)
#+END_SRC
Next, you need to write a configuration file for =offlineimap=. Mine can be found
[[https://github.com/hlissner/dotfiles/tree/master/shell/mu][in my dotfiles repository]]. It is configured to download mail to ~\~/.mail~. I
use [[https://www.passwordstore.org/][unix pass]] to securely store my login credentials. You can find a *very*
detailed configuration [[https://github.com/OfflineIMAP/offlineimap/blob/master/offlineimap.conf][here]].
Next you can download your email with ~offlineimap -o~. This may take a while,
especially if you have thousands of mails.
You can now proceed with the [[*mu and mu4e][mu and mu4e]] section.
** mbsync
This module uses =Gmailier= by default. To use =mbsync=, change ~+notmuch-sync-backend~:
#+BEGIN_SRC emacs-lisp
(setq +notmuch-sync-backend 'mbsync)
#+END_SRC
The steps needed to set up =mu4e= with =mbsync= are very similar to the ones for
[[*offlineimap][offlineimap]].
Start with writing a ~\~/.mbsyncrc~. An example for GMAIL can be found on
[[http://pragmaticemacs.com/emacs/migrating-from-offlineimap-to-mbsync-for-mu4e/][pragmaticemacs.com]]. A non-GMAIL example is available as a gist [[https://gist.github.com/agraul/60977cc497c3aec44e10591f94f49ef0][here]]. The [[http://isync.sourceforge.net/mbsync.html][manual
page]] contains all needed information to set up your own.
Next you can download your email with ~mbsync --all~. This may take a while, but
should be quicker than =offlineimap= ;).
You can now proceed with the [[*mu and mu4e][mu and mu4e]] section.
** notmuch
You should have your email downloaded already. If you have not, you need to set
=Gmailier=, =offlineimap= or =mbsync= up before you proceed.
Before you can use =notmuch=, you need to index your email initially.
#+BEGIN_SRC sh
notmuch new
#+END_SRC
* Troubleshooting

View file

@ -1,7 +1,7 @@
;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; lang/csharp/doctor.el
(require 'omnisharp)
(let ((omnisharp-bin (or omnisharp-server-executable-path (omnisharp--server-installation-path t))))
(unless (file-exists-p omnisharp-bin)
(warn! "Omnisharp server isn't installed, completion won't work")))
(when (and (require 'omnisharp nil t) (not (featurep! +lsp)))
(let ((omnisharp-bin (or omnisharp-server-executable-path (omnisharp--server-installation-path t))))
(unless (file-exists-p omnisharp-bin)
(warn! "Omnisharp server isn't installed, completion won't work"))))

View file

@ -16,10 +16,10 @@
* Description
This module provides support for [[https://elixir-lang.org/][Elixir programming language]] via [[https://github.com/tonini/alchemist.el][alchemist.el]]
or [[https://github.com/JakeBecker/elixir-ls/][elixir-ls]].
or [[https://github.com/elixir-lsp/elixir-ls/][elixir-ls]].
** Module flags
+ ~+lsp~ Enable LSP support. Requires [[https://github.com/JakeBecker/elixir-ls/][elixir-ls]].
+ ~+lsp~ Enable LSP support. Requires [[https://github.com/elixir-lsp/elixir-ls/][elixir-ls]].
** Plugins
+ [[https://github.com/elixir-editors/emacs-elixir][elixir-mode]]

View file

@ -67,6 +67,9 @@ library/userland functions"
(byte-compile #'+emacs-lisp-highlight-vars-and-faces)))
;;
;;; Handlers
(defun +emacs-lisp--module-at-point ()
(let ((origin (point)))
(save-excursion
@ -126,11 +129,52 @@ if it's callable, `apropos' otherwise."
(thing (helpful-symbol (intern thing)))
((call-interactively #'helpful-at-point))))
;; FIXME
;; (defun +emacs-lisp-lookup-file (thing)
;; (when-let (module (+emacs-lisp--module-at-point thing))
;; (doom/help-modules (car module) (cadr module) 'visit-dir)
;; t))
;;;###autoload
(defun +emacs-lisp-indent-function (indent-point state)
"A replacement for `lisp-indent-function'.
Indents plists more sensibly. Adapted from
https://emacs.stackexchange.com/questions/10230/how-to-indent-keywords-aligned"
(let ((normal-indent (current-column))
(orig-point (point))
;; TODO Refactor `target' usage (ew!)
target)
(goto-char (1+ (elt state 1)))
(parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
(cond ((and (elt state 2)
(or (not (looking-at-p "\\sw\\|\\s_"))
(eq (char-after) ?:)))
(unless (> (save-excursion (forward-line 1) (point))
calculate-lisp-indent-last-sexp)
(goto-char calculate-lisp-indent-last-sexp)
(beginning-of-line)
(parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t))
(backward-prefix-chars)
(current-column))
((and (save-excursion
(goto-char indent-point)
(skip-syntax-forward " ")
(not (eq (char-after) ?:)))
(save-excursion
(goto-char orig-point)
(and (eq (char-after) ?:)
(eq (char-before) ?\()
(setq target (current-column)))))
(save-excursion
(move-to-column target t)
target))
((let* ((function (buffer-substring (point) (progn (forward-sexp 1) (point))))
(method (or (function-get (intern-soft function) 'lisp-indent-function)
(get (intern-soft function) 'lisp-indent-hook))))
(cond ((or (eq method 'defun)
(and (null method)
(> (length function) 3)
(string-match-p "\\`def" function)))
(lisp-indent-defform state indent-point))
((integerp method)
(lisp-indent-specform method state indent-point normal-indent))
(method
(funcall method indent-point state))))))))
;;
@ -170,6 +214,18 @@ if it's callable, `apropos' otherwise."
load-path)))
(buttercup-run-discover)))
;;;###autoload
(defun +emacs-lisp/edebug-instrument-defun-on ()
"Toggle on instrumentalisation for the function under `defun'."
(interactive)
(eval-defun 'edebugit))
;;;###autoload
(defun +emacs-lisp/edebug-instrument-defun-off ()
"Toggle off instrumentalisation for the function under `defun'."
(interactive)
(eval-defun nil))
;;
;;; Hooks
@ -234,62 +290,3 @@ verbosity when editing a file in `doom-private-dir' or `doom-emacs-dir'."
(when (and start finish)
(put-text-property start finish 'display "...")))))
nil)
;;;###autoload
(defun +emacs-lisp-indent-function (indent-point state)
"A replacement for `lisp-indent-function'.
Indents plists more sensibly. Adapted from
https://emacs.stackexchange.com/questions/10230/how-to-indent-keywords-aligned"
(let ((normal-indent (current-column))
(orig-point (point))
;; TODO Refactor `target' usage (ew!)
target)
(goto-char (1+ (elt state 1)))
(parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
(cond ((and (elt state 2)
(or (not (looking-at-p "\\sw\\|\\s_"))
(eq (char-after) ?:)))
(unless (> (save-excursion (forward-line 1) (point))
calculate-lisp-indent-last-sexp)
(goto-char calculate-lisp-indent-last-sexp)
(beginning-of-line)
(parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t))
(backward-prefix-chars)
(current-column))
((and (save-excursion
(goto-char indent-point)
(skip-syntax-forward " ")
(not (eq (char-after) ?:)))
(save-excursion
(goto-char orig-point)
(and (eq (char-after) ?:)
(eq (char-before) ?\()
(setq target (current-column)))))
(save-excursion
(move-to-column target t)
target))
((let* ((function (buffer-substring (point) (progn (forward-sexp 1) (point))))
(method (or (function-get (intern-soft function) 'lisp-indent-function)
(get (intern-soft function) 'lisp-indent-hook))))
(cond ((or (eq method 'defun)
(and (null method)
(> (length function) 3)
(string-match-p "\\`def" function)))
(lisp-indent-defform state indent-point))
((integerp method)
(lisp-indent-specform method state indent-point normal-indent))
(method
(funcall method indent-point state))))))))
;;;###autoload
(defun +emacs-lisp/edebug-instrument-defun-on ()
"Toggle on instrumentalisation for the function under `defun'."
(interactive)
(eval-defun 'edebugit))
;;;###autoload
(defun +emacs-lisp/edebug-instrument-defun-off ()
"Toggle off instrumentalisation for the function under `defun'."
(interactive)
(eval-defun nil))

View file

@ -3,15 +3,16 @@
(package! elisp-mode :built-in t)
(package! highlight-quoted :pin "2410347815")
;; Fontification plugins
(package! highlight-quoted :pin "24103478158cd19fbcfb4339a3f1fa1f054f1469")
;; Tools
(package! macrostep :pin "424e3734a1")
(package! overseer :pin "02d49f582e")
(package! elisp-def :pin "368b04da68")
(package! elisp-demos :pin "57dd4ae3e4")
(package! macrostep :pin "424e3734a1ee526a1bd7b5c3cd1d3ef19d184267")
(package! overseer :pin "02d49f582e80e36b4334c9187801c5ecfb027789")
(package! elisp-def :pin "368b04da68783601b52e3169312183381871cf9e")
(package! elisp-demos :pin "4cd55a30d5dbd8d36a0e6f87261c4fef17fc6db0")
(when (featurep! :checkers syntax)
(package! flycheck-cask :pin "3457ae553c"))
(package! flycheck-cask :pin "3457ae553c4feaf8168008f063d78fdde8fb5f94"))
;; Libraries
(package! buttercup :pin "a91f282025")
(package! buttercup :pin "532d082a363add4f6d9838ca3f924a773ce12136")

View file

@ -1,15 +1,15 @@
;; -*- no-byte-compile: t; -*-
;;; lang/go/packages.el
(package! go-eldoc :pin "cbbd2ea1e9")
(package! go-guru :pin "10d6ab43d9")
(package! go-mode :pin "10d6ab43d9")
(package! gorepl-mode :pin "6a73bf352e")
(package! go-tag :pin "59b243f2fa")
(package! go-gen-test :pin "44c202ac97")
(package! go-eldoc :pin "cbbd2ea1e94a36004432a9ac61414cb5a95a39bd")
(package! go-guru :pin "734d5232455ffde088021ea5908849ac570e890f")
(package! go-mode :pin "734d5232455ffde088021ea5908849ac570e890f")
(package! gorepl-mode :pin "6a73bf352e8d893f89cad36c958c4db2b5e35e07")
(package! go-tag :pin "59b243f2fa079d9de9d56f6e2d94397e9560310a")
(package! go-gen-test :pin "44c202ac97e728e93a35cee028a0ea8dd6e4292c")
(when (featurep! :completion company)
(package! company-go :pin "4acdcbdea7"))
(package! company-go :pin "4acdcbdea79de6b3dee1c637eca5cbea0fdbe37c"))
(when (featurep! :checkers syntax)
(package! flycheck-golangci-lint :pin "8e446c6831"))
(package! flycheck-golangci-lint :pin "8e446c68311048f0b87febf8ef0379e29d358851"))

View file

@ -31,7 +31,9 @@
(map! :map haskell-mode-map
:n "o" #'+haskell/evil-open-below
:n "O" #'+haskell/evil-open-above)
:n "O" #'+haskell/evil-open-above
(:when (featurep! :tools lookup)
[remap haskell-mode-jump-to-def-or-tag] #'+lookup/definition))
(map! :localleader
:map haskell-mode-map

View file

@ -92,10 +92,6 @@ capture, the end position, and the output buffer.")
(use-package! evil-markdown
:when (featurep! :editor evil +everywhere)
:hook (markdown-mode . evil-markdown-mode)
:init
;; REVIEW Until Somelauw/evil-markdown#1 is resolved:
(defun evil-disable-insert-state-bindings ()
evil-disable-insert-state-bindings)
:config
(add-hook 'evil-markdown-mode-hook #'evil-normalize-keymaps)
(map! :map evil-markdown-mode-map

View file

@ -1,8 +1,8 @@
;; -*- no-byte-compile: t; -*-
;;; lang/markdown/packages.el
(package! markdown-mode :pin "c927a114b1b23cf7538181d62fd14679cce7fa25")
(package! markdown-toc :pin "eda9650a1bf0015e52e9678bd92b0a8beb1d7d71")
(package! markdown-mode :pin "f47a2e9796dfdde6fae7920af23647fe027dc34e")
(package! markdown-toc :pin "a9f13eecd0c7d8be960055dbc2d6f5d3fe6f40ca")
(package! edit-indirect :pin "935ded353b9ed3da67bc61abf245c21b58d88864")
(when (featurep! +grip)
@ -11,4 +11,4 @@
(when (featurep! :editor evil +everywhere)
(package! evil-markdown
:recipe (:host github :repo "Somelauw/evil-markdown")
:pin "46cd81b37991c4325fc24015a610f832b0ff995d"))
:pin "685d7fbb81bc02fa32779d2a127b99a0c8c7436b"))

View file

@ -46,11 +46,15 @@ exist, and `org-link' otherwise."
"Intepret LINK as an image file path and return its data."
(setq
link (expand-file-name
link
(pcase protocol
("download" (or org-download-image-dir org-attach-id-dir default-directory))
("attachment" org-attach-id-dir)
(_ default-directory))))
link (pcase protocol
("download"
(or (if (require 'org-download nil t) org-download-image-dir)
(if (require 'org-attach) org-attach-id-dir)
default-directory))
("attachment"
(require 'org-attach)
org-attach-id-dir)
(_ default-directory))))
(when (and (file-exists-p link)
(image-type-from-file-name link))
(with-temp-buffer

View file

@ -141,7 +141,7 @@ current file). Only scans first 2048 bytes of the document."
;;; Commands
;;;###autoload
(defun +org/dwim-at-point ()
(defun +org/dwim-at-point (&optional arg)
"Do-what-I-mean at point.
If on a:
@ -158,7 +158,7 @@ If on a:
- latex fragment: toggle it.
- link: follow it
- otherwise, refresh all inline images in current tree."
(interactive)
(interactive "P")
(let* ((context (org-element-context))
(type (org-element-type context)))
;; skip over unimportant contexts
@ -206,7 +206,7 @@ If on a:
(`table-cell
(org-table-blank-field)
(org-table-recalculate)
(org-table-recalculate arg)
(when (and (string-empty-p (string-trim (org-table-get-field)))
(bound-and-true-p evil-local-mode))
(evil-change-state 'insert)))
@ -215,13 +215,13 @@ If on a:
(org-babel-lob-execute-maybe))
(`statistics-cookie
(save-excursion (org-update-statistics-cookies nil)))
(save-excursion (org-update-statistics-cookies arg)))
((or `src-block `inline-src-block)
(org-babel-execute-src-block))
(org-babel-execute-src-block arg))
((or `latex-fragment `latex-environment)
(org-latex-preview))
(org-latex-preview arg))
(`link
(let* ((lineage (org-element-lineage context '(link) t))
@ -229,7 +229,7 @@ If on a:
(if (or (equal (org-element-property :type lineage) "img")
(and path (image-type-from-file-name path)))
(+org--refresh-inline-images-in-subtree)
(org-open-at-point))))
(org-open-at-point arg))))
((guard (org-element-property :checkbox (org-element-lineage context '(item) t)))
(let ((match (and (org-at-item-checkbox-p) (match-string 1))))
@ -238,7 +238,7 @@ If on a:
(_
(if (or (org-in-regexp org-ts-regexp-both nil t)
(org-in-regexp org-tsr-regexp-both nil t)
(org-in-regexp org-any-link-re nil t))
(org-in-regexp org-link-any-re nil t))
(call-interactively #'org-open-at-point)
(+org--refresh-inline-images-in-subtree))))))
@ -306,6 +306,20 @@ the prefix ARG changes this command's behavior."
;;;###autoload
(defalias #'+org/close-fold #'outline-hide-subtree)
;;;###autoload
(defun +org/close-all-folds (&optional level)
"Close all folds in the buffer (or below LEVEL)."
(interactive "p")
(outline-hide-sublevels (or level 1)))
;;;###autoload
(defun +org/open-all-folds (&optional level)
"Open all folds in the buffer (or up to LEVEL)."
(interactive "P")
(if (integerp level)
(outline-hide-sublevels level)
(outline-show-all)))
(defun +org--get-foldlevel ()
(let ((max 1))
(save-restriction
@ -321,22 +335,20 @@ the prefix ARG changes this command's behavior."
max)))
;;;###autoload
(defun +org/show-next-fold-level ()
(defun +org/show-next-fold-level (&optional count)
"Decrease the fold-level of the visible area of the buffer. This unfolds
another level of headings on each invocation."
(interactive)
(let* ((current-level (+org--get-foldlevel))
(new-level (1+ current-level)))
(interactive "p")
(let ((new-level (+ (+org--get-foldlevel) (or count 1))))
(outline-hide-sublevels new-level)
(message "Folded to level %s" new-level)))
;;;###autoload
(defun +org/hide-next-fold-level ()
(defun +org/hide-next-fold-level (&optional count)
"Increase the global fold-level of the visible area of the buffer. This folds
another level of headings on each invocation."
(interactive)
(let* ((current-level (+org--get-foldlevel))
(new-level (max 1 (1- current-level))))
(interactive "p")
(let ((new-level (max 1 (- (+org--get-foldlevel) (or count 1)))))
(outline-hide-sublevels new-level)
(message "Folded to level %s" new-level)))
@ -434,20 +446,14 @@ with `org-cycle')."
t))
;;;###autoload
(defun +org-unfold-to-2nd-level-or-point-h ()
"Alters '#+STARTUP overview' to only expand first-level headings.
Expands the first level, but no further. If a different startup option was
provided, do that instead."
(unless org-agenda-inhibit-startup
;; TODO Implement a custom #+STARTUP option?
(when (eq org-startup-folded t)
(outline-hide-sublevels +org-initial-fold-level))
;; If point was left somewhere deeper, unfold to point on startup.
(when (outline-invisible-p)
(ignore-errors
(save-excursion
(outline-previous-visible-heading 1)
(org-show-subtree))))))
(defun +org-make-last-point-visible-h ()
"Unfold subtree around point if saveplace places it to a folded region."
(and (not org-agenda-inhibit-startup)
(outline-invisible-p)
(ignore-errors
(save-excursion
(outline-previous-visible-heading 1)
(org-show-subtree)))))
;;;###autoload
(defun +org-remove-occur-highlights-h ()

View file

@ -50,9 +50,6 @@ Is relative to `org-directory', unless it is absolute. Is used in Doom's default
(defvar +org-capture-projects-file "projects.org"
"Default, centralized target for org-capture templates.")
(defvar +org-initial-fold-level 2
"The initial fold level of org files when no #+STARTUP options for it.")
(defvar +org-habit-graph-padding 2
"The padding added to the end of the consistency graph")
@ -163,7 +160,7 @@ This forces it to read the background before rendering."
("HOLD" . +org-todo-onhold)
("PROJ" . +org-todo-project)))
(defadvice! +org-display-link-in-eldoc-a (&rest args)
(defadvice! +org-display-link-in-eldoc-a (&rest _)
"Display full link in minibuffer when cursor/mouse is over it."
:before-until #'org-eldoc-documentation-function
(when-let (link (org-element-property :raw-link (org-element-context)))
@ -199,10 +196,10 @@ This forces it to read the background before rendering."
;; I prefer C-c C-c over C-c ' (more consistent)
(define-key org-src-mode-map (kbd "C-c C-c") #'org-edit-src-exit)
(defadvice! +org-fix-newline-and-indent-in-src-blocks-a ()
(defadvice! +org-fix-newline-and-indent-in-src-blocks-a (&optional indent _arg _interactive)
"Mimic `newline-and-indent' in src blocks w/ lang-appropriate indentation."
:after #'org-return-indent
(when (org-in-src-block-p t)
:after #'org-return
(when (and indent (org-in-src-block-p t))
(org-babel-do-in-edit-buffer
(call-interactively #'indent-for-tab-command))))
@ -322,11 +319,17 @@ I like:
(after! org-capture
(org-capture-put :kill-buffer t))
;; Fix #462: when refiling from org-capture, Emacs prompts to kill the
;; underlying, modified buffer. This fixes that.
(add-hook 'org-after-refile-insert-hook #'save-buffer)
;; HACK Doom doesn't support `customize'. Best not to advertise it as an
;; option in `org-capture's menu.
(defadvice! +org--remove-customize-option-a (orig-fn table title &optional prompt specials)
:around #'org-mks
(funcall orig-fn table title prompt (remove '("C" "Customize org-capture-templates") specials)))
(funcall orig-fn table title prompt
(remove '("C" "Customize org-capture-templates")
specials)))
(defadvice! +org--capture-expand-variable-file-a (file)
"If a variable is used for a file path in `org-capture-template', it is used
@ -337,13 +340,6 @@ relative to `org-directory', unless it is an absolute path."
(expand-file-name (symbol-value file) org-directory)
file))
(defadvice! +org--prevent-save-prompts-when-refiling-a (&rest _)
"Fix #462: when refiling from org-capture, Emacs prompts to kill the
underlying, modified buffer. This fixes that."
:after #'org-refile
(when (bound-and-true-p org-capture-is-refiling)
(org-save-all-org-buffers)))
(add-hook! 'org-capture-mode-hook
(defun +org-show-target-in-capture-header-h ()
(setq header-line-format
@ -436,28 +432,39 @@ underlying, modified buffer. This fixes that."
(setq org-pandoc-options
'((standalone . t)
(mathjax . t)
(variable . "revealjs-url=https://revealjs.com")))))
(variable . "revealjs-url=https://revealjs.com"))))
(defadvice! +org--fix-async-export-a (orig-fn &rest args)
:around #'org-export-to-file
(if (not org-export-in-background)
(apply orig-fn args)
(setq org-export-async-init-file (make-temp-file "doom-org-async-export"))
(with-temp-file org-export-async-init-file
(prin1 `(progn (setq org-export-async-debug ,debug-on-error
load-path ',load-path)
(load ,user-init-file nil t))
(current-buffer)))
(apply orig-fn args))))
(defun +org-init-habit-h ()
"TODO"
(add-hook! 'org-agenda-mode-hook
(defun +org-habit-resize-graph-h ()
"Right align and resize the consistency graphs based on
`+org-habit-graph-window-ratio'"
(require 'org-habit)
(let* ((total-days (float (+ org-habit-preceding-days org-habit-following-days)))
(preceding-days-ratio (/ org-habit-preceding-days total-days))
(graph-width (floor (* (window-width) +org-habit-graph-window-ratio)))
(preceding-days (floor (* graph-width preceding-days-ratio)))
(following-days (- graph-width preceding-days))
(graph-column (- (window-width) (+ preceding-days following-days)))
(graph-column-adjusted (if (> graph-column +org-habit-min-width)
(- graph-column +org-habit-graph-padding)
nil)))
(setq-local org-habit-preceding-days preceding-days)
(setq-local org-habit-following-days following-days)
(setq-local org-habit-graph-column graph-column-adjusted)))))
(when (featurep 'org-habit)
(let* ((total-days (float (+ org-habit-preceding-days org-habit-following-days)))
(preceding-days-ratio (/ org-habit-preceding-days total-days))
(graph-width (floor (* (window-width) +org-habit-graph-window-ratio)))
(preceding-days (floor (* graph-width preceding-days-ratio)))
(following-days (- graph-width preceding-days))
(graph-column (- (window-width) (+ preceding-days following-days)))
(graph-column-adjusted (if (> graph-column +org-habit-min-width)
(- graph-column +org-habit-graph-padding)
nil)))
(setq-local org-habit-preceding-days preceding-days)
(setq-local org-habit-following-days following-days)
(setq-local org-habit-graph-column graph-column-adjusted))))))
(defun +org-init-hacks-h ()
@ -467,10 +474,11 @@ underlying, modified buffer. This fixes that."
;; Open directory links in dired
(add-to-list 'org-file-apps '(directory . emacs))
;; When you create a sparse tree and `org-indent-mode' is enabled, the
;; highlighting destroys the invisibility added by `org-indent-mode'.
;; Therefore, don't highlight when creating a sparse tree.
(setq org-highlight-sparse-tree-matches nil)
;; HACK Org is known to use a lot of unicode symbols (and large org files tend
;; to be especially memory hungry). Compounded with
;; `inhibit-compacting-font-caches' being non-nil, org needs more memory
;; to be performant.
(setq-hook! 'org-mode-hook gcmh-high-cons-threshold (* 2 gcmh-high-cons-threshold))
(add-hook! 'org-follow-link-hook
(defun +org-delayed-recenter-h ()
@ -707,12 +715,12 @@ between the two."
:localleader
"d" #'org-agenda-deadline
(:prefix ("c" . "clock")
"c" #'org-agenda-clock-in
"C" #'org-agenda-clock-out
"c" #'org-agenda-clock-cancel
"g" #'org-agenda-clock-goto
"i" #'org-agenda-clock-in
"o" #'org-agenda-clock-out
"r" #'org-agenda-clockreport-mode
"s" #'org-agenda-show-clocking-issues
"x" #'org-agenda-clock-cancel)
"s" #'org-agenda-show-clocking-issues)
"q" #'org-agenda-set-tags
"r" #'org-agenda-refile
"s" #'org-agenda-schedule
@ -770,6 +778,11 @@ compelling reason, so..."
)
(defun +org-init-smartparens-h ()
;; Disable the slow defaults
(provide 'smartparens-org))
;;
;;; Packages
@ -891,8 +904,8 @@ compelling reason, so..."
:ni "C-S-k" #'org-shiftup
:ni "C-S-j" #'org-shiftdown
;; more intuitive RET keybinds
:i [return] #'org-return-indent
:i "RET" #'org-return-indent
:i [return] (λ! (org-return t))
:i "RET" (λ! (org-return t))
:n [return] #'+org/dwim-at-point
:n "RET" #'+org/dwim-at-point
;; more vim-esque org motion keys (not covered by evil-org-mode)
@ -911,11 +924,12 @@ compelling reason, so..."
:n "zc" #'+org/close-fold
:n "zC" #'outline-hide-subtree
:n "zm" #'+org/hide-next-fold-level
:n "zM" #'+org/close-all-folds
:n "zn" #'org-tree-to-indirect-buffer
:n "zo" #'+org/open-fold
:n "zO" #'outline-show-subtree
:n "zr" #'+org/show-next-fold-level
:n "zR" #'outline-show-all
:n "zR" #'+org/open-all-folds
:n "zi" #'org-toggle-inline-images
:map org-read-date-minibuffer-local-map
@ -971,15 +985,8 @@ compelling reason, so..."
))
;;; Custom org modules
(if (featurep! +brain) (load! "contrib/brain"))
(if (featurep! +dragndrop) (load! "contrib/dragndrop"))
(if (featurep! +ipython) (load! "contrib/ipython"))
(if (featurep! +journal) (load! "contrib/journal"))
(if (featurep! +jupyter) (load! "contrib/jupyter"))
(if (featurep! +pomodoro) (load! "contrib/pomodoro"))
(if (featurep! +present) (load! "contrib/present"))
(if (featurep! +roam) (load! "contrib/roam"))
(if (featurep! +noter) (load! "contrib/noter"))
(dolist (flag doom--current-flags)
(load! (concat "contrib/" (substring (symbol-name flag) 1)) nil t))
;; Add our general hooks after the submodules, so that any hooks the
;; submodules add run after them, and can overwrite any defaults if necessary.
@ -991,7 +998,7 @@ compelling reason, so..."
#'doom-disable-show-trailing-whitespace-h
#'+org-enable-auto-reformat-tables-h
#'+org-enable-auto-update-cookies-h
#'+org-unfold-to-2nd-level-or-point-h)
#'+org-make-last-point-visible-h)
(add-hook! 'org-load-hook
#'+org-init-org-directory-h
@ -1009,7 +1016,8 @@ compelling reason, so..."
#'+org-init-keybinds-h
#'+org-init-popup-rules-h
#'+org-init-protocol-h
#'+org-init-protocol-lazy-loader-h)
#'+org-init-protocol-lazy-loader-h
#'+org-init-smartparens-h)
;; (Re)activate eldoc-mode in org-mode a little later, because it disables
;; itself if started too soon (which is the case with `global-eldoc-mode').

View file

@ -41,19 +41,19 @@
(defadvice! +org-present--narrow-to-subtree-a (orig-fn &rest args)
"Narrow to the target subtree when you start the presentation."
:around #'org-tree-slide--display-tree-with-narrow
(letf! ((defun org-narrow-to-subtree ()
(save-excursion
(save-match-data
(org-with-limited-levels
(narrow-to-region
(progn
(when (org-before-first-heading-p)
(org-next-visible-heading 1))
(ignore-errors (org-up-heading-all 99))
(forward-line 1)
(point))
(progn (org-end-of-subtree t t)
(when (and (org-at-heading-p) (not (eobp)))
(backward-char 1))
(point))))))))
(letf! (defun org-narrow-to-subtree ()
(save-excursion
(save-match-data
(org-with-limited-levels
(narrow-to-region
(progn
(when (org-before-first-heading-p)
(org-next-visible-heading 1))
(ignore-errors (org-up-heading-all 99))
(forward-line 1)
(point))
(progn (org-end-of-subtree t t)
(when (and (org-at-heading-p) (not (eobp)))
(backward-char 1))
(point)))))))
(apply orig-fn args))))

View file

@ -27,7 +27,7 @@
:recipe (:host github
:repo "emacs-straight/org-mode"
:files ("*.el" "lisp/*.el" "contrib/lisp/*.el"))
:pin "b171ff02f6e69bcce0dec56ea23e11c75e558704")
:pin "93c50e3a7867a1a85fc78b337172585f7a10dcc6")
;; ...And prevent other packages from pulling org; org-plus-contrib satisfies
;; the dependency already: https://github.com/raxod502/straight.el/issues/352
(package! org :recipe (:local-repo nil))
@ -51,7 +51,7 @@
(when (featurep! :tools magit)
(package! orgit :pin "e147f055772cc934fe1f1d8619059badeb647c93"))
(when (featurep! +brain)
(package! org-brain :pin "ae7fe0f628bd093526786ece6917f7a4310e5e4d"))
(package! org-brain :pin "ed99f7e38dd687800fb898f8934a0da0541ebcd9"))
(when (featurep! +dragndrop)
(package! org-download :pin "d248fcb8f2592a40507682e91eed9a31ead4e4a6"))
(when (featurep! +gnuplot)
@ -62,7 +62,7 @@
(when (featurep! +jupyter)
(package! jupyter :pin "785edbbff65abb0c929dc2fbd8b8305c77fd529e"))
(when (featurep! +journal)
(package! org-journal :pin "8bf06b28d6f14f52d4968123e2b4b91930c8f947"))
(package! org-journal :pin "2c43b10eed0659f8e47797e5e53d2973f939284d"))
(when (featurep! +noter)
(package! org-noter :pin "9ead81d42dd4dd5074782d239b2efddf9b8b7b3d"))
(when (featurep! +pomodoro)
@ -72,11 +72,11 @@
:recipe (:host github :repo "anler/centered-window-mode")
:pin "f50859941ab5c7cbeaee410f2d38716252b552ac")
(package! org-tree-slide :pin "7bf09a02bd2d8f1ccfcb5209bfb18fbe02d1f44e")
(package! org-re-reveal :pin "61549f4c00284a30e34caa3d76001b233ea5d2ad"))
(package! org-re-reveal :pin "a9e9d4ef88417b3af7741a8d8f444ece820e7a3b"))
(when (featurep! +roam)
(package! org-roam :pin "689f55908048eede3cb65aa30ab990be3ac93263")
(package! org-roam :pin "1267a430431f11035798cc4007c5dd3efe543ced")
(when (featurep! :completion company)
(package! company-org-roam :pin "0913d86f167164e18831206e611f44bb8e7297e3")))
(package! company-org-roam :pin "674c2bd493f571c5323d69279557a6c18ccbd14e")))
;;; Babel
(package! ob-async :pin "80a30b96a007d419ece12c976a81804ede340311")

View file

@ -1,6 +1,9 @@
;;; lang/purescript/config.el -*- lexical-binding: t; -*-
(after! purescript-mode
(when (featurep! +lsp)
(add-hook 'purescript-mode-local-vars-hook #'lsp!))
(add-hook! 'purescript-mode-hook
#'purescript-indentation-mode
#'rainbow-delimiters-mode)

View file

@ -4,6 +4,7 @@
(defun +python/open-repl ()
"Open the Python REPL."
(interactive)
(require 'python)
(unless python-shell-interpreter
(user-error "`python-shell-interpreter' isn't set"))
(pop-to-buffer
@ -23,6 +24,7 @@
(defun +python/open-ipython-repl ()
"Open an IPython REPL."
(interactive)
(require 'python)
(let ((python-shell-interpreter (or (+python-executable-find "ipython") "ipython"))
(python-shell-interpreter-args (string-join +python-ipython-repl-args " ")))
(+python/open-repl)))
@ -31,6 +33,7 @@
(defun +python/open-jupyter-repl ()
"Open a Jupyter console."
(interactive)
(require 'python)
(add-to-list 'python-shell-completion-native-disabled-interpreters "jupyter")
(let ((python-shell-interpreter (or (+python-executable-find "jupyter") "jupyter"))
(python-shell-interpreter-args (format "console %s" (string-join +python-jupyter-repl-args " "))))

View file

@ -5,7 +5,7 @@
"This module requires (:tools lsp)")
(if (not (executable-find "python"))
(error! "Python isn't installed.")
(error! "Couldn't find python in your PATH")
(unless (featurep! +lsp)
(unless (zerop (shell-command "python -c 'import setuptools'"))
(warn! "setuptools wasn't detected, which anaconda-mode requires"))))

View file

@ -50,6 +50,11 @@
(set-lookup-handlers! 'ruby-mode
:definition #'robe-jump
:documentation #'robe-doc)
(when (boundp 'read-process-output-max)
;; Robe can over saturate IPC, making interacting with it slow/clobbering
;; the GC, so increase the amount of data Emacs reads from it at a time.
(setq-hook! '(robe-mode-hook inf-ruby-mode-hook)
read-process-output-max (* 1024 1024)))
(when (featurep! :editor evil)
(add-hook 'robe-mode-hook #'evil-normalize-keymaps))
(map! :localleader
@ -175,7 +180,9 @@
:when (featurep! +rails)
:hook ((ruby-mode inf-ruby-mode projectile-rails-server-mode) . projectile-rails-mode)
:hook (projectile-rails-server-mode . doom-mark-buffer-as-real-h)
:hook (projectile-rails-mode . auto-insert-mode)
:init
(setq auto-insert-query nil)
(setq inf-ruby-console-environment "development")
(when (featurep! :lang web)
(add-hook 'web-mode-hook #'projectile-rails-mode))

View file

@ -3,34 +3,34 @@
;; Major modes
(package! ruby-mode :built-in t)
(package! yard-mode :pin "ba74a47463")
(package! yard-mode :pin "ba74a47463b0320ae152bd42a7dd7aeecd7b5748")
;; REPL
(package! inf-ruby :pin "41e5ed3a88")
(package! inf-ruby :pin "41e5ed3a886fca56990486f1987bb3bae0dbd54b")
(when (featurep! :completion company)
(package! company-inf-ruby :pin "fe3e4863bc"))
(package! company-inf-ruby :pin "fe3e4863bc971fbb81edad447efad5795ead1b17"))
;; Programming environment
(package! rubocop :pin "03bf15558a")
(package! robe :pin "68503b32bb")
(package! rubocop :pin "03bf15558a6eb65e4f74000cab29412efd46660e")
(package! robe :pin "68503b32bb3a005787ecb7a7fdeb3bb4a2317e2b")
;; Project tools
(package! bundler :pin "43efb6be4e")
(package! rake :pin "9c204334b0")
(package! bundler :pin "43efb6be4ed118b06d787ce7fbcffd68a31732a7")
(package! rake :pin "9c204334b03b4e899fadae6e59c20cf105404128")
;; Environment management
(when (featurep! +rbenv)
(package! rbenv :pin "2ea1a5bdc1"))
(package! rbenv :pin "2ea1a5bdc1266caef1dd77700f2c8f42429b03f1"))
(when (featurep! +rvm)
(package! rvm :pin "134497bc46"))
(package! rvm :pin "134497bc460990c71ab8fa75431156e62c17da2d"))
(when (featurep! +chruby)
(package! chruby :pin "42bc6d521f"))
(package! chruby :pin "42bc6d521f832eca8e2ba210f30d03ad5529788f"))
;; Testing frameworks
(package! rspec-mode :pin "9a2a9d2935")
(package! minitest :pin "97d7d1760b")
(package! rspec-mode :pin "9a2a9d2935ae17b8570485bdea7c347533b464f6")
(package! minitest :pin "ddd152c990a528ad09a696bfad23afa4330ea4d7")
;; Rails
(when (featurep! +rails)
(package! projectile-rails :pin "0398d940a2")
(package! inflections :pin "e4f1372cf2"))
(package! projectile-rails :pin "11980b2bcb99208888856a9b8666ff329b6f0142")
(package! inflections :pin "e4f1372cf22e811faca52fc86bdd5d817498a4d8"))

View file

@ -0,0 +1,61 @@
#+TITLE: term/eshell
#+DATE: May 18, 2020
#+SINCE: v2.0
#+STARTUP: inlineimages nofold
* Table of Contents :TOC_3:noexport:
- [[#description][Description]]
- [[#maintainers][Maintainers]]
- [[#module-flags][Module Flags]]
- [[#plugins][Plugins]]
- [[#hacks][Hacks]]
- [[#prerequisites][Prerequisites]]
- [[#features][Features]]
- [[#configuration][Configuration]]
- [[#troubleshooting][Troubleshooting]]
* Description
This module provides additional features for the built-in [[https://www.gnu.org/software/emacs/manual/html_mono/eshell.html][Emacs Shell]]
The Emacs Shell or =eshell= is a shell-like command interpreter implemented in
Emacs Lisp. It is an alternative to traditional shells such as =bash=, =zsh=,
=fish=, etc. that is built into Emacs and entirely cross-platform.
** Maintainers
This module has no dedicated maintainers.
** Module Flags
This module provides no flags, but does gain auto-completion if =:completion
company= is enabled.
** Plugins
+ [[https://github.com/peterwvj/eshell-up][eshell-up]]
+ [[https://github.com/xuchunyang/eshell-z][eshell-z]]
+ [[https://github.com/tom-tan/esh-help][esh-help]]
+ [[https://gitlab.com/bennya/shrink-path.el][shrink-path]]
+ [[https://github.com/xuchunyang/eshell-did-you-mean][eshell-did-you-mean]]
+ =:completion company=
+ [[https://gitlab.com/ambrevar/emacs-fish-completion][fish-completion]]
+ [[https://github.com/szermatt/emacs-bash-completion][bash-completion]]
** Hacks
+ Even with =fish-completion-fallback-on-bash-p= non-nil, fish must be installed
for bash completion to work. Workaround in =config.el=.
+ =eshell-did-you-mean= does not work on first invocation, so we manually invoke
it once.
* Prerequisites
[[https://fishshell.com/][=fish= shell]] for completions, falling back to [[https://www.gnu.org/software/bash/][=bash= shell]] if =fish= is not
found. If neither shell is found, completions may not be available.
* Features
+ Command completion with Company
+ =fish=-style prompt with Git integration
+ [[https://github.com/rupa/z][=z=]]-like directory jumping
+ Command-not-found recommendations
* TODO Configuration
# How to configure this module, including common problems and how to address them.
* TODO Troubleshooting
# Common issues and their solution, or places to look for help.

View file

@ -21,13 +21,15 @@
t))
(defun +eshell--bury-buffer (&optional dedicated-p)
(unless (switch-to-prev-buffer nil 'bury)
(switch-to-buffer (doom-fallback-buffer)))
(when (eq major-mode 'eshell-mode)
(switch-to-buffer (doom-fallback-buffer)))
(when +eshell-enable-new-shell-on-split
(when-let (win (get-buffer-window (+eshell/here)))
(set-window-dedicated-p win dedicated-p))))
(let ((directory default-directory))
(unless (switch-to-prev-buffer nil 'bury)
(switch-to-buffer (doom-fallback-buffer)))
(when (eq major-mode 'eshell-mode)
(switch-to-buffer (doom-fallback-buffer)))
(when +eshell-enable-new-shell-on-split
(let ((default-directory directory))
(when-let (win (get-buffer-window (+eshell/here t)))
(set-window-dedicated-p win dedicated-p))))))
(defun +eshell--setup-window (window &optional flag)
(when (window-live-p window)

View file

@ -12,6 +12,10 @@
"Where to store eshell configuration files, as opposed to
`eshell-directory-name', which is where Doom will store temporary/data files.")
(defvar eshell-directory-name (concat doom-etc-dir "eshell")
"Where to store temporary/data files, as opposed to `eshell-config-dir',
which is where Doom will store eshell configuration files.")
(defvar +eshell-enable-new-shell-on-split t
"If non-nil, spawn a new eshell session after splitting from an eshell
buffer.")
@ -22,11 +26,13 @@ buffer.")
(defvar +eshell-aliases
'(("q" "exit") ; built-in
("f" "find-file $1")
("ff" "find-file $1")
("d" "dired $1")
("bd" "eshell-up $1")
("rg" "rg --color=always $*")
("l" "ls -lh $*")
("ll" "ls -lah $*")
("gg" "magit-status")
("clear" "clear-scrollback")) ; more sensible than default
"An alist of default eshell aliases, meant to emulate useful shell utilities,
like fasd and bd. Note that you may overwrite these in your
@ -35,15 +41,11 @@ to define your aliases.
You should use `set-eshell-alias!' to change this.")
;;
(defvar eshell-directory-name (concat doom-etc-dir "eshell"))
;; These files are exceptions, because they may contain configuration
(defvar eshell-aliases-file (concat +eshell-config-dir "aliases"))
(defvar eshell-rc-script (concat +eshell-config-dir "profile"))
(defvar eshell-login-script (concat +eshell-config-dir "login"))
(defvar +eshell--default-aliases nil)
@ -152,7 +154,11 @@ You should use `set-eshell-alias!' to change this.")
[remap doom/backward-kill-to-bol-and-indent] #'eshell-kill-input
[remap evil-delete-back-to-indentation] #'eshell-kill-input
[remap evil-window-split] #'+eshell/split-below
[remap evil-window-vsplit] #'+eshell/split-right))))
[remap evil-window-vsplit] #'+eshell/split-right
(:localleader
"b" #'eshell-insert-buffer-name
"e" #'eshell-insert-envvar
"s" #'+eshell/search-history)))))
(use-package! eshell-up
@ -173,13 +179,26 @@ You should use `set-eshell-alias!' to change this.")
:config (setup-esh-help-eldoc))
(use-package! eshell-did-you-mean
:after esh-mode ; Specifically esh-mode, not eshell
:config
(eshell-did-you-mean-setup)
;; HACK There is a known issue with `eshell-did-you-mean' where it does not
;; work on first invocation, so we invoke it once manually by setting the
;; last command and then calling the output filter.
(setq eshell-last-command-name "catt")
(eshell-did-you-mean-output-filter "catt: command not found"))
(use-package! fish-completion
:unless IS-WINDOWS
:hook (eshell-mode . fish-completion-mode)
:init (setq fish-completion-fallback-on-bash-p t)
:config
;; HACK Even with `fish-completion-fallback-on-bash-p' non-nil, fish must be
;; installed for bash completion to work. How frustrating. This way we
;; can at least get bash completion whether or not fish is present.
;; HACK Even with `fish-completion-fallback-on-bash-p' non-nil,
;; `fish-completion--list-completions-with-desc' will throw an error if
;; fish isn't installed (and so, will fail to fall back to bash), so we
;; advise it to fail silently.
(defadvice! +eshell--fallback-to-bash-a (&rest _)
:before-while #'fish-completion--list-completions-with-desc
(executable-find "fish")))
:before-until #'fish-completion--list-completions-with-desc
(unless (executable-find "fish") "")))

View file

@ -5,7 +5,9 @@
(package! eshell-z :pin "337cb241e17bd472bd3677ff166a0800f684213c")
(package! shrink-path :pin "c14882c8599aec79a6e8ef2d06454254bb3e1e41")
(package! esh-help :pin "417673ed18a983930a66a6692dbfb288a995cb80")
(package! eshell-did-you-mean :pin "7cb6ef8e2274d0a50a9e114d412307a6543533d5")
(when (featurep! :completion company)
(package! fish-completion :pin "10384881817b5ae38cf6197a077a663420090d2c")
(package! bash-completion :pin "96ce14af9674f3e605bacca87abc0c23b8f13cd5"))
(unless IS-WINDOWS
(when (featurep! :completion company)
(package! fish-completion :pin "10384881817b5ae38cf6197a077a663420090d2c")
(package! bash-completion :pin "96ce14af9674f3e605bacca87abc0c23b8f13cd5")))

View file

@ -1,10 +1,10 @@
;; -*- no-byte-compile: t; -*-
;;; tools/debugger/packages.el
(when (package! realgud :pin "e03446f54c7ee0b4ed3ec7300597046cf1de2bb8")
(when (package! realgud :pin "1238d8e72945a84bb06cd39d7ded75f37105d4d2")
(when (featurep! :lang javascript)
(package! realgud-trepan-ni :pin "6e9cac5e8097018aadf41c88de541168036cc227")))
(when (featurep! +lsp)
(package! dap-mode :pin "cc2eb2fc1b2958ef01dad8c004d2f3bc4dc38bc3")
(package! dap-mode :pin "8f69dc2e3c850571758744d271061549c19e11fc")
(package! posframe :pin "093b29a53cbeda6d637ccc9ef4dfc47123e79b9e"))

View file

@ -12,8 +12,8 @@
;;; Packages
(use-package! direnv
:hook (before-hack-local-variables . direnv--maybe-update-environment)
:hook (flycheck-before-syntax-check . direnv--maybe-update-environment)
:hook (before-hack-local-variables . direnv-update-environment)
:hook (flycheck-before-syntax-check . direnv-update-environment)
:hook (direnv-envrc-mode . +direnv-envrc-fontify-keywords-h)
:config
(add-to-list 'direnv-non-file-modes 'vterm-mode)

View file

@ -82,7 +82,7 @@ export PATH="/usr/local/opt/sqlite/bin:$PATH"
** Arch Linux
#+BEGIN_SRC sh
sudo pacman -S sqlite ripgrep
sudo yay -S wordnet-cli
yay -S wordnet-cli
#+END_SRC
** NixOS

View file

@ -15,6 +15,12 @@ properties:
:definition FN
Run when jumping to a symbol's definition. Used by `+lookup/definition'.
:implementations FN
Run when looking for implementations of a symbol in the current project. Used
by `+lookup/implementations'.
:type-definition FN
Run when jumping to a symbol's type definition. Used by
`+lookup/type-definition'.
:references FN
Run when looking for usage references of a symbol in the current project. Used
by `+lookup/references'.
@ -46,6 +52,7 @@ change the current buffer or window or return non-nil when it succeeds.
If it doesn't change the current buffer, or it returns nil, the lookup module
will fall back to the next handler in `+lookup-definition-functions',
`+lookup-implementations-functions', `+lookup-type-definition-functions',
`+lookup-references-functions', `+lookup-file-functions' or
`+lookup-documentation-functions'.
@ -57,7 +64,7 @@ This can be passed nil as its second argument to unset handlers for MODES. e.g.
(set-lookup-handlers! 'python-mode nil)
\(fn MODES &key DEFINITION REFERENCES DOCUMENTATION FILE XREF-BACKEND ASYNC)"
\(fn MODES &key DEFINITION IMPLEMENTATIONS TYPE-DEFINITION REFERENCES DOCUMENTATION FILE XREF-BACKEND ASYNC)"
(declare (indent defun))
(dolist (mode (doom-enlist modes))
(let ((hook (intern (format "%s-hook" mode)))
@ -69,15 +76,19 @@ This can be passed nil as its second argument to unset handlers for MODES. e.g.
(fset
fn
(lambda ()
(cl-destructuring-bind (&key definition references documentation file xref-backend async)
(cl-destructuring-bind (&key definition implementations type-definition references documentation file xref-backend async)
plist
(cl-mapc #'+lookup--set-handler
(list definition
implementations
type-definition
references
documentation
file
xref-backend)
(list '+lookup-definition-functions
'+lookup-implementations-functions
'+lookup-type-definition-functions
'+lookup-references-functions
'+lookup-documentation-functions
'+lookup-file-functions
@ -133,6 +144,8 @@ This can be passed nil as its second argument to unset handlers for MODES. e.g.
(let* ((origin (point-marker))
(handlers
(plist-get (list :definition '+lookup-definition-functions
:implementations '+lookup-implementations-functions
:type-definition '+lookup-type-definition-functions
:references '+lookup-references-functions
:documentation '+lookup-documentation-functions
:file '+lookup-file-functions)
@ -241,6 +254,30 @@ evil-mode is active."
((+lookup--jump-to :definition identifier nil arg))
((error "Couldn't find the definition of %S" identifier))))
;;;###autoload
(defun +lookup/implementations (identifier &optional arg)
"Jump to the implementations of IDENTIFIER (defaults to the symbol at point).
Each function in `+lookup-implementations-functions' is tried until one changes
the point or current buffer."
(interactive (list (doom-thing-at-point-or-region)
current-prefix-arg))
(cond ((null identifier) (user-error "Nothing under point"))
((+lookup--jump-to :implementations identifier nil arg))
((error "Couldn't find the implementations of %S" identifier))))
;;;###autoload
(defun +lookup/type-definition (identifier &optional arg)
"Jump to the type definition of IDENTIFIER (defaults to the symbol at point).
Each function in `+lookup-type-definition-functions' is tried until one changes
the point or current buffer."
(interactive (list (doom-thing-at-point-or-region)
current-prefix-arg))
(cond ((null identifier) (user-error "Nothing under point"))
((+lookup--jump-to :type-definition identifier nil arg))
((error "Couldn't find the definition of %S" identifier))))
;;;###autoload
(defun +lookup/references (identifier &optional arg)
"Show a list of usages of IDENTIFIER (defaults to the symbol at point)

View file

@ -3,6 +3,8 @@
;; "What am I looking at?" This module helps you answer this question.
;;
;; + `+lookup/definition': a jump-to-definition that should 'just work'
;; + `+lookup/implementations': find a symbol's implementations in the current
;; project
;; + `+lookup/references': find a symbol's references in the current project
;; + `+lookup/file': open the file referenced at point
;; + `+lookup/online'; look up a symbol on online resources
@ -52,6 +54,24 @@ If the argument is interactive (satisfies `commandp'), it is called with
argument: the identifier at point. See `set-lookup-handlers!' about adding to
this list.")
(defvar +lookup-implementations-functions ()
"Function for `+lookup/implementations' to try. Stops at the first function to
return non-nil or change the current window/point.
If the argument is interactive (satisfies `commandp'), it is called with
`call-interactively' (with no arguments). Otherwise, it is called with one
argument: the identifier at point. See `set-lookup-handlers!' about adding to
this list.")
(defvar +lookup-type-definition-functions ()
"Functions for `+lookup/type-definition' to try. Stops at the first function to
return non-nil or change the current window/point.
If the argument is interactive (satisfies `commandp'), it is called with
`call-interactively' (with no arguments). Otherwise, it is called with one
argument: the identifier at point. See `set-lookup-handlers!' about adding to
this list.")
(defvar +lookup-references-functions
'(+lookup-xref-references-backend-fn
+lookup-project-search-backend-fn)

View file

@ -28,9 +28,8 @@
(if IS-MAC
(package! osx-dictionary :pin "1b79ff64c72485cb078db9ab7ee3256b11a99f4b")
(package! define-word :pin "08c71b1ff4fd07bf0c78d1fcf77efeaafc8f7443")
;; HACK Fix #2945: the main package is broken (see
;; SavchenkoValeriy/emacs-powerthesaurus). We use this fork until it is
;; merged.
;; HACK Fix #2945: the main package is broken due to
;; SavchenkoValeriy/emacs-powerthesaurus#11
(package! powerthesaurus
:recipe (:host github :repo "maxchaos/emacs-powerthesaurus" :branch "pt-api-change")
:pin "4a834782a394f2dc70fc02d68b6962b44d87f0cf")

View file

@ -51,6 +51,7 @@ As of this writing, this is the state of LSP support in Doom Emacs:
| [[../../lang/sh/README.org][:lang sh]] | sh-mode | bash-language-server |
| [[../../lang/swift/README.org][:lang swift]] | swift-mode | sourcekit |
| [[../../lang/web/README.org][:lang web]] | web-mode, css-mode, scss-mode, sass-mode, less-css-mode | vscode-css-languageserver-bin, vscode-html-languageserver-bin |
| [[../../lang/purescript/README.org][:lang purescript]] | purescript-mode | purescript-language-server |
** Module Flags
+ =+peek= Use =lsp-ui-peek= when looking up definitions and references with

View file

@ -54,6 +54,8 @@ working on that project after closing the last buffer.")
(set-lookup-handlers! 'lsp-mode :async t
:documentation #'lsp-describe-thing-at-point
:definition #'lsp-find-definition
:implementations #'lsp-find-implementation
:type-definition #'lsp-find-type-definition
:references #'lsp-find-references)
;; TODO Lazy load these. They don't need to be loaded all at once unless the
@ -91,6 +93,10 @@ This also logs the resolved project root, if found, so we know where we are."
;; development builds of Emacs 27 and above
(or (not (boundp 'read-process-output-max))
(setq-local read-process-output-max (* 1024 1024)))
;; REVIEW LSP causes a lot of allocations, with or without Emacs 27+'s
;; native JSON library, so we up the GC threshold to stave off
;; GC-induced slowdowns/freezes.
(setq-local gcmh-high-cons-threshold (* 2 gcmh-high-cons-threshold))
(prog1 (lsp-mode 1)
(setq-local lsp-buffer-uri (lsp--buffer-uri))
;; Announce what project root we're using, for diagnostic purposes
@ -189,6 +195,7 @@ auto-killed (which is a potentially expensive process)."
(when (featurep! +peek)
(set-lookup-handlers! 'lsp-ui-mode :async t
:definition 'lsp-ui-peek-find-definitions
:implementations 'lsp-ui-peek-find-implementation
:references 'lsp-ui-peek-find-references)))

View file

@ -1,8 +1,8 @@
;; -*- no-byte-compile: t; -*-
;;; tools/lsp/packages.el
(package! lsp-mode :pin "11750e7b118858b38417a538c1c6eff8759c12f3")
(package! lsp-ui :pin "1288be94b4c37f89e80a03b1cff1b81aba9560bb")
(package! lsp-mode :pin "bac42c50b370f3716f258506dc1ae9f62906313f")
(package! lsp-ui :pin "ab55e306af9dd9eb62fe7463e4e05d948ad3dfc6")
(when (featurep! :completion ivy)
(package! lsp-ivy :pin "81e81ced99829358674c5a6bbe2c3e15cecd4ed8"))
(when (featurep! :completion helm)

View file

@ -1,10 +1,22 @@
;;; tools/magit/autoload.el -*- lexical-binding: t; -*-
;; HACK Magit complains loudly when it can't determine its own version, which is
;; the case when magit is built through straight. The warning is harmless,
;; however, so we just need it to shut up.
;; HACK Magit complains loudly (but harmlessly) when it can't determine its own
;; version (in the case of a sparse clone).
;;;###autoload
(advice-add #'magit-version :override #'ignore)
(defadvice! +magit--ignore-version-a (&optional print-dest)
:override #'magit-version
(when print-dest
(defvar magit-git-debug)
(princ (format "Magit (unknown), Git %s, Emacs %s, %s"
(or (let ((magit-git-debug
(lambda (err)
(display-warning '(magit git) err :error))))
(magit-git-version t))
"(unknown)")
emacs-version
system-type)
print-dest))
nil)
;;;###autoload
(defun +magit-display-buffer-fn (buffer)

View file

@ -25,6 +25,20 @@
(setq pdf-view-use-scaling t
pdf-view-use-imagemagick nil)
;; Persist current page for PDF files viewed in Emacs
(defvar +pdf--page-restored-p nil)
(add-hook! 'pdf-view-change-page-hook
(defun +pdf-remember-page-number-h ()
(when-let (page (and buffer-file-name (pdf-view-current-page)))
(doom-store-put buffer-file-name page nil "pdf-view"))))
(add-hook! 'pdf-view-mode-hook
(defun +pdf-restore-page-number-h ()
(when-let (page (and buffer-file-name (doom-store-get buffer-file-name "pdf-view")))
(and (not +pdf--page-restored-p)
(<= page (or (pdf-cache-number-of-pages) 1))
(pdf-view-goto-page page)
(setq-local +pdf--page-restored-p t)))))
;; Add retina support for MacOS users
(when IS-MAC
(advice-add #'pdf-util-frame-scale-factor :around #'+pdf--util-frame-scale-factor-a)
@ -51,29 +65,30 @@
(setq-hook! 'pdf-view-mode-hook evil-normal-state-cursor (list nil))
;; Install epdfinfo binary if needed, blocking until it is finished
(require 'pdf-tools)
(unless (file-executable-p pdf-info-epdfinfo-program)
(let ((wconf (current-window-configuration)))
(pdf-tools-install)
(message "Building epdfinfo, this will take a moment...")
;; HACK We reset all `pdf-view-mode' buffers to fundamental mode so that
;; `pdf-tools-install' has a chance to reinitialize them as
;; `pdf-view-mode' buffers. This is necessary because
;; `pdf-tools-install' won't do this to buffers that are already in
;; pdf-view-mode.
(dolist (buffer (doom-buffers-in-mode 'pdf-view-mode))
(with-current-buffer buffer (fundamental-mode)))
(while compilation-in-progress
;; Block until `pdf-tools-install' is done
(redisplay)
(sleep-for 1))
;; HACK If pdf-tools was loaded by you opening a pdf file, once
;; `pdf-tools-install' completes, `pdf-view-mode' will throw an error
;; because the compilation buffer is focused, not the pdf buffer.
;; Therefore, it is imperative that the window config is restored.
(when (file-executable-p pdf-info-epdfinfo-program)
(set-window-configuration wconf))))
(when doom-interactive-mode
(require 'pdf-tools)
(unless (file-executable-p pdf-info-epdfinfo-program)
(let ((wconf (current-window-configuration)))
(pdf-tools-install)
(message "Building epdfinfo, this will take a moment...")
;; HACK We reset all `pdf-view-mode' buffers to fundamental mode so that
;; `pdf-tools-install' has a chance to reinitialize them as
;; `pdf-view-mode' buffers. This is necessary because
;; `pdf-tools-install' won't do this to buffers that are already in
;; pdf-view-mode.
(dolist (buffer (doom-buffers-in-mode 'pdf-view-mode))
(with-current-buffer buffer (fundamental-mode)))
(while compilation-in-progress
;; Block until `pdf-tools-install' is done
(redisplay)
(sleep-for 1))
;; HACK If pdf-tools was loaded by you opening a pdf file, once
;; `pdf-tools-install' completes, `pdf-view-mode' will throw an error
;; because the compilation buffer is focused, not the pdf buffer.
;; Therefore, it is imperative that the window config is restored.
(when (file-executable-p pdf-info-epdfinfo-program)
(set-window-configuration wconf))))
;; Sets up `pdf-tools-enable-minor-modes', `pdf-occur-global-minor-mode' and
;; `pdf-virtual-global-minor-mode'.
(pdf-tools-install-noverify))
;; Sets up `pdf-tools-enable-minor-modes', `pdf-occur-global-minor-mode' and
;; `pdf-virtual-global-minor-mode'.
(pdf-tools-install-noverify)))

View file

@ -1,4 +1,4 @@
;; -*- no-byte-compile: t; -*-
;;; tools/pdf/packages.el
(package! pdf-tools :pin "d9712989fc4715443f674459199bdffa987054ac")
(package! pdf-tools :pin "c510442ab89c8a9e9881230eeb364f4663f59e76")

View file

@ -2,7 +2,7 @@
(use-package! evil-goggles
:when (featurep! :editor evil)
:after-call pre-command-hook
:hook (doom-first-input . evil-goggles-mode)
:init
(setq evil-goggles-duration 0.1
evil-goggles-pulse nil ; too slow
@ -23,13 +23,12 @@
'(+eval:region
:face evil-goggles-yank-face
:switch evil-goggles-enable-yank
:advice evil-goggles--generic-async-advice))
(evil-goggles-mode +1))
:advice evil-goggles--generic-async-advice)))
(use-package! volatile-highlights
:unless (featurep! :editor evil)
:after-call pre-command-hook
:hook (doom-first-input . volatile-highlights-mode)
:config
(after! undo-fu
(vhl/define-extension 'undo-fu 'undo-fu-only-undo 'undo-fu-only-redo)