Merge branch 'develop' into lsp-tex

This commit is contained in:
M. Yas. Davoodeh 2020-04-26 10:40:34 +04:30 committed by GitHub
commit 96276a688d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
263 changed files with 4049 additions and 2644 deletions

View file

@ -7,12 +7,14 @@
(not inhibit-workspace))
(+workspace-switch +irc--workspace-name 'auto-create))
(let ((buffers (doom-buffers-in-mode 'circe-mode nil t)))
(if buffers
(ignore (switch-to-buffer (car buffers)))
(require 'circe)
(delete-other-windows)
(switch-to-buffer (doom-fallback-buffer))
t)))
(if (not (member (window-buffer) buffers))
(if buffers
(ignore (switch-to-buffer (car buffers)))
(require 'circe)
(delete-other-windows)
(switch-to-buffer (doom-fallback-buffer))
t)
(user-error "IRC buffer is already active and selected"))))
;;;###autoload
(defun =irc (&optional inhibit-workspace)

View file

@ -48,7 +48,6 @@ playback.")
(use-package! circe
:commands circe circe-server-buffers
:init (setq circe-network-defaults nil)
:config
(setq circe-default-quit-message nil
circe-default-part-message nil
@ -95,6 +94,25 @@ playback.")
(add-hook 'circe-mode-hook #'+irc--add-circe-buffer-to-persp-h)
(add-hook 'circe-mode-hook #'turn-off-smartparens-mode)
;; HACK Fix #1862: circe hangs on TLS connections when using OpenSSL versions
;; > 1.1.0, where tls.el does not correctly determine the end of the info
;; block. This fixes proposed in jorgenschaefer/circe#340
(setq-hook! 'circe-mode-hook
tls-end-of-info
(concat "\\("
;; `openssl s_client' regexp. See ssl/ssl_txt.c lines 219-220.
;; According to apps/s_client.c line 1515 `---' is always the last
;; line that is printed by s_client before the real data.
"^ Verify return code: .+\n\\(\\|^ Extended master secret: .+\n\\)\\(\\|^ Max Early Data: .+\n\\)---\n\\|"
;; `gnutls' regexp. See src/cli.c lines 721-.
"^- Simple Client Mode:\n"
"\\(\n\\|" ; ignore blank lines
;; According to GnuTLS v2.1.5 src/cli.c lines 640-650 and 705-715 in
;; `main' the handshake will start after this message. If the
;; handshake fails, the programs will abort.
"^\\*\\*\\* Starting TLS handshake\n\\)*"
"\\)"))
(defadvice! +irc--circe-run-disconnect-hook-a (&rest _)
"Runs `+irc-disconnect-hook' after circe disconnects."
:after #'circe--irc-conn-disconnected

View file

@ -1,5 +1,5 @@
;; -*- no-byte-compile: t; -*-
;;; app/irc/packages.el
(package! circe :pin "0c79138fb2")
(package! circe :pin "e5bf5f8974")
(package! circe-notifications :pin "291149ac12")

View file

@ -1,14 +0,0 @@
;;; app/regex/autoload/export.el
;;;###autoload
(defun +regex/export () (interactive)) ; TODO +regex/export
;;
(defun +regex-export-python ()) ; import (re|regex)
(defun +regex-export-php ()) ; preg_(match(_all)?|replace)
(defun +regex-export-ruby ()) ; %r[.+]
(defun +regex-export-js ()) ; /.+/

View file

@ -1,272 +0,0 @@
;;; app/regex/autoload/regex.el
(defvar +regex--text-buffer nil)
(defvar +regex--text-replace-buffer nil)
(defvar +regex--expr-buffer nil)
(defvar +regex--expr-replace-buffer nil)
(defvar +regex--groups-buffer nil)
(defvar +regex--replace-buffer nil)
;;
(defface +regex-match-0-face
`((t (:foreground "Black" :background ,(doom-color 'magenta) :bold t)))
"TODO"
:group 'faces)
(defface +regex-match-1-face
`((t (:foreground "Black" :background ,(doom-color 'blue) :bold t)))
"TODO"
:group 'faces)
(defface +regex-match-2-face
`((t (:foreground "Black" :background ,(doom-color 'green) :bold t)))
"TODO"
:group 'faces)
(defvar +regex-faces
'(+regex-match-0-face +regex-match-1-face +regex-match-2-face)
"TODO")
;;
(defvar +regex-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "\C-c\C-c" #'+regex-update-buffers)
(define-key map "\C-c\C-r" #'=regex/replace)
(define-key map "\C-c\C-k" #'+regex/quit)
(define-key map [remap kill-current-buffer] #'+regex/quit)
(define-key map [remap kill-buffer] #'+regex/quit)
map)
"TODO")
;;;###autoload
(define-minor-mode +regex-mode
"TODO"
:init-value nil
:global nil
:lighter ""
:keymap +regex-mode-map
(if +regex-mode
(add-hook 'after-change-functions #'+regex-update-buffers nil t)
(remove-hook 'after-change-functions #'+regex-update-buffers t)))
;;;###autoload
(defun =regex (&optional dummy-text)
"Start the Regex IDE."
(interactive "P")
(unless (buffer-live-p +regex--expr-buffer)
(condition-case ex
(progn
(setq +regex--expr-buffer (get-buffer-create "*doom-regex*")
+regex--text-buffer (if dummy-text (get-buffer-create "*doom-regex-text*") (current-buffer))
+regex--groups-buffer (get-buffer-create "*doom-regex-groups*"))
(when dummy-text
(+workspace-switch +regex-workspace-name t)
(switch-to-buffer +regex--text-buffer)
(with-current-buffer +regex--text-buffer
(insert +regex-dummy-text)))
(pop-to-buffer +regex--groups-buffer)
(pop-to-buffer +regex--expr-buffer)
(with-current-buffer +regex--expr-buffer
(conf-mode)
(rainbow-delimiters-mode +1)
(doom/toggle-line-numbers +1)
(setq-local require-final-newline nil)
(+regex-mode +1)
(text-scale-set 3)))
('error
(+regex/quit)
(error "Failed to open the Regexp IDE: %s" ex)))))
;;;###autoload
(defun =regex/replace ()
(interactive)
(unless (buffer-live-p +regex--replace-buffer)
(let (text)
(=regex t)
(with-selected-window (get-buffer-window +regex--text-buffer)
(setq text (buffer-string))
(select-window (split-window-right))
(switch-to-buffer (get-buffer-create "*doom-regex-text-repl*"))
(erase-buffer)
(insert text)
(read-only-mode +1)
(setq +regex--text-replace-buffer (current-buffer)))
(with-current-buffer +regex--expr-buffer
(select-window (split-window-right))
(switch-to-buffer (get-buffer-create "*doom-regex-repl*"))
(conf-mode)
(rainbow-delimiters-mode +1)
(doom/toggle-line-numbers -1)
(setq-local require-final-newline nil)
(setq mode-line-format nil
+regex--expr-replace-buffer (current-buffer))
(+regex-mode +1)
(text-scale-set 3)))))
;;;###autoload
(defun +regex/quit ()
"TODO"
(interactive)
(when (and +regex--text-buffer (buffer-live-p +regex--text-buffer))
(with-current-buffer +regex--text-buffer
(+regex-mode -1)
(remove-overlays nil nil 'category '+regex))
(when (equal (buffer-name +regex--text-buffer) "*doom-regex-text*")
(kill-buffer +regex--text-buffer)))
(when (equal (+workspace-current-name) +regex-workspace-name)
(+workspace/delete +regex-workspace-name))
(mapc (lambda (bufname)
(let ((buf (symbol-value bufname)))
(when (and buf (buffer-live-p buf))
(kill-buffer buf)
(set bufname nil))))
(list '+regex--text-replace-buffer
'+regex--expr-replace-buffer
'+regex--expr-buffer
'+regex--groups-buffer
'+regex--replace-buffer)))
(defun +regex--expr ()
(when (buffer-live-p +regex--expr-buffer)
(with-current-buffer +regex--expr-buffer
(string-trim (buffer-string)))))
(defun +regex--expr-replace ()
(when (buffer-live-p +regex--expr-replace-buffer)
(with-current-buffer +regex--expr-replace-buffer
(string-trim (buffer-string)))))
;;;###autoload
(defun +regex-update-buffers (&optional beg end len)
(interactive)
(let* ((inhibit-read-only t)
(regex (or (+regex--expr) ""))
(replace (or (+regex--expr-replace) ""))
(str (or (with-current-buffer +regex--text-buffer (buffer-string)) "")))
(with-current-buffer +regex--groups-buffer
(erase-buffer))
(with-current-buffer +regex--text-buffer
(remove-overlays nil nil 'category '+regex)
(when (> (length regex) 0)
(save-excursion
(goto-char (point-min))
(pcase +regex-default-backend
('emacs (+regex-backend-emacs regex replace str))
('perl (+regex-backend-perl regex replace str))))))
(with-current-buffer +regex--groups-buffer
(goto-char (point-min)))))
;; --- backends ---------------------------
(defun +regex--render-perl (regex text)
"From <https://github.com/jwiegley/regex-tool>"
(with-temp-buffer
(insert (format "@lines = <DATA>;
$line = join(\"\", @lines);
print \"(\";
while ($line =~ m/%s/gm) {
print \"(\", length($`), \" \", length($&), \" \";
for $i (1 .. 20) {
if ($$i) {
my $group = $$i;
$group =~ s/([\\\\\"])/\\\\\\1/g;
print \"(\", $i, \" . \\\"\", $group, \"\\\") \";
}
}
print \")\";
}
print \")\";
__DATA__
%s" (replace-regexp-in-string "/" "\\/" regex nil t) text))
(call-process-region (point-min) (point-max) "perl" t t)
(goto-char (point-min))
(read (current-buffer))))
(defun +regex--replace-perl (regex replace text)
(unless (or (string-empty-p regex)
(string-empty-p replace)
(string-empty-p text))
(with-temp-buffer
(insert (format "@lines = <DATA>;
$line = join(\"\", @lines);
$line =~ s/%s/%s/gm;
print $line;
__DATA__
%s" (replace-regexp-in-string "/" "\\/" regex nil t) (replace-regexp-in-string "/" "\\/" replace nil t) text))
(call-process-region (point-min) (point-max) "perl" t t)
(buffer-string))))
;;;###autoload
(defun +regex-backend-perl (regex replace str)
"TODO"
(cl-assert (stringp regex))
(cl-assert (stringp replace))
(cl-assert (stringp str))
(let ((i 0)
(results (+regex--render-perl regex str)))
(when (buffer-live-p +regex--text-replace-buffer)
(let ((replace (+regex--replace-perl regex replace str)))
(with-current-buffer +regex--text-replace-buffer
(erase-buffer)
(insert
(if (and (listp results)
replace
(not (string-empty-p replace)))
replace
str)))))
(dolist (result (if (listp results) results))
(let* ((offset (nth 0 result))
(length (nth 1 result))
(matches (nthcdr 2 result))
(ov (make-overlay (1+ offset) (+ offset length 1))))
(overlay-put ov 'face (nth (mod i 3) +regex-faces))
(overlay-put ov 'category '+regex)
(cl-incf i)
(let* ((match-zero (buffer-substring (1+ offset) (+ offset length 1)))
(line (format "Match: %s\n" (propertize match-zero 'face 'font-lock-string-face))))
(with-current-buffer +regex--groups-buffer
(insert line)))
(dolist (match matches)
(with-current-buffer +regex--groups-buffer
(goto-char (point-max))
(insert (format "Group %d: %s\n"
(propertize (car match) 'face 'font-lock-constant-face)
(propertize (cdr match) 'face 'font-lock-string-face)))))
(with-current-buffer +regex--groups-buffer
(insert ?\n))))))
;;;###autoload
(defun +regex-backend-emacs (regex replace str)
"TODO"
(cl-assert (stringp regex))
(cl-assert (stringp replace))
(cl-assert (stringp str))
(let ((i 0)
pos)
(when (buffer-live-p +regex--text-replace-buffer)
(with-current-buffer +regex--text-replace-buffer
(erase-buffer)
(insert str)
(when (and (listp results) (string-empty-p replace))
(replace-regexp regex replace))))
(while (and (setq pos (point))
(re-search-forward regex nil t))
(if (= (point) pos)
(forward-char 1)
(let ((ov (make-overlay (match-beginning 0) (match-end 0))))
(overlay-put ov 'face (nth (mod i 3) +regex-faces))
(overlay-put ov 'category '+regex))
(cl-incf i)
(dotimes (i 10)
(when-let (text (match-string i))
(save-match-data
(with-current-buffer +regex--groups-buffer
(goto-char (point-max))
(insert
(format "Group %d: %s\n"
(propertize i 'face 'font-lock-constant-face)
(propertize text 'face 'font-lock-string-face)))))))
(with-current-buffer +regex--groups-buffer
(insert ?\n))))))

View file

@ -1,51 +0,0 @@
;;; app/regex/config.el
;; Often, I find myself writing regular expressions that could terrify seasoned
;; programmers (or little children). To hone my regex fu, I need a regex
;; playground. Sure, there's regexr.com, but don't be silly, that's not Emacs.
;;
;; Sadly, the Emacs' regex syntax is niche and lacks support for a few
;; questionably useful features, like lookaround assertions, conditionals, case
;; modifiers or backreferences, among others. No, I want PCRE. I am going to
;; have my cake and eat it too, damn it!
;;
;; Workflow:
;; + Invoke `=regex' (if opened with C-u, opens in separate workspace with a
;; dummy text buffer).
;; + A regex window will popup up. Any matches will be highlighted in the
;; original buffer.
;; + C-c C-k to close it
;; + TODO C-c C-e to export to various langauges
;;
;; WARNING: THIS IS A WORK IN PROGRESS
(defvar +regex-workspace-name "*regex*"
"TODO")
(defvar +regex-default-backend 'perl
"The backend used to process regular expressions.
The `emacs' backend handles regular expressions directly.
The `perl' backend talks to a perl subprocess to do the handling.")
(defvar +regex-dummy-text
"Welcome to DOOM Emacs, proudly hosted by the demons of hell!
Edit the Expression & Text to see matches. Roll over matches or the expression
for details. Undo mistakes with ctrl-z. Save Favorites & Share expressions with
friends or the Community. Explore your results with Tools. A full Reference &
Help is available in the Library, or watch the video Tutorial.
Sample text for testing:
abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
0123456789 _+-.,!@#$%^&*();\/|<>\"'
12345 -98.7 3.141 .6180 9,000 +42
555.123.4567 +1-(800)-555-2468
foo@demo.net bar.ba@test.co.uk
www.demo.com http://foo.co.uk/
http://regexr.com/foo.html?q=bar
https://mediatemple.net"
"TODO")
(set-popup-rules!
'(("^\\*doom-regex\\*$" :size 4 :quit nil)
("^\\*doom-regex-groups" :side 'left :size 28 :select nil :quit nil)))

View file

@ -1,5 +1,5 @@
;; -*- no-byte-compile: t; -*-
;;; app/rss/packages.el
(package! elfeed :pin "3f0edb1737")
(package! elfeed :pin "d0405e6386")
(package! elfeed-org :pin "77b6bbf222")

View file

@ -2,4 +2,4 @@
;;; app/twitter/packages.el
(package! twittering-mode :pin "114891e8fd")
(package! avy :pin "cf95ba9582")
(package! avy :pin "3bf83140fa")

View file

@ -7,7 +7,8 @@
langtool-correct-buffer)
:init (setq langtool-default-language "en-US")
:config
(unless langtool-language-tool-jar
(unless (or langtool-bin
langtool-language-tool-jar)
(setq langtool-language-tool-jar
(cond (IS-MAC
(locate-file "libexec/languagetool-commandline.jar"

View file

@ -65,10 +65,10 @@
(defun +spell-inhibit-duplicate-detection-maybe-h ()
"Don't mark duplicates when style/grammar linters are present.
e.g. proselint and langtool."
(when (or (and (bound-and-true-p flycheck-mode)
(executable-find "proselint"))
(featurep 'langtool))
(setq-local flyspell-mark-duplications-flag nil))))
(and (or (and (bound-and-true-p flycheck-mode)
(executable-find "proselint"))
(featurep 'langtool))
(setq-local flyspell-mark-duplications-flag nil))))
;; Ensure mode-local predicates declared with `set-flyspell-predicate!' are
;; used in their respective major modes.

View file

@ -10,9 +10,14 @@
(setq flycheck-emacs-lisp-load-path 'inherit)
;; Check only when saving or opening files. Newline & idle checks are a mote
;; excessive, especially when that can easily catch code in an incomplete
;; state, so we removed them.
(setq flycheck-check-syntax-automatically '(save mode-enabled))
;; excessive and can catch code in an incomplete state, producing false
;; positives, so we removed them.
(setq flycheck-check-syntax-automatically '(save mode-enabled idle-buffer-switch))
;; For the above functionality, check syntax in a buffer that you switched to
;; only briefly. This allows "refreshing" the syntax check state for several
;; buffers quickly after e.g. changing a config file.
(setq flycheck-buffer-switch-check-intermediate-buffers t)
;; Display errors a little quicker (default is 0.9s)
(setq flycheck-display-errors-delay 0.25)
@ -41,7 +46,7 @@
(use-package! flycheck-popup-tip
:commands flycheck-popup-tip-show-popup flycheck-popup-tip-delete-popup
:init (add-hook 'flycheck-mode-hook #'+syntax-init-popups-h)
:hook (flycheck-mode . +syntax-init-popups-h)
:config
(setq flycheck-popup-tip-error-prefix "")
(after! evil
@ -58,8 +63,7 @@
(use-package! flycheck-posframe
:when (featurep! +childframe)
:defer t
:init (add-hook 'flycheck-mode-hook #'+syntax-init-popups-h)
:hook (flycheck-mode . +syntax-init-popups-h)
:config
(setq flycheck-posframe-warning-prefix ""
flycheck-posframe-info-prefix "··· "

View file

@ -1,7 +1,7 @@
;; -*- no-byte-compile: t; -*-
;;; checkers/syntax/packages.el
(package! flycheck :pin "08345d38e2")
(package! flycheck :pin "f19a51c0f1")
(package! flycheck-popup-tip :pin "ef86aad907")
(when (featurep! +childframe)
(package! flycheck-posframe :pin "2b3e94c2e4"))

View file

@ -4,24 +4,23 @@
:commands company-complete-common company-manual-begin company-grab-line
:after-call pre-command-hook after-find-file
:init
(setq company-minimum-prefix-length 2
(setq company-idle-delay 0.25
company-minimum-prefix-length 2
company-tooltip-limit 14
company-dabbrev-downcase nil
company-dabbrev-ignore-case nil
company-dabbrev-code-other-buffers t
company-tooltip-align-annotations t
company-require-match 'never
company-global-modes
'(not erc-mode message-mode help-mode gud-mode eshell-mode)
company-backends '(company-capf)
company-frontends
'(company-pseudo-tooltip-frontend
company-echo-metadata-frontend))
company-backends '(company-capf)
company-frontends '(company-pseudo-tooltip-frontend
company-echo-metadata-frontend))
:config
(when (featurep! :editor evil)
(add-hook 'company-mode-hook #'evil-normalize-keymaps)
;; Don't persist company popups when switching back to normal mode.
(add-hook 'evil-normal-state-entry-hook #'company-abort)
(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))
;; 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'.
@ -50,8 +49,7 @@
;; Packages
(after! company-files
(pushnew! company-files--regexps
"file:\\(\\(?:\\.\\{1,2\\}/\\|~/\\|/\\)[^\]\n]*\\)"))
(add-to-list 'company-files--regexps "file:\\(\\(?:\\.\\{1,2\\}/\\|~/\\|/\\)[^\]\n]*\\)"))
(use-package! company-prescient

View file

@ -1,8 +1,8 @@
;; -*- no-byte-compile: t; -*-
;;; completion/company/packages.el
(package! company :pin "9de9905ed2")
(package! company :pin "61ddd9afb5")
(package! company-dict :pin "cd7b8394f6")
(package! company-prescient :pin "7fd8c3b802")
(package! company-prescient :pin "53307731f3")
(when (featurep! +childframe)
(package! company-box :pin "8fc6168f2d"))

View file

@ -77,35 +77,31 @@ be negative.")
(setq helm-display-function #'+helm-posframe-display-fn))
(let ((fuzzy (featurep! +fuzzy)))
(setq helm-M-x-fuzzy-match fuzzy
helm-apropos-fuzzy-match fuzzy
helm-apropos-fuzzy-match fuzzy
(setq helm-apropos-fuzzy-match fuzzy
helm-bookmark-show-location fuzzy
helm-buffers-fuzzy-matching fuzzy
helm-completion-in-region-fuzzy-match fuzzy
helm-completion-in-region-fuzzy-match fuzzy
helm-ff-fuzzy-matching fuzzy
helm-file-cache-fuzzy-match fuzzy
helm-flx-for-helm-locate fuzzy
helm-imenu-fuzzy-match fuzzy
helm-lisp-fuzzy-completion fuzzy
helm-locate-fuzzy-match fuzzy
helm-mode-fuzzy-match fuzzy
helm-projectile-fuzzy-match fuzzy
helm-recentf-fuzzy-match fuzzy
helm-semantic-fuzzy-match fuzzy))
helm-semantic-fuzzy-match fuzzy)
;; Make sure that we have helm-multi-matching or fuzzy matching,
;; (as prescribed by the fuzzy flag) also in the following cases:
;; - helmized commands that use `completion-at-point' and similar functions
;; - native commands that fall back to `completion-styles' like `helm-M-x'
(push (if EMACS27+
(if fuzzy 'flex 'helm)
(if fuzzy 'helm-flex 'helm))
completion-styles))
:config
(set-popup-rule! "^\\*helm" :vslot -100 :size 0.22 :ttl nil)
;; HACK Doom doesn't support these commands, which invite the user to install
;; the package via ELPA. Force them to use +helm/* instead, because they work
;; out of the box.
(advice-add #'helm-projectile-rg :override #'+helm/project-search)
(advice-add #'helm-projectile-ag :override #'+helm/project-search)
(advice-add #'helm-projectile-grep :override #'+helm/project-search)
;; Hide the modeline
;; Hide the modeline in helm windows as it serves little purpose.
(defun +helm--hide-mode-line (&rest _)
(with-current-buffer (helm-buffer-get)
(unless helm-mode-line-string
@ -121,7 +117,6 @@ be negative.")
(dolist (fn '(helm-describe-variable helm-describe-function))
(advice-add fn :around #'doom-use-helpful-a)))
(use-package! helm-flx
:when (featurep! +fuzzy)
:hook (helm-mode . helm-flx-mode)
@ -187,3 +182,7 @@ be negative.")
(lambda (buf &optional _resume) (pop-to-buffer buf)))
(global-set-key [remap swiper] #'swiper-helm)
(add-to-list 'swiper-font-lock-exclude #'+doom-dashboard-mode nil #'eq))
(use-package! helm-descbinds
:hook (helm-mode . helm-descbinds-mode))

View file

@ -1,7 +1,7 @@
;; -*- no-byte-compile: t; -*-
;;; completion/helm/packages.el
(package! helm :pin "21e778bc88")
(package! helm :pin "d978f20f4c")
(package! helm-rg :pin "785a80fe5c")
(package! helm-c-yasnippet :pin "65ca732b51")
(package! helm-company :pin "6eb5c2d730")
@ -13,6 +13,7 @@
(when (featurep! +fuzzy)
(package! helm-flx :pin "6640fac5cb"))
(when (featurep! +childframe)
(package! posframe :pin "8a9af547e6"))
(package! posframe :pin "e62e584268"))
(when (featurep! :lang org)
(package! helm-org :pin "8457e1e462"))
(package! helm-org :pin "b7a18dfc17"))
(package! helm-descbinds :pin "b725159823")

View file

@ -1,59 +1,64 @@
;;; completion/ido/config.el -*- lexical-binding: t; -*-
(defun +ido-init-h ()
(setq ido-ignore-buffers
'("\\` " "^\\*ESS\\*" "^\\*Messages\\*" "^\\*Help\\*" "^\\*Buffer"
"^\\*.*Completions\\*$" "^\\*Ediff" "^\\*tramp" "^\\*cvs-"
"_region_" " output\\*$" "^TAGS$" "^\*Ido")
ido-use-faces nil
ido-confirm-unique-completion t
ido-case-fold t
ido-enable-tramp-completion nil
ido-enable-flex-matching t
ido-create-new-buffer 'always
ido-enable-tramp-completion t
ido-enable-last-directory-history t
ido-save-directory-list-file (concat doom-cache-dir "ido.last"))
(defvar ido-mode-hook nil
"List of hooks to run when `ido-mode' is activated.")
(unless (member "\\`.DS_Store$" ido-ignore-files)
(push "\\`.DS_Store$" ido-ignore-files)
(push "Icon\\?$" ido-ignore-files))
(define-key! (ido-common-completion-map ido-completion-map ido-file-completion-map)
"\C-n" #'ido-next-match
"\C-p" #'ido-prev-match
"\C-w" #'ido-delete-backward-word-updir
;; Go to $HOME with ~
"~" (λ! (if (looking-back "/" (point-min))
(insert "~/")
(call-interactively #'self-insert-command))))
(defadvice! +ido--sort-mtime-a ()
"Sort ido filelist by mtime instead of alphabetically."
:override #'ido-sort-mtime
(setq ido-temp-list
(sort ido-temp-list
(lambda (a b)
(time-less-p
(sixth (file-attributes (concat ido-current-directory b)))
(sixth (file-attributes (concat ido-current-directory a)))))))
(ido-to-end ;; move . files to end (again)
(cl-loop for x in ido-temp-list
if (char-equal (string-to-char x) ?.)
collect x)))
(add-hook! '(ido-make-file-list-hook ido-make-dir-list-hook)
#'ido-sort-mtime)
;;
(ido-mode 1)
(ido-everywhere 1)
(ido-ubiquitous-mode 1)
(ido-vertical-mode 1)
(flx-ido-mode +1)
(crm-custom-mode +1)
;;
(remove-hook 'ido-setup-hook #'+ido-init-h))
;;
(add-hook 'ido-setup-hook #'+ido-init-h)
;;; Packages
(use-package! ido
:after-call pre-command-hook
: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.")
(defadvice! +ido-run-hooks-a (&rest _)
:after #'ido-mode
(run-hooks 'ido-mode-hook))
:init
(setq ido-save-directory-list-file (concat doom-cache-dir "ido.last"))
:config
(pushnew! ido-ignore-files "\\`.DS_Store$" "Icon\\?$")
(setq ido-ignore-buffers
'("\\` " "^\\*ESS\\*" "^\\*Messages\\*" "^\\*[Hh]elp" "^\\*Buffer"
"^\\*.*Completions\\*$" "^\\*Ediff" "^\\*tramp" "^\\*cvs-" "_region_"
" output\\*$" "^TAGS$" "^\*Ido")
ido-auto-merge-work-directories-length -1
ido-confirm-unique-completion t
ido-case-fold t
ido-create-new-buffer 'always
ido-enable-flex-matching t)
(map! :map (ido-common-completion-map ido-file-completion-map)
"C-w" #'ido-delete-backward-word-updir
:map ido-common-completion-map
"C-n" #'ido-next-match
"C-p" #'ido-prev-match
[down] #'ido-next-match
[up] #'ido-prev-match
:map ido-file-completion-map
;; Go to $HOME with ~
"~" (λ! (if (looking-back "/" (point-min))
(insert "~/")
(call-interactively #'self-insert-command))))
(ido-mode +1))
(use-package! ido-vertical-mode
:hook (ido-mode . ido-vertical-mode)
:config (setq ido-vertical-show-count t))
(use-package! ido-sort-mtime
:hook (ido-mode . ido-sort-mtime-mode))
(use-package! crm-custom
:hook (ido-mode . crm-custom-mode))
(use-package! flx-ido
:hook (ido-mode . flx-ido-mode))

View file

@ -2,6 +2,7 @@
;;; completion/ido/packages.el
(package! flx-ido :pin "17f5c9cb2a")
(package! ido-completing-read+ :pin "74861eabd0")
(package! ido-completing-read+ :pin "98d3a6e56b")
(package! ido-sort-mtime :pin "f638ff0c92")
(package! ido-vertical-mode :pin "16c4c1a112")
(package! crm-custom :pin "f1aaccf643")

View file

@ -136,7 +136,7 @@ These keybindings are available while a search is active:
| =C-c C-o= | Open a buffer with your search results |
| =C-c C-e= | Open a writable buffer of your search results |
| =C-SPC= | Preview the current candidate |
| =M-RET= | Open the selected candidate in other-window |
| =C-RET= | Open the selected candidate in other-window |
Changes to the resulting wgrep buffer (opened by =C-c C-e=) can be committed
with =C-c C-c= and aborted with =C-c C-k= (alternatively =ZZ= and =ZQ=, for evil

View file

@ -207,8 +207,8 @@ If ARG (universal argument), open selection in other-window."
;;;###autoload
(defun +ivy/projectile-find-file ()
"A more sensible `counsel-projectile-find-file', which will revert to
`counsel-find-file' if invoked from $HOME, `counsel-file-jump' if invoked from a
non-project, `projectile-find-file' if in a big project (more than
`counsel-find-file' if invoked from $HOME or /, `counsel-file-jump' if invoked
from a non-project, `projectile-find-file' if in a big project (more than
`ivy-sort-max-size' files), or `counsel-projectile-find-file' otherwise.
The point of this is to avoid Emacs locking up indexing massive file trees."
@ -219,6 +219,7 @@ The point of this is to avoid Emacs locking up indexing massive file trees."
(let ((this-command 'counsel-find-file))
(call-interactively
(cond ((or (file-equal-p default-directory "~")
(file-equal-p default-directory "/")
(when-let (proot (doom-project-root))
(file-equal-p proot "~")))
#'counsel-find-file)

View file

@ -122,7 +122,14 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
'(:columns
((counsel-describe-variable-transformer (:width 40)) ; the original transformer
(+ivy-rich-describe-variable-transformer (:width 50))
(ivy-rich-counsel-variable-docstring (:face font-lock-doc-face)))))
(ivy-rich-counsel-variable-docstring (:face font-lock-doc-face))))
'counsel-M-x
'(:columns
((counsel-M-x-transformer (:width 60))
(ivy-rich-counsel-function-docstring (:face font-lock-doc-face))))
;; Apply switch buffer transformers to `counsel-projectile-switch-to-buffer' as well
'counsel-projectile-switch-to-buffer
(plist-get ivy-rich-display-transformers-list 'ivy-switch-buffer))
;; Remove built-in coloring of buffer list; we do our own
(setq ivy-switch-buffer-faces-alist nil)
@ -135,11 +142,6 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
(when switch-buffer-alist
(setcar switch-buffer-alist '+ivy-rich-buffer-name)))
;; Apply switch buffer transformers to `counsel-projectile-switch-to-buffer' as well
(plist-put! ivy-rich-display-transformers-list
'counsel-projectile-switch-to-buffer
(plist-get ivy-rich-display-transformers-list 'ivy-switch-buffer))
(ivy-rich-mode +1))
@ -153,9 +155,10 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
(all-the-icons-ivy-setup)
(after! counsel-projectile
(let ((all-the-icons-ivy-file-commands '(counsel-projectile
counsel-projectile-find-file
counsel-projectile-find-dir)))
(let ((all-the-icons-ivy-file-commands
'(counsel-projectile
counsel-projectile-find-file
counsel-projectile-find-dir)))
(all-the-icons-ivy-setup))))
@ -259,7 +262,10 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
(cond ((executable-find doom-projectile-fd-binary)
(cons doom-projectile-fd-binary (list "-t" "f" "-E" ".git")))
((executable-find "rg")
(split-string (format counsel-rg-base-command "--files --no-messages") " " t))
(append (list "rg" "--files" "--color=never" "--hidden" "--no-messages")
(cl-loop for dir in projectile-globally-ignored-directories
collect "--glob" and collect (concat "!" dir))
(if IS-WINDOWS (list "--path-separator /"))))
((cons find-program args)))
(unless (listp args)
(user-error "`counsel-file-jump-args' is a list now, please customize accordingly."))
@ -297,8 +303,8 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
;; no highlighting visited files; slows down the filtering
(ivy-set-display-transformer #'counsel-projectile-find-file nil)
(if (featurep! +prescient)
(setq counsel-projectile-sort-files t)))
(when (featurep! +prescient)
(setq counsel-projectile-sort-files t)))
(use-package! wgrep
@ -325,7 +331,9 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
;; posframe.
(dolist (fn '(swiper counsel-rg counsel-grep counsel-git-grep))
(setf (alist-get fn ivy-posframe-display-functions-alist)
#'ivy-display-function-fallback)))
#'ivy-display-function-fallback))
(add-hook 'doom-reload-hook #'posframe-delete-all))
(use-package! flx
@ -336,8 +344,9 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
(use-package! ivy-prescient
:hook (ivy-mode . ivy-prescient-mode)
:when (featurep! +prescient)
:hook (ivy-mode . ivy-prescient-mode)
:hook (ivy-prescient-mode . prescient-persist-mode)
:init
(setq prescient-filter-method
(if (featurep! +fuzzy)
@ -354,8 +363,7 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
(ivy-prescient-re-builder str)))
;; NOTE prescient config duplicated with `company'
(setq prescient-save-file (concat doom-cache-dir "prescient-save.el"))
(prescient-persist-mode +1))
(setq prescient-save-file (concat doom-cache-dir "prescient-save.el")))
;;;###package swiper

View file

@ -1,23 +1,23 @@
;; -*- no-byte-compile: t; -*-
;;; completion/ivy/packages.el
(package! swiper :pin "5f1d9ce045")
(package! swiper :pin "64f05f4735")
(package! ivy)
(package! ivy-hydra)
(package! counsel)
(package! amx :pin "e512e74e83")
(package! counsel-projectile :pin "b556ed8995")
(package! ivy-rich :pin "0f22aff4c7")
(package! ivy-rich :pin "596874d146")
(package! wgrep :pin "5977b8e000")
(if (featurep! +prescient)
(package! ivy-prescient :pin "7fd8c3b802")
(package! ivy-prescient :pin "53307731f3")
(when (featurep! +fuzzy)
(package! flx :pin "17f5c9cb2a")))
(when (featurep! +childframe)
(package! ivy-posframe :pin "6d697ff00a"))
(package! ivy-posframe :pin "ae9bafe94f"))
(when (featurep! +icons)
(package! all-the-icons-ivy :pin "a70cbfa1ef"))

View file

@ -86,6 +86,7 @@
;;; <leader> s --- search
(:prefix-map ("s" . "search")
:desc "Search project for symbol" "." #'+default/search-project-for-symbol-at-point
:desc "Search buffer" "b" #'swiper
:desc "Search current directory" "d" #'+default/search-cwd
:desc "Search other directory" "D" #'+default/search-other-cwd
@ -123,6 +124,17 @@
(:prefix-map ("n" . "notes")
:desc "Search notes for symbol" "." #'+default/search-notes-for-symbol-at-point
:desc "Org agenda" "a" #'org-agenda
(:when (featurep! :tools biblio)
:desc "Bibliographic entries" "b"
(cond ((featurep! :completion ivy) #'ivy-bibtex)
((featurep! :completion helm) #'helm-bibtex)))
:desc "Toggle org-clock" "c" #'+org/toggle-clock
:desc "Cancel org-clock" "C" #'org-clock-cancel
:desc "Open deft" "d" #'deft
(:when (featurep! :lang org +noter)
:desc "Org noter" "e" #'org-noter)
:desc "Find file in notes" "f" #'+default/find-in-notes
:desc "Browse notes" "F" #'+default/browse-notes
:desc "Org store link" "l" #'org-store-link
@ -139,7 +151,20 @@
(:when (featurep! :lang org +journal)
(:prefix ("j" . "journal")
:desc "New Entry" "j" #'org-journal-new-entry
:desc "Search Forever" "s" #'org-journal-search-forever)))
:desc "Search Forever" "s" #'org-journal-search-forever))
(:when (featurep! :lang org +roam)
(:prefix ("r" . "roam")
:desc "Switch to buffer" "b" #'org-roam-switch-to-buffer
:desc "Org Roam Capture" "c" #'org-roam-capture
:desc "Find file" "f" #'org-roam-find-file
:desc "Show graph" "g" #'org-roam-graph-show
:desc "Insert" "i" #'org-roam-insert
:desc "Org Roam" "r" #'org-roam
(:prefix ("d" . "by date")
:desc "Arbitrary date" "d" #'org-roam-dailies-date
:desc "Today" "t" #'org-roam-dailies-today
:desc "Tomorrow" "m" #'org-roam-dailies-tomorrow
:desc "Yesterday" "y" #'org-roam-dailies-yesterday))))
;;; <leader> o --- open
"o" nil ; we need to unbind it first as Org claims this prefix
@ -180,6 +205,7 @@
;;; <leader> p --- project
(:prefix ("p" . "project")
:desc "Search project for symbol" "." #'+default/search-project-for-symbol-at-point
:desc "Find file in other project" "F" #'doom/find-file-in-other-project
:desc "Search project" "s" #'+default/search-project
:desc "List project tasks" "t" #'magit-todos-list

View file

@ -7,9 +7,9 @@
(define-key! evil-ex-completion-map
"C-a" #'evil-beginning-of-line
"C-b" #'evil-backward-char
"C-s" (if (featurep! :completion ivy)
#'counsel-minibuffer-history
#'helm-minibuffer-history))
"C-f" #'evil-forward-char
"C-j" #'previous-complete-history-element
"C-k" #'next-complete-history-element)
(define-key! :keymaps +default-minibuffer-maps
[escape] #'abort-recursive-edit
@ -18,16 +18,21 @@
"C-u" #'evil-delete-back-to-indentation
"C-v" #'yank
"C-w" #'doom/delete-backward-word
"C-z" (λ! (ignore-errors (call-interactively #'undo)))
;; Scrolling lines
"C-j" #'next-line
"C-k" #'previous-line
"C-S-j" #'scroll-up-command
"C-S-k" #'scroll-down-command)
"C-z" (λ! (ignore-errors (call-interactively #'undo))))
(define-key! read-expression-map
"C-j" #'next-line-or-history-element
"C-k" #'previous-line-or-history-element))
(when (featurep! :editor evil +everywhere)
(define-key! :keymaps +default-minibuffer-maps
"C-f" #'forward-word
"C-b" #'backward-word
"M-f" #'foward-char
"M-b" #'backward-char
"C-j" #'next-line
"C-k" #'previous-line
"C-S-j" #'scroll-up-command
"C-S-k" #'scroll-down-command)
(define-key! read-expression-map
"C-j" #'next-line-or-history-element
"C-k" #'previous-line-or-history-element)))
;;
@ -42,19 +47,11 @@
(and (featurep! :completion company +tng)
(+company-has-completion-p))
#'+company/complete)
:n [tab] (general-predicate-dispatch nil
(and (featurep! :editor fold)
(save-excursion (end-of-line) (invisible-p (point))))
#'+fold/toggle
(fboundp 'evil-jump-item)
#'evil-jump-item)
:v [tab] (general-predicate-dispatch nil
(and (bound-and-true-p yas-minor-mode)
(or (eq evil-visual-selection 'line)
(not (memq (char-after) (list ?\( ?\[ ?\{ ?\} ?\] ?\))))))
#'yas-insert-snippet
(fboundp 'evil-jump-item)
#'evil-jump-item)
#'yas-insert-snippet)
;; Smarter newlines
:i [remap newline] #'newline-and-indent ; auto-indent on newline
@ -76,7 +73,6 @@
(:after man :map Man-mode-map
:n "q" #'kill-current-buffer)
:m "gs" #'+evil/easymotion ; lazy-load `evil-easymotion'
(:after (evil-org evil-easymotion)
:map evil-org-mode-map
:m "gsh" #'+org/goto-visible)
@ -161,15 +157,18 @@
(:when (featurep! :completion helm)
(:after helm :map helm-map
[remap next-line] #'helm-next-line
[remap previous-line] #'helm-previous-line
[left] #'left-char
[right] #'right-char
"C-S-f" #'helm-previous-page
"C-S-n" #'helm-next-source
"C-S-p" #'helm-previous-source
"C-S-j" #'helm-next-source
"C-S-k" #'helm-previous-source
"C-j" #'helm-next-line
"C-k" #'helm-previous-line
(:when (featurep! :editor evil +everywhere)
"C-j" #'helm-next-line
"C-k" #'helm-previous-line
"C-S-j" #'helm-next-source
"C-S-k" #'helm-previous-source)
"C-u" #'helm-delete-minibuffer-contents
"C-s" #'helm-minibuffer-history
;; Swap TAB and C-z
@ -266,7 +265,6 @@
:desc "M-x" ":" #'execute-extended-command
:desc "Pop up scratch buffer" "x" #'doom/open-scratch-buffer
:desc "Org Capture" "X" #'org-capture
;; C-u is used by evil
:desc "Universal argument" "u" #'universal-argument
:desc "window" "w" evil-window-map
@ -275,12 +273,10 @@
(:when (featurep! :ui popup)
:desc "Toggle last popup" "~" #'+popup/toggle)
:desc "Find file" "." #'find-file
:desc "Switch buffer" "," #'switch-to-buffer
(:when (featurep! :ui workspaces)
:desc "Switch workspace buffer" "," #'persp-switch-to-buffer
:desc "Switch buffer" "<" #'switch-to-buffer)
:desc "Switch to last buffer" "`" #'evil-switch-to-windows-last-buffer
:desc "Resume last search" "'"
(cond ((featurep! :completion ivy) #'ivy-resume)
@ -468,14 +464,23 @@
(:prefix-map ("n" . "notes")
:desc "Search notes for symbol" "*" #'+default/search-notes-for-symbol-at-point
:desc "Org agenda" "a" #'org-agenda
(:when (featurep! :tools biblio)
:desc "Bibliographic entries" "b"
(cond ((featurep! :completion ivy) #'ivy-bibtex)
((featurep! :completion helm) #'helm-bibtex)))
:desc "Toggle org-clock" "c" #'+org/toggle-clock
:desc "Cancel org-clock" "C" #'org-clock-cancel
:desc "Open deft" "d" #'deft
(:when (featurep! :lang org +noter)
:desc "Org noter" "e" #'org-noter)
:desc "Find file in notes" "f" #'+default/find-in-notes
:desc "Browse notes" "F" #'+default/browse-notes
:desc "Org store link" "l" #'org-store-link
:desc "Tags search" "m" #'org-tags-view
:desc "Org capture" "n" #'org-capture
:desc "Goto capture" "N" #'org-capture-goto-target
:desc "Active org-clock" "o" #'org-clock-goto
:desc "Todo list" "t" #'org-todo-list
:desc "Search notes" "s" #'+default/org-notes-search
@ -484,6 +489,20 @@
:desc "Org export to clipboard" "y" #'+org/export-to-clipboard
:desc "Org export to clipboard as RTF" "Y" #'+org/export-to-clipboard-as-rich-text
(:when (featurep! :lang org +roam)
(:prefix ("r" . "roam")
:desc "Switch to buffer" "b" #'org-roam-switch-to-buffer
:desc "Org Roam Capture" "c" #'org-roam-capture
:desc "Find file" "f" #'org-roam-find-file
:desc "Show graph" "g" #'org-roam-graph-show
:desc "Insert" "i" #'org-roam-insert
:desc "Org Roam" "r" #'org-roam
(:prefix ("d" . "by date")
:desc "Arbitrary date" "d" #'org-roam-dailies-date
:desc "Today" "t" #'org-roam-dailies-today
:desc "Tomorrow" "m" #'org-roam-dailies-tomorrow
:desc "Yesterday" "y" #'org-roam-dailies-yesterday)))
(:when (featurep! :lang org +journal)
(:prefix ("j" . "journal")
:desc "New Entry" "j" #'org-journal-new-entry
@ -553,10 +572,10 @@
:desc "Find recent project files" "r" #'projectile-recentf
:desc "Run project" "R" #'projectile-run-project
:desc "Save project files" "s" #'projectile-save-project-buffers
:desc "Pop up scratch buffer" "x" #'doom/open-project-scratch-buffer
:desc "Switch to scratch buffer" "X" #'doom/switch-to-project-scratch-buffer
:desc "List project tasks" "t" #'magit-todos-list
:desc "Test project" "T" #'projectile-test-project)
:desc "Test project" "T" #'projectile-test-project
:desc "Pop up scratch buffer" "x" #'doom/open-project-scratch-buffer
:desc "Switch to scratch buffer" "X" #'doom/switch-to-project-scratch-buffer)
;;; <leader> q --- quit/session
(:prefix-map ("q" . "quit/session")
@ -626,7 +645,7 @@
(:when (featurep! :lang org +pomodoro)
:desc "Pomodoro timer" "t" #'org-pomodoro)
:desc "Soft line wrapping" "w" #'visual-line-mode
(:when (featurep! :ui word-wrap)
(:when (featurep! :editor word-wrap)
:desc "Soft line wrapping" "w" #'+word-wrap-mode)
:desc "Zen mode" "z" #'writeroom-mode))

View file

@ -27,11 +27,15 @@
;;;###autoload
(defun +default/browse-notes ()
"Browse files from `org-directory'."
(interactive) (doom-project-browse org-directory))
(interactive)
(require 'org)
(doom-project-browse org-directory))
;;;###autoload
(defun +default/find-in-notes ()
"Find a file under `org-directory', recursively."
(interactive) (doom-project-find-file org-directory))
(interactive)
(require 'org)
(doom-project-find-file org-directory))
;;;###autoload
(defun +default/find-file-under-here ()

View file

@ -35,7 +35,7 @@
(defun +default/yank-buffer-filename ()
"Copy the current buffer's path to the kill ring."
(interactive)
(if-let* ((filename (or buffer-file-name (bound-and-true-p list-buffers-directory))))
(if-let (filename (or buffer-file-name (bound-and-true-p list-buffers-directory)))
(message (kill-new (abbreviate-file-name filename)))
(error "Couldn't find filename in current buffer")))

View file

@ -1,19 +1,19 @@
;;; config/default/config.el -*- lexical-binding: t; -*-
(defvar +default-minibuffer-maps
`(minibuffer-local-map
minibuffer-local-ns-map
minibuffer-local-completion-map
minibuffer-local-must-match-map
minibuffer-local-isearch-map
read-expression-map
,@(cond ((featurep! :completion ivy)
'(ivy-minibuffer-map
ivy-switch-buffer-map))
((featurep! :completion helm)
'(helm-map
helm-ag-map
helm-read-file-map))))
(append '(minibuffer-local-map
minibuffer-local-ns-map
minibuffer-local-completion-map
minibuffer-local-must-match-map
minibuffer-local-isearch-map
read-expression-map)
(cond ((featurep! :completion ivy)
'(ivy-minibuffer-map
ivy-switch-buffer-map))
((featurep! :completion helm)
'(helm-map
helm-ag-map
helm-read-file-map))))
"A list of all the keymaps used for the minibuffer.")
@ -31,8 +31,11 @@
(after! epa
;; With GPG 2.1+, this forces gpg-agent to use the Emacs minibuffer to prompt
;; for the key passphrase.
(setq epa-pinentry-mode 'loopback)
;; Default to the first secret key available in your keyring.
(set (if EMACS27+
'epg-pinentry-mode
'epa-pinentry-mode) ; DEPRECATED `epa-pinentry-mode'
'loopback)
;; Default to the first secret key available in your keyring.
(setq-default
epa-file-encrypt-to
(or (default-value 'epa-file-encrypt-to)
@ -254,6 +257,7 @@
"s-c" (if (featurep 'evil) #'evil-yank #'copy-region-as-kill)
"s-v" #'yank
"s-s" #'save-buffer
"s-x" #'execute-extended-command
:v "s-x" #'kill-region
;; Buffer-local font scaling
"s-+" #'doom/reset-font-size
@ -377,10 +381,15 @@
;; A Doom convention where C-s on popups and interactive searches will invoke
;; ivy/helm for their superior filtering.
(define-key! :keymaps +default-minibuffer-maps
"C-s" (if (featurep! :completion ivy)
#'counsel-minibuffer-history
#'helm-minibuffer-history))
(when-let (command (cond ((featurep! :completion ivy)
#'counsel-minibuffer-history)
((featurep! :completion helm)
#'helm-minibuffer-history)))
(define-key!
:keymaps (append +default-minibuffer-maps
(when (featurep! :editor evil +everywhere)
'(evil-ex-completion-map)))
"C-s" command))
;; Smarter C-a/C-e for both Emacs and Evil. C-a will jump to indentation.
;; Pressing it again will send you to the true bol. Same goes for C-e, except

View file

@ -1,9 +1,9 @@
;; -*- no-byte-compile: t; -*-
;;; config/default/packages.el
(package! avy :pin "cf95ba9582")
(package! avy :pin "3bf83140fa")
(package! drag-stuff :pin "6d06d846cd")
(package! link-hint :pin "0d9cabcdb7")
(unless (featurep! :editor evil)
(package! expand-region :pin "1603d01fbf"))
(package! expand-region :pin "ea6b4cbb99"))

View file

@ -28,8 +28,6 @@
;; TODO (evil-ex-define-cmd "rx" 'doom:regex) ; open re-builder
(evil-ex-define-cmd "sh[ell]" #'+eshell:run)
(evil-ex-define-cmd "t[mux]" #'+tmux:run) ; send to tmux
(evil-ex-define-cmd "tcd" #'+tmux:cd-here) ; cd to default-directory in tmux
(evil-ex-define-cmd "pad" #'+evil:open-scratch-buffer)
;;; GIT
@ -49,9 +47,9 @@
(evil-ex-define-cmd "k[ill]m" #'+evil:kill-matching-buffers)
(evil-ex-define-cmd "k[ill]o" #'doom/kill-other-buffers)
(evil-ex-define-cmd "k[ill]b" #'doom/kill-buried-buffers)
(evil-ex-define-cmd "l[ast]" #'doom/popup-restore)
(evil-ex-define-cmd "l[ast]" #'+popup/restore)
(evil-ex-define-cmd "messages" #'view-echo-area-messages)
(evil-ex-define-cmd "pop[up]" #'doom/popup-this-buffer)
(evil-ex-define-cmd "pop[up]" #'+popup/buffer)
;;; Project navigation
(evil-ex-define-cmd "a" #'projectile-find-other-file)
@ -100,4 +98,8 @@
(evil-ex-define-cmd "tabsave" #'+workspace:save)
;;; Org-mode
(evil-ex-define-cmd "cap" #'org-capture)
(evil-ex-define-cmd "cap[ture]" #'org-capture)
;;; ibuffer
(when (featurep! :emacs ibuffer)
(evil-ex-define-cmd "buffers" #'ibuffer))

View file

@ -1,250 +0,0 @@
;;; editor/evil/+everywhere.el -*- lexical-binding: t; -*-
;; We load evil-collection ourselves for these reasons:
;;
;; 1. To truly lazy load it. Some of its modules, like
;; evil-collection-{elisp-mode,buff-menu} are loaded immediately, because
;; Emacs loads their packages immediately, which pulls in all of
;; evil-collection (and other packages with it, sometimes).
;; 2. This ensures a predictable load order, versus lazy loading using :defer or
;; :after-call. This means users can use (after! org ...) and be sure that
;; their changes will override evil-collection's.
;; 3. Ideally, we'd do away with evil-collection entirely. It changes too often,
;; introduces breaking bugs too frequently, and I don't agree with all their
;; design choices. Regardless, it does more good than trouble, so it may be
;; here to stay.
;; 4. Adds `+evil-collection-disabled-list', to make it easier for users to
;; disable modules, and to reduce the effort required to maintain our copy of
;; `evil-collection-list' (now I can just copy it from time to time).
(defvar +evil-collection-disabled-list
'(anaconda-mode
buff-menu
comint
company
custom
eldoc
elisp-mode
ert
free-keys
help
helm
image
kotlin-mode
occur
package-menu
ruby-mode
simple
slime
lispy)
"A list of `evil-collection' modules to ignore. See the definition of this
variable for an explanation of the defaults (in comments). See
`evil-collection-mode-list' for a list of available options.")
(defvar evil-collection-setup-minibuffer nil)
;; We do this ourselves, and better.
(defvar evil-collection-want-unimpaired-p nil)
;; We handle loading evil-collection ourselves
(defvar evil-collection--supported-modes nil)
;; This has to be defined here since evil-collection doesn't autoload its own.
;; It must be updated whenever evil-collection updates theirs. Here's an easy
;; way to update it:
;;
;; (with-current-buffer
;; (url-retrieve-synchronously "https://raw.githubusercontent.com/emacs-evil/evil-collection/master/evil-collection.el" t t)
;; (goto-char (point-min))
;; (when (re-search-forward "^(defvar evil-collection--supported-modes\n[^(]+")
;; (let ((list (sexp-at-point)))
;; ;; Fixes
;; (when (assq 'pdf list)
;; (setf (alist-get 'pdf list) '(pdf-tools)))
;; (kill-new (prin1-to-string list)))))
(defvar evil-collection-mode-list
`(2048-game
ag
alchemist
anaconda-mode
apropos
arc-mode
bookmark
(buff-menu "buff-menu")
calc
calendar
cider
cmake-mode
comint
company
compile
(custom cus-edit)
cus-theme
daemons
dashboard
deadgrep
debbugs
debug
diff-mode
dired
dired-sidebar
disk-usage
doc-view
docker
ebib
edbi
edebug
ediff
eglot
elfeed
elisp-mode
elisp-refs
elisp-slime-nav
emms
epa
ert
eshell
eval-sexp-fu
evil-mc
eww
flycheck
flymake
free-keys
geiser
ggtags
git-timemachine
gnus
go-mode
grep
guix
hackernews
helm
help
helpful
hg-histedit
hungry-delete
ibuffer
image
image-dired
image+
imenu-list
indium
info
ivy
js2-mode
leetcode
lispy
log-edit
log-view
lsp-ui-imenu
lua-mode
kotlin-mode
macrostep
man
magit
magit-todos
,@(if evil-collection-setup-minibuffer '(minibuffer))
monky
mu4e
mu4e-conversation
neotree
notmuch
nov
(occur replace)
omnisharp
outline
p4
(package-menu package)
pass
(pdf pdf-tools)
popup
proced
process-menu
prodigy
profiler
python
quickrun
racer
realgud
reftex
restclient
rjsx-mode
robe
rtags
ruby-mode
simple
slime
sly
tablist
tar-mode
(term term ansi-term multi-term)
tetris
tide
transmission
typescript-mode
vc-annotate
vc-dir
vc-git
vdiff
view
vlf
vterm
w3m
wdired
wgrep
which-key
woman
xref
youtube-dl
(ztree ztree-diff)))
(defun +evil-collection-init (module &optional disabled-list)
"Initialize evil-collection-MODULE.
Unlike `evil-collection-init', this respects `+evil-collection-disabled-list',
and complains if a module is loaded too early (during startup)."
(unless (memq (or (car-safe module) module) disabled-list)
(doom-log "Initialized evil-collection-%s %s"
(or (car-safe module) module)
(if doom-init-time "" "(too early!)"))
(with-demoted-errors "evil-collection error: %s"
(evil-collection-init (list module)))))
;;
;;; Bootstrap
;; These modes belong to packages that Emacs always loads at startup, causing
;; evil-collection to load immediately. We avoid this by loading them after
;; evil-collection has first loaded...
(with-eval-after-load 'evil-collection
(mapc #'+evil-collection-init '(comint custom help)))
;; ...or on first invokation of their associated major/minor modes.
(add-transient-hook! 'Buffer-menu-mode
(+evil-collection-init '(buff-menu "buff-menu")))
(add-transient-hook! 'image-mode
(+evil-collection-init 'image))
(add-transient-hook! 'emacs-lisp-mode
(+evil-collection-init 'elisp-mode))
(add-transient-hook! 'occur-mode
(+evil-collection-init 'occur))
(evil-define-key* 'normal process-menu-mode-map
"q" #'kill-current-buffer
"d" #'process-menu-delete-process)
;; Don't overwrite the leader keys
(setq evil-collection-key-blacklist
(list doom-leader-key doom-localleader-key
doom-leader-alt-key doom-localleader-alt-key))
;; HACK Do this ourselves because evil-collection break's `eval-after-load' load
;; order by loading their target plugin before applying keys. It'd be too
;; much work to accommodate this eveywhere we want to bind our own evil
;; keybinds.
(dolist (mode evil-collection-mode-list)
(dolist (req (or (cdr-safe mode) (list mode)))
(with-eval-after-load req
(+evil-collection-init mode +evil-collection-disabled-list))))

View file

@ -36,7 +36,6 @@ This holy module brings the vim experience to Emacs.
+ [[https://github.com/TheBB/evil-indent-plus][evil-indent-plus]]
+ [[https://github.com/edkolev/evil-lion][evil-lion]]
+ [[https://github.com/redguardtoo/evil-nerd-commenter][evil-nerd-commentary]]
+ [[https://github.com/redguardtoo/evil-matchit][evil-matchit]]
+ [[https://github.com/cofi/evil-numbers][evil-numbers]]
+ [[https://github.com/noctuid/evil-textobj-anyblock][evil-textobj-anyblock]]
+ [[https://github.com/hlissner/evil-snipe][evil-snipe]]
@ -72,6 +71,7 @@ The following vim plugins have been ported to evil:
| vim-lion | evil-lion | omap =gl= / =gL= |
| vim-seek or vim-sneak | evil-snipe | mmap =s= / =S=, omap =z= / =Z= & =x= / =X= |
| vim-surround | evil-embrace and evil-surround | vmap =S=, omap =ys= |
| vim-unimpaired | (provided by Doom) | [[https://github.com/hlissner/doom-emacs/blob/develop/modules/editor/evil/config.el#L413-L460][see the list]] |
This module has also ported vim-unimpaired keybinds to Emacs.

View file

@ -92,22 +92,6 @@ the only window, use evil-window-move-* (e.g. `evil-window-move-far-left')."
"Swap windows downward."
(interactive) (+evil--window-swap 'down))
;;;###autoload
(defun +evil/easymotion (&optional state keymap)
"Invoke `evil-easymotion' lazily without compromising which-key integration."
(interactive (list 'motion 'global))
(let ((prefix (this-command-keys)))
(require 'evil-easymotion)
(evil-define-key* state keymap prefix evilem-map)
(setq prefix-arg current-prefix-arg
unread-command-events
(mapcar (lambda (e) (cons t e))
(vconcat (when evil-this-operator
(where-is-internal evil-this-operator
nil
t))
prefix)))))
;;;###autoload (autoload '+evil:apply-macro "editor/evil/autoload/evil" nil t)
(evil-define-operator +evil:apply-macro (beg end)
"Apply macro to each line."

View file

@ -7,7 +7,8 @@
;;;###autoload (autoload '+evil:defun-txtobj "editor/evil/autoload/textobjects" nil nil)
(evil-define-text-object +evil:defun-txtobj (count &optional _beg _end type)
"Text object to select the whole buffer."
"Text object to select the top-level Lisp form or function definition at
point."
(cl-destructuring-bind (beg . end)
(bounds-of-thing-at-point 'defun)
(evil-range beg end type)))

View file

@ -45,8 +45,6 @@ directives. By default, this only recognizes C directives.")
evil-emacs-state-cursor '(box +evil-emacs-cursor-fn)
evil-insert-state-cursor 'bar
evil-visual-state-cursor 'hollow
;; must be set before evil/evil-collection is loaded
evil-want-keybinding (not (featurep! +everywhere))
;; Only do highlighting in selected window so that Emacs has less work
;; to do highlighting them all.
evil-ex-interactive-search-highlight 'selected-window)
@ -146,6 +144,15 @@ directives. By default, this only recognizes C directives.")
(when (eq major-mode 'fundamental-mode)
(hack-local-variables)))
;; HACK Invoking helpful from evil-ex throws a "No recursive edit is in
;; progress" error because, between evil-ex and helpful,
;; `abort-recursive-edit' gets called one time too many.
(defadvice! +evil--fix-helpful-key-in-evil-ex-a (key-sequence)
:before #'helpful-key
(when (evil-ex-p)
(run-at-time 0.1 nil #'helpful-key key-sequence)
(abort-recursive-edit)))
;; Make ESC (from normal mode) the universal escaper. See `doom-escape-hook'.
(advice-add #'evil-force-normal-state :after #'+evil-escape-a)
@ -165,17 +172,6 @@ directives. By default, this only recognizes C directives.")
(advice-add #'evil-open-above :around #'+evil--insert-newline-above-and-respect-comments-a)
(advice-add #'evil-open-below :around #'+evil--insert-newline-below-and-respect-comments-a)
;; Recenter screen after most searches
(dolist (fn '(evil-visualstar/begin-search-forward
evil-visualstar/begin-search-backward
evil-ex-search-word-forward
evil-ex-search-word-backward
evil-ex-search-next
evil-ex-search-previous
evil-ex-search-forward
evil-ex-search-backward))
(advice-add fn :around #'doom-preserve-window-position-a))
;; --- custom interactive codes -----------
;; These arg types will highlight matches in the current buffer
(evil-ex-define-argument-type regexp-match
@ -214,6 +210,7 @@ directives. By default, this only recognizes C directives.")
;;; Packages
(use-package! evil-easymotion
:after-call pre-command-hook
:commands evilem-create evilem-default-keybindings
:config
;; Use evil-search backend, instead of isearch
@ -221,7 +218,6 @@ directives. By default, this only recognizes C directives.")
:bind ((evil-ex-search-highlight-all nil)))
(evilem-make-motion evilem-motion-search-previous #'evil-ex-search-previous
:bind ((evil-ex-search-highlight-all nil)))
(evilem-make-motion evilem-motion-search-word-forward #'evil-ex-search-word-forward
:bind ((evil-ex-search-highlight-all nil)))
(evilem-make-motion evilem-motion-search-word-backward #'evil-ex-search-word-backward
@ -403,26 +399,6 @@ To change these keys see `+evil-repeat-keys'."
evil-ex-search-previous evil-ex-search-next)
;; `evil-collection'
(when (featurep! +everywhere)
(setq evil-collection-company-use-tng (featurep! :completion company +tng))
(unless doom-reloading-p
(load! "+everywhere"))
;; Don't let evil-collection interfere with certain keys
(appendq! evil-collection-key-blacklist
(append (when (featurep! :tools lookup)
'("gd" "gf" "K"))
(when (featurep! :tools eval)
'("gr" "gR"))
'("[" "]" "gz" "<escape>")))
(defadvice! +evil-collection-disable-blacklist-a (orig-fn)
:around #'evil-collection-vterm-toggle-send-escape ; allow binding to ESC
(let (evil-collection-key-blacklist)
(funcall-interactively orig-fn))))
;; Keybinds that have no Emacs+evil analogues (i.e. don't exist):
;; zq - mark word at point as good word
;; zw - mark word at point as bad
@ -567,6 +543,7 @@ To change these keys see `+evil-repeat-keys'."
;; evil-easymotion (see `+evil/easymotion')
(:after evil-easymotion
:m "gs" evilem-map
(:map evilem-map
"a" (evilem-create #'evil-forward-arg)
"A" (evilem-create #'evil-backward-arg)

269
modules/editor/evil/init.el Normal file
View file

@ -0,0 +1,269 @@
;;; editor/evil/init.el -*- lexical-binding: t; -*-
;; We load evil-collection ourselves for these reasons:
;;
;; 1. To truly lazy load it. Some of its modules, like
;; evil-collection-{elisp-mode,buff-menu} are loaded immediately, because
;; Emacs loads their packages immediately, which pulls in all of
;; evil-collection (and other packages with it, sometimes).
;; 2. This ensures a predictable load order, versus lazy loading using :defer or
;; :after-call. This means users can use (after! org ...) and be sure that
;; their changes will override evil-collection's.
;; 3. Ideally, we'd do away with evil-collection entirely. It changes too often,
;; introduces breaking bugs too frequently, and I don't agree with all their
;; design choices. Regardless, it does more good than trouble, so it may be
;; here to stay.
;; 4. Adds `+evil-collection-disabled-list', to make it easier for users to
;; disable modules, and to reduce the effort required to maintain our copy of
;; `evil-collection-list' (now I can just copy it from time to time).
(when (and doom-interactive-mode
(not doom-reloading-p)
(featurep! +everywhere))
(setq evil-collection-company-use-tng (featurep! :completion company +tng)
;; must be set before evil/evil-collection is loaded
evil-want-keybinding nil)
(defvar +evil-collection-disabled-list
'(anaconda-mode
buff-menu
comint
company
custom
eldoc
elisp-mode
ert
free-keys
help
helm
image
kotlin-mode
occur
package-menu
ruby-mode
simple
slime
lispy)
"A list of `evil-collection' modules to ignore. See the definition of this
variable for an explanation of the defaults (in comments). See
`evil-collection-mode-list' for a list of available options.")
(defvar evil-collection-setup-minibuffer nil)
;; We do this ourselves, and better.
(defvar evil-collection-want-unimpaired-p nil)
;; We handle loading evil-collection ourselves
(defvar evil-collection--supported-modes nil)
;; This has to be defined here since evil-collection doesn't autoload its own.
;; It must be updated whenever evil-collection updates theirs. Here's an easy
;; way to update it:
;;
;; (with-current-buffer
;; (url-retrieve-synchronously "https://raw.githubusercontent.com/emacs-evil/evil-collection/master/evil-collection.el" t t)
;; (goto-char (point-min))
;; (when (re-search-forward "^(defvar evil-collection--supported-modes\n[^(]+")
;; (let ((list (sexp-at-point)))
;; ;; Fixes
;; (when (assq 'pdf list)
;; (setf (alist-get 'pdf list) '(pdf-tools)))
;; (let ((diff (cl-set-difference evil-collection-mode-list list :test #'equal)))
;; (list (- (length list) (length evil-collection-mode-list))
;; diff)
;; (message "diff: %s" diff)
;; (kill-new (prin1-to-string list))))))
(defvar evil-collection-mode-list
`(2048-game
ag
alchemist
anaconda-mode
apropos
arc-mode
bookmark
(buff-menu "buff-menu")
calc
calendar
cider
cmake-mode
comint
company
compile
(custom cus-edit)
cus-theme
daemons
dashboard
deadgrep
debbugs
debug
diff-mode
dired
dired-sidebar
disk-usage
doc-view
docker
ebib
edbi
edebug
ediff
eglot
elfeed
elisp-mode
elisp-refs
elisp-slime-nav
emms
epa
ert
eshell
eval-sexp-fu
evil-mc
eww
flycheck
flymake
free-keys
geiser
ggtags
git-timemachine
gnus
go-mode
grep
guix
hackernews
helm
help
helpful
hg-histedit
hungry-delete
ibuffer
image
image-dired
image+
imenu-list
indium
info
ivy
js2-mode
leetcode
lispy
log-edit
log-view
lsp-ui-imenu
lua-mode
kotlin-mode
macrostep
man
magit
magit-todos
,@(if evil-collection-setup-minibuffer '(minibuffer))
monky
mu4e
mu4e-conversation
neotree
notmuch
nov
(occur replace)
omnisharp
outline
p4
(package-menu package)
pass
(pdf pdf-tools)
popup
proced
process-menu
prodigy
profiler
python
quickrun
racer
realgud
reftex
restclient
rjsx-mode
robe
rtags
ruby-mode
simple
slime
sly
tablist
tar-mode
(term term ansi-term multi-term)
tetris
tide
transmission
typescript-mode
vc-annotate
vc-dir
vc-git
vdiff
view
vlf
vterm
w3m
wdired
wgrep
which-key
woman
xref
xwidget
youtube-dl
(ztree ztree-diff)))
(defun +evil-collection-init (module &optional disabled-list)
"Initialize evil-collection-MODULE.
Unlike `evil-collection-init', this respects `+evil-collection-disabled-list',
and complains if a module is loaded too early (during startup)."
(unless (memq (or (car-safe module) module) disabled-list)
(doom-log "Initialized evil-collection-%s %s"
(or (car-safe module) module)
(if doom-init-time "" "(too early!)"))
(with-demoted-errors "evil-collection error: %s"
(evil-collection-init (list module)))))
;; These modes belong to packages that Emacs always loads at startup, causing
;; evil-collection to load immediately. We avoid this by loading them after
;; evil-collection has first loaded...
(with-eval-after-load 'evil-collection
;; Don't let evil-collection interfere with certain keys
(setq evil-collection-key-blacklist
(append (list doom-leader-key doom-localleader-key
doom-leader-alt-key)
(when (featurep! :tools lookup)
'("gd" "gf" "K"))
(when (featurep! :tools eval)
'("gr" "gR"))
'("[" "]" "gz" "<escape>")))
(evil-define-key* 'normal process-menu-mode-map
"q" #'kill-current-buffer
"d" #'process-menu-delete-process)
(mapc #'+evil-collection-init '(comint custom help)))
(defadvice! +evil-collection-disable-blacklist-a (orig-fn)
:around #'evil-collection-vterm-toggle-send-escape ; allow binding to ESC
(let (evil-collection-key-blacklist)
(funcall-interactively orig-fn)))
;; ...or on first invokation of their associated major/minor modes.
(add-transient-hook! 'Buffer-menu-mode
(+evil-collection-init '(buff-menu "buff-menu")))
(add-transient-hook! 'image-mode
(+evil-collection-init 'image))
(add-transient-hook! 'emacs-lisp-mode
(+evil-collection-init 'elisp-mode))
(add-transient-hook! 'occur-mode
(+evil-collection-init '(occur replace)))
;; HACK Do this ourselves because evil-collection break's `eval-after-load'
;; load order by loading their target plugin before applying keys. This
;; makes it hard for end-users to overwrite these keybinds with a
;; simple `after!' or `with-eval-after-load'.
(dolist (mode evil-collection-mode-list)
(dolist (req (or (cdr-safe mode) (list mode)))
(with-eval-after-load req
(+evil-collection-init mode +evil-collection-disabled-list)))))

View file

@ -1,7 +1,7 @@
;; -*- no-byte-compile: t; -*-
;;; editor/evil/packages.el
(package! evil :pin "7c42ba4de0")
(package! evil :pin "8aa6337fa8")
(package! evil-args :pin "758ad5ae54")
(package! evil-easymotion :pin "79c13ed3bc")
(package! evil-embrace :pin "4379adea03")
@ -9,16 +9,16 @@
(package! evil-exchange :pin "3030e21ee1")
(package! evil-indent-plus :pin "0c7501e6ef")
(package! evil-lion :pin "6b03593f5d")
(package! evil-nerd-commenter :pin "fa40dab8d2")
(package! evil-nerd-commenter :pin "747e346f11")
(package! evil-numbers
:recipe (:host github :repo "janpath/evil-numbers")
:pin "d988041c1f")
:pin "c2cfdd1eb1")
(package! evil-snipe :pin "3ec8adfd49")
(package! evil-surround :pin "9b0b17f06c")
(package! evil-textobj-anyblock :pin "ff00980f06")
(package! evil-traces :pin "bc25cae9fa")
(package! evil-visualstar :pin "06c053d8f7")
(package! exato :pin "88266fa7fc")
(package! exato :pin "d5daea3017")
(package! evil-quick-diff
:recipe (:host github :repo "rgrinberg/evil-quick-diff")
:pin "69c883720b")
@ -31,4 +31,4 @@
(package! neotree)
(autoload 'neotree-make-executor "neotree" nil nil 'macro))
(package! evil-collection :pin "e6a4ba695e"))
(package! evil-collection :pin "493d523c9b"))

View file

@ -1,4 +1,4 @@
;; -*- no-byte-compile: t; -*-
;;; editor/file-templates/packages.el
(package! yasnippet :pin "3bf9a3b1af")
(package! yasnippet :pin "ac03c2f192")

View file

@ -1,3 +1,4 @@
#!/usr/bin/env `(if (equal (file-name-extension buffer-file-name) "zsh") "zsh" "bash")`
set -euo pipefail
$0

View file

@ -53,7 +53,19 @@
nil (lambda (_arg) (matlab-forward-sexp)))
(nxml-mode "<!--\\|<[^/>]*[^/]>"
"-->\\|</[^/>]*[^/]>"
"<!--" sgml-skip-tag-forward nil))
"<!--" sgml-skip-tag-forward nil)
(latex-mode
;; LaTeX-find-matching-end needs to be inside the env
("\\\\begin{[a-zA-Z*]+}\\(\\)" 1)
"\\\\end{[a-zA-Z*]+}"
"%"
(lambda (_arg)
;; Don't fold whole document, that's useless
(unless (save-excursion
(search-backward "\\begin{document}"
(line-beginning-position) t))
(LaTeX-find-matching-end)))
nil))
hs-special-modes-alist
'((t))))))

View file

@ -201,7 +201,7 @@ See `+format/buffer' for the interactive version of this function, and
(defalias '+format/buffer #'format-all-buffer)
;;;###autoload
(defun +format/region (beg end &optional arg)
(defun +format/region (beg end)
"Runs the active formatter on the lines within BEG and END.
WARNING: this may not work everywhere. It will throw errors if the region
@ -211,7 +211,7 @@ snippets or single lines."
(save-restriction
(narrow-to-region beg end)
(let ((+format-region-p t))
(+format/buffer arg))))
(+format/buffer))))
;;;###autoload
(defun +format/region-or-buffer ()

View file

@ -3,26 +3,5 @@
(use-package! god-mode
:hook (doom-after-init-modules . god-mode-all)
:config
(pushnew! god-exempt-major-modes
'Custom-mode
'Info-mode
'ag-mode
'calculator-mode
'calendar-mode
'cider-test-report-mode
'compilation-mode
'debugger-mode
'edebug-mode
'ediff-mode
'eww-mode
'geben-breakpoint-list-mode
'ibuffer-mode
'org-agenda-mode
'pdf-outline-buffer-mode
'recentf-dialog-mode
'sldb-mode
'sly-db-mode
'wdired-mode)
(add-hook 'post-command-hook #'+god--configure-cursor-and-modeline-h)
(add-hook 'overwrite-mode-hook #'+god--toggle-on-overwrite-h))

View file

@ -1,4 +1,4 @@
;; -*- no-byte-compile: t; -*-
;;; editor/god/packages.el
(package! god-mode :pin "344167ed9b")
(package! god-mode :pin "1eb6ef3a4f")

View file

@ -1,7 +1,7 @@
;;; editor/lispy/config.el -*- lexical-binding: t; -*-
(use-package! lispy
:hook ((common-lisp-mode . lispy-mode)
:hook ((lisp-mode . lispy-mode)
(emacs-lisp-mode . lispy-mode)
(scheme-mode . lispy-mode)
(racket-mode . lispy-mode)

View file

@ -1,6 +1,6 @@
;; -*- no-byte-compile: t; -*-
;;; editor/lispyville/packages.el
(package! lispy :pin "d6b19fe2c3")
(package! lispy :pin "c7e282ae06")
(when (featurep! :editor evil)
(package! lispyville :pin "56198f1c44"))
(package! lispyville :pin "25a70126ea"))

View file

@ -82,6 +82,22 @@
:test #'eq
:key #'car))
;; HACK Allow these commands to be repeated by prefixing them with a numerical
;; argument. See gabesoft/evil-mc#110
(defadvice! +multiple-cursors--make-repeatable-a (orig-fn)
:around '(evil-mc-make-and-goto-first-cursor
evil-mc-make-and-goto-last-cursor
evil-mc-make-and-goto-prev-cursor
evil-mc-make-and-goto-next-cursor
evil-mc-skip-and-goto-prev-cursor
evil-mc-skip-and-goto-next-cursor
evil-mc-make-and-goto-prev-match
evil-mc-make-and-goto-next-match
evil-mc-skip-and-goto-prev-match
evil-mc-skip-and-goto-next-match)
(dotimes (i (if (integerp current-prefix-arg) current-prefix-arg 1))
(funcall orig-fn)))
;; If we're entering insert mode, it's a good bet that we want to start using
;; our multiple cursors
(add-hook 'evil-insert-state-entry-hook #'evil-mc-resume-cursors)

View file

@ -4,9 +4,7 @@
:after-call pre-command-hook
:config
;; Prevent undo actions from exiting edit state
(add-to-list 'objed-keeper-commands 'undo-tree-undo)
(add-to-list 'objed-keeper-commands 'undo-tree-redo)
(add-to-list 'objed-keeper-commands 'undo-tree-visualize)
(pushnew! objed-keeper-commands 'undo-fu-only-undo 'undo-fu-only-redo)
(defvar +objed--extra-face-remaps nil)

View file

@ -5,9 +5,10 @@
;;
;; Packages
;;; Packages
(use-package! yasnippet
:defer-incrementally eldoc easymenu help-mode
:commands (yas-minor-mode-on
yas-expand
yas-expand-snippet
@ -19,9 +20,11 @@
;; Remove default ~/.emacs.d/snippets
(defvar yas-snippet-dirs nil)
;; Ensure `yas-reload-all' is called as late as possible. Other modules could
;; have additional configuration for yasnippet. For example, file-templates.
(add-transient-hook! 'yas-minor-mode-hook (yas-reload-all))
(unless (daemonp)
;; Ensure `yas-reload-all' is called as late as possible. Other modules
;; could have additional configuration for yasnippet. For example,
;; file-templates.
(add-transient-hook! 'yas-minor-mode-hook (yas-reload-all)))
(add-hook! '(text-mode-hook
prog-mode-hook
@ -30,24 +33,28 @@
#'yas-minor-mode-on)
:config
(setq yas-verbosity (if doom-debug-mode 3 0)
yas-also-auto-indent-first-line t)
(add-to-list 'load-path +snippets-dir)
;; default snippets library, if available
(require 'doom-snippets nil t)
;; Allow private snippets in DOOMDIR/snippets
(add-to-list 'yas-snippet-dirs '+snippets-dir)
;; In case `+snippets-dir' and `doom-snippets-dir' are the same
;; Reduce verbosity. 3 is too chatty about initializing yasnippet. 2 is just
;; right (only shows errors).
(setq yas-verbosity (if doom-debug-mode 3 0))
;; Ensure the snippet is properly indented
(setq yas-also-auto-indent-first-line t)
;; default snippets library, if available
(add-to-list 'load-path +snippets-dir)
(require 'doom-snippets nil t)
;; HACK In case `+snippets-dir' and `doom-snippets-dir' are the same, or
;; duplicates exist in `yas-snippet-dirs'.
(advice-add #'yas-snippet-dirs :filter-return #'delete-dups)
;; Remove GUI dropdown prompt (prefer ivy/helm)
(delq! 'yas-dropdown-prompt yas-prompt-functions)
;; Prioritize private snippets in `+snippets-dir' over built-in ones if there
;; are multiple choices.
(add-to-list 'yas-prompt-functions #'+snippets-prompt-private nil #'eq)
(add-to-list 'yas-prompt-functions #'+snippets-prompt-private)
;; Register `def-project-mode!' modes with yasnippet. This enables project
;; specific snippet libraries (e.g. for Laravel, React or Jekyll projects).
@ -60,22 +67,14 @@
;; tell smartparens overlays not to interfere with yasnippet keybinds
(advice-add #'yas-expand :before #'sp-remove-active-pair-overlay))
;; Enable `read-only-mode' for built-in snippets (in `doom-local-dir')
(add-hook 'snippet-mode-hook #'+snippets-read-only-maybe-h)
;; (Evil only) fix off-by-one issue with line-wise visual selections in
;; `yas-insert-snippet', and switches to insert mode afterwards.
(advice-add #'yas-insert-snippet :around #'+snippets-expand-on-region-a)
(define-key! snippet-mode-map
"C-c C-k" #'+snippet--abort
"C-c C-e" #'+snippet--edit)
;; Show keybind hints in snippet header-line
(add-hook 'snippet-mode-hook #'+snippets-show-hints-in-header-line-h)
;; Replace commands with superior alternatives
(define-key! yas-minor-mode-map
[remap yas-new-snippet] #'+snippets/new
[remap yas-visit-snippet-file] #'+snippets/edit)
;; Enable `read-only-mode' for built-in snippets (in `doom-local-dir')
(add-hook 'snippet-mode-hook #'+snippets-read-only-maybe-h)
(map! :map yas-keymap
"C-e" #'+snippets/goto-end-of-field
@ -84,7 +83,14 @@
[M-left] #'+snippets/goto-start-of-field
[M-backspace] #'+snippets/delete-to-start-of-field
[backspace] #'+snippets/delete-backward-char
[delete] #'+snippets/delete-forward-char-or-field))
[delete] #'+snippets/delete-forward-char-or-field
;; Replace commands with superior alternatives
:map yas-minor-mode-map
[remap yas-new-snippet] #'+snippets/new
[remap yas-visit-snippet-file] #'+snippets/edit)
;; If in a daemon session, front-load this expensive work:
(if (daemonp) (yas-reload-all)))
(use-package! auto-yasnippet

View file

@ -1,10 +1,10 @@
;; -*- no-byte-compile: t; -*-
;;; editor/snippets/packages.el
(package! yasnippet :pin "3bf9a3b1af")
(package! yasnippet :pin "5b1217ab08")
(package! auto-yasnippet :pin "db9e0dd433")
(package! doom-snippets
:recipe (:host github
:repo "hlissner/doom-snippets"
:files ("*.el" "*"))
:pin "2781b782a3")
:pin "feaedeb550")

View file

@ -3,10 +3,10 @@
(package! diredfl :pin "83567d00af")
(package! dired-git-info :pin "b47f2b0c3a")
(package! diff-hl :pin "fb9eb1cd3c")
(package! dired-rsync :pin "698294cbd4")
(package! diff-hl :pin "2cf8b489f3")
(package! dired-rsync :pin "bfd5c155be")
(when (featurep! +ranger)
(package! ranger :pin "af6f781a60"))
(when (featurep! +icons)
(package! all-the-icons-dired :pin "980b7747d6"))
(package! all-the-icons-dired :pin "816987d339"))
(package! fd-dired :pin "fd4c3f490b")

View file

@ -1,5 +1,5 @@
;; -*- no-byte-compile: t; -*-
;;; emacs/ibuffer/packages.el
(package! ibuffer-projectile :pin "7649621414")
(package! ibuffer-vc :pin "64cb03887b")
(package! ibuffer-projectile :pin "504b0edaa0")
(package! ibuffer-vc :pin "1249c1e30c")

View file

@ -0,0 +1,54 @@
#+TITLE: emacs/undo
#+DATE: April 13, 2020
#+SINCE: v3.0.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 augments Emacs' built-in undo system to be more intuitive.
** Maintainers
This module has no dedicated maintainers.
** Module Flags
+ =+tree= Uses ~undo-tree~ instead of ~undo-fu~, which is a little less stable,
but offers branching undo history and a visualizer for navigating it.
** Plugins
+ [[https://gitlab.com/ideasman42/emacs-undo-fu][undo-fu]]
+ [[https://gitlab.com/ideasman42/emacs-undo-fu-session][undo-fu-session]]
+ [[https://github.com/emacsmirror/undo-tree][undo-tree]] (=+tree=)
** Hacks
+ Both undo-fu and undo-tree have been modified to use zstd to compress undo
history if it is available.
+ undo-tree only
+ Text properties are stripped from undo history to shrink it.
+ Undo-tree is too chatty about saving its history files. This has be
"silenced". i.e. It's visible in \*Messages\*, but won't appear in your
minibuffer.
+ unfo-fu only
+ Doom defines =undo-fu-mode= to make it easier to add hooks/mode-local
keybinds.
* Prerequisites
This module has no prereqisites.
* TODO Features
# An in-depth list of features, how to use them, and their dependencies.
* TODO Configuration
# How to configure this module, including common problems and how to address them.
* TODO Troubleshooting
# Common issues and their solution, or places to look for help.

View file

@ -0,0 +1,96 @@
;;; emacs/undo/config.el -*- lexical-binding: t; -*-
(use-package! undo-fu
:unless (featurep! +tree)
:after-call doom-switch-buffer after-find-file
:init
(after! undo-tree
(global-undo-tree-mode -1))
:config
;; Store more undo history to prevent loss of data
(setq undo-limit 400000
undo-strong-limit 3000000
undo-outer-limit 3000000)
(define-minor-mode undo-fu-mode
"Enables `undo-fu' for the current session."
:keymap (let ((map (make-sparse-keymap)))
(define-key map [remap undo] #'undo-fu-only-undo)
(define-key map [remap redo] #'undo-fu-only-redo)
(define-key map (kbd "C-_") #'undo-fu-only-undo)
(define-key map (kbd "M-_") #'undo-fu-only-redo)
(define-key map (kbd "C-M-_") #'undo-fu-only-redo-all)
(define-key map (kbd "C-x r u") #'undo-fu-session-save)
(define-key map (kbd "C-x r U") #'undo-fu-session-recover)
map)
:init-value nil
:global t)
(undo-fu-mode +1))
(use-package! undo-fu-session
:unless (featurep! +tree)
:hook (undo-fu-mode . global-undo-fu-session-mode)
:preface
(setq undo-fu-session-directory (concat doom-cache-dir "undo-fu-session/")
undo-fu-session-incompatible-files '("/COMMIT_EDITMSG\\'" "/git-rebase-todo\\'"))
;; HACK We avoid `:config' here because `use-package's `:after' complicates
;; the load order of a package's `:config' block and makes it impossible
;; for the user to override its settings with merely `after!' (or
;; `eval-after-load'). See jwiegley/use-package#829.
(after! undo-fu-session
;; HACK Use the faster zstd to compress undo files instead of gzip
(when (executable-find "zstd")
(defadvice! doom--undo-fu-session-use-zstd-a (filename)
:filter-return #'undo-fu-session--make-file-name
(if undo-fu-session-compression
(concat (file-name-sans-extension filename) ".zst")
filename)))))
(use-package! undo-tree
:when (featurep! +tree)
;; Branching & persistent undo
:after-call doom-switch-buffer-hook after-find-file
:config
(setq undo-tree-visualizer-diff t
undo-tree-auto-save-history t
undo-tree-enable-undo-in-region t
;; Increase undo-limits by a factor of ten to avoid emacs prematurely
;; truncating the undo history and corrupting the tree. See
;; https://github.com/syl20bnr/spacemacs/issues/12110
undo-limit 800000
undo-strong-limit 12000000
undo-outer-limit 120000000
undo-tree-history-directory-alist
`(("." . ,(concat doom-cache-dir "undo-tree-hist/"))))
;; Compress undo-tree history files with zstd, if available. File size isn't
;; the (only) concern here: the file IO barrier is slow for Emacs to cross;
;; reading a tiny file and piping it in-memory through zstd is *slightly*
;; faster than Emacs reading the entire undo-tree file from the get go (on
;; SSDs). Whether or not that's true in practice, we still enjoy zstd's ~80%
;; file savings (these files add up over time and zstd is so incredibly fast).
(when (executable-find "zstd")
(defadvice! doom--undo-tree-make-history-save-file-name-a (file)
:filter-return #'undo-tree-make-history-save-file-name
(concat file ".zst")))
;; Strip text properties from undo-tree data to stave off bloat. File size
;; isn't the concern here; undo cache files bloat easily, which can cause
;; freezing, crashes, GC-induced stuttering or delays when opening files.
(defadvice! doom--undo-tree-strip-text-properties-a (&rest _)
:before #'undo-list-transfer-to-tree
(dolist (item buffer-undo-list)
(and (consp item)
(stringp (car item))
(setcar item (substring-no-properties (car item))))))
;; Undo-tree is too chatty about saving its history files. This doesn't
;; totally suppress it logging to *Messages*, it only stops it from appearing
;; in the echo-area.
(advice-add #'undo-tree-save-history :around #'doom-shut-up-a)
(global-undo-tree-mode +1))

View file

@ -0,0 +1,7 @@
;; -*- no-byte-compile: t; -*-
;;; emacs/undo/packages.el
(if (featurep! +tree)
(package! undo-tree :pin "5b6df03781")
(package! undo-fu :pin "0c34b6747e")
(package! undo-fu-session :pin "b808ef0cdc"))

View file

@ -5,7 +5,7 @@
(package! vc-annotate :built-in t)
(package! smerge-mode :built-in t)
(package! browse-at-remote :pin "771a3079e2")
(package! browse-at-remote :pin "6aecae4b5d")
(package! git-timemachine :pin "391eb61050")
(package! gitconfig-mode :pin "55468314a5")
(package! gitignore-mode :pin "55468314a5")

View file

@ -12,10 +12,14 @@
- [[#arch-linux][Arch Linux]]
- [[#nixos][NixOS]]
- [[#opensuse][openSUSE]]
- [[#debianubuntu][Debian/Ubuntu]]
- [[#features][Features]]
- [[#configuration][Configuration]]
- [[#offlineimap][offlineimap]]
- [[#mbsync][mbsync]]
- [[#troubleshooting][Troubleshooting]]
- [[#no-such-file-or-directory-mu4e][=No such file or directory, mu4e=]]
- [[#void-function-org-time-add-error-on-gentoo][~(void-function org-time-add)~ error on Gentoo]]
* Description
This module makes Emacs an email client, using ~mu4e~.
@ -54,6 +58,7 @@ Run one of the following commands.
#+BEGIN_SRC sh
sudo pacman -S isync # mbsync
# OR
sudo pacman -S offlineimap
#+END_SRC
@ -84,9 +89,18 @@ Remove ~#~ in ~#sync_program=offlineimap~ to choose ~offlineimap~ instead of
sync_program=isync # mbsync
#sync_program=offlineimap
sudo zypper install maildir-utils $sync_programm
sudo zypper install maildir-utils $sync_program
#+END_SRC
** Debian/Ubuntu
Run the command corresponding to the desired backend and the last one.
#+BEGIN_SRC sh
sudo apt-get install isync # mbsync
# or
sudo apt-get install offlineimap
# then
sudo apt-get install maildir-utils # mu
#+END_SRC
* TODO Features
* Configuration
@ -101,7 +115,8 @@ Then you must set up offlineimap and index your mail:
1. Write a ~\~/.offlineimaprc~. 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.
store my login credentials. You can find a *very* detailed configuration
[[https://github.com/OfflineIMAP/offlineimap/blob/master/offlineimap.conf][here]].
2. Download your email: ~offlineimap -o~ (may take a while)
3. Index it with mu: ~mu index --maildir ~/.mail~
@ -121,3 +136,15 @@ Then configure Emacs to use your email address:
#+END_SRC
** TODO mbsync
* Troubleshooting
** =No such file or directory, mu4e=
You will get =No such file or directory, mu4e= errors if you don't run ~doom
sync~ after installing =mu= through your package manager.
** ~(void-function org-time-add)~ error on Gentoo
Gentoo users will see this error because [[https://gitweb.gentoo.org/repo/gentoo.git/tree/net-mail/mu/files/70mu-gentoo.el#n2][the =net-mail/mu= package eagerly loads
=mu4e= (which pulls in =org=) much too early]]; before Emacs reads =~/.emacs.d=.
So early, that it loads the built-in version of org-mode, rather than the newer
version that Doom installs.
Later versions of the =net-mail/mu= package have [[https://gitweb.gentoo.org/repo/gentoo.git/commit/net-mail/mu?id=770e1fccb119fbce8ba6d16021a3598123f212ff][fixed this issue]], but you may
need to switch to the unstable build of =net-mail/mu= to see it.

View file

@ -60,11 +60,7 @@
(setq mail-user-agent 'mu4e-user-agent)
;; Use fancy icons
(setq mu4e-headers-has-child-prefix '("+" . "")
mu4e-headers-empty-parent-prefix '("-" . "")
mu4e-headers-first-child-prefix '("\\" . "")
mu4e-headers-duplicate-prefix '("=" . "")
mu4e-headers-default-prefix '("|" . "")
(setq mu4e-use-fancy-chars t
mu4e-headers-draft-mark '("D" . "")
mu4e-headers-flagged-mark '("F" . "")
mu4e-headers-new-mark '("N" . "")

View file

@ -2,9 +2,10 @@
(use-package! pyim
:after-call after-find-file pre-command-hook
:init
(setq pyim-dcache-directory (concat doom-cache-dir "pyim/"))
:config
(setq pyim-dcache-directory (concat doom-cache-dir "pyim/")
pyim-page-tooltip t
(setq pyim-page-tooltip t
default-input-method "pyim"))

View file

@ -1,8 +1,7 @@
;; -*- no-byte-compile: t; -*-
;;; input/chinese/packages.el
(package! pyim :pin "bbeb68605e")
(package! pyim :pin "77170724fa")
(package! fcitx :pin "12dc2638dd")
(package! ace-pinyin :pin "8b2e9335b0")
(package! pangu-spacing :pin "f92898949b")
(package! pyim :pin "bbeb68605e")

View file

@ -3,5 +3,5 @@
(package! migemo :pin "f42832c8ac")
(package! avy-migemo :pin "922a6dd82c")
(package! ddskk :pin "51747f7afb")
(package! ddskk :pin "f9a2333ec3")
(package! pangu-spacing :pin "f92898949b")

View file

@ -6,11 +6,11 @@
:recipe (:host github :repo "agda/agda"
:files ("src/data/emacs-mode/agda-input.el")
:nonrecursive t)
:pin "74d9fd53cd")
:pin "ff9173e14e")
(package! agda2-mode
:recipe (:host github :repo "agda/agda"
:files ("src/data/emacs-mode/*.el"
(:exclude "agda-input.el"))
:nonrecursive t)
:pin "74d9fd53cd"))
:pin "ff9173e14e"))

View file

@ -1,4 +0,0 @@
;;; lang/assembly/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.hax\\'" . haxor-mode))

View file

@ -1,6 +0,0 @@
;; -*- no-byte-compile: t; -*-
;;; lang/assembly/packages.el
(package! mips-mode :pin "75152fc78b")
(package! haxor-mode :pin "6fa25a8e6b")
(package! nasm-mode :pin "65ca6546fc")

View file

@ -33,28 +33,24 @@ This is ignored by ccls.")
;;; Packages
(use-package! cc-mode
:commands (c-mode c++-mode objc-mode java-mode)
:mode ("\\.mm\\'" . objc-mode)
:init
;; Activate `c-mode', `c++-mode' or `objc-mode' depending on heuristics
(add-to-list 'auto-mode-alist '("\\.h\\'" . +cc-c-c++-objc-mode))
;; Ensure find-file-at-point works in C modes, must be added before irony
;; and/or lsp hooks are run.
(add-hook! '(c-mode-local-vars-hook
c++-mode-local-vars-hook
objc-mode-local-vars-hook)
#'+cc-init-ffap-integration-h)
;; Use `c-mode'/`c++-mode'/`objc-mode' depending on heuristics
:mode ("\\.h\\'" . +cc-c-c++-objc-mode)
;; Ensure find-file-at-point recognize system libraries in C modes. It must be
;; set up before the likes of irony/lsp are initialized. Also, we use
;; local-vars hooks to ensure these only run in their respective major modes,
;; and not their derived modes.
:hook ((c-mode-local-vars c++-mode-local-vars objc-mode-local-vars) . +cc-init-ffap-integration-h)
;;; Improve fontification in C/C++ (also see `modern-cpp-font-lock')
:hook (c-mode-common . rainbow-delimiters-mode)
:hook ((c-mode c++-mode) . +cc-fontify-constants-h)
:config
(set-electric! '(c-mode c++-mode objc-mode java-mode) :chars '(?\n ?\} ?\{))
(set-docsets! 'c-mode "C")
(set-docsets! 'c++-mode "C++" "Boost")
(set-electric! '(c-mode c++-mode objc-mode java-mode) :chars '(?\n ?\} ?\{))
(set-rotate-patterns! 'c++-mode
:symbols '(("public" "protected" "private")
("class" "struct")))
(set-pretty-symbols! '(c-mode c++-mode)
;; Functional
;; :def "void "
@ -71,9 +67,12 @@ This is ignored by ccls.")
:return "return"
:yield "#require")
;;; Better fontification (also see `modern-cpp-font-lock')
(add-hook 'c-mode-common-hook #'rainbow-delimiters-mode)
(add-hook! '(c-mode-hook c++-mode-hook) #'+cc-fontify-constants-h)
;; HACK Suppress 'Args out of range' error in when multiple modifications are
;; performed at once in a `c++-mode' buffer, e.g. with `iedit' or
;; multiple cursors.
(undefadvice! +cc--suppress-silly-errors-a (orig-fn &rest args)
:around #'c-after-change-mark-abnormal-strings
(ignore-errors (apply orig-fn args)))
;; Custom style, based off of linux
(setq c-basic-offset tab-width
@ -122,23 +121,21 @@ This is ignored by ccls.")
(use-package! irony
:unless (featurep! +lsp)
:commands (irony-install-server irony-mode)
:preface
(setq irony-server-install-prefix (concat doom-etc-dir "irony-server/"))
:init
(add-hook! '(c-mode-local-vars-hook
c++-mode-local-vars-hook
objc-mode-local-vars-hook)
(defun +cc-init-irony-mode-h ()
(if (file-directory-p irony-server-install-prefix)
(irony-mode +1)
(message "Irony server isn't installed"))))
:config
(setq irony-cdb-search-directory-list '("." "build" "build-conda"))
:commands irony-install-server
;; Initialize compilation database, if present. Otherwise, fall back on
;; `+cc-default-compiler-options'.
(add-hook 'irony-mode-hook #'+cc-init-irony-compile-options-h)
:hook (irony-mode . +cc-init-irony-compile-options-h)
;; Only initialize `irony-mode' if the server is available. Otherwise fail
;; quietly and gracefully.
:hook ((c-mode-local-vars c++-mode-local-vars objc-mode-local-vars) . +cc-init-irony-mode-maybe-h)
:preface (setq irony-server-install-prefix (concat doom-etc-dir "irony-server/"))
:config
(defun +cc-init-irony-mode-maybe-h ()
(if (file-directory-p irony-server-install-prefix)
(irony-mode +1)
(message "Irony server isn't installed")))
(setq irony-cdb-search-directory-list '("." "build" "build-conda"))
(use-package! irony-eldoc
:hook (irony-mode . irony-eldoc))
@ -149,19 +146,15 @@ This is ignored by ccls.")
(use-package! company-irony
:when (featurep! :completion company)
:init
(set-company-backend! 'irony-mode
'(:separate company-irony-c-headers company-irony))
:config
(require 'company-irony-c-headers)))
:init (set-company-backend! 'irony-mode '(:separate company-irony-c-headers company-irony))
:config (require 'company-irony-c-headers)))
;;
;; Major modes
(use-package! cmake-mode
:defer t
:config (set-docsets! 'cmake-mode "CMake"))
(after! cmake-mode
(set-docsets! 'cmake-mode "CMake"))
(use-package! company-cmake ; for `cmake-mode'
:when (featurep! :completion company)
@ -184,19 +177,17 @@ This is ignored by ccls.")
(use-package! rtags
:unless (featurep! +lsp)
:commands rtags-executable-find
:preface
(setq rtags-install-path (concat doom-etc-dir "rtags/"))
:init
(add-hook! '(c-mode-local-vars-hook
c++-mode-local-vars-hook
objc-mode-local-vars-hook)
(defun +cc-init-rtags-h ()
"Start an rtags server in c-mode and c++-mode buffers."
(when (and (require 'rtags nil t)
(rtags-executable-find rtags-rdm-binary-name))
(rtags-start-process-unless-running))))
;; Only initialize rtags-mode if rtags and rdm are available.
:hook ((c-mode-local-vars c++-mode-local-vars objc-mode-local-vars) . +cc-init-rtags-maybe-h)
:preface (setq rtags-install-path (concat doom-etc-dir "rtags/"))
:config
(defun +cc-init-rtags-maybe-h ()
"Start an rtags server in c-mode and c++-mode buffers.
If rtags or rdm aren't available, fail silently instead of throwing a breaking error."
(and (require 'rtags nil t)
(rtags-executable-find rtags-rdm-binary-name)
(rtags-start-process-unless-running)))
(setq rtags-autostart-diagnostics t
rtags-use-bookmarks nil
rtags-completions-enabled nil
@ -221,11 +212,13 @@ This is ignored by ccls.")
:definition #'rtags-find-symbol-at-point
:references #'rtags-find-references-at-point)
(add-hook! 'kill-emacs-hook (ignore-errors (rtags-cancel-process)))
;; Use rtags-imenu instead of imenu/counsel-imenu
(define-key! (c-mode-map c++-mode-map) [remap imenu] #'+cc/imenu)
;; Ensure rtags cleans up after itself properly when exiting Emacs, rather
;; than display a jarring confirmation prompt for killing it.
(add-hook! 'kill-emacs-hook (ignore-errors (rtags-cancel-process)))
(add-hook 'rtags-jump-hook #'better-jumper-set-jump)
(add-hook 'rtags-after-find-file-hook #'recenter))

View file

@ -17,16 +17,16 @@
:pin "404cd0694a")))
(if (featurep! +lsp)
(package! ccls :pin "e5cc4c3e6f")
(when (package! irony :pin "8387098286")
(package! ccls :pin "17ec7bb4cf")
(when (package! irony :pin "5f75fc0c92")
(package! irony-eldoc :pin "0df5831eaa")
(when (featurep! :checkers syntax)
(package! flycheck-irony :pin "42dbecd4a8"))
(when (featurep! :completion company)
(package! company-irony :pin "b44711dfce")
(package! company-irony-c-headers :pin "72c386aeb0")))
(when (package! rtags :pin "31f7842015")
(when (package! rtags :pin "d370c09007")
(when (featurep! :completion ivy)
(package! ivy-rtags :pin "31f7842015"))
(package! ivy-rtags))
(when (featurep! :completion helm)
(package! helm-rtags :pin "31f7842015"))))
(package! helm-rtags))))

View file

@ -15,11 +15,14 @@
- [[#troubleshooting][Troubleshooting]]
* Description
# A summary of what this module does.
This module adds support for the Clojure(Script) language.
+ If possible, include a brief list of feature highlights here
+ Like code completion, syntax checking or available snippets
+ Include links to packages & external things where possible
+ Interactive development environment (~cider~): REPL, compilation, debugging,
running tests, definitions & documentation lookup, code completion, and many
more
+ Refactoring (~clj-refactor~)
+ Linting (~clj-kondo~), requires ~:checkers syntax~
+ LSP support
** Maintainers
This module has no dedicated maintainers.
@ -30,7 +33,7 @@ This module has no dedicated maintainers.
** Plugins
+ [[https://github.com/clojure-emacs/cider][cider]]
+ [[https://github.com/clojure-emacs/clj-refactor.el][clj-refactor]]
+ [[https://github.com/candid82/flycheck-joker][flycheck-joker]]
+ [[https://github.com/borkdude/flycheck-clj-kondo][flycheck-clj-kondo]]
** Hacks
+ Error messages emitted from CIDER are piped into the REPL buffer when it is
@ -44,8 +47,8 @@ This module requires:
+ With =+lsp=
+ clojure-lsp
+ Without =+lsp=
+ leiningen (REPL)
+ joker (linter)
+ [[https://leiningen.org/][leiningen]] (REPL)
+ [[https://github.com/borkdude/clj-kondo][clj-kondo]] (linter)
* TODO Features
# An in-depth list of features, how to use them, and their dependencies.

View file

@ -11,21 +11,22 @@
;;
;;; Packages
;;;###package clojure-mode
(add-hook 'clojure-mode-hook #'rainbow-delimiters-mode)
(when (featurep! +lsp)
(add-hook! '(clojure-mode-local-vars-hook
clojurec-mode-local-vars-hook
clojurescript-mode-local-vars-hook)
(defun +clojure-disable-lsp-indentation-h ()
(setq-local lsp-enable-indentation nil))
#'lsp!)
(after! lsp-clojure
(dolist (m '(clojure-mode
clojurec-mode
clojurescript-mode
clojurex-mode))
(add-to-list 'lsp-language-id-configuration (cons m "clojure")))))
(use-package! clojure-mode
:hook (clojure-mode . rainbow-delimiters-mode)
:config
(when (featurep! +lsp)
(add-hook! '(clojure-mode-local-vars-hook
clojurec-mode-local-vars-hook
clojurescript-mode-local-vars-hook)
(defun +clojure-disable-lsp-indentation-h ()
(setq-local lsp-enable-indentation nil))
#'lsp!)
(after! lsp-clojure
(dolist (m '(clojure-mode
clojurec-mode
clojurescript-mode
clojurex-mode))
(add-to-list 'lsp-language-id-configuration (cons m "clojure"))))))
(use-package! cider
@ -58,13 +59,18 @@
cider-repl-history-quit-action 'delete-and-restore
cider-repl-history-highlight-inserted-item t
cider-repl-history-size 1000
cider-repl-pop-to-buffer-on-connect 'display-only
cider-repl-result-prefix ";; => "
cider-repl-print-length 100
cider-repl-use-clojure-font-lock t
cider-repl-use-pretty-printing t
cider-repl-wrap-history nil
cider-stacktrace-default-filters '(tooling dup))
cider-stacktrace-default-filters '(tooling dup)
;; Don't focus the CIDER REPL when it starts. Since it can take so long
;; to start up, you either wait for a minute doing nothing or be
;; prepared for your cursor to suddenly change buffers without warning.
;; See https://github.com/clojure-emacs/cider/issues/1872
cider-repl-pop-to-buffer-on-connect 'display-only)
;; Error messages emitted from CIDER is silently funneled into *nrepl-server*
;; rather than the *cider-repl* buffer. How silly. We might want to see that
@ -90,6 +96,8 @@
"\"" #'cider-jack-in-cljs
"c" #'cider-connect-clj
"C" #'cider-connect-cljs
"m" #'cider-macroexpand-1
"M" #'cider-macroexpand-all
(:prefix ("e" . "eval")
"b" #'cider-eval-buffer
"d" #'cider-eval-defun-at-point
@ -114,9 +122,6 @@
"e" #'cider-enlighten-mode
"i" #'cider-inspect
"r" #'cider-inspect-last-result)
(:prefix ("m" . "macro")
"e" #'cider-macroexpand-1
"E" #'cider-macroexpand-all)
(:prefix ("n" . "namespace")
"n" #'cider-browse-ns
"N" #'cider-browse-ns-all
@ -159,6 +164,25 @@
:i "U" #'cider-repl-history-undo-other-window)))
(after! cider-doc
;; Fixes raxod502/radian#446: CIDER tries to do color calculations when it's
;; loaded, sometimes too early, causing errors. Better to wait until something
;; is actually rendered.
(setq cider-docview-code-background-color nil)
(defadvice! +clojure--defer-color-calculation-a (&rest _)
"Set `cider-docview-code-background-color'.
This is needed because we have ripped out the code that would normally set it
(since that code will run during early init, which is a problem)."
:before #'cider-docview-fontify-code-blocks
(setq cider-docview-code-background-color (cider-scale-background-color)))
;; HACK Disable cider's advice on these; and hope no one else is using these
;; old-style advice.
(ad-deactivate #'enable-theme)
(ad-deactivate #'disable-theme))
(use-package! clj-refactor
:hook (clojure-mode . clj-refactor-mode)
:config

View file

@ -1,8 +1,9 @@
;; -*- no-byte-compile: t; -*-
;;; lang/clojure/packages.el
(package! cider :pin "7437c67f0e")
(package! clj-refactor :pin "e24ba62843")
(package! clojure-mode :pin "c970c4605c")
(package! cider :pin "d63e5652fd")
(package! clj-refactor :pin "8259791e05")
(when (featurep! :checkers syntax)
(package! flycheck-clj-kondo :pin "f652a8dc4c"))
(package! flycheck-clj-kondo :pin "5472c26ffd"))

View file

@ -1,6 +1,6 @@
;; -*- no-byte-compile: t; -*-
;;; lang/common-lisp/packages.el
(package! sly :pin "cfecd21410")
(package! sly :pin "1382bda945")
(package! sly-macrostep :pin "5113e4e926")
(package! sly-repl-ansi-color :pin "b9cd52d1cf")

View file

@ -72,11 +72,11 @@
(setq company-coq-disabled-features '(hello company-defaults))
(if (featurep! :completion company)
(map! :map coq-mode-map [remap company-complete-common]
#'company-indent-or-complete-common)
(define-key coq-mode-map [remap company-complete-common]
#'company-indent-or-complete-common)
;; `company-coq''s company defaults impose idle-completion on folks, so
;; we'll set up company ourselves.
;; See https://github.com/cpitclaudel/company-coq/issues/42
;; we'll set up company ourselves. See
;; https://github.com/cpitclaudel/company-coq/issues/42
(add-to-list 'company-coq-disabled-features 'company))
(map! :map coq-mode-map

View file

@ -1,6 +1,5 @@
;; -*- no-byte-compile: t; -*-
;;; lang/coq/packages.el
(package! proof-general :pin "2a17093f6a")
(package! company-coq :pin "6e8bc2e367")
(package! proof-general :pin "9196749d55")
(package! company-coq :pin "f9dba9ddff")

View file

@ -8,3 +8,8 @@
(sp-point-after-word-p id action context))
((eq action 'autoskip)
(/= (char-before) 32)))))
;;;###autoload
(defun +csharp-kill-omnisharp-server-h ()
(unless (doom-buffers-in-mode 'csharp-mode (buffer-list))
(omnisharp-stop-server)))

View file

@ -1,12 +1,13 @@
;;; lang/csharp/config.el -*- lexical-binding: t; -*-
(after! csharp-mode
(add-hook 'csharp-mode-hook #'rainbow-delimiters-mode)
(use-package! csharp-mode
:hook (csharp-mode . rainbow-delimiters-mode)
:config
(set-electric! 'csharp-mode :chars '(?\n ?\}))
(set-rotate-patterns! 'csharp-mode
:symbols '(("public" "protected" "private")
("class" "struct")))
(sp-local-pair 'csharp-mode "<" ">"
:when '(+csharp-sp-point-in-type-p)
:post-handlers '(("| " "SPC")))
@ -17,25 +18,22 @@
(use-package! omnisharp
:unless (featurep! +lsp)
:hook (csharp-mode-local-vars . omnisharp-mode)
:commands omnisharp-install-server
:hook (csharp-mode-local-vars . omnisharp-mode)
:preface
(setq omnisharp-auto-complete-want-documentation nil
omnisharp-cache-directory (concat doom-etc-dir "omnisharp"))
:config
(defun +csharp-cleanup-omnisharp-server-h ()
"Clean up the omnisharp server once you kill the last csharp-mode buffer."
(unless (doom-buffers-in-mode 'csharp-mode (buffer-list))
(omnisharp-stop-server)))
(add-hook! 'omnisharp-mode-hook
(add-hook 'kill-buffer-hook #'+csharp-cleanup-omnisharp-server-h nil t))
(set-company-backend! 'omnisharp-mode 'company-omnisharp)
(set-lookup-handlers! 'omnisharp-mode
:definition #'omnisharp-go-to-definition
:references #'omnisharp-find-usages
:documentation #'omnisharp-current-type-documentation)
;; Kill the omnisharp server once the last csharp-mode buffer is killed
(add-hook! 'omnisharp-mode-hook
(add-hook 'kill-buffer-hook #'+csharp-kill-omnisharp-server-h nil t))
(map! :localleader
:map omnisharp-mode-map
"b" #'omnisharp-recompile
@ -60,11 +58,11 @@
"b" #'omnisharp-unit-test-buffer)))
;;;###package shader-mode
(when (featurep! +unity)
;; Unity shaders
(add-to-list 'auto-mode-alist '("\\.shader\\'" . shader-mode))
;; Unity shaders
(use-package! shader-mode
:when (featurep! +unity)
:mode "\\.shader\\'"
:config
(def-project-mode! +csharp-unity-mode
:modes '(csharp-mode shader-mode)
:files (and "Assets" "Library/MonoManager.asset" "Library/ScriptMapper")))

View file

@ -2,9 +2,7 @@
;;; lang/csharp/packages.el
(package! csharp-mode :pin "57bd21bda4")
(unless (featurep! +lsp)
(package! omnisharp :pin "e658a18a76"))
(when (featurep! +unity)
(package! shader-mode :pin "d7dc8d0d6f"))

View file

@ -0,0 +1,105 @@
#+TITLE: lang/dart
#+DATE: February 16, 2020
#+SINCE: v3.0.0
#+STARTUP: inlineimages nofold
* Table of Contents :TOC_3:noexport:
- [[#description][Description]]
- [[#maintainers][Maintainers]]
- [[#module-flags][Module Flags]]
- [[#plugins][Plugins]]
- [[#prerequisites][Prerequisites]]
- [[#installing-dart-sdk][Installing Dart SDK]]
- [[#installing-flutter-sdk][Installing Flutter SDK]]
- [[#features][Features]]
- [[#configuration][Configuration]]
- [[#dart--flutter][Dart & Flutter]]
- [[#android][Android]]
- [[#troubleshooting][Troubleshooting]]
* Description
[[https://dart.dev/][Dart]] is a client-optimized language by Google for fast apps on any platform.
It is fast and optimized for UI, Famous for the [[https://flutter.io/][Flutter]] framework, also
made by Google. Both Flutter and Dart are free and open-source.
This module wraps ~dart-mode~, with LSP code completion for =.dart= files,
syntax highlighting, etc.
** Maintainers
This module has no dedicated maintainers.
** Module Flags
+ =+lsp= Enable LSP server integration.
+ =+flutter= Adds ~flutter~ integration and some sane defaults for Flutter
development along with ~hover~ for desktop development.
** Plugins
+ [[https://github.com/bradyt/dart-mode][dart-mode]]
+ [[https://github.com/amake/flutter.el][flutter.el]]
+ [[https://github.com/ericdallo/hover.el][hover.el]]
* Prerequisites
Make sure that the Dart SDK is on your ~PATH~, and if using Flutter, make sure
the Flutter binary is on your ~PATH~ as well.
** Installing Dart SDK
Before starting note that Flutter SDK will have a version of Dart. Therefore,
there is no need to install Dart. If you want to use Flutter just see
the next part.
The stable version of the SDK is in most major distributions repositories.
If you find it necessary to install any other version or build from source,
please refer to the official website at: https://dart.dev/get-dart
+ *On Debian (also Ubuntu and its derivations):*
#+BEGIN_SRC shell
sudo apt-get install dart
#+END_SRC
+ *On Arch Linux (and derivations like Manjaro):*
#+BEGIN_SRC shell
sudo pacman -S dart
#+END_SRC
+ *On macOS*:
#+BEGIN_SRC shell
brew tap dart-lang/dart
brew install dart#+END_SRC
#+END_SRC
** Installing Flutter SDK
Due to complications with permissions, it is suggested not to use AUR or any
automatic installation tools for Flutter SDK.
On any system just run the following commands to install Flutter, once you have
met dependencies named on [[https://flutter.dev/docs/get-started/install/][the site]]:
#+BEGIN_SRC shell
git clone https://github.com/flutter/flutter --branch stable # to download Flutter
export PATH="$PATH:$(pwd)/flutter/bin" # to add it to PATH
flutter doctor # for Dependency check and further instructions
#+END_SRC
* Features
+ Syntax highlighting and formatting for ~.dart~ files provided by LSP
+ Emacs functions for running and debugging Flutter projects
* Configuration
** Dart & Flutter
On Linux, the installers for Dart and Flutter use the ~/opt~ directory, and this
module assumes that. However, you may set ~lsp-dart-sdk-dir~ to your Dart
install directory and ~flutter-sdk-path~ to you flutter SDK folder, to make sure
LSP can find the language server included with the Dart SDK.
Alternatively, these variables shouldn't be necessary if you just include Dart
and Flutter on your `PATH` variable.
** Android
You will also need to setup your system for Android development if you intend to
use Flutter to develop mobile applications. Refer to your distributions package
manager for details. In most distributions the ~/opt/android-sdk~ directory is
used, and you might have to change some permissions in this directory since it's
owned by root. The [[https://wiki.archlinux.org/index.php/Android][Arch Linux wiki has a great guide on this here.]]
* Troubleshooting
See the configuration section for information on the binaries for Dart and
Flutter. On new installs to the ~/opt~ directory, you will likely need to edit
the permissions of the ~/opt/dart-sdk~ and ~/opt/flutter~ directories (not to
mention the Android SDK, as discussed above).

View file

@ -0,0 +1,28 @@
;;; lang/dart/config.el -*- lexical-binding: t; -*-
(use-package! dart-mode
:when (featurep! +lsp)
:hook (dart-mode-local-vars . lsp!)
:config
(when (and (featurep! +flutter) IS-LINUX)
(when-let (path (doom-glob "/opt/flutter/bin/cache/dart-sdk"))
(setq flutter-sdk-path path))))
(use-package! flutter
:when (featurep! +flutter)
:defer t
:config
(map! :map dart-mode-map
:localleader
"r" #'flutter-run-or-hot-reload))
(use-package! hover
:when (featurep! +flutter)
:defer t
:config
(map! :map dart-mode-map
:localleader
"h r" #'hover-run-or-hot-reload
"h R" #'hover-run-or-hot-restart))

View file

@ -0,0 +1,8 @@
;;; lang/dart/doctor.el -*- lexical-binding: t; -*-
(assert! (or (not (featurep! +lsp))
(featurep! :tools lsp))
"This module requires (:tools lsp)")
(unless (executable-find "dart")
(warn! "Dart isn't on PATH."))

View file

@ -0,0 +1,11 @@
;; -*- no-byte-compile: t; -*-
;;; lang/dart/packages.el
(package! dart-mode :pin "04fcd649f1")
(when (featurep! +lsp)
(package! lsp-dart :pin "4cd73b77f4"))
(when (featurep! +flutter)
(package! flutter :pin "293b7225b9")
(package! hover :pin "6f9ed1a651"))

View file

@ -1,9 +1,5 @@
;;; lang/data/config.el -*- lexical-binding: t; -*-
;; Built in plugins
(add-to-list 'auto-mode-alist '("/sxhkdrc\\'" . conf-mode))
(add-to-list 'auto-mode-alist '("\\.\\(?:hex\\|nes\\)\\'" . hexl-mode))
(use-package! nxml-mode
:mode "\\.p\\(?:list\\|om\\)\\'" ; plist, pom
:mode "\\.xs\\(?:d\\|lt\\)\\'" ; xslt, xsd
@ -16,9 +12,6 @@
(setq-hook! 'nxml-mode-hook tab-width nxml-child-indent))
;;
;;; Third-party plugins
;;;###package csv-mode
(map! :after csv-mode
:localleader
@ -29,25 +22,3 @@
"S" #'csv-sort-numeric-fields
"k" #'csv-kill-fields
"t" #'csv-transpose)
(use-package! graphql-mode
:mode "\\.gql\\'"
:config (setq-hook! 'graphql-mode-hook tab-width graphql-indent-level))
(use-package! json-mode
:mode "\\.js\\(?:on\\|[hl]int\\(?:rc\\)?\\)\\'"
:config
(set-electric! 'json-mode :chars '(?\n ?: ?{ ?})))
(after! jsonnet-mode
(set-electric! 'jsonnet-mode :chars '(?\n ?: ?{ ?})))
(after! yaml-mode
(setq-hook! 'yaml-mode-hook tab-width yaml-indent-offset))
;;
;;; Frameworks
(def-project-mode! +data-vagrant-mode
:files ("Vagrantfile"))

View file

@ -1,12 +1,4 @@
;; -*- no-byte-compile: t; -*-
;;; lang/data/packages.el
(package! graphql-mode :pin "7c37aee28b")
(package! json-mode :pin "0e819e519a")
(package! jsonnet-mode :pin "2b90b4e12a")
(package! yaml-mode :pin "cecf4b106b")
(package! csv-mode :pin "fbf942e127")
(package! dhall-mode :pin "ef4d33debe")
(package! protobuf-mode
:recipe (:host github :repo "emacsmirror/protobuf-mode" :files (:defaults "*"))
:pin "94b7bd7e8b")
(package! csv-mode :pin "635337407c")

View file

@ -37,31 +37,30 @@
(sp-local-pair "fn " " end" :unless '(sp-in-comment-p sp-in-string-p)))
(when (featurep! +lsp)
(add-hook 'elixir-mode-local-vars-hook #'lsp!))
(add-hook 'elixir-mode-local-vars-hook #'lsp!)))
(use-package! flycheck-credo
:when (featurep! :checkers syntax)
:config (flycheck-credo-setup)))
(use-package! flycheck-credo
:when (featurep! :checkers syntax)
:after elixir-mode
:config (flycheck-credo-setup))
(use-package! alchemist
:hook (elixir-mode . alchemist-mode)
:init
(after! elixir-mode
(set-lookup-handlers! 'elixir-mode
:definition #'alchemist-goto-definition-at-point
:documentation #'alchemist-help-search-at-point)
(set-eval-handler! 'elixir-mode #'alchemist-eval-region)
(set-repl-handler! 'elixir-mode #'alchemist-iex-project-run)))
:config
(set-lookup-handlers! 'alchemist-mode
:definition #'alchemist-goto-definition-at-point
:documentation #'alchemist-help-search-at-point)
(set-eval-handler! 'alchemist-mode #'alchemist-eval-region)
(set-repl-handler! 'alchemist-mode #'alchemist-iex-project-run))
(use-package! alchemist-company
:when (featurep! :completion company)
:commands alchemist-company
:init
(after! elixir-mode
(set-company-backend! 'elixir-mode '(alchemist-company company-yasnippet)))
:config
(set-company-backend! 'alchemist-mode '(alchemist-company company-yasnippet))
;; Alchemist doesn't use hook symbols to add these backends, so we have to use
;; the entire closure to get rid of it.
(let ((fn (byte-compile (lambda () (add-to-list (make-local-variable 'company-backends) 'alchemist-company)))))

View file

@ -1,12 +1,10 @@
;;; lang/elm/config.el -*- lexical-binding: t; -*-
(after! elm-mode
(add-hook 'elm-mode-hook #'rainbow-delimiters-mode)
(when (featurep! +lsp)
(add-hook 'elm-mode-local-vars-hook #'lsp!))
(set-company-backend! 'elm-mode 'company-elm)
(if (featurep! +lsp)
(add-hook 'elm-mode-local-vars-hook #'lsp!)
(set-company-backend! 'elm-mode 'company-elm))
(set-repl-handler! 'elm-mode #'run-elm-interactive)
(set-pretty-symbols! 'elm-mode
:null "null"
@ -22,4 +20,4 @@
(use-package! flycheck-elm
:when (featurep! :checkers syntax)
:after elm-mode
:config (add-to-list 'flycheck-checkers 'elm nil #'eq))
:config (add-to-list 'flycheck-checkers 'elm))

View file

@ -1,6 +1,6 @@
;; -*- no-byte-compile: t; -*-
;;; lang/elm/packages.el
(package! elm-mode :pin "dd868e55ff")
(package! elm-mode :pin "7782be0814")
(when (featurep! :checkers syntax)
(package! flycheck-elm :pin "debd0af563"))
(package! flycheck-elm :pin "1b60050efd"))

View file

@ -48,9 +48,6 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
;; variable-width indentation is superior in elisp
(add-to-list 'doom-detect-indentation-excluded-modes 'emacs-lisp-mode nil #'eq)
;; Use helpful instead of describe-* from `company'
(advice-add #'elisp--company-doc-buffer :around #'doom-use-helpful-a)
(add-hook! 'emacs-lisp-mode-hook
#'outline-minor-mode
;; fontificiation
@ -100,7 +97,8 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
"v" #'find-variable
"l" #'find-library)))
;; Adapted from http://www.modernemacs.com/post/comint-highlighting/
;; Adapted from http://www.modernemacs.com/post/comint-highlighting/ to add
;; syntax highlighting to ielm REPLs.
(add-hook! 'ielm-mode-hook
(defun +emacs-lisp-init-syntax-highlighting-h ()
(font-lock-add-keywords
@ -125,7 +123,7 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
;;;###package overseer
(autoload 'overseer-test "overseer" nil t)
(remove-hook 'emacs-lisp-mode-hook 'overseer-enable-mode)
(remove-hook 'emacs-lisp-mode-hook #'overseer-enable-mode)
(use-package! flycheck-cask

View file

@ -4,12 +4,14 @@
(package! elisp-mode :built-in t)
(package! highlight-quoted :pin "2410347815")
;; Tools
(package! macrostep :pin "424e3734a1")
(package! overseer :pin "02d49f582e")
(package! elisp-def :pin "368b04da68")
(package! elisp-demos :pin "bec206bf1b")
(package! elisp-demos :pin "57dd4ae3e4")
(when (featurep! :checkers syntax)
(package! flycheck-cask :pin "3457ae553c"))
(package! buttercup :pin "178c7954f8")
;; Libraries
(package! buttercup :pin "a91f282025")

View file

@ -3,7 +3,10 @@
(use-package! erlang
:mode ("\\.erlang\\'" . erlang-mode)
:mode ("/rebar\\.config\\(?:\\.script\\)?\\'" . erlang-mode)
:mode ("/\\(?:app\\|sys\\)\\.config\\'" . erlang-mode))
:mode ("/\\(?:app\\|sys\\)\\.config\\'" . erlang-mode)
:config
(when (featurep! +lsp)
(add-hook 'erlang-mode-local-vars-hook #'lsp!)))
(use-package! flycheck-rebar3
@ -12,18 +15,10 @@
:config (flycheck-rebar3-setup))
(use-package! ivy-erlang-complete
:when (featurep! :completion ivy)
:hook (erlang-mode . ivy-erlang-complete-init)
:config
(add-hook! 'erlang-mode-hook
(add-hook 'after-save-hook #'ivy-erlang-complete-reparse nil t)))
(use-package! company-erlang
:when (featurep! :completion company)
:unless (featurep! +lsp)
:hook (erlang-mode . company-erlang-init))
(when (featurep! +lsp)
(add-hook 'erlang-mode-local-vars-hook #'lsp!))
:hook (erlang-mode . company-erlang-init)
:config
(add-hook! 'erlang-mode-hook
(add-hook 'after-save-hook #'ivy-erlang-complete-reparse nil t)))

View file

@ -1,11 +1,9 @@
;; -*- no-byte-compile: t; -*-
;;; private/erlang/packages.el
(package! erlang :pin "c15eb5fdf7")
(package! erlang :pin "3065fbf434")
(when (featurep! :checkers syntax)
(package! flycheck-rebar3 :pin "3cca1268c5"))
(unless (featurep! +lsp)
(when (featurep! :completion ivy)
(package! ivy-erlang-complete :pin "7d60ed111d"))
(when (featurep! :completion company)
(package! company-erlang :pin "bc0524a16f")))

View file

@ -1,7 +1,7 @@
;; -*- no-byte-compile: t; -*-
;;; lang/ess/packages.el
(package! ess :pin "a2be8cb97c")
(package! ess :pin "625041ad51")
(package! ess-R-data-view :pin "d6e98d3ae1")
(package! polymode :pin "3eab3c9eed")
(package! poly-R :pin "0443c89b4d")
(package! polymode :pin "44265e3516")
(package! poly-R :pin "51ffeb6ec4")

View file

@ -1,4 +1,4 @@
;; -*- no-byte-compile: t; -*-
;;; lang/factor/packages.el
(package! fuel :pin "a62ea78d73")
(package! fuel :pin "497d6491e6")

View file

@ -1,4 +1,4 @@
;; -*- no-byte-compile: t; -*-
;;; lang/fstar/packages.el
(package! fstar-mode)
(package! fstar-mode :pin "aaaf256888")

View file

@ -15,7 +15,8 @@
- [[#troubleshooting][Troubleshooting]]
* Description
This module adds [[https://golang.org][Go]] support.
This module adds [[https://golang.org][Go]] support, with optional (but recommended) LSP support via
[[https://github.com/golang/tools/blob/master/gopls/README.md][gopls]].
+ Code completion (~gocode~)
+ Documentation lookup (~godoc~)
@ -30,7 +31,8 @@ This module adds [[https://golang.org][Go]] support.
+ Code checking (~flycheck-golangci-lint~)
** Module Flags
+ =+lsp= Enables integration for the gopls LSP server.
+ =+lsp= Enables integration for the gopls LSP server. It is highly recommended
you use this, as the non-LSP experience is deprecated (and poor).
** Plugins
+ [[https://github.com/dominikh/go-mode.el][go-mode]]
@ -38,7 +40,7 @@ This module adds [[https://golang.org][Go]] support.
+ [[https://github.com/dominikh/go-mode.el][go-guru]]
+ [[https://github.com/manute/gorepl-mode][gorepl-mode]]
+ [[https://github.com/brantou/emacs-go-tag][go-tag]]
+ [[https://github.com/mdempsky/gocode][company-go]]*
+ [[https://github.com/mdempsky/gocode][company-go]]* =DEPRECATED=
+ [[https://github.com/s-kostyaev/go-gen-test][go-gen-test]]
+ [[https://github.com/weijiangan/flycheck-golangci-lint][flycheck-golangci-lint]] (if =:checkers syntax= is enabled)

View file

@ -44,7 +44,7 @@
(:prefix ("ri" . "imports")
"a" #'go-import-add
"r" #'go-remove-unused-imports)
(:prefix ( "b" . "build")
(:prefix ("b" . "build")
:desc "go run ." "r" (λ! (compile "go run ."))
:desc "go build" "b" (λ! (compile "go build"))
:desc "go clean" "c" (λ! (compile "go clean")))

View file

@ -2,14 +2,14 @@
;;; lang/go/packages.el
(package! go-eldoc :pin "cbbd2ea1e9")
(package! go-guru :pin "85a20dac6c")
(package! go-mode :pin "85a20dac6c")
(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")
(when (featurep! :completion company)
(package! company-go :pin "939b4a677f"))
(package! company-go :pin "4acdcbdea7"))
(when (featurep! :checkers syntax)
(package! flycheck-golangci-lint :pin "8e446c6831"))

View file

@ -1,30 +0,0 @@
;;; lang/haskell/+intero.el -*- lexical-binding: t; -*-
;;;###if (featurep! +intero)
(use-package! intero
:commands intero-mode
:init
(add-hook! 'haskell-mode-local-vars-hook
(defun +haskell-init-intero-h ()
"Initializes `intero-mode' in haskell-mode, unless stack isn't installed.
This is necessary because `intero-mode' doesn't do its own error checks."
(when (derived-mode-p 'haskell-mode)
(if (executable-find "stack")
(intero-mode +1)
(message "Couldn't find stack. Refusing to enable intero-mode.")))))
:config
(setq haskell-compile-cabal-build-command "stack build --fast")
(set-lookup-handlers! 'intero-mode :definition #'intero-goto-definition)
(set-company-backend! 'intero-mode 'intero-company)
(when (featurep! :checkers syntax)
(flycheck-add-next-checker 'intero '(warning . haskell-hlint)))
(when (featurep 'evil)
(add-hook 'intero-mode-hook #'evil-normalize-keymaps))
(map! :localleader
:map intero-mode-map
"t" #'intero-type-at
"i" #'intero-info
"l" #'intero-repl-load
"e" #'intero-repl-eval-region
"a" #'intero-apply-suggestions))

View file

@ -1,10 +1,13 @@
;;; lang/haskell/+lsp.el -*- lexical-binding: t; -*-
(use-package! lsp-haskell
:after haskell-mode
:init (add-hook 'haskell-mode-hook #'lsp!)
:after lsp-clients
:preface (add-hook 'haskell-mode-local-vars-hook #'lsp!)
:config
(when IS-MAC
(setq lsp-haskell-process-path-hie "hie-wrapper"))
(when (featurep! +ghcide)
(setq lsp-haskell-process-path-hie "ghcide"
lsp-haskell-process-args-hie nil))
;; Does some strange indentation if it pastes in the snippet
(setq-hook! 'haskell-mode-hook yas-indent-line 'fixed))

View file

@ -10,7 +10,8 @@
- [[#plugins][Plugins]]
- [[#prerequisites][Prerequisites]]
- [[#cabal][Cabal]]
- [[#lsp][LSP]]
- [[#lsp-haskell-ide-engine][LSP (haskell-ide-engine)]]
- [[#lsp-ghcide][LSP (ghcide)]]
- [[#stack][Stack]]
- [[#haskell-packages][Haskell packages]]
- [[#configuration][Configuration]]
@ -18,8 +19,8 @@
- [[#troubleshooting][Troubleshooting]]
* Description
This module adds [[https://www.haskell.org/][Haskell]] support, powered by either [[https://github.com/jyp/dante][dante]] (the default), LSP or
[[https://haskell-lang.org/intero][intero]].
This module adds [[https://www.haskell.org/][Haskell]] support, powered by either [[https://github.com/jyp/dante][dante]] (the default) or LSP
(haskell-language-server or ghcide).
+ Code completion (~company-ghc~)
+ Look up documentation (~hoogle~)
@ -41,9 +42,9 @@ Here are a few resources I've found indispensable in my Haskell adventures:
+ =+dante= Enables dante; a fork of intero aimed at lightweightedness. It
doesn't depend on =stack=, supports both ~cabal~-only and ~stack~ projects,
but lacks eldoc support.
+ =+lsp= Enables lsp-haskell (this requires the ~:tools lsp~ to be enabled).
+ =+intero= (Deprecated) Enables intero; a comprehensive, stack-based
development environment for Haskell.
+ =+ghcide= Enables LSP support with ghcide (requires the ~:tools lsp~ module).
+ =+lsp= Enables LSP support with haskell-ide-engine (requires the ~:tools lsp~
module).
** Plugins
+ [[https://github.com/haskell/haskell-mode][haskell-mode]]
@ -52,16 +53,13 @@ Here are a few resources I've found indispensable in my Haskell adventures:
+ [[https://github.com/jyp/attrap][attrap]]
+ =+lsp=
+ [[https://github.com/emacs-lsp/lsp-haskell][lsp-haskell]]
+ =+intero=
+ [[https://github.com/chrisdone/intero][intero]]
* Prerequisites
Depending on whether you use Intero, Dante or LSP, your dependencies will
differ:
Depending on whether you use Dante, haskell-language-server or ghcide, your
dependencies will differ:
+ Dante users need =cabal=, =ghc= and =ghc-mod=
+ LSP users need the =haskell-ide-engine= LSP server
+ Intero and LSP users need =stack=
+ LSP users need the =haskell-ide-engine= LSP server OR =ghcide=
+ All users will need the =hoogle= package
** Cabal
@ -83,7 +81,7 @@ sudo pacman -S cabal-install ghc
sudo zypper install cabal-install ghc
#+END_SRC
** LSP
** LSP (haskell-ide-engine)
You will need =stack= and =git= installed.
You will find a comprehensive [[https://github.com/haskell/haskell-ide-engine#installation][install guide for haskell-ide-engine on its
@ -92,7 +90,7 @@ project page]], but here's a TL;DR:
*** MacOS
haskell-ide-engine must be build and installed manually on MacOS, e.g.
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC bash
git clone https://github.com/haskell/haskell-ide-engine
cd haskell-ide-engine
make
@ -101,12 +99,14 @@ make
*** Arch Linux
=haskell-ide-engine-git= is available on the AUR
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC bash
yay -S haskell-ide-engine-git
#+END_SRC
** LSP (ghcide)
See https://github.com/digital-asset/ghcide for install instructions.
** Stack
To use Intero or LSP, you need =stack=:
To use LSP, you need =stack=:
*** MacOS
#+BEGIN_SRC sh

View file

@ -4,12 +4,9 @@
(defun +haskell/open-repl (&optional arg)
"Opens a Haskell REPL."
(interactive "P")
(if-let*
((window
(display-buffer
(if (featurep! +intero)
(intero-repl-buffer arg)
(haskell-session-interactive-buffer (haskell-session))))))
(if-let (window
(display-buffer
(haskell-session-interactive-buffer (haskell-session))))
(window-buffer window)
(error "Failed to display Haskell REPL")))

View file

@ -3,14 +3,9 @@
(after! projectile
(add-to-list 'projectile-project-root-files "stack.yaml"))
;; TODO ghcide?
(cond ((featurep! +intero) (load! "+intero")) ; DEPRECATED
((featurep! +dante) (load! "+dante"))
((featurep! +lsp) (load! "+lsp")))
;;
;; Common packages
;;; Common packages
(after! haskell-mode
(setq haskell-process-suggest-remove-import-lines t ; warnings for redundant imports etc
@ -40,8 +35,16 @@
(map! :localleader
:map haskell-mode-map
;; this is set to use cabal for dante users and stack for intero users:
"b" #'haskell-process-cabal-build
"c" #'haskell-cabal-visit-file
"h" #'haskell-hide-toggle
"H" #'haskell-hide-toggle-all))
;;
;;; Backends
(cond ((featurep! +dante) (load! "+dante"))
((or (featurep! +lsp)
(featurep! +ghcide))
(load! "+lsp")))

View file

@ -7,12 +7,6 @@
(when (featurep! +dante)
(unless (executable-find "cabal")
(warn! "Couldn't find cabal, haskell-mode may have issues")))
(when (featurep! +intero)
(unless (executable-find "stack")
(warn! "Couldn't find stack. Intero will not work")))
(when (or (featurep! +dante) (featurep! +intero))
(warn! "Couldn't find cabal, haskell-mode may have issues"))
(unless (executable-find "hlint")
(warn! "Couldn't find hlint. Flycheck may have issues in haskell-mode")))

View file

@ -1,13 +1,11 @@
;; -*- no-byte-compile: t; -*-
;;; lang/haskell/packages.el
(package! haskell-mode :pin "4a87d72589")
(package! haskell-mode :pin "7032966ee7")
(when (featurep! +dante)
(package! dante :pin "4955bc7363")
(package! attrap :pin "4cf3e4a162"))
(when (featurep! +lsp)
(package! lsp-haskell :pin "6d481f97e6"))
;; DEPRECATED
(when (featurep! +intero)
(package! intero :pin "fdb0550a2d"))
(when (or (featurep! +lsp)
(featurep! +ghcide))
(package! lsp-haskell :pin "582fa27c88"))

View file

@ -3,8 +3,8 @@
(use-package! lsp-java
:after lsp-clients
:init
(add-hook 'java-mode-local-vars-hook #'lsp!)
:hook (java-mode-local-vars . lsp!)
:preface
(setq lsp-java-server-install-dir (concat doom-etc-dir "eclipse.jdt.ls/server/")
lsp-java-workspace-dir (concat doom-etc-dir "java-workspace"))
:config

Some files were not shown because too many files have changed in this diff Show more