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)))
("EMACSDIR" . ,doom-emacs-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)))
("__DOOMSTEP" . ,(number-to-string (doom-cli-context-step context)))
("__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"
"_doomrun() {\n " ,command "\n}\n"
,(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"
(doom-path doom-emacs-dir "bin")
path-separator)

View file

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

View file

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

View file

@ -368,7 +368,15 @@ editorconfig or dtrt-indent installed."
(setq-local standard-indent width)
(when (boundp 'evil-shift-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)
(editorconfig-set-indentation nil width)))
((require 'dtrt-indent nil t)
@ -376,7 +384,7 @@ editorconfig or dtrt-indent installed."
(dolist (var (ensure-list vars))
(doom-log "Updated %s = %d" var width)
(set var width)))))
(message "Changed indentation to %d" width))
(message "Changed buffer's indent-size to %d" width))
;;