2017-06-09 00:19:44 +02:00
|
|
|
|
;;; core-ui.el -*- lexical-binding: t; -*-
|
2015-06-15 09:05:52 +02:00
|
|
|
|
|
2019-03-02 01:12:48 -05:00
|
|
|
|
;;
|
|
|
|
|
;;; Variables
|
|
|
|
|
|
2017-06-28 16:18:22 +02:00
|
|
|
|
(defvar doom-theme nil
|
2018-09-20 14:16:21 -04:00
|
|
|
|
"A symbol representing the Emacs theme to load at startup.
|
|
|
|
|
|
2020-11-04 19:49:35 -05:00
|
|
|
|
Set to `default' to load no theme at all. This is changed by `load-theme'.")
|
2017-06-28 16:18:22 +02:00
|
|
|
|
|
2017-07-04 19:53:39 +02:00
|
|
|
|
(defvar doom-font nil
|
2018-09-28 20:45:20 -04:00
|
|
|
|
"The default font to use.
|
2020-07-22 11:04:34 -04:00
|
|
|
|
Must be a `font-spec', a font object, an XFT font string, or an XLFD string.
|
2018-09-20 14:16:21 -04:00
|
|
|
|
|
2018-09-27 23:04:16 -04:00
|
|
|
|
This affects the `default' and `fixed-pitch' faces.
|
|
|
|
|
|
2018-09-20 14:16:21 -04:00
|
|
|
|
Examples:
|
|
|
|
|
(setq doom-font (font-spec :family \"Fira Mono\" :size 12))
|
|
|
|
|
(setq doom-font \"Terminus (TTF):pixelsize=12:antialias=off\")")
|
2017-06-28 16:18:22 +02:00
|
|
|
|
|
2017-07-04 19:53:39 +02:00
|
|
|
|
(defvar doom-variable-pitch-font nil
|
2020-07-22 11:04:34 -04:00
|
|
|
|
"The default font to use for variable-pitch text.
|
|
|
|
|
Must be a `font-spec', a font object, an XFT font string, or an XLFD string. See
|
2018-09-28 20:45:20 -04:00
|
|
|
|
`doom-font' for examples.
|
|
|
|
|
|
2020-07-22 11:04:34 -04:00
|
|
|
|
An omitted font size means to inherit `doom-font''s size.")
|
2018-09-28 20:45:20 -04:00
|
|
|
|
|
|
|
|
|
(defvar doom-serif-font nil
|
|
|
|
|
"The default font to use for the `fixed-pitch-serif' face.
|
2020-07-22 11:04:34 -04:00
|
|
|
|
Must be a `font-spec', a font object, an XFT font string, or an XLFD string. See
|
2018-09-28 20:45:20 -04:00
|
|
|
|
`doom-font' for examples.
|
|
|
|
|
|
2020-07-22 11:04:34 -04:00
|
|
|
|
An omitted font size means to inherit `doom-font''s size.")
|
2017-06-28 16:18:22 +02:00
|
|
|
|
|
2021-05-06 04:06:19 -04:00
|
|
|
|
(defvar doom-unicode-font nil
|
2020-07-22 11:04:34 -04:00
|
|
|
|
"Fallback font for Unicode glyphs.
|
|
|
|
|
Must be a `font-spec', a font object, an XFT font string, or an XLFD string. See
|
|
|
|
|
`doom-font' for examples.
|
2018-09-28 20:45:20 -04:00
|
|
|
|
|
2020-07-22 11:04:34 -04:00
|
|
|
|
The defaults on macOS and Linux are Apple Color Emoji and Symbola, respectively.
|
2018-09-28 20:45:20 -04:00
|
|
|
|
|
2021-06-05 12:54:54 -04:00
|
|
|
|
WARNING: if you specify a size for this font it will hard-lock any usage of this
|
|
|
|
|
font to that size. It's rarely a good idea to do so!")
|
2017-06-28 16:18:22 +02:00
|
|
|
|
|
2021-05-06 04:06:19 -04:00
|
|
|
|
(defvar doom-emoji-fallback-font-families
|
|
|
|
|
'("Apple Color Emoji"
|
|
|
|
|
"Segoe UI Emoji"
|
|
|
|
|
"Noto Color Emoji"
|
|
|
|
|
"Noto Emoji")
|
|
|
|
|
"A list of fallback font families to use for emojis.")
|
|
|
|
|
|
|
|
|
|
(defvar doom-symbol-fallback-font-families
|
|
|
|
|
'("Segoe UI Symbol"
|
|
|
|
|
"Apple Symbols")
|
|
|
|
|
"A list of fallback font families for general symbol glyphs.")
|
2020-04-30 17:02:24 -04:00
|
|
|
|
|
2017-06-28 16:18:22 +02:00
|
|
|
|
|
2018-05-24 22:03:17 +02:00
|
|
|
|
;;
|
2019-03-02 01:12:48 -05:00
|
|
|
|
;;; Custom hooks
|
|
|
|
|
|
2017-06-28 16:18:22 +02:00
|
|
|
|
(defvar doom-init-ui-hook nil
|
2018-05-11 00:08:50 +02:00
|
|
|
|
"List of hooks to run when the UI has been initialized.")
|
|
|
|
|
|
2019-03-02 01:12:48 -05:00
|
|
|
|
(defvar doom-load-theme-hook nil
|
|
|
|
|
"Hook run after the theme is loaded with `load-theme' or reloaded with
|
|
|
|
|
`doom/reload-theme'.")
|
|
|
|
|
|
2019-03-07 00:26:51 -05:00
|
|
|
|
(defvar doom-switch-buffer-hook nil
|
2019-04-05 22:50:09 -04:00
|
|
|
|
"A list of hooks run after changing the current buffer.")
|
2019-03-02 01:12:48 -05:00
|
|
|
|
|
2019-03-07 00:26:51 -05:00
|
|
|
|
(defvar doom-switch-window-hook nil
|
2019-04-05 22:50:09 -04:00
|
|
|
|
"A list of hooks run after changing the focused windows.")
|
2019-03-02 01:12:48 -05:00
|
|
|
|
|
2019-03-07 00:26:51 -05:00
|
|
|
|
(defvar doom-switch-frame-hook nil
|
2019-04-05 22:50:09 -04:00
|
|
|
|
"A list of hooks run after changing the focused frame.")
|
2019-03-02 01:12:48 -05:00
|
|
|
|
|
|
|
|
|
(defvar doom-inhibit-switch-buffer-hooks nil
|
2019-03-07 00:26:51 -05:00
|
|
|
|
"Letvar for inhibiting `doom-switch-buffer-hook'. Do not set this directly.")
|
2019-03-02 01:12:48 -05:00
|
|
|
|
(defvar doom-inhibit-switch-window-hooks nil
|
2019-03-07 00:26:51 -05:00
|
|
|
|
"Letvar for inhibiting `doom-switch-window-hook'. Do not set this directly.")
|
|
|
|
|
(defvar doom-inhibit-switch-frame-hooks nil
|
|
|
|
|
"Letvar for inhibiting `doom-switch-frame-hook'. Do not set this directly.")
|
|
|
|
|
|
|
|
|
|
(defvar doom--last-window nil)
|
|
|
|
|
(defvar doom--last-frame nil)
|
|
|
|
|
|
2019-07-18 15:27:20 +02:00
|
|
|
|
(defun doom-run-switch-window-hooks-h ()
|
2020-04-29 21:54:02 -04:00
|
|
|
|
(unless (or doom-inhibit-switch-window-hooks
|
|
|
|
|
(eq doom--last-window (selected-window))
|
|
|
|
|
(minibufferp))
|
|
|
|
|
(let ((gc-cons-threshold most-positive-fixnum)
|
|
|
|
|
(doom-inhibit-switch-window-hooks t)
|
|
|
|
|
(inhibit-redisplay t))
|
|
|
|
|
(run-hooks 'doom-switch-window-hook)
|
|
|
|
|
(setq doom--last-window (selected-window)))))
|
2019-03-07 00:26:51 -05:00
|
|
|
|
|
2019-07-18 15:27:20 +02:00
|
|
|
|
(defun doom-run-switch-frame-hooks-h (&rest _)
|
2019-04-05 23:52:29 -04:00
|
|
|
|
(unless (or doom-inhibit-switch-frame-hooks
|
|
|
|
|
(eq doom--last-frame (selected-frame))
|
|
|
|
|
(frame-parameter nil 'parent-frame))
|
2020-04-29 21:54:02 -04:00
|
|
|
|
(let ((gc-cons-threshold most-positive-fixnum)
|
|
|
|
|
(doom-inhibit-switch-frame-hooks t))
|
2019-04-05 23:52:29 -04:00
|
|
|
|
(run-hooks 'doom-switch-frame-hook)
|
|
|
|
|
(setq doom--last-frame (selected-frame)))))
|
2019-03-07 00:26:51 -05:00
|
|
|
|
|
: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
|
|
|
|
(defun doom-run-switch-buffer-hooks-a (orig-fn buffer-or-name &rest args)
|
2020-04-29 21:54:02 -04:00
|
|
|
|
(if (or doom-inhibit-switch-buffer-hooks
|
|
|
|
|
(and buffer-or-name
|
|
|
|
|
(eq (current-buffer)
|
|
|
|
|
(get-buffer buffer-or-name)))
|
|
|
|
|
(and (eq orig-fn #'switch-to-buffer) (car args)))
|
|
|
|
|
(apply orig-fn buffer-or-name args)
|
|
|
|
|
(let ((gc-cons-threshold most-positive-fixnum)
|
|
|
|
|
(doom-inhibit-switch-buffer-hooks t)
|
|
|
|
|
(inhibit-redisplay t))
|
|
|
|
|
(when-let (buffer (apply orig-fn buffer-or-name args))
|
|
|
|
|
(with-current-buffer (if (windowp buffer)
|
|
|
|
|
(window-buffer buffer)
|
|
|
|
|
buffer)
|
|
|
|
|
(run-hooks 'doom-switch-buffer-hook))
|
|
|
|
|
buffer))))
|
2019-03-07 00:26:51 -05:00
|
|
|
|
|
: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
|
|
|
|
(defun doom-run-switch-to-next-prev-buffer-hooks-a (orig-fn &rest args)
|
2020-04-29 21:54:02 -04:00
|
|
|
|
(if doom-inhibit-switch-buffer-hooks
|
|
|
|
|
(apply orig-fn args)
|
|
|
|
|
(let ((gc-cons-threshold most-positive-fixnum)
|
|
|
|
|
(doom-inhibit-switch-buffer-hooks t)
|
|
|
|
|
(inhibit-redisplay t))
|
|
|
|
|
(when-let (buffer (apply orig-fn args))
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(run-hooks 'doom-switch-buffer-hook))
|
|
|
|
|
buffer))))
|
2019-05-02 23:08:47 -04:00
|
|
|
|
|
: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
|
|
|
|
(defun doom-protect-fallback-buffer-h ()
|
2019-03-02 01:12:48 -05:00
|
|
|
|
"Don't kill the scratch buffer. Meant for `kill-buffer-query-functions'."
|
|
|
|
|
(not (eq (current-buffer) (doom-fallback-buffer))))
|
|
|
|
|
|
2019-07-18 15:27:20 +02:00
|
|
|
|
(defun doom-highlight-non-default-indentation-h ()
|
2020-07-22 11:04:34 -04:00
|
|
|
|
"Highlight whitespace at odds with `indent-tabs-mode'.
|
2020-08-02 22:48:46 -04:00
|
|
|
|
That is, highlight tabs if `indent-tabs-mode' is `nil', and highlight spaces at
|
|
|
|
|
the beginnings of lines if `indent-tabs-mode' is `t'. The purpose is to make
|
|
|
|
|
incorrect indentation in the current buffer obvious to you.
|
2019-03-02 01:12:48 -05:00
|
|
|
|
|
2020-07-22 11:04:34 -04:00
|
|
|
|
Does nothing if `whitespace-mode' or `global-whitespace-mode' is already active
|
|
|
|
|
or if the current buffer is read-only or not file-visiting."
|
2019-06-30 14:26:18 +02:00
|
|
|
|
(unless (or (eq major-mode 'fundamental-mode)
|
2020-04-17 21:50:05 -04:00
|
|
|
|
(bound-and-true-p global-whitespace-mode)
|
2019-03-02 01:12:48 -05:00
|
|
|
|
(null buffer-file-name))
|
|
|
|
|
(require 'whitespace)
|
|
|
|
|
(set (make-local-variable 'whitespace-style)
|
2020-08-02 22:48:46 -04:00
|
|
|
|
(cl-union (if indent-tabs-mode
|
|
|
|
|
'(indentation)
|
|
|
|
|
'(tabs tab-mark))
|
|
|
|
|
(when whitespace-mode
|
|
|
|
|
(remq 'face whitespace-active-style))))
|
|
|
|
|
(cl-pushnew 'face whitespace-style) ; must be first
|
2019-03-02 01:12:48 -05:00
|
|
|
|
(whitespace-mode +1)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
2019-07-21 04:02:09 +02:00
|
|
|
|
;;; General UX
|
|
|
|
|
|
2021-05-06 15:54:10 -04:00
|
|
|
|
;; A simple confirmation prompt when killing Emacs. But only prompt when there
|
|
|
|
|
;; are real buffers open.
|
2019-07-21 04:02:09 +02:00
|
|
|
|
(setq confirm-kill-emacs #'doom-quit-p)
|
2021-05-06 15:54:10 -04:00
|
|
|
|
;; Prompt for confirmation when deleting a non-empty frame; a last line of
|
|
|
|
|
;; defense against accidental loss of work.
|
|
|
|
|
(global-set-key [remap delete-frame] #'doom/delete-frame-with-prompt)
|
2019-07-21 04:02:09 +02:00
|
|
|
|
|
2020-04-15 00:17:16 -04:00
|
|
|
|
;; Don't prompt for confirmation when we create a new file or buffer (assume the
|
|
|
|
|
;; user knows what they're doing).
|
|
|
|
|
(setq confirm-nonexistent-file-or-buffer nil)
|
|
|
|
|
|
2019-07-21 04:02:09 +02:00
|
|
|
|
(setq uniquify-buffer-name-style 'forward
|
|
|
|
|
;; no beeping or blinking please
|
|
|
|
|
ring-bell-function #'ignore
|
|
|
|
|
visible-bell nil)
|
2017-01-28 02:03:35 -05:00
|
|
|
|
|
2019-07-21 04:02:09 +02:00
|
|
|
|
;; middle-click paste at point, not at click
|
|
|
|
|
(setq mouse-yank-at-point t)
|
|
|
|
|
|
2020-08-07 19:33:10 -04:00
|
|
|
|
;; Larger column width for function name in profiler reports
|
|
|
|
|
(after! profiler
|
|
|
|
|
(setf (caar profiler-report-cpu-line-format) 80
|
|
|
|
|
(caar profiler-report-memory-line-format) 80))
|
2019-07-21 04:02:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
;;; Scrolling
|
|
|
|
|
|
|
|
|
|
(setq hscroll-margin 2
|
|
|
|
|
hscroll-step 1
|
2020-01-04 17:12:09 -05:00
|
|
|
|
;; Emacs spends too much effort recentering the screen if you scroll the
|
|
|
|
|
;; cursor more than N lines past window edges (where N is the settings of
|
|
|
|
|
;; `scroll-conservatively'). This is especially slow in larger files
|
|
|
|
|
;; during large-scale scrolling commands. If kept over 100, the window is
|
|
|
|
|
;; never automatically recentered.
|
|
|
|
|
scroll-conservatively 101
|
2019-07-21 04:02:09 +02:00
|
|
|
|
scroll-margin 0
|
|
|
|
|
scroll-preserve-screen-position t
|
2019-10-17 20:12:43 -04:00
|
|
|
|
;; Reduce cursor lag by a tiny bit by not auto-adjusting `window-vscroll'
|
|
|
|
|
;; for tall lines.
|
|
|
|
|
auto-window-vscroll nil
|
2019-07-21 04:02:09 +02:00
|
|
|
|
;; mouse
|
2021-01-26 23:46:15 -05:00
|
|
|
|
mouse-wheel-scroll-amount '(2 ((shift) . hscroll))
|
|
|
|
|
mouse-wheel-scroll-amount-horizontal 2)
|
2019-07-21 04:02:09 +02:00
|
|
|
|
|
|
|
|
|
;; Remove hscroll-margin in shells, otherwise it causes jumpiness
|
|
|
|
|
(setq-hook! '(eshell-mode-hook term-mode-hook) hscroll-margin 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
;;; Cursor
|
|
|
|
|
|
2020-04-15 14:12:45 -04:00
|
|
|
|
;; The blinking cursor is distracting, but also interferes with cursor settings
|
|
|
|
|
;; in some minor modes that try to change it buffer-locally (like treemacs) and
|
|
|
|
|
;; can cause freezing for folks (esp on macOS) with customized & color cursors.
|
|
|
|
|
(blink-cursor-mode -1)
|
|
|
|
|
|
2019-07-21 04:02:09 +02:00
|
|
|
|
;; Don't blink the paren matching the one at point, it's too distracting.
|
|
|
|
|
(setq blink-matching-paren nil)
|
|
|
|
|
|
|
|
|
|
;; Don't stretch the cursor to fit wide characters, it is disorienting,
|
|
|
|
|
;; especially for tabs.
|
|
|
|
|
(setq x-stretch-cursor nil)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
;;; Buffers
|
|
|
|
|
|
|
|
|
|
;; Make `next-buffer', `other-buffer', etc. ignore unreal buffers.
|
|
|
|
|
(push '(buffer-predicate . doom-buffer-frame-predicate) default-frame-alist)
|
|
|
|
|
|
2019-12-15 23:22:10 -05:00
|
|
|
|
(defadvice! doom--switch-to-fallback-buffer-maybe-a (&rest _)
|
: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
|
|
|
|
"Switch to `doom-fallback-buffer' if on last real buffer.
|
|
|
|
|
|
|
|
|
|
Advice for `kill-current-buffer'. If in a dedicated window, delete it. If there
|
|
|
|
|
are no real buffers left OR if all remaining buffers are visible in other
|
|
|
|
|
windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|
|
|
|
`kill-current-buffer'."
|
2019-12-15 23:22:10 -05:00
|
|
|
|
:before-until #'kill-current-buffer
|
: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
|
|
|
|
(let ((buf (current-buffer)))
|
|
|
|
|
(cond ((window-dedicated-p)
|
2019-12-15 23:22:10 -05:00
|
|
|
|
(delete-window)
|
|
|
|
|
t)
|
: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
|
|
|
|
((eq buf (doom-fallback-buffer))
|
2019-12-15 23:22:10 -05:00
|
|
|
|
(message "Can't kill the fallback buffer.")
|
|
|
|
|
t)
|
: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
|
|
|
|
((doom-real-buffer-p buf)
|
2021-05-28 16:22:26 -04:00
|
|
|
|
(let ((visible-p (delq (selected-window) (get-buffer-window-list buf nil t))))
|
2020-08-08 02:59:59 -04:00
|
|
|
|
(unless visible-p
|
|
|
|
|
(when (and (buffer-modified-p buf)
|
|
|
|
|
(not (y-or-n-p
|
|
|
|
|
(format "Buffer %s is modified; kill anyway?"
|
|
|
|
|
buf))))
|
|
|
|
|
(user-error "Aborted")))
|
2021-05-28 16:22:26 -04:00
|
|
|
|
(let ((inhibit-redisplay t)
|
|
|
|
|
(doom-inhibit-switch-buffer-hooks t)
|
|
|
|
|
buffer-list-update-hook)
|
|
|
|
|
(when (or ;; if there aren't more real buffers than visible buffers,
|
|
|
|
|
;; then there are no real, non-visible buffers left.
|
|
|
|
|
(not (cl-set-difference (doom-real-buffer-list)
|
|
|
|
|
(doom-visible-buffers)))
|
|
|
|
|
;; if we end up back where we start (or previous-buffer
|
|
|
|
|
;; returns nil), we have nowhere left to go
|
|
|
|
|
(memq (switch-to-prev-buffer nil t) (list buf 'nil)))
|
|
|
|
|
(switch-to-buffer (doom-fallback-buffer)))
|
|
|
|
|
(unless visible-p
|
|
|
|
|
(with-current-buffer buf
|
|
|
|
|
(restore-buffer-modified-p nil))
|
|
|
|
|
(kill-buffer buf)))
|
|
|
|
|
(run-hooks 'doom-switch-buffer-hook 'buffer-list-update-hook)
|
2020-08-08 02:59:59 -04:00
|
|
|
|
t)))))
|
: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
|
|
|
|
|
2018-08-21 02:52:08 +02:00
|
|
|
|
|
2019-07-21 04:02:09 +02:00
|
|
|
|
;;
|
|
|
|
|
;;; Fringes
|
|
|
|
|
|
|
|
|
|
;; Reduce the clutter in the fringes; we'd like to reserve that space for more
|
|
|
|
|
;; useful information, like git-gutter and flycheck.
|
|
|
|
|
(setq indicate-buffer-boundaries nil
|
|
|
|
|
indicate-empty-lines nil)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
;;; Windows/frames
|
|
|
|
|
|
|
|
|
|
;; A simple frame title
|
|
|
|
|
(setq frame-title-format '("%b – Doom Emacs")
|
|
|
|
|
icon-title-format frame-title-format)
|
|
|
|
|
|
2020-11-16 19:21:26 -05:00
|
|
|
|
;; Don't resize the frames in steps; it looks weird, especially in tiling window
|
|
|
|
|
;; managers, where it can leave unseemly gaps.
|
|
|
|
|
(setq frame-resize-pixelwise t)
|
|
|
|
|
|
|
|
|
|
;; But do not resize windows pixelwise, this can cause crashes in some cases
|
2021-05-06 15:54:10 -04:00
|
|
|
|
;; when resizing too many windows at once or rapidly.
|
2020-11-16 19:21:26 -05:00
|
|
|
|
(setq window-resize-pixelwise nil)
|
2019-07-21 04:02:09 +02:00
|
|
|
|
|
2021-01-11 02:41:14 -05:00
|
|
|
|
;; Disable tool, menu, and scrollbars. Doom is designed to be keyboard-centric,
|
|
|
|
|
;; so these are just clutter (the scrollbar also impacts performance). Whats
|
|
|
|
|
;; more, the menu bar exposes functionality that Doom doesn't endorse.
|
2021-05-06 15:54:10 -04:00
|
|
|
|
;;
|
|
|
|
|
;; I am intentionally avoid using `menu-bar-mode', `tool-bar-mode', and
|
|
|
|
|
;; `scroll-bar-mode' because they do extra and unnecessary work that can be more
|
|
|
|
|
;; concisely, and efficiently, expressed with these six lines:
|
2021-01-03 22:56:36 -05:00
|
|
|
|
(push '(menu-bar-lines . 0) default-frame-alist)
|
|
|
|
|
(push '(tool-bar-lines . 0) default-frame-alist)
|
|
|
|
|
(push '(vertical-scroll-bars) default-frame-alist)
|
2019-07-21 04:02:09 +02:00
|
|
|
|
|
2021-01-11 02:41:14 -05:00
|
|
|
|
;; These are disabled directly through their frame parameters to avoid the extra
|
|
|
|
|
;; work their minor modes do, but their variables must be unset too, otherwise
|
|
|
|
|
;; users will have to cycle them twice to re-enable them.
|
2020-05-20 15:40:39 -04:00
|
|
|
|
(setq menu-bar-mode nil
|
|
|
|
|
tool-bar-mode nil
|
|
|
|
|
scroll-bar-mode nil)
|
|
|
|
|
|
2019-07-21 04:02:09 +02:00
|
|
|
|
;; The native border "consumes" a pixel of the fringe on righter-most splits,
|
|
|
|
|
;; `window-divider' does not. Available since Emacs 25.1.
|
|
|
|
|
(setq window-divider-default-places t
|
|
|
|
|
window-divider-default-bottom-width 1
|
|
|
|
|
window-divider-default-right-width 1)
|
|
|
|
|
(add-hook 'doom-init-ui-hook #'window-divider-mode)
|
|
|
|
|
|
2021-05-06 15:54:10 -04:00
|
|
|
|
;; GUIs are inconsistent across systems and themes (and will rarely match our
|
|
|
|
|
;; active Emacs theme). They impose inconsistent shortcut key paradigms too.
|
|
|
|
|
;; It's best to avoid GUIs altogether and have Emacs handle the prompting, since
|
|
|
|
|
;; its promtps are governed by the same rules and keybinds as the rest of Emacs.
|
2019-07-21 04:02:09 +02:00
|
|
|
|
(setq use-dialog-box nil)
|
2019-12-19 14:49:17 -05:00
|
|
|
|
(when (bound-and-true-p tooltip-mode)
|
|
|
|
|
(tooltip-mode -1))
|
2019-07-21 04:02:09 +02:00
|
|
|
|
(when IS-LINUX
|
|
|
|
|
(setq x-gtk-use-system-tooltips nil))
|
|
|
|
|
|
2021-05-06 15:54:10 -04:00
|
|
|
|
;; Favor vertical splits over horizontal ones. Monitors are trending toward
|
|
|
|
|
;; wide, rather than tall.
|
2019-07-21 04:02:09 +02:00
|
|
|
|
(setq split-width-threshold 160
|
|
|
|
|
split-height-threshold nil)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
;;; Minibuffer
|
|
|
|
|
|
|
|
|
|
;; Allow for minibuffer-ception. Sometimes we need another minibuffer command
|
2019-12-21 14:58:40 -05:00
|
|
|
|
;; while we're in the minibuffer.
|
2019-07-21 04:02:09 +02:00
|
|
|
|
(setq enable-recursive-minibuffers t)
|
|
|
|
|
|
2020-03-27 18:06:31 -04:00
|
|
|
|
;; Show current key-sequence in minibuffer ala 'set showcmd' in vim. Any
|
|
|
|
|
;; feedback after typing is better UX than no feedback at all.
|
2019-07-21 04:02:09 +02:00
|
|
|
|
(setq echo-keystrokes 0.02)
|
|
|
|
|
|
|
|
|
|
;; Expand the minibuffer to fit multi-line text displayed in the echo-area. This
|
|
|
|
|
;; doesn't look too great with direnv, however...
|
2020-12-13 15:40:29 -05:00
|
|
|
|
(setq resize-mini-windows 'grow-only)
|
2019-07-21 04:02:09 +02:00
|
|
|
|
|
2019-09-22 11:59:53 -04:00
|
|
|
|
;; Typing yes/no is obnoxious when y/n will do
|
2020-11-16 19:29:41 -05:00
|
|
|
|
(fset #'yes-or-no-p #'y-or-n-p)
|
2019-07-21 04:02:09 +02:00
|
|
|
|
|
2021-05-06 15:54:10 -04:00
|
|
|
|
;; Try to keep the cursor out of the read-only portions of the minibuffer.
|
2019-07-21 04:02:09 +02:00
|
|
|
|
(setq minibuffer-prompt-properties '(read-only t intangible t cursor-intangible t face minibuffer-prompt))
|
|
|
|
|
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
|
|
|
|
|
|
|
|
|
|
|
2016-03-03 15:04:14 -05:00
|
|
|
|
;;
|
2019-03-02 01:12:48 -05:00
|
|
|
|
;;; Built-in packages
|
2017-06-09 00:19:44 +02:00
|
|
|
|
|
2019-07-21 04:02:09 +02:00
|
|
|
|
;;;###package ansi-color
|
|
|
|
|
(setq ansi-color-for-comint-mode t)
|
|
|
|
|
|
|
|
|
|
|
2020-07-28 20:48:30 +05:30
|
|
|
|
(after! comint
|
2021-02-26 21:20:39 -05:00
|
|
|
|
(setq comint-prompt-read-only t
|
|
|
|
|
comint-buffer-maximum-size 2048)) ; double the default
|
2020-07-28 20:48:30 +05:30
|
|
|
|
|
|
|
|
|
|
2019-11-18 14:18:18 -05:00
|
|
|
|
(after! compile
|
2019-07-21 04:02:09 +02:00
|
|
|
|
(setq compilation-always-kill t ; kill compilation process before starting another
|
|
|
|
|
compilation-ask-about-save nil ; save all buffers on `compile'
|
|
|
|
|
compilation-scroll-output 'first-error)
|
|
|
|
|
;; Handle ansi codes in compilation buffer
|
2021-02-26 21:20:39 -05:00
|
|
|
|
(add-hook 'compilation-filter-hook #'doom-apply-ansi-color-to-compilation-buffer-h)
|
|
|
|
|
;; Automatically truncate compilation buffers so they don't accumulate too
|
|
|
|
|
;; much data and bog down the rest of Emacs.
|
|
|
|
|
(autoload 'comint-truncate-buffer "comint" nil t)
|
|
|
|
|
(add-hook 'compilation-filter-hook #'comint-truncate-buffer))
|
2019-07-21 04:02:09 +02:00
|
|
|
|
|
|
|
|
|
|
2019-11-18 14:18:18 -05:00
|
|
|
|
(after! ediff
|
2019-02-17 18:49:22 -05:00
|
|
|
|
(setq ediff-diff-options "-w" ; turn off whitespace checking
|
|
|
|
|
ediff-split-window-function #'split-window-horizontally
|
|
|
|
|
ediff-window-setup-function #'ediff-setup-windows-plain)
|
2019-09-22 11:59:53 -04:00
|
|
|
|
|
2019-03-06 19:57:38 -05:00
|
|
|
|
(defvar doom--ediff-saved-wconf nil)
|
2019-02-17 18:49:22 -05:00
|
|
|
|
;; Restore window config after quitting ediff
|
2019-07-26 19:57:13 +02:00
|
|
|
|
(add-hook! 'ediff-before-setup-hook
|
2019-07-23 12:30:47 +02:00
|
|
|
|
(defun doom-ediff-save-wconf-h ()
|
2019-07-18 15:27:20 +02:00
|
|
|
|
(setq doom--ediff-saved-wconf (current-window-configuration))))
|
2019-07-26 19:57:13 +02:00
|
|
|
|
(add-hook! '(ediff-quit-hook ediff-suspend-hook) :append
|
2019-07-23 12:30:47 +02:00
|
|
|
|
(defun doom-ediff-restore-wconf-h ()
|
2019-07-18 15:27:20 +02:00
|
|
|
|
(when (window-configuration-p doom--ediff-saved-wconf)
|
2019-07-26 19:57:13 +02:00
|
|
|
|
(set-window-configuration doom--ediff-saved-wconf)))))
|
2019-02-17 18:49:22 -05:00
|
|
|
|
|
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
|
(use-package! hl-line
|
2018-09-07 21:43:32 -04:00
|
|
|
|
;; Highlights the current line
|
2020-11-14 13:56:14 -05:00
|
|
|
|
:hook (doom-first-buffer . global-hl-line-mode)
|
|
|
|
|
:init
|
2021-01-24 15:48:37 -05:00
|
|
|
|
(defvar global-hl-line-modes
|
|
|
|
|
'(prog-mode text-mode conf-mode special-mode
|
|
|
|
|
org-agenda-mode)
|
2020-11-14 13:56:14 -05:00
|
|
|
|
"What modes to enable `hl-line-mode' in.")
|
2017-02-19 18:11:28 -05:00
|
|
|
|
:config
|
2020-11-14 13:56:14 -05:00
|
|
|
|
;; HACK I reimplement `global-hl-line-mode' so we can white/blacklist modes in
|
|
|
|
|
;; `global-hl-line-modes' _and_ so we can use `global-hl-line-mode',
|
|
|
|
|
;; which users expect to control hl-line in Emacs.
|
|
|
|
|
(define-globalized-minor-mode global-hl-line-mode hl-line-mode
|
|
|
|
|
(lambda ()
|
2021-05-23 21:48:38 -04:00
|
|
|
|
(and (cond (hl-line-mode nil)
|
|
|
|
|
((null global-hl-line-modes) nil)
|
2020-11-14 13:56:14 -05:00
|
|
|
|
((eq global-hl-line-modes t))
|
|
|
|
|
((eq (car global-hl-line-modes) 'not)
|
|
|
|
|
(not (derived-mode-p global-hl-line-modes)))
|
|
|
|
|
((apply #'derived-mode-p global-hl-line-modes)))
|
|
|
|
|
(hl-line-mode +1))))
|
|
|
|
|
|
2019-12-21 01:37:53 -05:00
|
|
|
|
;; Temporarily disable `hl-line' when selection is active, since it doesn't
|
|
|
|
|
;; serve much purpose when the selection is so much more visible.
|
2020-03-27 18:06:31 -04:00
|
|
|
|
(defvar doom--hl-line-mode nil)
|
2019-12-21 01:37:53 -05:00
|
|
|
|
|
2020-11-03 16:14:24 -05:00
|
|
|
|
(add-hook! 'hl-line-mode-hook
|
|
|
|
|
(defun doom-truly-disable-hl-line-h ()
|
|
|
|
|
(unless hl-line-mode
|
|
|
|
|
(setq-local doom--hl-line-mode nil))))
|
|
|
|
|
|
2019-12-21 01:37:53 -05:00
|
|
|
|
(add-hook! '(evil-visual-state-entry-hook activate-mark-hook)
|
|
|
|
|
(defun doom-disable-hl-line-h ()
|
|
|
|
|
(when hl-line-mode
|
2020-11-03 16:14:24 -05:00
|
|
|
|
(hl-line-mode -1)
|
|
|
|
|
(setq-local doom--hl-line-mode t))))
|
2019-12-21 01:37:53 -05:00
|
|
|
|
|
|
|
|
|
(add-hook! '(evil-visual-state-exit-hook deactivate-mark-hook)
|
|
|
|
|
(defun doom-enable-hl-line-maybe-h ()
|
2020-03-27 18:06:31 -04:00
|
|
|
|
(when doom--hl-line-mode
|
2019-12-21 01:37:53 -05:00
|
|
|
|
(hl-line-mode +1)))))
|
2016-05-01 01:05:25 -04:00
|
|
|
|
|
2018-09-07 21:43:32 -04:00
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
|
(use-package! winner
|
2018-09-07 21:43:32 -04:00
|
|
|
|
;; undo/redo changes to Emacs' window layout
|
2019-10-10 16:07:00 -04:00
|
|
|
|
:preface (defvar winner-dont-bind-my-keys t) ; I'll bind keys myself
|
2020-06-10 23:23:17 -07:00
|
|
|
|
:hook (doom-first-buffer . winner-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
|
|
|
|
:config
|
2019-10-10 16:07:00 -04:00
|
|
|
|
(appendq! winner-boring-buffers
|
|
|
|
|
'("*Compile-Log*" "*inferior-lisp*" "*Fuzzy Completions*"
|
|
|
|
|
"*Apropos*" "*Help*" "*cvs*" "*Buffer List*" "*Ibuffer*"
|
|
|
|
|
"*esh command on file*")))
|
2018-01-03 13:54:51 -05:00
|
|
|
|
|
2018-09-07 21:43:32 -04:00
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
|
(use-package! paren
|
2018-09-07 21:43:32 -04:00
|
|
|
|
;; highlight matching delimiters
|
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 . show-paren-mode)
|
2018-07-06 12:48:41 +02:00
|
|
|
|
:config
|
2018-05-14 18:40:35 +02:00
|
|
|
|
(setq show-paren-delay 0.1
|
|
|
|
|
show-paren-highlight-openparen t
|
2019-10-18 19:49:17 -04:00
|
|
|
|
show-paren-when-point-inside-paren 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
|
|
|
|
show-paren-when-point-in-periphery t))
|
2018-01-03 13:54:51 -05:00
|
|
|
|
|
2018-09-07 21:43:32 -04:00
|
|
|
|
|
2019-05-17 01:11:52 -04:00
|
|
|
|
;;;###package whitespace
|
2018-05-08 23:21:17 +02:00
|
|
|
|
(setq whitespace-line-column nil
|
|
|
|
|
whitespace-style
|
|
|
|
|
'(face indentation tabs tab-mark spaces space-mark newline newline-mark
|
2019-02-19 15:03:14 -05:00
|
|
|
|
trailing lines-tail)
|
2018-05-08 23:21:17 +02:00
|
|
|
|
whitespace-display-mappings
|
|
|
|
|
'((tab-mark ?\t [?› ?\t])
|
|
|
|
|
(newline-mark ?\n [?¬ ?\n])
|
|
|
|
|
(space-mark ?\ [?·] [?.])))
|
|
|
|
|
|
2018-01-03 13:54:51 -05:00
|
|
|
|
|
2017-07-18 22:07:13 +02:00
|
|
|
|
;;
|
2019-03-02 01:12:48 -05:00
|
|
|
|
;;; Third party packages
|
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
|
(use-package! all-the-icons
|
2019-07-21 23:31:42 +02:00
|
|
|
|
:commands (all-the-icons-octicon
|
|
|
|
|
all-the-icons-faicon
|
|
|
|
|
all-the-icons-fileicon
|
|
|
|
|
all-the-icons-wicon
|
|
|
|
|
all-the-icons-material
|
2019-12-21 23:30:04 -05:00
|
|
|
|
all-the-icons-alltheicon)
|
2020-04-30 17:02:24 -04:00
|
|
|
|
:preface
|
2021-05-06 04:06:19 -04:00
|
|
|
|
(add-hook! 'after-setting-font-hook
|
|
|
|
|
(defun doom-init-all-the-icons-fonts-h ()
|
2021-05-06 13:18:43 -04:00
|
|
|
|
(when (fboundp 'set-fontset-font)
|
|
|
|
|
(dolist (font (list "Weather Icons"
|
|
|
|
|
"github-octicons"
|
|
|
|
|
"FontAwesome"
|
|
|
|
|
"all-the-icons"
|
|
|
|
|
"file-icons"
|
|
|
|
|
"Material Icons"))
|
|
|
|
|
(set-fontset-font t 'unicode font nil 'append)))))
|
2019-12-21 23:30:04 -05:00
|
|
|
|
:config
|
|
|
|
|
(cond ((daemonp)
|
|
|
|
|
(defadvice! doom--disable-all-the-icons-in-tty-a (orig-fn &rest args)
|
|
|
|
|
"Return a blank string in tty Emacs, which doesn't support multiple fonts."
|
|
|
|
|
:around '(all-the-icons-octicon all-the-icons-material
|
2020-02-18 22:56:47 -05:00
|
|
|
|
all-the-icons-faicon all-the-icons-fileicon
|
|
|
|
|
all-the-icons-wicon all-the-icons-alltheicon)
|
2019-12-21 23:30:04 -05:00
|
|
|
|
(if (or (not after-init-time) (display-multi-font-p))
|
|
|
|
|
(apply orig-fn args)
|
|
|
|
|
"")))
|
|
|
|
|
((not (display-graphic-p))
|
|
|
|
|
(defadvice! doom--disable-all-the-icons-in-tty-a (&rest _)
|
|
|
|
|
"Return a blank string for tty users."
|
|
|
|
|
:override '(all-the-icons-octicon all-the-icons-material
|
|
|
|
|
all-the-icons-faicon all-the-icons-fileicon
|
|
|
|
|
all-the-icons-wicon all-the-icons-alltheicon)
|
|
|
|
|
""))))
|
2019-03-02 01:12:48 -05:00
|
|
|
|
|
2021-01-27 03:36:53 -05:00
|
|
|
|
;; Hide the mode line in completion popups and MAN pages because they serve
|
|
|
|
|
;; little purpose there, and is better hidden.
|
2019-03-13 01:55:50 -04:00
|
|
|
|
;;;###package hide-mode-line-mode
|
2019-07-18 15:27:20 +02:00
|
|
|
|
(add-hook! '(completion-list-mode-hook Man-mode-hook)
|
2019-07-26 19:57:13 +02:00
|
|
|
|
#'hide-mode-line-mode)
|
2019-03-02 01:12:48 -05:00
|
|
|
|
|
2019-10-26 13:57:54 -04:00
|
|
|
|
;; Many major modes do no highlighting of number literals, so we do it for them
|
2019-07-23 12:44:03 +02:00
|
|
|
|
(use-package! highlight-numbers
|
2019-03-02 01:12:48 -05:00
|
|
|
|
:hook ((prog-mode conf-mode) . highlight-numbers-mode)
|
|
|
|
|
:config (setq highlight-numbers-generic-regexp "\\_<[[:digit:]]+\\(?:\\.[0-9]*\\)?\\_>"))
|
|
|
|
|
|
2019-07-21 04:02:09 +02:00
|
|
|
|
;;;###package image
|
|
|
|
|
(setq image-animate-loop t)
|
|
|
|
|
|
2019-03-13 01:55:50 -04:00
|
|
|
|
;;;###package rainbow-delimiters
|
|
|
|
|
;; Helps us distinguish stacked delimiter pairs, especially in parentheses-drunk
|
2021-01-27 03:36:53 -05:00
|
|
|
|
;; languages like Lisp. I reduce it from it's default of 9 to reduce the
|
|
|
|
|
;; complexity of the font-lock keyword and hopefully buy us a few ms of
|
|
|
|
|
;; performance.
|
2021-05-26 16:18:27 -04:00
|
|
|
|
(setq rainbow-delimiters-max-face-count 4)
|
2019-03-02 01:12:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
;;; Line numbers
|
2018-09-07 20:08:06 -04:00
|
|
|
|
|
2021-01-27 03:36:53 -05:00
|
|
|
|
;; Explicitly define a width to reduce the cost of on-the-fly computation
|
2019-07-21 04:02:09 +02:00
|
|
|
|
(setq-default display-line-numbers-width 3)
|
|
|
|
|
|
2021-01-27 03:36:53 -05:00
|
|
|
|
;; Show absolute line numbers for narrowed regions to make it easier to tell the
|
2019-12-31 15:55:56 -05:00
|
|
|
|
;; buffer is narrowed, and where you are, exactly.
|
2019-12-15 15:52:28 -05:00
|
|
|
|
(setq-default display-line-numbers-widen t)
|
|
|
|
|
|
2019-12-31 15:55:56 -05:00
|
|
|
|
;; Enable line numbers in most text-editing modes. We avoid
|
|
|
|
|
;; `global-display-line-numbers-mode' because there are many special and
|
|
|
|
|
;; temporary modes where we don't need/want them.
|
2019-07-18 15:27:20 +02:00
|
|
|
|
(add-hook! '(prog-mode-hook text-mode-hook conf-mode-hook)
|
2019-07-26 19:57:13 +02:00
|
|
|
|
#'display-line-numbers-mode)
|
2017-07-18 22:07:13 +02:00
|
|
|
|
|
2020-10-05 15:40:11 -04:00
|
|
|
|
;; Fix #2742: cursor is off by 4 characters in `artist-mode'
|
2020-10-30 17:12:22 -04:00
|
|
|
|
;; REVIEW Reported upstream https://debbugs.gnu.org/cgi/bugreport.cgi?bug=43811
|
|
|
|
|
;; DEPRECATED Fixed in Emacs 28; remove when we drop 27 support
|
|
|
|
|
(unless EMACS28+
|
|
|
|
|
(add-hook 'artist-mode-hook #'doom-disable-line-numbers-h))
|
2020-10-05 15:40:11 -04:00
|
|
|
|
|
2017-07-18 22:07:13 +02:00
|
|
|
|
|
2017-02-11 06:02:46 -05:00
|
|
|
|
;;
|
2019-03-02 01:12:48 -05:00
|
|
|
|
;;; Theme & font
|
2017-02-11 06:02:46 -05:00
|
|
|
|
|
2021-01-10 08:07:27 -05:00
|
|
|
|
;; User themes should live in ~/.doom.d/themes, not ~/.emacs.d
|
|
|
|
|
(setq custom-theme-directory (concat doom-private-dir "themes/"))
|
|
|
|
|
|
2020-12-29 00:52:12 -05:00
|
|
|
|
;; Always prioritize the user's themes above the built-in/packaged ones.
|
|
|
|
|
(setq custom-theme-load-path
|
|
|
|
|
(cons 'custom-theme-directory
|
2021-05-07 16:33:07 -04:00
|
|
|
|
(delq 'custom-theme-directory custom-theme-load-path)))
|
2020-12-29 00:52:12 -05:00
|
|
|
|
|
2019-07-21 04:02:09 +02:00
|
|
|
|
;; Underline looks a bit better when drawn lower
|
|
|
|
|
(setq x-underline-at-descent-line t)
|
|
|
|
|
|
2021-05-07 16:33:07 -04:00
|
|
|
|
(defun doom-init-fonts-h (&optional reload)
|
2019-09-20 19:45:22 -04:00
|
|
|
|
"Loads `doom-font'."
|
2021-05-06 04:06:19 -04:00
|
|
|
|
(when (fboundp 'set-fontset-font)
|
|
|
|
|
(let ((fn (doom-rpartial #'member (font-family-list))))
|
|
|
|
|
(when-let (font (cl-find-if fn doom-symbol-fallback-font-families))
|
|
|
|
|
(set-fontset-font t 'symbol font))
|
|
|
|
|
(when-let (font (cl-find-if fn doom-emoji-fallback-font-families))
|
|
|
|
|
(set-fontset-font t 'unicode font))
|
|
|
|
|
(when doom-unicode-font
|
|
|
|
|
(set-fontset-font t 'unicode doom-unicode-font))))
|
2021-05-09 20:12:45 -04:00
|
|
|
|
(apply #'custom-set-faces
|
Unset :weight, :slant, :width on font faces
Setting a face's `:font` attribute implicitly sets a host of other faces
attributes (:family, :foundry, :width, :weight, :height, and :slant),
which is problematic in places where these faces are used in tandem with
other faces, like how EWW renders bold elements with both
variable-pitch+bold faces, with the expectation that their attributes
would cascade properly, but not so if variable-pitch sets :weight or
:slant.
2021-06-04 01:35:59 -04:00
|
|
|
|
(let ((attrs '(:weight unspecified :slant unspecified :width unspecified)))
|
|
|
|
|
(append (when doom-font
|
|
|
|
|
`((fixed-pitch ((t (:font ,doom-font ,@attrs))))))
|
|
|
|
|
(when doom-serif-font
|
|
|
|
|
`((fixed-pitch-serif ((t (:font ,doom-serif-font ,@attrs))))))
|
|
|
|
|
(when doom-variable-pitch-font
|
|
|
|
|
`((variable-pitch ((t (:font ,doom-variable-pitch-font ,@attrs)))))))))
|
2021-05-22 16:01:01 -04:00
|
|
|
|
;; Never save these settings to `custom-file'
|
|
|
|
|
(dolist (sym '(fixed-pitch fixed-pitch-serif variable-pitch))
|
|
|
|
|
(put sym 'saved-face nil))
|
2020-01-20 01:54:11 -05:00
|
|
|
|
(cond
|
|
|
|
|
(doom-font
|
2021-05-07 16:33:07 -04:00
|
|
|
|
;; I avoid `set-frame-font' at startup because it is expensive; doing extra,
|
|
|
|
|
;; unnecessary work we can avoid by setting the frame parameter directly.
|
2021-05-06 04:06:19 -04:00
|
|
|
|
(setf (alist-get 'font default-frame-alist)
|
|
|
|
|
(cond ((stringp doom-font) doom-font)
|
|
|
|
|
((fontp doom-font) (font-xlfd-name doom-font))
|
2021-05-07 16:33:07 -04:00
|
|
|
|
((signal 'wrong-type-argument
|
|
|
|
|
(list '(fontp stringp) doom-font)))))
|
|
|
|
|
(when reload
|
|
|
|
|
(set-frame-font doom-font t)))
|
2020-01-20 01:54:11 -05:00
|
|
|
|
((display-graphic-p)
|
2021-05-06 04:06:19 -04:00
|
|
|
|
(setq font-use-system-font t)))
|
|
|
|
|
;; Give users a chance to inject their own font logic.
|
|
|
|
|
(run-hooks 'after-setting-font-hook))
|
2017-02-11 06:02:46 -05:00
|
|
|
|
|
2019-07-18 15:27:20 +02:00
|
|
|
|
(defun doom-init-theme-h (&optional frame)
|
2019-05-09 23:15:13 -04:00
|
|
|
|
"Load the theme specified by `doom-theme' in FRAME."
|
2021-05-09 20:12:45 -04:00
|
|
|
|
(when (and doom-theme (not (custom-theme-enabled-p doom-theme)))
|
|
|
|
|
;; Fix #1397: if `doom-init-theme-h' is used on `after-make-frame-functions'
|
|
|
|
|
;; (for daemon sessions), the new frame must be focused to ensure the theme
|
|
|
|
|
;; loads correctly.
|
|
|
|
|
(with-selected-frame (or frame (selected-frame))
|
|
|
|
|
(load-theme doom-theme t))))
|
2018-03-22 19:26:07 -04:00
|
|
|
|
|
2020-04-23 03:33:08 -04:00
|
|
|
|
(defadvice! doom--load-theme-a (orig-fn theme &optional no-confirm no-enable)
|
2021-05-07 16:33:07 -04:00
|
|
|
|
"Record `doom-theme', disable old themes, and trigger `doom-load-theme-hook'."
|
2020-04-23 03:33:08 -04:00
|
|
|
|
:around #'load-theme
|
2021-05-07 16:33:07 -04:00
|
|
|
|
;; Run `load-theme' from an estranged buffer, where we can ensure that
|
|
|
|
|
;; buffer-local face remaps (by `mixed-pitch-mode', for instance) won't
|
|
|
|
|
;; interfere with recalculating faces in new themes.
|
2020-04-23 03:33:08 -04:00
|
|
|
|
(with-temp-buffer
|
2021-05-08 13:50:48 -04:00
|
|
|
|
(let ((last-themes (copy-sequence custom-enabled-themes)))
|
|
|
|
|
;; Disable previous themes so there are no conflicts. If you truly want
|
|
|
|
|
;; multiple themes enabled, then use `enable-theme' instead.
|
|
|
|
|
(mapc #'disable-theme custom-enabled-themes)
|
|
|
|
|
(prog1 (funcall orig-fn theme no-confirm no-enable)
|
|
|
|
|
(when (and (not no-enable) (custom-theme-enabled-p theme))
|
|
|
|
|
(setq doom-theme theme)
|
2021-05-10 16:05:19 -04:00
|
|
|
|
(put 'doom-theme 'previous-themes (or last-themes 'none))
|
2021-05-09 20:12:45 -04:00
|
|
|
|
(doom-run-hooks 'doom-load-theme-hook))))))
|
: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
|
|
|
|
|
2017-04-25 18:25:54 -04:00
|
|
|
|
|
2018-01-03 13:54:51 -05:00
|
|
|
|
;;
|
2019-03-02 01:12:48 -05:00
|
|
|
|
;;; Bootstrap
|
2018-09-18 15:16:22 -04:00
|
|
|
|
|
2019-07-18 15:27:20 +02:00
|
|
|
|
(defun doom-init-ui-h ()
|
2018-01-03 13:54:51 -05:00
|
|
|
|
"Initialize Doom's user interface by applying all its advice and hooks."
|
2021-05-05 16:12:35 -04:00
|
|
|
|
;; Produce more helpful (and visible) error messages from errors emitted from
|
|
|
|
|
;; hooks (particularly mode hooks, that usually go unnoticed otherwise.
|
|
|
|
|
(advice-add #'run-hooks :override #'doom-run-hooks)
|
|
|
|
|
|
|
|
|
|
(doom-run-hooks 'doom-init-ui-hook)
|
2019-03-04 20:35:47 -05:00
|
|
|
|
|
2019-10-26 13:57:54 -04:00
|
|
|
|
(add-hook 'kill-buffer-query-functions #'doom-protect-fallback-buffer-h)
|
2019-07-26 13:57:42 +02:00
|
|
|
|
(add-hook 'after-change-major-mode-hook #'doom-highlight-non-default-indentation-h 'append)
|
2018-09-07 21:43:32 -04:00
|
|
|
|
|
2019-03-07 00:26:51 -05:00
|
|
|
|
;; Initialize custom switch-{buffer,window,frame} hooks:
|
2020-04-08 15:29:29 -04:00
|
|
|
|
;;
|
2019-03-07 00:26:51 -05:00
|
|
|
|
;; + `doom-switch-buffer-hook'
|
|
|
|
|
;; + `doom-switch-window-hook'
|
|
|
|
|
;; + `doom-switch-frame-hook'
|
2020-04-08 15:29:29 -04:00
|
|
|
|
;;
|
|
|
|
|
;; These should be done as late as possible, as not to prematurely trigger
|
|
|
|
|
;; hooks during startup.
|
2019-07-18 15:27:20 +02:00
|
|
|
|
(add-hook 'buffer-list-update-hook #'doom-run-switch-window-hooks-h)
|
|
|
|
|
(add-hook 'focus-in-hook #'doom-run-switch-frame-hooks-h)
|
: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
|
|
|
|
(dolist (fn '(switch-to-next-buffer switch-to-prev-buffer))
|
|
|
|
|
(advice-add fn :around #'doom-run-switch-to-next-prev-buffer-hooks-a))
|
|
|
|
|
(dolist (fn '(switch-to-buffer display-buffer))
|
|
|
|
|
(advice-add fn :around #'doom-run-switch-buffer-hooks-a)))
|
2019-03-04 20:35:47 -05:00
|
|
|
|
|
2019-09-20 19:45:22 -04:00
|
|
|
|
;; Apply `doom-theme'
|
|
|
|
|
(add-hook (if (daemonp)
|
|
|
|
|
'after-make-frame-functions
|
2021-05-07 13:28:47 -04:00
|
|
|
|
'doom-after-init-modules-hook)
|
2019-09-20 19:45:22 -04:00
|
|
|
|
#'doom-init-theme-h)
|
2019-03-07 19:41:22 -05:00
|
|
|
|
|
2021-05-07 13:28:47 -04:00
|
|
|
|
;; Apply `doom-font' et co
|
|
|
|
|
(add-hook 'doom-after-init-modules-hook #'doom-init-fonts-h)
|
|
|
|
|
|
|
|
|
|
(add-hook 'window-setup-hook #'doom-init-ui-h 'append)
|
2017-02-11 06:02:46 -05:00
|
|
|
|
|
2018-08-31 23:38:54 +02:00
|
|
|
|
|
|
|
|
|
;;
|
2019-03-02 01:12:48 -05:00
|
|
|
|
;;; Fixes/hacks
|
2018-08-31 23:38:54 +02:00
|
|
|
|
|
2019-11-21 14:19:14 -05:00
|
|
|
|
;; Doom doesn't support `customize' and it never will. It's a clumsy interface
|
2020-01-23 00:56:58 -05:00
|
|
|
|
;; that sets variables at a time where it can be easily and unpredictably
|
|
|
|
|
;; overwritten. Configure things from your $DOOMDIR instead.
|
|
|
|
|
(dolist (sym '(customize-option customize-browse customize-group customize-face
|
|
|
|
|
customize-rogue customize-saved customize-apropos
|
|
|
|
|
customize-changed customize-unsaved customize-variable
|
|
|
|
|
customize-set-value customize-customized customize-set-variable
|
|
|
|
|
customize-apropos-faces customize-save-variable
|
|
|
|
|
customize-apropos-groups customize-apropos-options
|
|
|
|
|
customize-changed-options customize-save-customized))
|
|
|
|
|
(put sym 'disabled "Doom doesn't support `customize', configure Emacs from $DOOMDIR/config.el instead"))
|
2019-11-21 14:19:14 -05:00
|
|
|
|
(put 'customize-themes 'disabled "Set `doom-theme' or use `load-theme' in $DOOMDIR/config.el instead")
|
|
|
|
|
|
2021-05-06 15:54:10 -04:00
|
|
|
|
;; Doesn't exist in terminal Emacs, but some Emacs packages (internal and
|
|
|
|
|
;; external) use it anyway, leading to a void-function error, so define a no-op
|
|
|
|
|
;; substitute to suppress them.
|
2018-08-31 23:38:54 +02:00
|
|
|
|
(unless (fboundp 'define-fringe-bitmap)
|
2019-09-13 21:59:03 -04:00
|
|
|
|
(fset 'define-fringe-bitmap #'ignore))
|
2018-08-31 23:38:54 +02:00
|
|
|
|
|
2019-03-02 01:12:48 -05:00
|
|
|
|
(after! whitespace
|
: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
|
|
|
|
(defun doom-disable-whitespace-mode-in-childframes-a (orig-fn)
|
2020-03-27 18:06:31 -04:00
|
|
|
|
"`whitespace-mode' inundates child frames with whitespace markers, so
|
|
|
|
|
disable it to fix all that visual noise."
|
2019-03-11 19:11:10 -04:00
|
|
|
|
(unless (frame-parameter nil 'parent-frame)
|
2019-03-02 01:12:48 -05:00
|
|
|
|
(funcall orig-fn)))
|
: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
|
|
|
|
(add-function :around whitespace-enable-predicate #'doom-disable-whitespace-mode-in-childframes-a))
|
2018-08-31 23:38:54 +02:00
|
|
|
|
|
2019-03-01 15:37:42 -05:00
|
|
|
|
;; Don't display messages in the minibuffer when using the minibuffer
|
2021-05-03 17:31:03 -04:00
|
|
|
|
;; DEPRECATED Remove when Emacs 26.x support is dropped.
|
|
|
|
|
(eval-when! (not EMACS27+)
|
|
|
|
|
(defmacro doom-silence-motion-key (command key)
|
|
|
|
|
(let ((key-command (intern (format "doom/silent-%s" command))))
|
|
|
|
|
`(progn
|
|
|
|
|
(defun ,key-command ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(ignore-errors (call-interactively ',command)))
|
|
|
|
|
(define-key minibuffer-local-map (kbd ,key) #',key-command))))
|
|
|
|
|
(doom-silence-motion-key backward-delete-char "<backspace>")
|
|
|
|
|
(doom-silence-motion-key delete-char "<delete>"))
|
2018-08-31 23:38:54 +02:00
|
|
|
|
|
2015-06-04 18:23:21 -04:00
|
|
|
|
(provide 'core-ui)
|
|
|
|
|
;;; core-ui.el ends here
|