dev: merge branch 'master' of github.com:doomemacs

This commit is contained in:
Matt Nish-Lapidus 2024-09-15 11:39:49 -04:00
commit 688d69df58
19 changed files with 162 additions and 119 deletions

View file

@ -1141,7 +1141,7 @@ Emacs' batch library lacks an implementation of the exec system call."
`(("DOOMPROFILE" . ,(ignore-errors (doom-profile->id doom-profile))) `(("DOOMPROFILE" . ,(ignore-errors (doom-profile->id doom-profile)))
("EMACSDIR" . ,doom-emacs-dir) ("EMACSDIR" . ,doom-emacs-dir)
("DOOMDIR" . ,doom-user-dir) ("DOOMDIR" . ,doom-user-dir)
("DEBUG" . ,(if init-file-debug "1")) ("DEBUG" . ,(if init-file-debug (number-to-string doom-log-level)))
("__DOOMPID" . ,(number-to-string (doom-cli-context-pid context))) ("__DOOMPID" . ,(number-to-string (doom-cli-context-pid context)))
("__DOOMSTEP" . ,(number-to-string (doom-cli-context-step context))) ("__DOOMSTEP" . ,(number-to-string (doom-cli-context-step context)))
("__DOOMCONTEXT" . ,context-file)) ("__DOOMCONTEXT" . ,context-file))
@ -1179,7 +1179,9 @@ Emacs' batch library lacks an implementation of the exec system call."
"_doomcleanup() {\n rm -f " ,persistent-files "\n}\n" "_doomcleanup() {\n rm -f " ,persistent-files "\n}\n"
"_doomrun() {\n " ,command "\n}\n" "_doomrun() {\n " ,command "\n}\n"
,(cl-loop for (var . val) in persisted-env ,(cl-loop for (var . val) in persisted-env
concat (format "%s=%s \\\n" var (shell-quote-argument val))) if (<= (length val) 2048) ; Prevent "Argument list too long" errors
concat (format "%s=%s \\\n" var (shell-quote-argument val))
else do (doom-log 1 "restart: wiscarding envvar %S for being too long (%d)" var (length val)))
,(format "PATH=\"%s%s$PATH\" \\\n" ,(format "PATH=\"%s%s$PATH\" \\\n"
(doom-path doom-emacs-dir "bin") (doom-path doom-emacs-dir "bin")
path-separator) path-separator)

View file

@ -55,34 +55,29 @@ and Emacs states, and for non-evil users.")
(setq w32-lwindow-modifier 'super (setq w32-lwindow-modifier 'super
w32-rwindow-modifier 'super))) w32-rwindow-modifier 'super)))
;; HACK: Emacs can't distinguish C-i from TAB in either GUI or TTY frames. This ;; HACK: Emacs can't distinguish C-i from TAB, or C-m from RET, in either GUI or
;; is a byproduct of its history with the terminal, which can't distinguish ;; TTY frames. This is a byproduct of its history with the terminal, which
;; them either, however, Emacs has separate input events for many contentious ;; can't distinguish them either, however, Emacs has separate input events for
;; keys like TAB and RET (like [tab] and [return], aka "<tab>" and ;; many contentious keys like TAB and RET (like [tab] and [return], aka
;; "<return>"), which are only triggered in GUI frames, so here, I create one ;; "<tab>" and "<return>"), which are only triggered in GUI frames, so here, I
;; for C-i. Won't work in TTY frames, though. Doom's :os tty module has a ;; create one for C-i. Won't work in TTY frames, though. Doom's :os tty module
;; workaround for that though. ;; has a workaround for that though.
(define-key input-decode-map (pcase-dolist (`(,key ,fallback . ,events)
[?\C-i] (cmd! (if (when-let ((keys (this-single-command-raw-keys))) '(([C-i] [?\C-i] tab kp-tab)
(and (display-graphic-p) ([C-m] [?\C-m] return kp-return)))
(not (cl-position 'tab keys)) (define-key
(not (cl-position 'kp-tab keys)) input-decode-map fallback
;; Fall back if no <C-i> keybind can be found, (cmd! (if (when-let ((keys (this-single-command-raw-keys)))
;; otherwise we've broken all pre-existing C-i (and (display-graphic-p)
;; keybinds. (not (cl-loop for event in events
(key-binding (vconcat (cl-subseq keys 0 -1) [C-i]) nil t))) if (cl-position event keys)
[C-i] [?\C-i]))) return t))
;; Use FALLBACK if nothing is bound to KEY, otherwise we've
;; HACK: Same as C-i, but C-m is a little harder. There is no workaround for ;; broken all pre-existing FALLBACK keybinds.
;; this for the terminal. (key-binding
(define-key input-decode-map (vconcat (if (= 0 (length keys)) [] (cl-subseq keys 0 -1))
[?\C-m] (cmd! (if (when-let ((keys (this-single-command-raw-keys))) key) nil t)))
(and (display-graphic-p) key fallback))))
(not (cl-position 'return keys))
(not (cl-position 'kp-return keys))
;; Fall back if no <C-m> keybind can be found.
(key-binding (vconcat (cl-subseq keys 0 -1) [C-m]) nil t)))
[C-m] [?\C-m])))
;; ;;

View file

@ -10,6 +10,7 @@
`(;; Doom variables `(;; Doom variables
(doom-print-minimum-level . debug) (doom-print-minimum-level . debug)
(doom-inhibit-log . nil) (doom-inhibit-log . nil)
(doom-log-level . 2)
;; Emacs variables ;; Emacs variables
async-debug async-debug

View file

@ -368,7 +368,15 @@ editorconfig or dtrt-indent installed."
(setq-local standard-indent width) (setq-local standard-indent width)
(when (boundp 'evil-shift-width) (when (boundp 'evil-shift-width)
(setq evil-shift-width width)) (setq evil-shift-width width))
(cond ((require 'editorconfig nil t) ;; REVIEW: Only use `editorconfig' once we drop 29.x support.
(cond ((let ((load-path (get 'load-path 'initial-value)))
;; A built-in `editorconfig' package was added in Emacs 30.x, but
;; with a different API. Since it's built in, prefer it over the
;; upstream one, but we still need to adapt:
(require 'editorconfig nil t))
(pcase-dolist (`(,var . ,val) (editorconfig--default-indent-size-function width))
(set (make-local-variable var) val)))
((require 'editorconfig nil t)
(let (editorconfig-lisp-use-default-indent) (let (editorconfig-lisp-use-default-indent)
(editorconfig-set-indentation nil width))) (editorconfig-set-indentation nil width)))
((require 'dtrt-indent nil t) ((require 'dtrt-indent nil t)
@ -376,7 +384,7 @@ editorconfig or dtrt-indent installed."
(dolist (var (ensure-list vars)) (dolist (var (ensure-list vars))
(doom-log "Updated %s = %d" var width) (doom-log "Updated %s = %d" var width)
(set var width))))) (set var width)))))
(message "Changed indentation to %d" width)) (message "Changed buffer's indent-size to %d" width))
;; ;;

View file

@ -11,6 +11,7 @@
company-tooltip-limit 14 company-tooltip-limit 14
company-tooltip-align-annotations t company-tooltip-align-annotations t
company-require-match 'never company-require-match 'never
company-idle-delay 0.26
company-global-modes company-global-modes
'(not erc-mode '(not erc-mode
circe-mode circe-mode

View file

@ -237,3 +237,27 @@ See minad/consult#770."
(defun +vertico-basic-remote-all-completions (string table pred point) (defun +vertico-basic-remote-all-completions (string table pred point)
(and (vertico--remote-p string) (and (vertico--remote-p string)
(completion-basic-all-completions string table pred point))) (completion-basic-all-completions string table pred point)))
;;;###autoload
(defun +vertico-orderless-dispatch (pattern _index _total)
"Like `orderless-affix-dispatch', but allows affixes to be escaped."
(let ((len (length pattern))
(alist orderless-affix-dispatch-alist))
(when (> len 0)
(cond
;; Ignore single dispatcher character
((and (= len 1) (alist-get (aref pattern 0) alist)) #'ignore)
;; Prefix
((when-let ((style (alist-get (aref pattern 0) alist))
((not (char-equal (aref pattern (max (1- len) 1)) ?\\))))
(cons style (substring pattern 1))))
;; Suffix
((when-let ((style (alist-get (aref pattern (1- len)) alist))
((not (char-equal (aref pattern (max 0 (- len 2))) ?\\))))
(cons style (substring pattern 0 -1))))))))
;;;###autoload
(defun +vertico-orderless-disambiguation-dispatch (pattern _index _total)
"Ensure $ works with Consult commands, which add disambiguation suffixes."
(when (char-equal (aref pattern (1- (length pattern))) ?$)
`(orderless-regexp . ,(concat (substring pattern 0 -1) "[\x200000-\x300000]*$"))))

View file

@ -81,15 +81,10 @@ orderless."
(?` . orderless-initialism) (?` . orderless-initialism)
(?= . orderless-literal) (?= . orderless-literal)
(?^ . orderless-literal-prefix) (?^ . orderless-literal-prefix)
(?~ . orderless-flex))) (?~ . orderless-flex))
orderless-style-dispatchers
(defun +vertico-orderless-dispatch (pattern _index _total) '(+vertico-orderless-dispatch
(cond +vertico-orderless-disambiguation-dispatch))
;; Ensure $ works with Consult commands, which add disambiguation suffixes
((string-suffix-p "$" pattern)
`(orderless-regexp . ,(concat (substring pattern 0 -1) "[\x200000-\x300000]*$")))))
(add-to-list 'orderless-style-dispatchers '+vertico-orderless-dispatch)
(add-to-list (add-to-list
'completion-styles-alist 'completion-styles-alist
@ -134,6 +129,15 @@ orderless."
:before (list #'consult-recent-file #'consult-buffer) :before (list #'consult-recent-file #'consult-buffer)
(recentf-mode +1)) (recentf-mode +1))
(defadvice! +vertico--use-evil-registers-a (fn &rest args)
"Use `evil-register-list' if `evil-mode' is active."
:around #'consult-register--alist
(let ((register-alist
(if (bound-and-true-p evil-local-mode)
(evil-register-list)
register-alist)))
(apply fn args)))
(setq consult-project-function #'doom-project-root (setq consult-project-function #'doom-project-root
consult-narrow-key "<" consult-narrow-key "<"
consult-line-numbers-widen t consult-line-numbers-widen t

View file

@ -49,7 +49,8 @@
'(((memq (bound-and-true-p yas--active-field-overlay) '(((memq (bound-and-true-p yas--active-field-overlay)
(overlays-in (1- (point)) (1+ (point)))) (overlays-in (1- (point)) (1+ (point))))
#'yas-next-field-or-maybe-expand) #'yas-next-field-or-maybe-expand)
((yas-maybe-expand-abbrev-key-filter 'yas-expand) ((and (bound-and-true-p yas-minor-mode)
(yas-maybe-expand-abbrev-key-filter 'yas-expand))
#'yas-expand))) #'yas-expand)))
,@(when (modulep! :completion company +tng) ,@(when (modulep! :completion company +tng)
'(((bound-and-true-p company-mode) '(((bound-and-true-p company-mode)

View file

@ -9,8 +9,16 @@
;;; Helpers ;;; Helpers
(defun +fold--ensure-hideshow-mode () (defun +fold--ensure-hideshow-mode ()
(unless (bound-and-true-p hs-minor-mode) "Enable `hs-minor-mode' if not already enabled.
(hs-minor-mode +1)))
Return non-nil if successful in doing so."
(if (not (bound-and-true-p hs-minor-mode))
;; `hs-grok-mode-type' applies this test; if it fails, it produces an
;; error indicating that `hs-minor-mode' is not supported here.
(when (and (bound-and-true-p comment-start)
(bound-and-true-p comment-end))
(hs-minor-mode +1))
t))
(defun +fold--vimish-fold-p () (defun +fold--vimish-fold-p ()
(and (featurep 'vimish-fold) (and (featurep 'vimish-fold)
@ -23,14 +31,14 @@
(outline-on-heading-p))) (outline-on-heading-p)))
(defun +fold--hideshow-fold-p () (defun +fold--hideshow-fold-p ()
(+fold--ensure-hideshow-mode) (when (+fold--ensure-hideshow-mode)
(save-excursion (save-excursion
(ignore-errors (ignore-errors
(or (hs-looking-at-block-start-p) (or (hs-looking-at-block-start-p)
(hs-find-block-beginning) (hs-find-block-beginning)
(unless (eolp) (unless (eolp)
(end-of-line) (end-of-line)
(+fold--hideshow-fold-p)))))) (+fold--hideshow-fold-p)))))))
;; NOTE: does this need more? ;; NOTE: does this need more?
(defun +fold--ts-fold-p () (defun +fold--ts-fold-p ()
@ -186,13 +194,13 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
((and (featurep 'vimish-fold) (+fold--vimish-fold-p)) ((and (featurep 'vimish-fold) (+fold--vimish-fold-p))
(vimish-fold-unfold-all)) (vimish-fold-unfold-all))
((save-excursion ((save-excursion
(+fold--ensure-hideshow-mode) (when (+fold--ensure-hideshow-mode)
(hs-life-goes-on
(if (integerp level)
(hs-hide-level-recursive level (point-min) (point-max))
(hs-show-all))))
(if (integerp level) (if (integerp level)
(progn (outline-hide-sublevels (max 1 level))
(outline-hide-sublevels (max 1 level))
(hs-life-goes-on
(hs-hide-level-recursive level (point-min) (point-max))))
(hs-show-all)
(when (fboundp 'outline-show-all) (when (fboundp 'outline-show-all)
(outline-show-all))))))) (outline-show-all)))))))
@ -207,15 +215,15 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
(progn (progn
(when (featurep 'vimish-fold) (when (featurep 'vimish-fold)
(vimish-fold-refold-all)) (vimish-fold-refold-all))
(+fold--ensure-hideshow-mode) (when (+fold--ensure-hideshow-mode)
(hs-life-goes-on (hs-life-goes-on
(if (integerp level) (if (integerp level)
(progn (hs-hide-level-recursive level (point-min) (point-max))
(outline--show-headings-up-to-level level) (hs-hide-all))))
(hs-hide-level-recursive level (point-min) (point-max))) (if (integerp level)
(hs-hide-all) (outline--show-headings-up-to-level level)
(when (fboundp 'outline-hide-sublevels) (when (fboundp 'outline-hide-sublevels)
(outline-show-only-headings)))))))) (outline-show-only-headings)))))))
;;;###autoload ;;;###autoload
(defun +fold/next (count) (defun +fold/next (count)

View file

@ -56,8 +56,7 @@ this."
(defadvice! +fold--hideshow-ensure-mode-a (&rest _) (defadvice! +fold--hideshow-ensure-mode-a (&rest _)
"Ensure `hs-minor-mode' is enabled when we need it, no sooner or later." "Ensure `hs-minor-mode' is enabled when we need it, no sooner or later."
:before '(hs-toggle-hiding hs-hide-block hs-hide-level hs-show-all hs-hide-all) :before '(hs-toggle-hiding hs-hide-block hs-hide-level hs-show-all hs-hide-all)
(unless (bound-and-true-p hs-minor-mode) (+fold--ensure-hideshow-mode))
(hs-minor-mode +1)))
;; extra folding support for more languages ;; extra folding support for more languages
(unless (assq 't hs-special-modes-alist) (unless (assq 't hs-special-modes-alist)

View file

@ -281,8 +281,6 @@ attach a file, or select a folder to open dired in and select file attachments
When otherwise called, open a dired buffer and enable `dired-mu4e-attach-ctrl-c-ctrl-c'." When otherwise called, open a dired buffer and enable `dired-mu4e-attach-ctrl-c-ctrl-c'."
;; TODO add ability to attach files (+dirs) as a single (named) archive ;; TODO add ability to attach files (+dirs) as a single (named) archive
(interactive "p") (interactive "p")
(when (fboundp '+mu4e-compose-org-msg-handle-toggle)
(+mu4e-compose-org-msg-handle-toggle (/= 1 files-to-attach)))
(pcase major-mode (pcase major-mode
((or 'mu4e-compose-mode 'org-msg-edit-mode) ((or 'mu4e-compose-mode 'org-msg-edit-mode)
(let ((mail-buffer (current-buffer)) (let ((mail-buffer (current-buffer))

View file

@ -441,21 +441,18 @@ This should already be the case yet it does not always seem to be."
(let ((files (org-msg-get-prop "attachment"))) (let ((files (org-msg-get-prop "attachment")))
(org-msg-set-prop "attachment" (nconc files (list file))))) (org-msg-set-prop "attachment" (nconc files (list file)))))
(defvar +mu4e-compose-org-msg-toggle-next t ; t to initialise org-msg ;; HACK: Toggle `org-msg' where sensible.
"Whether to toggle `org-msg-toggle' on ") (defvar +mu4e--compose-org-msg-toggle-next t)
(defun +mu4e-compose-org-msg-handle-toggle (toggle-p)
(when (xor toggle-p +mu4e-compose-org-msg-toggle-next)
(org-msg-mode (if org-msg-mode -1 1))
(setq +mu4e-compose-org-msg-toggle-next
(not +mu4e-compose-org-msg-toggle-next))))
;; HACK: ...
(defadvice! +mu4e-maybe-toggle-org-msg-a (&rest _) (defadvice! +mu4e-maybe-toggle-org-msg-a (&rest _)
:before #'+mu4e/attach-files
:before #'mu4e-compose-new :before #'mu4e-compose-new
:before #'mu4e-compose-reply :before #'mu4e-compose-reply
:before #'mu4e-compose-forward :before #'mu4e-compose-forward
:before #'mu4e-compose-resend :before #'mu4e-compose-resend
(+mu4e-compose-org-msg-handle-toggle (/= 1 (or current-prefix-arg 0)))) (when (xor (/= 1 (if (integerp current-prefix-arg) current-prefix-arg 0))
+mu4e-compose-org-msg-toggle-next)
(org-msg-mode (if org-msg-mode -1 1))
(cl-callf not +mu4e-compose-org-msg-toggle-next)))
;; HACK: ... ;; HACK: ...
(defadvice! +mu4e-draft-open-signature-a (fn &rest args) (defadvice! +mu4e-draft-open-signature-a (fn &rest args)

View file

@ -117,8 +117,9 @@ if it's callable, `apropos' otherwise."
(org-show-hidden-entry)))) (org-show-hidden-entry))))
'deferred)) 'deferred))
(thing (thing
(funcall (or (command-remapping #'describe-symbol) (funcall (if (fboundp #'helpful-symbol)
#'describe-symbol) #'helpful-symbol
#'describe-symbol)
(intern thing))) (intern thing)))
((call-interactively ((call-interactively
(if (fboundp #'helpful-at-point) (if (fboundp #'helpful-at-point)

View file

@ -273,7 +273,7 @@ See `+emacs-lisp-non-package-mode' for details.")
(global-set-key [remap describe-command] #'helpful-command) (global-set-key [remap describe-command] #'helpful-command)
(global-set-key [remap describe-variable] #'helpful-variable) (global-set-key [remap describe-variable] #'helpful-variable)
(global-set-key [remap describe-key] #'helpful-key) (global-set-key [remap describe-key] #'helpful-key)
(global-set-key [remap describe-symbol] #'helpful-symbol) ;; (global-set-key [remap describe-symbol] #'helpful-symbol)
(defun doom-use-helpful-a (fn &rest args) (defun doom-use-helpful-a (fn &rest args)
"Force FN to use helpful instead of the old describe-* commands." "Force FN to use helpful instead of the old describe-* commands."

View file

@ -19,14 +19,14 @@
(when (and (modulep! :checker syntax) (when (and (modulep! :checker syntax)
(not (modulep! :checker syntax +flymake))) (not (modulep! :checker syntax +flymake)))
(after! flycheck (after! flycheck
(flycheck-define-checker graphviz-dot (eval '(flycheck-define-checker graphviz-dot
"A checker using graphviz dot." "A checker using graphviz dot."
:command ("dot") :command ("dot")
:standard-input t :standard-input t
:error-patterns ((error line-start "Error: <stdin>: " (message "syntax error in line " line (* nonl))) :error-patterns ((error line-start "Error: <stdin>: " (message "syntax error in line " line (* nonl)))
;; I have no idea if this can actually be printed ;; I have no idea if this can actually be printed
(error line-start "Error: <stdin>: " (message))) (error line-start "Error: <stdin>: " (message)))
:modes graphviz-dot-mode) :modes graphviz-dot-mode))
(add-to-list 'flycheck-checkers 'graphviz-dot))) (add-to-list 'flycheck-checkers 'graphviz-dot)))
(map! :map graphviz-dot-mode-map (map! :map graphviz-dot-mode-map

View file

@ -42,9 +42,6 @@
(setq rustic-indent-method-chain t) (setq rustic-indent-method-chain t)
;; Conflicts with (and is redundant with) :ui ligatures
(setq rust-prettify-symbols-alist nil)
;; Leave automatic reformatting to the :editor format module. ;; Leave automatic reformatting to the :editor format module.
(setq rustic-babel-format-src-block nil (setq rustic-babel-format-src-block nil
rustic-format-trigger nil) rustic-format-trigger nil)

View file

@ -1,5 +1,6 @@
;;; tools/editorconfig/config.el -*- lexical-binding: t; -*- ;;; tools/editorconfig/config.el -*- lexical-binding: t; -*-
;; TODO: Adapt to built-in `editorconfig' in Emacs 30+
;; Handles whitespace (tabs/spaces) settings externally. This way projects can ;; Handles whitespace (tabs/spaces) settings externally. This way projects can
;; specify their own formatting rules. ;; specify their own formatting rules.
(use-package! editorconfig (use-package! editorconfig

View file

@ -18,15 +18,17 @@ pretty symbols and ligatures previously defined for MODES.
For example, the rule for emacs-lisp-mode is very simple: For example, the rule for emacs-lisp-mode is very simple:
(set-ligatures! \\='emacs-lisp-mode (after! elisp-mode
:lambda \"lambda\") (set-ligatures! \\='emacs-lisp-mode
:lambda \"lambda\"))
This will replace any instances of \"lambda\" in emacs-lisp-mode with the symbol This will replace any instances of \"lambda\" in emacs-lisp-mode with the symbol
associated with :lambda in `+ligatures-extra-symbols'. associated with :lambda in `+ligatures-extra-symbols'.
Pretty symbols can be unset for emacs-lisp-mode with: Pretty symbols can be unset by passing `nil':
(set-ligatures! \\='emacs-lisp-mode nil) (after! rustic
(set-ligatures! \\='rustic-mode nil))
Note that this will keep all ligatures in `+ligatures-prog-mode-list' active, as Note that this will keep all ligatures in `+ligatures-prog-mode-list' active, as
`emacs-lisp-mode' is derived from `prog-mode'." `emacs-lisp-mode' is derived from `prog-mode'."

View file

@ -59,7 +59,9 @@ font.")
"?=" "?." "??" ";;" "/*" "/=" "/>" "//" "__" "~~" "(*" "*)" "?=" "?." "??" ";;" "/*" "/=" "/>" "//" "__" "~~" "(*" "*)"
"\\\\" "://") "\\\\" "://")
(t)) (t))
"A alist of ligatures to enable in specific modes.") "A alist of ligatures to enable in specific modes.
To configure this variable, use `set-ligatures!'.")
(defvar +ligatures-in-modes nil (defvar +ligatures-in-modes nil
"List of major modes where ligatures should be enabled.") "List of major modes where ligatures should be enabled.")
@ -74,7 +76,9 @@ font.")
(make-obsolete-variable '+ligatures-all-modes-list "Use `+ligatures-alist' instead" "24.09.0") (make-obsolete-variable '+ligatures-all-modes-list "Use `+ligatures-alist' instead" "24.09.0")
(defvar +ligatures-extra-alist '((t)) (defvar +ligatures-extra-alist '((t))
"A map of major modes to symbol lists (for `prettify-symbols-alist').") "A map of major modes to symbol lists (for `prettify-symbols-alist').
To configure this variable, use `set-ligatures!'.")
(defvar +ligatures-extras-in-modes t (defvar +ligatures-extras-in-modes t
"List of major modes where extra ligatures should be enabled. "List of major modes where extra ligatures should be enabled.
@ -99,19 +103,24 @@ efficient to remove the `+extra' flag from the :ui ligatures module instead).")
(defun +ligatures-init-extra-symbols-h () (defun +ligatures-init-extra-symbols-h ()
"Set up `prettify-symbols-mode' for the current buffer. "Set up `prettify-symbols-mode' for the current buffer.
Extra ligatures are mode-specific substituions, defined in Overwrites `prettify-symbols-alist' and activates `prettify-symbols-mode' if
`+ligatures-extra-symbols', assigned with `set-ligatures!', and made possible (and only if) there is an associated entry for the current major mode (or a
with `prettify-symbols-mode'. This variable controls where these are enabled. parent mode) in `+ligatures-extra-alist' AND the current mode (or a parent mode)
See `+ligatures-extras-in-modes' to control what major modes this function can isn't disabled in `+ligatures-extras-in-modes'."
and cannot run in." (when after-init-time
(when (and after-init-time (+ligatures--enable-p +ligatures-extras-in-modes)) (when-let*
(prependq! prettify-symbols-alist (((+ligatures--enable-p +ligatures-extras-in-modes))
(or (alist-get major-mode +ligatures-extra-alist) (symbols
(cl-loop for (mode . symbols) in +ligatures-extra-alist (if-let ((symbols (assq major-mode +ligatures-extra-alist)))
if (derived-mode-p mode) (cdr symbols)
return symbols))) (cl-loop for (mode . symbols) in +ligatures-extra-alist
(when prettify-symbols-alist if (derived-mode-p mode)
(when prettify-symbols-mode return symbols))))
(setq prettify-symbols-alist
(append symbols
;; Don't overwrite global defaults
(default-value 'prettify-symbols-alist)))
(when (bound-and-true-p prettify-symbols-mode)
(prettify-symbols-mode -1)) (prettify-symbols-mode -1))
(prettify-symbols-mode +1)))) (prettify-symbols-mode +1))))
@ -124,11 +133,6 @@ and cannot run in."
(setq prettify-symbols-unprettify-at-point 'right-edge) (setq prettify-symbols-unprettify-at-point 'right-edge)
(when (modulep! +extra) (when (modulep! +extra)
;; Lisp modes offer their own defaults for `prettify-symbols-mode' (just a
;; lambda symbol substitution), but this might be unexpected if the user
;; enables +extra but has unset `+ligatures-extra-symbols'.
(setq lisp-prettify-symbols-alist nil)
(add-hook 'after-change-major-mode-hook #'+ligatures-init-extra-symbols-h)) (add-hook 'after-change-major-mode-hook #'+ligatures-init-extra-symbols-h))
(cond (cond