2017-06-08 11:47:56 +02:00
|
|
|
;;; core-editor.el -*- lexical-binding: t; -*-
|
2017-01-16 23:15:48 -05:00
|
|
|
|
2019-10-07 16:02:23 -04:00
|
|
|
(defvar doom-detect-indentation-excluded-modes '(fundamental-mode so-long-mode)
|
2019-07-21 04:02:09 +02:00
|
|
|
"A list of major modes in which indentation should be automatically
|
|
|
|
detected.")
|
|
|
|
|
2018-05-18 01:28:40 +02:00
|
|
|
(defvar-local doom-inhibit-indent-detection nil
|
|
|
|
"A buffer-local flag that indicates whether `dtrt-indent' should try to detect
|
|
|
|
indentation settings or not. This should be set by editorconfig if it
|
|
|
|
successfully sets indent_style/indent_size.")
|
|
|
|
|
2019-10-07 16:02:23 -04:00
|
|
|
(defvar-local doom-large-file-p nil)
|
|
|
|
(put 'doom-large-file-p 'permanent-local t)
|
|
|
|
|
2019-12-25 02:13:53 -05:00
|
|
|
(defvar doom-large-file-size-alist '(("." . 1.0))
|
|
|
|
"An alist mapping regexps (like `auto-mode-alist') to filesize thresholds.
|
2019-10-07 16:02:23 -04:00
|
|
|
|
2019-12-02 20:19:41 -05:00
|
|
|
If a file is opened and discovered to be larger than the threshold, Doom
|
|
|
|
performs emergency optimizations to prevent Emacs from hanging, crashing or
|
|
|
|
becoming unusably slow.
|
|
|
|
|
|
|
|
These thresholds are in MB, and is used by `doom--optimize-for-large-files-a'.")
|
2019-10-07 16:02:23 -04:00
|
|
|
|
|
|
|
(defvar doom-large-file-excluded-modes
|
|
|
|
'(so-long-mode special-mode archive-mode tar-mode jka-compr
|
|
|
|
git-commit-mode image-mode doc-view-mode doc-view-mode-maybe
|
|
|
|
ebrowse-tree-mode pdf-view-mode tags-table-mode)
|
|
|
|
"Major modes that `doom-check-large-file-h' will ignore.")
|
|
|
|
|
2018-07-29 02:54:19 +02:00
|
|
|
|
2019-07-26 22:05:26 +02:00
|
|
|
;;
|
|
|
|
;;; File handling
|
|
|
|
|
2020-10-18 17:12:39 -04:00
|
|
|
(defadvice! doom--prepare-for-large-files-a (size _ filename &rest _)
|
|
|
|
"Sets `doom-large-file-p' if the file is considered large.
|
2019-10-07 16:02:23 -04:00
|
|
|
|
2019-12-02 20:19:41 -05:00
|
|
|
Uses `doom-large-file-size-alist' to determine when a file is too large. When
|
2019-10-07 16:02:23 -04:00
|
|
|
`doom-large-file-p' is set, other plugins can detect this and reduce their
|
|
|
|
runtime costs (or disable themselves) to ensure the buffer is as fast as
|
|
|
|
possible."
|
2020-10-18 17:12:39 -04:00
|
|
|
:before #'abort-if-file-too-large
|
|
|
|
(and (numberp size)
|
|
|
|
(> size
|
|
|
|
(* 1024 1024
|
|
|
|
(assoc-default filename doom-large-file-size-alist
|
|
|
|
#'string-match-p)))
|
|
|
|
(setq doom-large-file-p size)))
|
|
|
|
|
|
|
|
(defadvice! doom--optimize-for-large-files-a (&rest _)
|
|
|
|
"Trigger `so-long-minor-mode' if the file is large."
|
|
|
|
:after #'after-find-file
|
|
|
|
(when (and doom-large-file-p buffer-file-name)
|
|
|
|
(if (memq major-mode doom-large-file-excluded-modes)
|
|
|
|
(setq doom-large-file-p nil)
|
|
|
|
(when (fboundp 'so-long-minor-mode) ; in case the user disabled it
|
|
|
|
(so-long-minor-mode +1))
|
|
|
|
(message "Large file detected! Cutting a few corners to improve performance..."))))
|
2019-10-07 16:02:23 -04:00
|
|
|
|
2019-07-26 22:05:26 +02:00
|
|
|
;; Resolve symlinks when opening files, so that any operations are conducted
|
|
|
|
;; from the file's true directory (like `find-file').
|
2019-12-08 16:10:31 -05:00
|
|
|
(setq find-file-visit-truename t
|
|
|
|
vc-follow-symlinks t)
|
2019-07-26 22:05:26 +02:00
|
|
|
|
|
|
|
;; Disable the warning "X and Y are the same file". It's fine to ignore this
|
|
|
|
;; warning as it will redirect you to the existing buffer anyway.
|
|
|
|
(setq find-file-suppress-same-file-warnings t)
|
|
|
|
|
|
|
|
;; Create missing directories when we open a file that doesn't exist under a
|
|
|
|
;; directory tree that may not exist.
|
|
|
|
(add-hook! 'find-file-not-found-functions
|
|
|
|
(defun doom-create-missing-directories-h ()
|
|
|
|
"Automatically create missing directories when creating new files."
|
2019-11-02 14:01:19 -04:00
|
|
|
(unless (file-remote-p buffer-file-name)
|
|
|
|
(let ((parent-directory (file-name-directory buffer-file-name)))
|
|
|
|
(and (not (file-directory-p parent-directory))
|
|
|
|
(y-or-n-p (format "Directory `%s' does not exist! Create it?"
|
|
|
|
parent-directory))
|
|
|
|
(progn (make-directory parent-directory 'parents)
|
|
|
|
t))))))
|
2019-07-26 22:05:26 +02:00
|
|
|
|
2020-10-18 17:18:13 -04:00
|
|
|
;; Don't generate backups or lockfiles. While auto-save maintains a copy so long
|
|
|
|
;; as a buffer is unsaved, backups create copies once, when the file is first
|
|
|
|
;; written, and never again until it is killed and reopened. This is better
|
|
|
|
;; suited to version control, and I don't want world-readable copies of
|
|
|
|
;; potentially sensitive material floating around our filesystem.
|
|
|
|
(setq create-lockfiles nil
|
2019-07-26 22:05:26 +02:00
|
|
|
make-backup-files nil
|
2020-10-20 23:12:16 -04:00
|
|
|
;; But in case the user does enable it, some sensible defaults:
|
|
|
|
version-control t ; number each backup file
|
|
|
|
backup-by-copying t ; instead of renaming current file (clobbers links)
|
|
|
|
delete-old-versions t ; clean up after itself
|
|
|
|
kept-old-versions 5
|
|
|
|
kept-new-versions 5
|
|
|
|
backup-directory-alist (list (cons "." (concat doom-cache-dir "backup/"))))
|
2019-07-26 22:05:26 +02:00
|
|
|
|
2020-10-18 17:18:13 -04:00
|
|
|
;; But turn on auto-save, so we have a fallback in case of crashes or lost data.
|
|
|
|
;; Use `recover-file' or `recover-session' to recover them.
|
|
|
|
(setq auto-save-default t
|
|
|
|
;; Don't auto-disable auto-save after deleting big chunks. Kind of
|
|
|
|
;; defaults the purpose of a fallback in case of crashes.
|
2020-10-20 23:12:16 -04:00
|
|
|
auto-save-include-big-deletions t
|
|
|
|
;; ...but have directories set up in case we use it.
|
|
|
|
auto-save-list-file-prefix (concat doom-cache-dir "autosave/")
|
|
|
|
auto-save-file-name-transforms (list (list ".*" auto-save-list-file-prefix t)))
|
2020-03-27 02:24:44 -04:00
|
|
|
|
2019-10-18 18:41:44 -04:00
|
|
|
(add-hook! 'after-save-hook
|
|
|
|
(defun doom-guess-mode-h ()
|
|
|
|
"Guess mode when saving a file in `fundamental-mode'."
|
2020-02-25 20:34:26 -05:00
|
|
|
(when (eq major-mode 'fundamental-mode)
|
|
|
|
(let ((buffer (or (buffer-base-buffer) (current-buffer))))
|
|
|
|
(and (buffer-file-name buffer)
|
|
|
|
(eq buffer (window-buffer (selected-window))) ; only visible buffers
|
|
|
|
(set-auto-mode))))))
|
2019-10-18 18:41:44 -04:00
|
|
|
|
2019-07-26 22:05:26 +02:00
|
|
|
|
2019-07-21 04:02:09 +02:00
|
|
|
;;
|
|
|
|
;;; Formatting
|
|
|
|
|
2020-04-08 15:29:29 -04:00
|
|
|
;; Favor spaces over tabs. Pls dun h8, but I think spaces (and 4 of them) is a
|
|
|
|
;; more consistent default than 8-space tabs. It can be changed on a per-mode
|
|
|
|
;; basis anyway (and is, where tabs are the canonical style, like go-mode).
|
|
|
|
(setq-default indent-tabs-mode nil
|
|
|
|
tab-width 4)
|
|
|
|
|
2020-09-01 01:41:39 -04:00
|
|
|
;; Only indent the line when at BOL or in a line's indentation. Anywhere else,
|
|
|
|
;; insert literal indentation.
|
|
|
|
(setq-default tab-always-indent nil)
|
|
|
|
|
2020-04-08 15:29:29 -04:00
|
|
|
;; Make `tabify' and `untabify' only affect indentation. Not tabs/spaces in the
|
|
|
|
;; middle of a line.
|
|
|
|
(setq tabify-regexp "^\t* [ \t]+")
|
|
|
|
|
|
|
|
;; An archaic default in the age of widescreen 4k displays? I disagree. We still
|
|
|
|
;; frequently split our terminals and editor frames, or have them side-by-side,
|
|
|
|
;; using up more of that newly available horizontal real-estate.
|
|
|
|
(setq-default fill-column 80)
|
|
|
|
|
|
|
|
;; Continue wrapped words at whitespace, rather than in the middle of a word.
|
|
|
|
(setq-default word-wrap t)
|
|
|
|
;; ...but don't do any wrapping by default. It's expensive. Enable
|
|
|
|
;; `visual-line-mode' if you want soft line-wrapping. `auto-fill-mode' for hard
|
|
|
|
;; line-wrapping.
|
|
|
|
(setq-default truncate-lines t)
|
|
|
|
;; If enabled (and `truncate-lines' was disabled), soft wrapping no longer
|
|
|
|
;; occurs when that window is less than `truncate-partial-width-windows'
|
|
|
|
;; characters wide. We don't need this, and it's extra work for Emacs otherwise,
|
|
|
|
;; so off it goes.
|
|
|
|
(setq truncate-partial-width-windows nil)
|
|
|
|
|
|
|
|
;; This was a widespread practice in the days of typewriters. I actually prefer
|
|
|
|
;; it when writing prose with monospace fonts, but it is obsolete otherwise.
|
|
|
|
(setq sentence-end-double-space nil)
|
|
|
|
|
|
|
|
;; The POSIX standard defines a line is "a sequence of zero or more non-newline
|
|
|
|
;; characters followed by a terminating newline", so files should end in a
|
|
|
|
;; newline. Windows doesn't respect this (because it's Windows), but we should,
|
|
|
|
;; since programmers' tools tend to be POSIX compliant.
|
|
|
|
(setq require-final-newline t)
|
|
|
|
|
2020-04-15 18:22:59 -04:00
|
|
|
;; Default to soft line-wrapping in text modes. It is more sensibile for text
|
|
|
|
;; modes, even if hard wrapping is more performant.
|
2020-04-15 13:12:10 -04:00
|
|
|
(add-hook 'text-mode-hook #'visual-line-mode)
|
2019-10-14 18:25:02 -04:00
|
|
|
|
2019-07-21 04:02:09 +02:00
|
|
|
|
|
|
|
;;
|
|
|
|
;;; Clipboard / kill-ring
|
|
|
|
|
2020-04-08 15:29:29 -04:00
|
|
|
;; Cull duplicates in the kill ring to reduce bloat and make the kill ring
|
|
|
|
;; easier to peruse (with `counsel-yank-pop' or `helm-show-kill-ring'.
|
2019-07-21 04:02:09 +02:00
|
|
|
(setq kill-do-not-save-duplicates t)
|
|
|
|
|
2020-04-08 15:29:29 -04:00
|
|
|
;; Allow UTF or composed text from the clipboard, even in the terminal or on
|
|
|
|
;; non-X systems (like Windows or macOS), where only `STRING' is used.
|
2019-07-21 04:02:09 +02:00
|
|
|
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
|
2017-06-05 23:00:50 +02:00
|
|
|
;;
|
2019-05-17 01:11:52 -04:00
|
|
|
;;; Extra file extensions to support
|
2017-06-05 23:00:50 +02:00
|
|
|
|
2020-07-26 18:26:33 -04:00
|
|
|
(nconc
|
|
|
|
auto-mode-alist
|
|
|
|
'(("/LICENSE\\'" . text-mode)
|
|
|
|
("\\.log\\'" . text-mode)
|
|
|
|
("rc\\'" . conf-mode)
|
|
|
|
("\\.\\(?:hex\\|nes\\)\\'" . hexl-mode)))
|
2018-05-17 15:29:54 +02:00
|
|
|
|
2019-02-18 00:09:57 -05:00
|
|
|
|
|
|
|
;;
|
2019-05-17 01:11:52 -04:00
|
|
|
;;; Built-in plugins
|
2018-05-14 18:40:35 +02:00
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! autorevert
|
2019-05-19 13:25:56 -04:00
|
|
|
;; revert buffers when their files/state have changed
|
2019-07-18 15:27:20 +02:00
|
|
|
:hook (focus-in . doom-auto-revert-buffers-h)
|
|
|
|
:hook (after-save . doom-auto-revert-buffers-h)
|
|
|
|
:hook (doom-switch-buffer . doom-auto-revert-buffer-h)
|
|
|
|
:hook (doom-switch-window . doom-auto-revert-buffer-h)
|
2018-05-14 18:40:35 +02:00
|
|
|
:config
|
2019-05-19 13:25:56 -04:00
|
|
|
(setq auto-revert-verbose t ; let us know when it happens
|
|
|
|
auto-revert-use-notify nil
|
2019-10-28 14:15:58 -04:00
|
|
|
auto-revert-stop-on-user-input nil
|
|
|
|
;; Only prompts for confirmation when buffer is unsaved.
|
|
|
|
revert-without-query (list "."))
|
2019-05-19 13:25:56 -04:00
|
|
|
|
2020-08-20 03:35:29 -04:00
|
|
|
;; `auto-revert-mode' and `global-auto-revert-mode' would, normally, abuse the
|
|
|
|
;; heck out of inotify handles _or_ aggresively poll your buffer list every X
|
|
|
|
;; seconds. Too many inotify handles can grind Emacs to a halt if you preform
|
|
|
|
;; expensive or batch processes on files outside of Emacs (e.g. their mtime
|
|
|
|
;; changes), and polling your buffer list is terribly inefficient as your
|
|
|
|
;; buffer list grows into the tens or hundreds.
|
2019-05-19 13:25:56 -04:00
|
|
|
;;
|
2020-08-20 03:35:29 -04:00
|
|
|
;; So Doom uses a different strategy: we lazily auto revert buffers when the
|
|
|
|
;; user a) saves a file, b) switches to a buffer (or its window), or c) you
|
|
|
|
;; focus Emacs (after using another program). This way, Emacs only ever has to
|
|
|
|
;; operate on, at minimum, a single buffer and, at maximum, X buffers, where X
|
|
|
|
;; is the number of open windows (which is rarely, if ever, over 10).
|
2019-07-18 15:27:20 +02:00
|
|
|
(defun doom-auto-revert-buffer-h ()
|
|
|
|
"Auto revert current buffer, if necessary."
|
2019-10-20 09:33:07 -04:00
|
|
|
(unless (or auto-revert-mode (active-minibuffer-window))
|
2020-08-13 22:46:51 -04:00
|
|
|
(let ((auto-revert-mode t))
|
|
|
|
(auto-revert-handler))))
|
2019-07-18 15:27:20 +02:00
|
|
|
|
|
|
|
(defun doom-auto-revert-buffers-h ()
|
2019-10-20 09:33:07 -04:00
|
|
|
"Auto revert stale buffers in visible windows, if necessary."
|
|
|
|
(dolist (buf (doom-visible-buffers))
|
|
|
|
(with-current-buffer buf
|
|
|
|
(doom-auto-revert-buffer-h)))))
|
2019-06-18 00:51:59 +02:00
|
|
|
|
2018-05-14 18:40:35 +02:00
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! recentf
|
2019-05-18 14:42:59 -04:00
|
|
|
;; Keep track of recently opened files
|
2019-07-21 23:31:42 +02:00
|
|
|
:defer-incrementally easymenu tree-widget timer
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
:hook (doom-first-file . recentf-mode)
|
2019-05-18 14:42:59 -04:00
|
|
|
:commands recentf-open-files
|
|
|
|
:config
|
2019-10-23 03:57:48 -04:00
|
|
|
(defun doom--recent-file-truename (file)
|
|
|
|
(if (or (file-remote-p file nil t)
|
|
|
|
(not (file-remote-p file)))
|
|
|
|
(file-truename file)
|
|
|
|
file))
|
2019-12-30 17:07:39 -05:00
|
|
|
(setq recentf-filename-handlers
|
2020-08-20 03:35:29 -04:00
|
|
|
'(;; Text properties inflate the size of recentf's files, and there is
|
|
|
|
;; no purpose in persisting them, so we strip them out.
|
|
|
|
substring-no-properties
|
|
|
|
;; Resolve symlinks of local files. Otherwise we get duplicate
|
|
|
|
;; entries opening symlinks.
|
|
|
|
doom--recent-file-truename
|
|
|
|
;; Replace $HOME with ~, which is more portable, and reduces how much
|
|
|
|
;; horizontal space the recentf listing uses to list recent files.
|
|
|
|
abbreviate-file-name)
|
2019-12-30 17:07:39 -05:00
|
|
|
recentf-save-file (concat doom-cache-dir "recentf")
|
2019-05-18 14:42:59 -04:00
|
|
|
recentf-auto-cleanup 'never
|
|
|
|
recentf-max-menu-items 0
|
2019-12-08 16:10:52 -05:00
|
|
|
recentf-max-saved-items 200)
|
2019-06-07 23:01:58 +02:00
|
|
|
|
2019-07-18 15:27:20 +02:00
|
|
|
(add-hook! '(doom-switch-window-hook write-file-functions)
|
|
|
|
(defun doom--recentf-touch-buffer-h ()
|
|
|
|
"Bump file in recent file list when it is switched or written to."
|
|
|
|
(when buffer-file-name
|
|
|
|
(recentf-add-file buffer-file-name))
|
|
|
|
;; Return nil for `write-file-functions'
|
|
|
|
nil))
|
2019-06-07 22:58:46 +02:00
|
|
|
|
2019-07-26 22:05:26 +02:00
|
|
|
(add-hook! 'dired-mode-hook
|
2019-07-18 15:27:20 +02:00
|
|
|
(defun doom--recentf-add-dired-directory-h ()
|
|
|
|
"Add dired directory to recentf file list."
|
|
|
|
(recentf-add-file default-directory)))
|
2019-06-07 22:58:46 +02:00
|
|
|
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
(add-hook 'kill-emacs-hook #'recentf-cleanup)
|
|
|
|
(advice-add #'recentf-load-list :around #'doom-shut-up-a))
|
2019-05-18 14:42:59 -04:00
|
|
|
|
2019-07-21 04:02:09 +02:00
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! savehist
|
2018-09-07 21:43:32 -04:00
|
|
|
;; persist variables across sessions
|
2019-07-21 23:31:42 +02:00
|
|
|
:defer-incrementally custom
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
:hook (doom-first-input . savehist-mode)
|
|
|
|
:init
|
|
|
|
(setq savehist-file (concat doom-cache-dir "savehist"))
|
2018-05-14 18:40:35 +02:00
|
|
|
:config
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
(setq savehist-save-minibuffer-history t
|
2020-08-05 16:15:59 -04:00
|
|
|
savehist-autosave-interval nil ; save on kill only
|
|
|
|
savehist-additional-variables
|
|
|
|
'(kill-ring ; persist clipboard
|
|
|
|
mark-ring global-mark-ring ; persist marks
|
|
|
|
search-ring regexp-search-ring)) ; persist searches
|
|
|
|
(add-hook! 'savehist-save-hook
|
2019-07-18 15:27:20 +02:00
|
|
|
(defun doom-unpropertize-kill-ring-h ()
|
|
|
|
"Remove text properties from `kill-ring' for a smaller savehist file."
|
|
|
|
(setq kill-ring (cl-loop for item in kill-ring
|
|
|
|
if (stringp item)
|
|
|
|
collect (substring-no-properties item)
|
|
|
|
else if item collect it)))))
|
|
|
|
|
2018-05-14 18:40:35 +02:00
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! saveplace
|
2018-09-07 21:43:32 -04:00
|
|
|
;; persistent point location in buffers
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
:hook (doom-first-file . save-place-mode)
|
|
|
|
:init
|
2019-04-29 18:54:46 -04:00
|
|
|
(setq save-place-file (concat doom-cache-dir "saveplace")
|
2019-09-28 12:23:31 -04:00
|
|
|
save-place-limit 100)
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
:config
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! doom--recenter-on-load-saveplace-a (&rest _)
|
2018-05-14 18:40:35 +02:00
|
|
|
"Recenter on cursor when loading a saved place."
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
:after-while #'save-place-find-file-hook
|
2018-05-14 18:40:35 +02:00
|
|
|
(if buffer-file-name (ignore-errors (recenter))))
|
2019-09-28 12:23:31 -04:00
|
|
|
|
2019-12-25 02:15:48 -05:00
|
|
|
(defadvice! doom--inhibit-saveplace-in-long-files-a (orig-fn &rest args)
|
|
|
|
:around #'save-place-to-alist
|
|
|
|
(unless doom-large-file-p
|
|
|
|
(apply orig-fn args)))
|
|
|
|
|
2019-09-28 12:23:31 -04:00
|
|
|
(defadvice! doom--dont-prettify-saveplace-cache-a (orig-fn)
|
|
|
|
"`save-place-alist-to-file' uses `pp' to prettify the contents of its cache.
|
|
|
|
`pp' can be expensive for longer lists, and there's no reason to prettify cache
|
|
|
|
files, so we replace calls to `pp' with the much faster `prin1'."
|
|
|
|
:around #'save-place-alist-to-file
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
(letf! ((#'pp #'prin1)) (funcall orig-fn))))
|
2017-06-05 23:00:50 +02:00
|
|
|
|
2019-07-21 04:02:09 +02:00
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! server
|
2019-05-18 14:42:59 -04:00
|
|
|
:when (display-graphic-p)
|
2019-07-21 23:31:42 +02:00
|
|
|
:after-call pre-command-hook after-find-file focus-out-hook
|
2019-12-20 23:00:54 -05:00
|
|
|
:defer 1
|
2019-06-16 23:01:17 +02:00
|
|
|
:init
|
2019-06-25 21:38:16 +02:00
|
|
|
(when-let (name (getenv "EMACS_SERVER_NAME"))
|
2019-05-18 14:42:59 -04:00
|
|
|
(setq server-name name))
|
2019-06-16 23:01:17 +02:00
|
|
|
:config
|
2019-05-18 14:42:59 -04:00
|
|
|
(unless (server-running-p)
|
|
|
|
(server-start)))
|
2018-05-14 18:40:35 +02:00
|
|
|
|
2017-06-05 23:00:50 +02:00
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
;;
|
2019-04-21 23:22:06 -04:00
|
|
|
;;; Packages
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! better-jumper
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
:hook (doom-first-input . better-jumper-mode)
|
2020-07-13 17:14:57 -04:00
|
|
|
:commands doom-set-jump-a doom-set-jump-maybe-a doom-set-jump-h
|
2019-09-20 14:36:50 -04:00
|
|
|
:preface
|
|
|
|
;; REVIEW Suppress byte-compiler warning spawning a *Compile-Log* buffer at
|
|
|
|
;; startup. This can be removed once gilbertw1/better-jumper#2 is merged.
|
|
|
|
(defvar better-jumper-local-mode nil)
|
2019-04-21 23:22:06 -04:00
|
|
|
:init
|
|
|
|
(global-set-key [remap evil-jump-forward] #'better-jumper-jump-forward)
|
|
|
|
(global-set-key [remap evil-jump-backward] #'better-jumper-jump-backward)
|
2019-07-13 15:46:15 +02:00
|
|
|
(global-set-key [remap xref-pop-marker-stack] #'better-jumper-jump-backward)
|
2019-04-21 23:22:06 -04:00
|
|
|
:config
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
(defun doom-set-jump-a (orig-fn &rest args)
|
2019-04-21 23:22:06 -04:00
|
|
|
"Set a jump point and ensure ORIG-FN doesn't set any new jump points."
|
|
|
|
(better-jumper-set-jump (if (markerp (car args)) (car args)))
|
|
|
|
(let ((evil--jumps-jumping t)
|
|
|
|
(better-jumper--jumping t))
|
|
|
|
(apply orig-fn args)))
|
|
|
|
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
(defun doom-set-jump-maybe-a (orig-fn &rest args)
|
2019-04-21 23:22:06 -04:00
|
|
|
"Set a jump point if ORIG-FN returns non-nil."
|
|
|
|
(let ((origin (point-marker))
|
|
|
|
(result
|
|
|
|
(let* ((evil--jumps-jumping t)
|
|
|
|
(better-jumper--jumping t))
|
|
|
|
(apply orig-fn args))))
|
|
|
|
(unless result
|
|
|
|
(with-current-buffer (marker-buffer origin)
|
|
|
|
(better-jumper-set-jump
|
|
|
|
(if (markerp (car args))
|
|
|
|
(car args)
|
|
|
|
origin))))
|
|
|
|
result))
|
|
|
|
|
2019-07-18 15:27:20 +02:00
|
|
|
(defun doom-set-jump-h ()
|
2019-04-21 23:22:06 -04:00
|
|
|
"Run `better-jumper-set-jump' but return nil, for short-circuiting hooks."
|
|
|
|
(better-jumper-set-jump)
|
2019-10-07 23:56:47 -04:00
|
|
|
nil)
|
|
|
|
|
|
|
|
;; Creates a jump point before killing a buffer. This allows you to undo
|
|
|
|
;; killing a buffer easily (only works with file buffers though; it's not
|
|
|
|
;; possible to resurrect special buffers).
|
2019-10-10 13:43:47 +10:00
|
|
|
(advice-add #'kill-current-buffer :around #'doom-set-jump-a)
|
|
|
|
|
|
|
|
;; Create a jump point before jumping with imenu.
|
|
|
|
(advice-add #'imenu :around #'doom-set-jump-a))
|
2019-04-21 23:22:06 -04:00
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! dtrt-indent
|
2018-09-07 21:43:32 -04:00
|
|
|
;; Automatic detection of indent settings
|
2020-05-25 02:58:07 -04:00
|
|
|
:when doom-interactive-p
|
2020-04-08 15:29:29 -04:00
|
|
|
:hook ((change-major-mode-after-body read-only-mode) . doom-detect-indentation-h)
|
2018-07-29 02:54:19 +02:00
|
|
|
:config
|
2020-04-08 15:29:29 -04:00
|
|
|
(defun doom-detect-indentation-h ()
|
|
|
|
(unless (or (not after-init-time)
|
|
|
|
doom-inhibit-indent-detection
|
|
|
|
doom-large-file-p
|
|
|
|
(memq major-mode doom-detect-indentation-excluded-modes)
|
|
|
|
(member (substring (buffer-name) 0 1) '(" " "*")))
|
|
|
|
;; Don't display messages in the echo area, but still log them
|
2020-05-25 02:58:07 -04:00
|
|
|
(let ((inhibit-message (not doom-debug-p)))
|
2020-04-08 15:29:29 -04:00
|
|
|
(dtrt-indent-mode +1))))
|
|
|
|
|
2019-10-07 16:06:49 -04:00
|
|
|
;; Enable dtrt-indent even in smie modes so that it can update `tab-width',
|
|
|
|
;; `standard-indent' and `evil-shift-width' there as well.
|
2019-05-22 14:50:31 -04:00
|
|
|
(setq dtrt-indent-run-after-smie t)
|
2019-10-07 16:06:49 -04:00
|
|
|
;; Reduced from the default of 5000 for slightly faster analysis
|
|
|
|
(setq dtrt-indent-max-lines 2000)
|
2019-05-22 14:50:31 -04:00
|
|
|
|
2018-09-07 21:43:32 -04:00
|
|
|
;; always keep tab-width up-to-date
|
|
|
|
(push '(t tab-width) dtrt-indent-hook-generic-mapping-list)
|
|
|
|
|
|
|
|
(defvar dtrt-indent-run-after-smie)
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! doom--fix-broken-smie-modes-a (orig-fn arg)
|
2018-08-30 22:39:03 +02:00
|
|
|
"Some smie modes throw errors when trying to guess their indentation, like
|
|
|
|
`nim-mode'. This prevents them from leaving Emacs in a broken state."
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
:around #'dtrt-indent-mode
|
2018-08-30 22:39:03 +02:00
|
|
|
(let ((dtrt-indent-run-after-smie dtrt-indent-run-after-smie))
|
2020-04-29 21:08:17 -04:00
|
|
|
(letf! ((defun symbol-config--guess (beg end)
|
|
|
|
(funcall symbol-config--guess beg (min end 10000)))
|
|
|
|
(defun smie-config-guess ()
|
|
|
|
(condition-case e (funcall smie-config-guess)
|
|
|
|
(error (setq dtrt-indent-run-after-smie t)
|
|
|
|
(message "[WARNING] Indent detection: %s"
|
|
|
|
(error-message-string e))
|
|
|
|
(message ""))))) ; warn silently
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
(funcall orig-fn arg)))))
|
2018-07-29 02:54:19 +02:00
|
|
|
|
2018-09-07 21:43:32 -04:00
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! helpful
|
2019-05-18 14:42:59 -04:00
|
|
|
;; a better *help* buffer
|
|
|
|
:commands helpful--read-symbol
|
|
|
|
:init
|
2019-12-24 00:00:40 -05:00
|
|
|
(global-set-key [remap describe-function] #'helpful-callable)
|
|
|
|
(global-set-key [remap describe-command] #'helpful-command)
|
|
|
|
(global-set-key [remap describe-variable] #'helpful-variable)
|
|
|
|
(global-set-key [remap describe-key] #'helpful-key)
|
2020-01-11 17:21:35 -05:00
|
|
|
(global-set-key [remap describe-symbol] #'helpful-symbol)
|
2019-05-18 14:42:59 -04:00
|
|
|
|
2019-07-21 14:58:12 +02:00
|
|
|
(defun doom-use-helpful-a (orig-fn &rest args)
|
|
|
|
"Force ORIG-FN to use helpful instead of the old describe-* commands."
|
2020-04-29 21:08:17 -04:00
|
|
|
(letf! ((#'describe-function #'helpful-function)
|
|
|
|
(#'describe-variable #'helpful-variable))
|
2019-07-21 14:58:12 +02:00
|
|
|
(apply orig-fn args)))
|
|
|
|
|
2019-05-18 14:42:59 -04:00
|
|
|
(after! apropos
|
|
|
|
;; patch apropos buttons to call helpful instead of help
|
|
|
|
(dolist (fun-bt '(apropos-function apropos-macro apropos-command))
|
|
|
|
(button-type-put
|
|
|
|
fun-bt 'action
|
|
|
|
(lambda (button)
|
|
|
|
(helpful-callable (button-get button 'apropos-symbol)))))
|
|
|
|
(dolist (var-bt '(apropos-variable apropos-user-option))
|
|
|
|
(button-type-put
|
|
|
|
var-bt 'action
|
|
|
|
(lambda (button)
|
|
|
|
(helpful-variable (button-get button 'apropos-symbol)))))))
|
|
|
|
|
|
|
|
|
2019-05-19 02:13:20 -04:00
|
|
|
;;;###package imenu
|
|
|
|
(add-hook 'imenu-after-jump-hook #'recenter)
|
2019-05-18 15:55:15 -04:00
|
|
|
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! smartparens
|
2019-05-18 14:42:59 -04:00
|
|
|
;; Auto-close delimiters and blocks as you type. It's more powerful than that,
|
|
|
|
;; but that is all Doom uses it for.
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
:hook (doom-first-buffer . smartparens-global-mode)
|
2019-07-21 23:31:42 +02:00
|
|
|
:commands sp-pair sp-local-pair sp-with-modes sp-point-in-comment sp-point-in-string
|
2019-05-18 14:42:59 -04:00
|
|
|
:config
|
2020-03-06 15:24:22 -05:00
|
|
|
;; smartparens recognizes `slime-mrepl-mode', but not `sly-mrepl-mode', so...
|
|
|
|
(add-to-list 'sp-lisp-modes 'sly-mrepl-mode)
|
2019-07-22 02:38:20 +02:00
|
|
|
;; Load default smartparens rules for various languages
|
2019-05-18 14:42:59 -04:00
|
|
|
(require 'smartparens-config)
|
2019-07-22 02:38:20 +02:00
|
|
|
;; Overlays are too distracting and not terribly helpful. show-parens does
|
2019-12-20 00:47:04 -05:00
|
|
|
;; this for us already (and is faster), so...
|
2019-05-18 14:42:59 -04:00
|
|
|
(setq sp-highlight-pair-overlay nil
|
|
|
|
sp-highlight-wrap-overlay nil
|
2019-07-22 02:38:20 +02:00
|
|
|
sp-highlight-wrap-tag-overlay nil)
|
2019-12-31 19:17:55 -05:00
|
|
|
(with-eval-after-load 'evil
|
|
|
|
;; But if someone does want overlays enabled, evil users will be stricken
|
|
|
|
;; with an off-by-one issue where smartparens assumes you're outside the
|
|
|
|
;; pair when you're really at the last character in insert mode. We must
|
|
|
|
;; correct this vile injustice.
|
|
|
|
(setq sp-show-pair-from-inside t)
|
|
|
|
;; ...and stay highlighted until we've truly escaped the pair!
|
|
|
|
(setq sp-cancel-autoskip-on-backward-movement nil))
|
|
|
|
|
2019-07-22 02:38:20 +02:00
|
|
|
;; The default is 100, because smartparen's scans are relatively expensive
|
2020-01-05 19:58:59 -05:00
|
|
|
;; (especially with large pair lists for some modes), we reduce it, as a
|
2019-07-22 02:38:20 +02:00
|
|
|
;; better compromise between performance and accuracy.
|
2020-01-05 19:58:59 -05:00
|
|
|
(setq sp-max-prefix-length 25)
|
|
|
|
;; No pair has any business being longer than 4 characters; if they must, set
|
|
|
|
;; it buffer-locally. It's less work for smartparens.
|
2019-07-22 02:38:20 +02:00
|
|
|
(setq sp-max-pair-length 4)
|
|
|
|
;; This isn't always smart enough to determine when we're in a string or not.
|
|
|
|
;; See https://github.com/Fuco1/smartparens/issues/783.
|
|
|
|
(setq sp-escape-quotes-after-insert nil)
|
|
|
|
|
|
|
|
;; Silence some harmless but annoying echo-area spam
|
|
|
|
(dolist (key '(:unmatched-expression :no-matching-tag))
|
2019-12-20 00:47:04 -05:00
|
|
|
(setf (alist-get key sp-message-alist) nil))
|
2019-07-22 02:38:20 +02:00
|
|
|
|
2019-07-26 22:05:26 +02:00
|
|
|
(add-hook! 'minibuffer-setup-hook
|
2019-07-22 02:38:20 +02:00
|
|
|
(defun doom-init-smartparens-in-minibuffer-maybe-h ()
|
2020-01-03 00:21:01 +08:00
|
|
|
"Enable `smartparens-mode' in the minibuffer, during `eval-expression',
|
|
|
|
`pp-eval-expression' or `evil-ex'."
|
2020-05-01 16:01:21 -04:00
|
|
|
(and (memq this-command '(eval-expression pp-eval-expression evil-ex))
|
|
|
|
smartparens-global-mode
|
|
|
|
(smartparens-mode))))
|
2019-05-22 03:51:12 -04:00
|
|
|
|
2019-07-22 02:38:20 +02:00
|
|
|
;; You're likely writing lisp in the minibuffer, therefore, disable these
|
|
|
|
;; quote pairs, which lisps doesn't use for strings:
|
2019-05-18 14:42:59 -04:00
|
|
|
(sp-local-pair 'minibuffer-inactive-mode "'" nil :actions nil)
|
2019-05-22 03:51:12 -04:00
|
|
|
(sp-local-pair 'minibuffer-inactive-mode "`" nil :actions nil)
|
2019-05-18 14:42:59 -04:00
|
|
|
|
2019-07-22 02:38:20 +02:00
|
|
|
;; Smartparens breaks evil-mode's replace state
|
2019-09-30 14:58:06 -04:00
|
|
|
(defvar doom-buffer-smartparens-mode nil)
|
|
|
|
(add-hook! 'evil-replace-state-exit-hook
|
|
|
|
(defun doom-enable-smartparens-mode-maybe-h ()
|
|
|
|
(when doom-buffer-smartparens-mode
|
|
|
|
(turn-on-smartparens-mode)
|
|
|
|
(kill-local-variable 'doom-buffer-smartparens-mode))))
|
|
|
|
(add-hook! 'evil-replace-state-entry-hook
|
|
|
|
(defun doom-disable-smartparens-mode-maybe-h ()
|
|
|
|
(when smartparens-mode
|
|
|
|
(setq-local doom-buffer-smartparens-mode t)
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
(turn-off-smartparens-mode)))))
|
2019-05-18 14:42:59 -04:00
|
|
|
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! so-long
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
:hook (doom-first-file . global-so-long-mode)
|
2019-10-08 21:07:50 -04:00
|
|
|
:config
|
2020-02-26 18:05:58 -05:00
|
|
|
(setq so-long-threshold 400) ; reduce false positives w/ larger threshold
|
2019-10-22 11:16:49 -04:00
|
|
|
;; Don't disable syntax highlighting and line numbers, or make the buffer
|
|
|
|
;; read-only, in `so-long-minor-mode', so we can have a basic editing
|
|
|
|
;; experience in them, at least. It will remain off in `so-long-mode',
|
|
|
|
;; however, because long files have a far bigger impact on Emacs performance.
|
2019-10-08 21:07:50 -04:00
|
|
|
(delq! 'font-lock-mode so-long-minor-modes)
|
|
|
|
(delq! 'display-line-numbers-mode so-long-minor-modes)
|
2019-10-22 11:16:49 -04:00
|
|
|
(delq! 'buffer-read-only so-long-variable-overrides 'assq)
|
|
|
|
;; ...but at least reduce the level of syntax highlighting
|
2019-10-20 10:01:23 -04:00
|
|
|
(add-to-list 'so-long-variable-overrides '(font-lock-maximum-decoration . 1))
|
2019-12-25 21:15:30 -05:00
|
|
|
;; ...and insist that save-place not operate in large/long files
|
|
|
|
(add-to-list 'so-long-variable-overrides '(save-place-alist . nil))
|
2019-12-09 18:14:20 -05:00
|
|
|
;; Text files could possibly be too long too
|
|
|
|
(add-to-list 'so-long-target-modes 'text-mode)
|
2019-10-20 10:01:23 -04:00
|
|
|
;; But disable everything else that may be unnecessary/expensive for large
|
|
|
|
;; or wide buffers.
|
2019-10-08 21:07:50 -04:00
|
|
|
(appendq! so-long-minor-modes
|
|
|
|
'(flycheck-mode
|
2019-10-20 10:01:23 -04:00
|
|
|
flyspell-mode
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
spell-fu-mode
|
2019-10-08 21:07:50 -04:00
|
|
|
eldoc-mode
|
|
|
|
smartparens-mode
|
|
|
|
highlight-numbers-mode
|
|
|
|
better-jumper-local-mode
|
|
|
|
ws-butler-mode
|
|
|
|
auto-composition-mode
|
|
|
|
undo-tree-mode
|
|
|
|
highlight-indent-guides-mode
|
2019-12-13 14:55:50 -05:00
|
|
|
hl-fill-column-mode))
|
|
|
|
(defun doom-buffer-has-long-lines-p ()
|
2020-01-15 02:20:46 -05:00
|
|
|
;; HACK Fix #2183: `so-long-detected-long-line-p' tries to parse comment
|
2020-02-26 18:05:58 -05:00
|
|
|
;; syntax, but in some buffers comment state isn't initialized,
|
|
|
|
;; leading to a wrong-type-argument: stringp error.
|
|
|
|
(let ((so-long-skip-leading-comments (bound-and-true-p comment-use-syntax))
|
|
|
|
;; HACK If visual-line-mode is on, then false positives are more
|
|
|
|
;; likely, so up the threshold. More so in text-mode, since long
|
|
|
|
;; paragraphs are the norm.
|
|
|
|
(so-long-threshold
|
|
|
|
(if visual-line-mode
|
|
|
|
(* so-long-threshold
|
|
|
|
(if (derived-mode-p 'text-mode)
|
2020-07-24 02:29:03 -04:00
|
|
|
4
|
2020-02-26 18:05:58 -05:00
|
|
|
2))
|
|
|
|
so-long-threshold)))
|
|
|
|
(so-long-detected-long-line-p)))
|
2019-12-13 14:55:50 -05:00
|
|
|
(setq so-long-predicate #'doom-buffer-has-long-lines-p))
|
2019-07-21 04:12:01 +02:00
|
|
|
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! ws-butler
|
2018-09-07 21:43:32 -04:00
|
|
|
;; a less intrusive `delete-trailing-whitespaces' on save
|
2020-10-11 16:23:31 -04:00
|
|
|
:hook (doom-first-buffer . ws-butler-global-mode)
|
|
|
|
:config
|
|
|
|
;; ws-butler normally preserves whitespace in the buffer (but strips it from
|
|
|
|
;; the written file). While sometimes convenient, this behavior is not
|
|
|
|
;; intuitive. To the average user it looks like whitespace cleanup is failing,
|
|
|
|
;; which causes folks to redundantly install their own.
|
|
|
|
(setq ws-butler-keep-whitespace-before-point nil))
|
2018-08-31 13:56:50 +02:00
|
|
|
|
2015-06-04 18:23:21 -04:00
|
|
|
(provide 'core-editor)
|
|
|
|
;;; core-editor.el ends here
|