dev: merging from main
This commit is contained in:
commit
9c0e95af1c
20 changed files with 237 additions and 140 deletions
|
@ -26,14 +26,14 @@
|
||||||
"^WSL_INTEROP$"
|
"^WSL_INTEROP$"
|
||||||
;; XDG variables that are best not persisted.
|
;; XDG variables that are best not persisted.
|
||||||
"^XDG_CURRENT_DESKTOP$" "^XDG_RUNTIME_DIR$"
|
"^XDG_CURRENT_DESKTOP$" "^XDG_RUNTIME_DIR$"
|
||||||
"^XDG_\\(VTNR\\|SEAT\\|SESSION_\\(TYPE\\|CLASS\\)\\)"
|
"^XDG_\\(VTNR$\\|SEAT$\\|BACKEND$\\|SESSION_\\)"
|
||||||
;; Socket envvars, like I3SOCK, GREETD_SOCK, SEATD_SOCK, SWAYSOCK, etc.
|
;; Socket envvars, like I3SOCK, GREETD_SOCK, SEATD_SOCK, SWAYSOCK, etc.
|
||||||
"SOCK$"
|
"SOCK$"
|
||||||
;; ssh and gpg variables that could quickly become stale if persisted.
|
;; ssh and gpg variables that could quickly become stale if persisted.
|
||||||
"^SSH_\\(AUTH_SOCK\\|AGENT_PID\\)$" "^\\(SSH\\|GPG\\)_TTY$"
|
"^SSH_\\(AUTH_SOCK\\|AGENT_PID\\)$" "^\\(SSH\\|GPG\\)_TTY$"
|
||||||
"^GPG_AGENT_INFO$"
|
"^GPG_AGENT_INFO$"
|
||||||
;; Internal Doom envvars
|
;; Internal Doom envvars
|
||||||
"^DEBUG$" "^INSECURE$" "^\\(EMACS\\|DOOM\\)DIR$"
|
"^DEBUG$" "^INSECURE$" "^\\(EMACS\\|DOOM\\(LOCAL\\)?\\)DIR$"
|
||||||
"^DOOM\\(PATH\\|PROFILE\\)$" "^__")
|
"^DOOM\\(PATH\\|PROFILE\\)$" "^__")
|
||||||
"Environment variables to omit from envvar files.
|
"Environment variables to omit from envvar files.
|
||||||
|
|
||||||
|
|
|
@ -23,11 +23,12 @@
|
||||||
doom-cache-dir
|
doom-cache-dir
|
||||||
doom-state-dir))
|
doom-state-dir))
|
||||||
|
|
||||||
;; HACK: bin/doom invokes Emacs with --no-site-lisp solely to allow us to load
|
;; HACK: bin/doom invokes Emacs with --no-site-lisp so that site files can be
|
||||||
;; site-start manually, here, to suppress any output it produces, and they
|
;; loaded manually, here, where I can suppress any output it produces, and
|
||||||
;; almost always produce some. This causes premature redraws of the Emacs
|
;; they almost always produce some. This output pollutes the output of doom
|
||||||
;; frame during startup (to display those messages in the minibuffer), which
|
;; scripts with potentially confusing -- but always unimportant --
|
||||||
;; -- as I mention in the comments of doom.el -- really hurts startup time.
|
;; information to the user, like deprecation notices, file-loaded messages,
|
||||||
|
;; and linter warnings. With this, that output is suppressed.
|
||||||
(quiet!
|
(quiet!
|
||||||
(require 'cl nil t)
|
(require 'cl nil t)
|
||||||
(unless site-run-file
|
(unless site-run-file
|
||||||
|
|
13
lisp/doom.el
13
lisp/doom.el
|
@ -487,12 +487,13 @@ users).")
|
||||||
;; later (see `startup--load-user-init-file@undo-hacks').
|
;; later (see `startup--load-user-init-file@undo-hacks').
|
||||||
(advice-add #'tool-bar-setup :override #'ignore)
|
(advice-add #'tool-bar-setup :override #'ignore)
|
||||||
|
|
||||||
;; PERF,UX: site-lisp files are often obnoxiously noisy (emitting load
|
;; PERF,UX: site-lisp files are often obnoxiously noisy (emitting output
|
||||||
;; messages or other output to *Messages* or stdout). These queue
|
;; that isn't useful to end-users, like load messages, deprecation
|
||||||
;; unnecessary redraws at startup which impact startup time depending on
|
;; notices, and linter warnings. Displaying these in the minibuffer causes
|
||||||
;; window system. It also pollutes the logs. By suppressing it now, I can
|
;; unnecessary redraws at startup which can impact startup time
|
||||||
;; load it myself, later, in a more controlled way (see
|
;; drastically and cause flashes of white. It also pollutes the logs. By
|
||||||
;; `startup--load-user-init-file@undo-hacks').
|
;; suppressing it here, I load it myself, later, in a more controlled way
|
||||||
|
;; (see `startup--load-user-init-file@undo-hacks').
|
||||||
(put 'site-run-file 'initial-value site-run-file)
|
(put 'site-run-file 'initial-value site-run-file)
|
||||||
(setq site-run-file nil)
|
(setq site-run-file nil)
|
||||||
|
|
||||||
|
|
|
@ -155,9 +155,14 @@ If DIR is not a project, it will be indexed (but not cached)."
|
||||||
((and (bound-and-true-p helm-mode)
|
((and (bound-and-true-p helm-mode)
|
||||||
(fboundp 'helm-find-files))
|
(fboundp 'helm-find-files))
|
||||||
(call-interactively #'helm-find-files))
|
(call-interactively #'helm-find-files))
|
||||||
((when-let ((project-current-directory-override t)
|
((when-let* ((project-current-directory-override t)
|
||||||
(pr (project-current t dir)))
|
(pr (project-current t dir)))
|
||||||
(project-find-file-in nil nil pr)))
|
(condition-case _
|
||||||
|
(project-find-file-in nil nil pr)
|
||||||
|
;; FIX: project.el throws errors if DIR is an empty directory,
|
||||||
|
;; which is poor UX.
|
||||||
|
(wrong-type-argument
|
||||||
|
(call-interactively #'find-file)))))
|
||||||
((call-interactively #'find-file)))))
|
((call-interactively #'find-file)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
|
@ -135,6 +135,19 @@ Uses `evil-visual-end' if available."
|
||||||
(marker-position evil-visual-end))
|
(marker-position evil-visual-end))
|
||||||
(region-end)))
|
(region-end)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun doom-region (&optional as-list)
|
||||||
|
"Return the bounds of the current seelction.
|
||||||
|
|
||||||
|
If AS-LIST is non-nil, returns (BEG END). Otherwise returns a cons cell (BEG .
|
||||||
|
END)."
|
||||||
|
(let* ((active (doom-region-active-p))
|
||||||
|
(beg (if active (doom-region-beginning)))
|
||||||
|
(end (if active (doom-region-end))))
|
||||||
|
(if as-list
|
||||||
|
(list beg end)
|
||||||
|
(cons beg end))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-thing-at-point-or-region (&optional thing prompt)
|
(defun doom-thing-at-point-or-region (&optional thing prompt)
|
||||||
"Grab the current selection, THING at point, or xref identifier at point.
|
"Grab the current selection, THING at point, or xref identifier at point.
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
(if (modulep! +icons)
|
(if (modulep! +icons)
|
||||||
(setq flycheck-posframe-warning-prefix "⚠ "
|
(setq flycheck-posframe-warning-prefix "⚠ "
|
||||||
flycheck-posframe-info-prefix "ⓘ "
|
flycheck-posframe-info-prefix "ⓘ "
|
||||||
flycheck-posframe-error-prefix "⚠ ")
|
flycheck-posframe-error-prefix "⮾ ")
|
||||||
(setq flycheck-posframe-warning-prefix "[?] "
|
(setq flycheck-posframe-warning-prefix "[?] "
|
||||||
flycheck-posframe-info-prefix "[i] "
|
flycheck-posframe-info-prefix "[i] "
|
||||||
flycheck-posframe-error-prefix "[!] "))
|
flycheck-posframe-error-prefix "[!] "))
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
;;; checkers/syntax/packages.el
|
;;; checkers/syntax/packages.el
|
||||||
|
|
||||||
(unless (modulep! +flymake)
|
(unless (modulep! +flymake)
|
||||||
(package! flycheck :pin "02148c6ce7edb0fd0986460db327cc9463939747")
|
(package! flycheck :pin "e8d1472aeab6ac4e19c8339e6be93e91e878f819")
|
||||||
(package! flycheck-popup-tip :pin "ef86aad907f27ca076859d8d9416f4f7727619c6")
|
(package! flycheck-popup-tip :pin "ef86aad907f27ca076859d8d9416f4f7727619c6")
|
||||||
(when (modulep! +childframe)
|
(when (modulep! +childframe)
|
||||||
(package! flycheck-posframe :pin "19896b922c76a0f460bf3fe8d8ebc2f9ac9028d8")))
|
(package! flycheck-posframe :pin "19896b922c76a0f460bf3fe8d8ebc2f9ac9028d8")))
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
;;; completion/corfu/autoload.el -*- lexical-binding: t; -*-
|
;;; completion/corfu/autoload.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +corfu-move-to-minibuffer ()
|
(defun +corfu/move-to-minibuffer ()
|
||||||
"Move the current list of candidates to your choice of minibuffer completion UI."
|
"Move the current list of candidates to your choice of minibuffer completion UI."
|
||||||
(interactive)
|
(interactive)
|
||||||
(pcase completion-in-region--data
|
(pcase completion-in-region--data
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
(t (error "No minibuffer completion UI available for moving to!")))))))
|
(t (error "No minibuffer completion UI available for moving to!")))))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +corfu-smart-sep-toggle-escape ()
|
(defun +corfu/smart-sep-toggle-escape ()
|
||||||
"Insert `corfu-separator' or toggle escape if it's already there."
|
"Insert `corfu-separator' or toggle escape if it's already there."
|
||||||
(interactive)
|
(interactive)
|
||||||
(cond ((and (char-equal (char-before) corfu-separator)
|
(cond ((and (char-equal (char-before) corfu-separator)
|
||||||
|
@ -37,3 +37,13 @@
|
||||||
(save-excursion (backward-char 1)
|
(save-excursion (backward-char 1)
|
||||||
(insert-char ?\\)))
|
(insert-char ?\\)))
|
||||||
(t (call-interactively #'corfu-insert-separator))))
|
(t (call-interactively #'corfu-insert-separator))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +corfu/dabbrev-this-buffer ()
|
||||||
|
"Like `cape-dabbrev', but only scans current buffer."
|
||||||
|
(interactive)
|
||||||
|
(require 'cape)
|
||||||
|
(let ((cape-dabbrev-check-other-buffers nil))
|
||||||
|
(cape-dabbrev t)))
|
||||||
|
|
||||||
|
;;; end of autoload.el
|
||||||
|
|
|
@ -74,8 +74,8 @@ TAB/S-TAB.")
|
||||||
tab-always-indent 'complete)
|
tab-always-indent 'complete)
|
||||||
(add-to-list 'completion-category-overrides `(lsp-capf (styles ,@completion-styles)))
|
(add-to-list 'completion-category-overrides `(lsp-capf (styles ,@completion-styles)))
|
||||||
(add-to-list 'corfu-auto-commands #'lispy-colon)
|
(add-to-list 'corfu-auto-commands #'lispy-colon)
|
||||||
(add-to-list 'corfu-continue-commands #'+corfu-move-to-minibuffer)
|
(add-to-list 'corfu-continue-commands #'+corfu/move-to-minibuffer)
|
||||||
(add-to-list 'corfu-continue-commands #'+corfu-smart-sep-toggle-escape)
|
(add-to-list 'corfu-continue-commands #'+corfu/smart-sep-toggle-escape)
|
||||||
(add-hook 'evil-insert-state-exit-hook #'corfu-quit)
|
(add-hook 'evil-insert-state-exit-hook #'corfu-quit)
|
||||||
|
|
||||||
;; HACK: If you want to update the visual hints after completing minibuffer
|
;; HACK: If you want to update the visual hints after completing minibuffer
|
||||||
|
|
|
@ -461,8 +461,8 @@ Continues comments if executed from a commented line. Consults
|
||||||
(map! :when (modulep! :completion corfu)
|
(map! :when (modulep! :completion corfu)
|
||||||
:after corfu
|
:after corfu
|
||||||
(:map corfu-map
|
(:map corfu-map
|
||||||
[remap corfu-insert-separator] #'+corfu-smart-sep-toggle-escape
|
[remap corfu-insert-separator] #'+corfu/smart-sep-toggle-escape
|
||||||
"C-S-s" #'+corfu-move-to-minibuffer
|
"C-S-s" #'+corfu/move-to-minibuffer
|
||||||
"C-p" #'corfu-previous
|
"C-p" #'corfu-previous
|
||||||
"C-n" #'corfu-next))
|
"C-n" #'corfu-next))
|
||||||
(let ((cmds-del
|
(let ((cmds-del
|
||||||
|
|
|
@ -576,15 +576,25 @@ directives. By default, this only recognizes C directives.")
|
||||||
:v "gl" #'evil-lion-left
|
:v "gl" #'evil-lion-left
|
||||||
:v "gL" #'evil-lion-right
|
:v "gL" #'evil-lion-right
|
||||||
|
|
||||||
;; Omni-completion
|
;; Emulation of Vim's omni-completion keybinds
|
||||||
(:when (modulep! :completion company)
|
(:prefix "C-x"
|
||||||
(:prefix "C-x"
|
(:when (modulep! :completion company)
|
||||||
:i "C-l" #'+company/whole-lines
|
:i "C-l" #'+company/whole-lines
|
||||||
:i "C-k" #'+company/dict-or-keywords
|
:i "C-k" #'+company/dict-or-keywords
|
||||||
:i "C-f" #'company-files
|
:i "C-f" #'company-files
|
||||||
:i "C-]" #'company-etags
|
:i "C-]" #'company-etags
|
||||||
:i "s" #'company-ispell
|
:i "s" #'company-ispell
|
||||||
:i "C-s" #'company-yasnippet
|
:i "C-s" #'company-yasnippet
|
||||||
:i "C-o" #'company-capf
|
:i "C-o" #'company-capf
|
||||||
:i "C-n" #'+company/dabbrev
|
:i "C-n" #'+company/dabbrev
|
||||||
:i "C-p" #'+company/dabbrev-code-previous)))
|
:i "C-p" #'+company/dabbrev-code-previous)
|
||||||
|
(:when (modulep! :completion corfu)
|
||||||
|
:i "C-l" #'cape-line
|
||||||
|
:i "C-k" #'cape-keyword
|
||||||
|
:i "C-f" #'cape-file
|
||||||
|
:i "C-]" #'complete-tag
|
||||||
|
:i "s" #'cape-dict
|
||||||
|
:i "C-s" #'yasnippet-capf
|
||||||
|
:i "C-o" #'completion-at-point
|
||||||
|
:i "C-n" #'cape-dabbrev
|
||||||
|
:i "C-p" #'+corfu/dabbrev-this-buffer)))
|
||||||
|
|
|
@ -18,44 +18,47 @@
|
||||||
(cur-buffer (current-buffer))
|
(cur-buffer (current-buffer))
|
||||||
(formatted-buffer (get-buffer-create " *apheleia-formatted*"))
|
(formatted-buffer (get-buffer-create " *apheleia-formatted*"))
|
||||||
(indent 0))
|
(indent 0))
|
||||||
(with-current-buffer formatted-buffer
|
(unwind-protect
|
||||||
(erase-buffer)
|
(with-current-buffer formatted-buffer
|
||||||
(unless (featurep :system 'windows)
|
(erase-buffer)
|
||||||
(setq-local coding-system-for-read 'utf-8)
|
(unless (featurep :system 'windows)
|
||||||
(setq-local coding-system-for-write 'utf-8))
|
(setq-local coding-system-for-read 'utf-8)
|
||||||
;; Ensure this temp buffer seems as much like the origin buffer as
|
(setq-local coding-system-for-write 'utf-8))
|
||||||
;; possible, in case the formatter is an elisp function, like `gofmt'.
|
;; Ensure this temp buffer seems as much like the origin buffer as
|
||||||
(cl-loop for (var . val)
|
;; possible, in case the formatter is an elisp function, like `gofmt'.
|
||||||
in (cl-remove-if-not #'listp (buffer-local-variables cur-buffer))
|
(cl-loop for (var . val)
|
||||||
;; `enable-multibyte-characters' can change how Emacs reads the
|
in (cl-remove-if-not #'listp (buffer-local-variables cur-buffer))
|
||||||
;; buffer's contents (or writes them to the formatters), which
|
;; `enable-multibyte-characters' can change how Emacs reads the
|
||||||
;; can cause errors.
|
;; buffer's contents (or writes them to the formatters), which
|
||||||
unless (eq var 'enable-multibyte-characters)
|
;; can cause errors.
|
||||||
do (set (make-local-variable var) val))
|
unless (eq var 'enable-multibyte-characters)
|
||||||
;;
|
do (set (make-local-variable var) val))
|
||||||
(insert-buffer-substring-no-properties cur-buffer start end)
|
;;
|
||||||
;; Since we're piping a region of text to the formatter, remove any
|
(insert-buffer-substring-no-properties cur-buffer start end)
|
||||||
;; leading indentation to make it look like a file.
|
;; Since we're piping a region of text to the formatter, remove any
|
||||||
(setq indent (+format--current-indentation))
|
;; leading indentation to make it look like a file.
|
||||||
(when (> indent 0)
|
(setq indent (+format--current-indentation))
|
||||||
(indent-rigidly (point-min) (point-max) (- indent)))
|
(when (> indent 0)
|
||||||
;;
|
(indent-rigidly (point-min) (point-max) (- indent)))
|
||||||
(apheleia-format-buffer
|
;;
|
||||||
command
|
(apheleia-format-buffer
|
||||||
(lambda ()
|
command
|
||||||
(with-current-buffer formatted-buffer
|
(lambda ()
|
||||||
(when (> indent 0)
|
(with-current-buffer formatted-buffer
|
||||||
;; restore indentation without affecting new indentation
|
(when (> indent 0)
|
||||||
(indent-rigidly (point-min) (point-max)
|
;; restore indentation without affecting new indentation
|
||||||
(max 0 (- indent (+format--current-indentation)))))
|
(indent-rigidly (point-min) (point-max)
|
||||||
(set-buffer-modified-p nil))
|
(max 0 (- indent (+format--current-indentation)))))
|
||||||
(with-current-buffer cur-buffer
|
(set-buffer-modified-p nil))
|
||||||
(delete-region start end)
|
(with-current-buffer cur-buffer
|
||||||
(goto-char start)
|
(delete-region start end)
|
||||||
(save-excursion
|
(goto-char start)
|
||||||
(insert-buffer-substring-no-properties formatted-buffer)
|
(save-excursion
|
||||||
(when callback (funcall callback)))
|
(insert-buffer-substring-no-properties formatted-buffer)
|
||||||
(kill-buffer formatted-buffer)))))))
|
(when callback (funcall callback)))
|
||||||
|
(kill-buffer formatted-buffer)))))
|
||||||
|
(when (doom-region-active-p)
|
||||||
|
(setq deactivate-mark t)))))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
@ -83,29 +86,4 @@ may not always work. Keep your undo keybind handy!"
|
||||||
#'+format/region
|
#'+format/region
|
||||||
#'+format/buffer)))
|
#'+format/buffer)))
|
||||||
|
|
||||||
;;;###autoload
|
;;; format.el ends here
|
||||||
(defun +format/org-block (&optional point)
|
|
||||||
"Reformat the org src block at POINT with a mode approriate formatter."
|
|
||||||
(interactive (list (point)))
|
|
||||||
(unless (derived-mode-p 'org-mode)
|
|
||||||
(user-error "Not an org-mode buffer!"))
|
|
||||||
(let ((element (org-element-at-point point)))
|
|
||||||
(unless (org-in-src-block-p nil element)
|
|
||||||
(user-error "Not in an org src block"))
|
|
||||||
(cl-destructuring-bind (beg end _) (org-src--contents-area element)
|
|
||||||
(let* ((lang (org-element-property :language element))
|
|
||||||
(mode (org-src-get-lang-mode lang)))
|
|
||||||
(save-excursion
|
|
||||||
(if (provided-mode-derived-p mode 'org-mode)
|
|
||||||
(user-error "Cannot reformat an org-mode or org-derived src block")
|
|
||||||
(let* ((major-mode mode)
|
|
||||||
(after-change-functions
|
|
||||||
;; HACK: Silence excessive and unhelpful warnings about
|
|
||||||
;; 'org-element-at-point being used in non-org-mode
|
|
||||||
;; buffers'.
|
|
||||||
(remq 'org-indent-refresh-maybe after-change-functions))
|
|
||||||
(apheleia-formatter
|
|
||||||
(or (apheleia--get-formatters 'interactive)
|
|
||||||
(apheleia--get-formatters 'prompt)
|
|
||||||
(user-error "No formatter configured for language: %s" lang))))
|
|
||||||
(+format-region beg end))))))))
|
|
||||||
|
|
64
modules/editor/format/autoload/org.el
Normal file
64
modules/editor/format/autoload/org.el
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
;;; editor/format/autoload/org.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +format/org-block (&optional point)
|
||||||
|
"Reformat the org src block at POINT with a mode appropriate formatter."
|
||||||
|
(interactive (list (point)))
|
||||||
|
(unless (derived-mode-p 'org-mode)
|
||||||
|
(user-error "Not an org-mode buffer!"))
|
||||||
|
(let ((element (org-element-at-point point)))
|
||||||
|
(unless (org-in-src-block-p nil element)
|
||||||
|
(user-error "Not in an org src block"))
|
||||||
|
(cl-destructuring-bind (beg end _) (org-src--contents-area element)
|
||||||
|
(let* ((lang (or (org-element-property :language element)
|
||||||
|
(user-error "Cannot reformat src block without a valid language")))
|
||||||
|
(mode (org-src-get-lang-mode lang)))
|
||||||
|
(save-excursion
|
||||||
|
(if (provided-mode-derived-p mode 'org-mode)
|
||||||
|
(user-error "Cannot reformat an org-mode or org-derived src block")
|
||||||
|
(let* ((major-mode mode)
|
||||||
|
(after-change-functions
|
||||||
|
;; HACK: Silence excessive and unhelpful warnings about
|
||||||
|
;; 'org-element-at-point being used in non-org-mode
|
||||||
|
;; buffers'.
|
||||||
|
(remq 'org-indent-refresh-maybe after-change-functions))
|
||||||
|
(apheleia-formatter
|
||||||
|
(or (apheleia--get-formatters)
|
||||||
|
(user-error "No formatter configured for language: %s" lang))))
|
||||||
|
(+format-region beg end))))))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +format/org-blocks-in-region (beg end)
|
||||||
|
"Calls `+format/org-block' in each src block between BEG and END (inclusive)."
|
||||||
|
(interactive (doom-region t))
|
||||||
|
(unless (derived-mode-p 'org-mode)
|
||||||
|
(user-error "Not an org-mode buffer!"))
|
||||||
|
(unless (and beg end)
|
||||||
|
(user-error "No active selection"))
|
||||||
|
(let ((n 0))
|
||||||
|
(org-block-map
|
||||||
|
(lambda ()
|
||||||
|
(let ((element (org-element-at-point)))
|
||||||
|
(when (and (org-in-src-block-p nil element)
|
||||||
|
(org-element-property :language element))
|
||||||
|
(with-demoted-errors "+format/org-block: %s"
|
||||||
|
(call-interactively #'+format/org-block))
|
||||||
|
(cl-incf n))))
|
||||||
|
(save-excursion
|
||||||
|
(goto-char beg)
|
||||||
|
(when (org-in-src-block-p)
|
||||||
|
(org-previous-block 1))
|
||||||
|
(point))
|
||||||
|
end)
|
||||||
|
(message "Formatted %d src block(s)" n)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +format/org-blocks-at-point-or-in-region ()
|
||||||
|
"See `+format/org-block' and `+format/org-blocks-in-region'."
|
||||||
|
(interactive)
|
||||||
|
(call-interactively
|
||||||
|
(if (doom-region-active-p)
|
||||||
|
#'+format/org-blocks-in-region
|
||||||
|
#'+format/org-block)))
|
||||||
|
|
||||||
|
;;; org.ell ends here
|
|
@ -11,33 +11,44 @@
|
||||||
:defer t
|
:defer t
|
||||||
:config
|
:config
|
||||||
(set-lookup-handlers! 'gdscript-mode
|
(set-lookup-handlers! 'gdscript-mode
|
||||||
:documentation #'gdscript-docs-browse-symbol-at-point)
|
:documentation '(gdscript-docs-browse-symbol-at-point :async t))
|
||||||
|
|
||||||
(set-formatter! 'gdformat '("gdformat" "-") :modes '(gdscript-mode))
|
(set-formatter! 'gdformat '("gdformat" "-") :modes '(gdscript-mode))
|
||||||
|
(set-popup-rule! "^\\*godot " :ttl 0 :quit t)
|
||||||
|
|
||||||
|
(defadvice! +gdscript--dont-focus-output-buffer-a (fn &rest args)
|
||||||
|
"Don't move cursor into gdscript compilation window."
|
||||||
|
:around #'gdscript-comint--run
|
||||||
|
(save-selected-window (apply fn args)))
|
||||||
|
|
||||||
|
;; eww is clumsy and slow. Best that `gdscript-docs-browse-symbol-at-point'
|
||||||
|
;; simply use the browser.
|
||||||
|
;; REVIEW: Maybe it's permissible if `gdscript-docs-local-path' is set?
|
||||||
|
(setq gdscript-docs-use-eww nil)
|
||||||
|
|
||||||
|
;; Some systems append the version number to the executable, so ensure that
|
||||||
|
;; the path is correct. Note that I avoid setting it to an absolute path to
|
||||||
|
;; preserve TRAMP support.
|
||||||
|
(setq gdscript-godot-executable
|
||||||
|
(cond ((executable-find gdscript-godot-executable) gdscript-godot-executable)
|
||||||
|
((executable-find "godot") "godot")
|
||||||
|
((executable-find "godot4") "godot4")))
|
||||||
|
|
||||||
(when (modulep! +lsp)
|
(when (modulep! +lsp)
|
||||||
(add-hook 'gdscript-mode-local-vars-hook #'lsp! 'append))
|
(add-hook 'gdscript-mode-local-vars-hook #'lsp! 'append))
|
||||||
|
|
||||||
(map! :localleader
|
(map! :localleader
|
||||||
:map gdscript-mode-map
|
:map gdscript-mode-map
|
||||||
|
|
||||||
(:prefix ("r" . "run")
|
(:prefix ("r" . "run")
|
||||||
:desc "Open project in Godot" "e" #'gdscript-godot-open-project-in-editor
|
:desc "Open project in Godot" "e" #'gdscript-godot-open-project-in-editor
|
||||||
:desc "Run project" "p" #'gdscript-godot-run-project
|
:desc "Run project" "p" #'gdscript-godot-run-project
|
||||||
:desc "Run debug" "d" #'gdscript-godot-run-project-debug
|
:desc "Run debug" "d" #'gdscript-godot-run-project-debug
|
||||||
:desc "Run current scene" "s" #'gdscript-godot-run-current-scene)
|
:desc "Run current scene" "s" #'gdscript-godot-run-current-scene)
|
||||||
|
|
||||||
(:prefix ("d" . "debug")
|
(:prefix ("d" . "debug")
|
||||||
:desc "Toggle breakpoint" "d" #'gdscript-debug-toggle-breakpoint
|
:desc "Toggle breakpoint" "d" #'gdscript-debug-toggle-breakpoint
|
||||||
:desc "Display breakpoint buffer" "b" #'gdscript-debug-display-breakpoint-buffer
|
:desc "Display breakpoint buffer" "b" #'gdscript-debug-display-breakpoint-buffer
|
||||||
:desc "Continue execution" "c" #'gdscript-debug-continue
|
:desc "Continue execution" "c" #'gdscript-debug-continue
|
||||||
:desc "Next" "n" #'gdscript-debug-next
|
:desc "Next" "n" #'gdscript-debug-next
|
||||||
:desc "Step" "s" #'gdscript-debug-step)
|
:desc "Step" "s" #'gdscript-debug-step)
|
||||||
|
|
||||||
(:prefix ("h" . "help")
|
(:prefix ("h" . "help")
|
||||||
:desc "Browse online API" "b" #'gdscript-docs-browse-api
|
:desc "Browse online API" "b" #'gdscript-docs-browse-api
|
||||||
:desc "Browse API at point" "f" #'gdscript-docs-browse-symbol-at-point)
|
:desc "Browse API at point" "f" #'gdscript-docs-browse-symbol-at-point)))
|
||||||
|
|
||||||
(:prefix ("f" . "format")
|
|
||||||
:desc "Format buffer" "b" #'gdscript-format-buffer
|
|
||||||
:desc "Format region" "r" #'gdscript-format-region)))
|
|
||||||
|
|
|
@ -344,7 +344,19 @@ If in an org table, realign the cells with `org-table-align'.
|
||||||
Otherwise, falls back to `org-fill-paragraph' to reflow paragraphs."
|
Otherwise, falls back to `org-fill-paragraph' to reflow paragraphs."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((element (org-element-at-point)))
|
(let ((element (org-element-at-point)))
|
||||||
(cond ((org-in-src-block-p nil element)
|
(cond ((doom-region-active-p)
|
||||||
|
;; TODO Perform additional formatting?
|
||||||
|
;; (save-restriction
|
||||||
|
;; (narrow-to-region beg end)
|
||||||
|
;; (org-table-recalculate t)
|
||||||
|
;; (org-table-map-tables #'org-table-align)
|
||||||
|
;; (org-align-tags t)
|
||||||
|
;; (org-update-statistics-cookies t)
|
||||||
|
;; ...)
|
||||||
|
(if (modulep! :editor format)
|
||||||
|
(call-interactively #'+format/org-blocks-in-region)
|
||||||
|
(message ":editor format is disabled, skipping reformatting of org-blocks")))
|
||||||
|
((org-in-src-block-p nil element)
|
||||||
(unless (modulep! :editor format)
|
(unless (modulep! :editor format)
|
||||||
(user-error ":editor format module is disabled, ignoring reformat..."))
|
(user-error ":editor format module is disabled, ignoring reformat..."))
|
||||||
(call-interactively #'+format/org-block))
|
(call-interactively #'+format/org-block))
|
||||||
|
|
|
@ -56,13 +56,13 @@ Is relative to `org-directory', unless it is absolute. Is used in Doom's default
|
||||||
"Default, centralized target for org-capture templates.")
|
"Default, centralized target for org-capture templates.")
|
||||||
|
|
||||||
(defvar +org-habit-graph-padding 2
|
(defvar +org-habit-graph-padding 2
|
||||||
"The padding added to the end of the consistency graph")
|
"The padding added to the end of the consistency graph.")
|
||||||
|
|
||||||
(defvar +org-habit-min-width 30
|
(defvar +org-habit-min-width 30
|
||||||
"Hides the consistency graph if the `org-habit-graph-column' is less than this value")
|
"Hide the consistency graph if `org-habit-graph-column' is less than this.")
|
||||||
|
|
||||||
(defvar +org-habit-graph-window-ratio 0.3
|
(defvar +org-habit-graph-window-ratio 0.3
|
||||||
"The ratio of the consistency graphs relative to the window width")
|
"The ratio of the consistency graphs relative to the window width.")
|
||||||
|
|
||||||
(defvar +org-startup-with-animated-gifs nil
|
(defvar +org-startup-with-animated-gifs nil
|
||||||
"If non-nil, and the cursor is over a gif inline-image preview, animate it!")
|
"If non-nil, and the cursor is over a gif inline-image preview, animate it!")
|
||||||
|
@ -846,7 +846,7 @@ between the two."
|
||||||
;; Recently, a [tab] keybind in `outline-mode-cycle-map' has begun
|
;; Recently, a [tab] keybind in `outline-mode-cycle-map' has begun
|
||||||
;; overriding org's [tab] keybind in GUI Emacs. This is needed to undo
|
;; overriding org's [tab] keybind in GUI Emacs. This is needed to undo
|
||||||
;; that, and should probably be PRed to org.
|
;; that, and should probably be PRed to org.
|
||||||
[tab] #'org-cycle
|
:ie [tab] #'org-cycle
|
||||||
|
|
||||||
"C-c C-S-l" #'+org/remove-link
|
"C-c C-S-l" #'+org/remove-link
|
||||||
"C-c C-i" #'org-toggle-inline-images
|
"C-c C-i" #'org-toggle-inline-images
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
;; -*- no-byte-compile: t; -*-
|
;; -*- no-byte-compile: t; -*-
|
||||||
;;; tools/magit/packages.el
|
;;; tools/magit/packages.el
|
||||||
|
|
||||||
(when (package! magit :pin "9d1f8db507e080e032943a3ed1445bd8d9aaa9fc")
|
(when (package! magit :pin "b9948f9571928bb7f39f4b3a112bd76e52a072ce")
|
||||||
(when (modulep! +forge)
|
(when (modulep! +forge)
|
||||||
(package! forge :pin "0102834bb7c872c8a3f77cabf5221e8199346c43")
|
(package! forge :pin "67314e2f83db358d3734183008586d8bd7cb2395")
|
||||||
(package! code-review
|
(package! code-review
|
||||||
:recipe (:host github
|
:recipe (:host github
|
||||||
:repo "doomelpa/code-review"
|
:repo "doomelpa/code-review"
|
||||||
|
|
|
@ -12,6 +12,8 @@ Use `treemacs' command for old functionality."
|
||||||
(require 'treemacs)
|
(require 'treemacs)
|
||||||
(pcase (treemacs-current-visibility)
|
(pcase (treemacs-current-visibility)
|
||||||
(`visible (delete-window (treemacs-get-local-window)))
|
(`visible (delete-window (treemacs-get-local-window)))
|
||||||
(_ (if (treemacs--find-current-user-project)
|
(_ (let ((project (treemacs--find-current-user-project)))
|
||||||
(treemacs-add-and-display-current-project-exclusively)
|
(if (and project (not (file-equal-p project "~")))
|
||||||
(treemacs)))))
|
(treemacs-add-and-display-current-project-exclusively)
|
||||||
|
(message "No valid project in current buffer; opening last treemacs session")
|
||||||
|
(treemacs))))))
|
||||||
|
|
|
@ -104,16 +104,6 @@
|
||||||
(add-hook 'magit-pre-refresh-hook #'diff-hl-magit-pre-refresh)
|
(add-hook 'magit-pre-refresh-hook #'diff-hl-magit-pre-refresh)
|
||||||
(add-hook 'magit-post-refresh-hook #'diff-hl-magit-post-refresh))
|
(add-hook 'magit-post-refresh-hook #'diff-hl-magit-post-refresh))
|
||||||
|
|
||||||
;; FIX: Fixes dgutov/diff-hl#213, where `diff-hl-update-async' stops
|
|
||||||
;; with-editor (and by extension, Magit COMMIT_EDITMSG buffers) buffers from
|
|
||||||
;; getting properly cleaned up.
|
|
||||||
(defadvice! +vc-gutter--inhibit-async-update-in-with-editor-a (fn &rest args)
|
|
||||||
:around #'diff-hl-update
|
|
||||||
(let ((diff-hl-update-async
|
|
||||||
(unless (bound-and-true-p with-editor-mode)
|
|
||||||
diff-hl-update-async)))
|
|
||||||
(apply fn args)))
|
|
||||||
|
|
||||||
;; FIX: The revert popup consumes 50% of the frame, whether or not you're
|
;; FIX: The revert popup consumes 50% of the frame, whether or not you're
|
||||||
;; reverting 2 lines or 20. This resizes the popup to match its contents.
|
;; reverting 2 lines or 20. This resizes the popup to match its contents.
|
||||||
(defadvice! +vc-gutter--shrink-popup-a (fn &rest args)
|
(defadvice! +vc-gutter--shrink-popup-a (fn &rest args)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
;; -*- no-byte-compile: t; -*-
|
;; -*- no-byte-compile: t; -*-
|
||||||
;;; ui/vc-gutter/packages.el
|
;;; ui/vc-gutter/packages.el
|
||||||
|
|
||||||
(package! diff-hl :pin "11f3113e790526d5ee00f61f8e7cd0d01e323b2e")
|
(package! diff-hl :pin "f66345ed1f174e844ce43d8225613b7b0fc3e253")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue