dev: merge branch 'pr7002' into emenel
This commit is contained in:
commit
87daad531e
32 changed files with 241 additions and 168 deletions
|
@ -106,9 +106,9 @@
|
||||||
;; this early -- I remove `.so' from `load-suffixes' and pass the
|
;; this early -- I remove `.so' from `load-suffixes' and pass the
|
||||||
;; `must-suffix' arg to `load'. See the docs of `load' for details.
|
;; `must-suffix' arg to `load'. See the docs of `load' for details.
|
||||||
(if (let ((load-suffixes '(".elc" ".el")))
|
(if (let ((load-suffixes '(".elc" ".el")))
|
||||||
;; I avoid `load's NOERROR argument because other, legitimate errors
|
;; I avoid `load's NOERROR argument because it suppresses other,
|
||||||
;; (like permission or IO errors) should not be suppressed or
|
;; legitimate errors (like permission or IO errors), which gets
|
||||||
;; interpreted as "this is not a Doom config".
|
;; incorrectly interpreted as "this is not a Doom config".
|
||||||
(condition-case _
|
(condition-case _
|
||||||
;; Load the heart of Doom Emacs.
|
;; Load the heart of Doom Emacs.
|
||||||
(load (expand-file-name "lisp/doom" user-emacs-directory)
|
(load (expand-file-name "lisp/doom" user-emacs-directory)
|
||||||
|
|
|
@ -25,22 +25,22 @@
|
||||||
|
|
||||||
;; HACK: Load `cl' and site files manually to prevent polluting logs and
|
;; HACK: Load `cl' and site files manually to prevent polluting logs and
|
||||||
;; stdout with deprecation and/or file load messages.
|
;; stdout with deprecation and/or file load messages.
|
||||||
(let ((inhibit-message (not init-file-debug)))
|
(quiet!
|
||||||
(require 'cl nil t)
|
(require 'cl nil t)
|
||||||
(unless site-run-file
|
(unless site-run-file
|
||||||
(let ((site-run-file "site-start")
|
(let ((site-run-file "site-start")
|
||||||
(tail load-path)
|
(tail load-path)
|
||||||
(lispdir (expand-file-name "../lisp" data-directory))
|
(lispdir (expand-file-name "../lisp" data-directory))
|
||||||
dir)
|
dir)
|
||||||
(while tail
|
(while tail
|
||||||
(setq dir (car tail))
|
(setq dir (car tail))
|
||||||
(let ((default-directory dir))
|
(let ((default-directory dir))
|
||||||
(load (expand-file-name "subdirs.el") t inhibit-message t))
|
(load (expand-file-name "subdirs.el") t inhibit-message t))
|
||||||
(unless (string-prefix-p lispdir dir)
|
(unless (string-prefix-p lispdir dir)
|
||||||
(let ((default-directory dir))
|
(let ((default-directory dir))
|
||||||
(load (expand-file-name "leim-list.el") t inhibit-message t)))
|
(load (expand-file-name "leim-list.el") t inhibit-message t)))
|
||||||
(setq tail (cdr tail)))
|
(setq tail (cdr tail)))
|
||||||
(load site-run-file t inhibit-message))))
|
(load site-run-file t inhibit-message))))
|
||||||
|
|
||||||
(setq-default
|
(setq-default
|
||||||
;; PERF: Don't generate superfluous files when writing temp buffers.
|
;; PERF: Don't generate superfluous files when writing temp buffers.
|
||||||
|
|
|
@ -51,12 +51,12 @@ and Emacs states, and for non-evil users.")
|
||||||
|
|
||||||
;; HACK: Emacs cannot distinguish between C-i from TAB. This is largely a
|
;; HACK: Emacs cannot distinguish between C-i from TAB. This is largely a
|
||||||
;; byproduct of its history in the terminal, which can't distinguish them
|
;; byproduct of its history in the terminal, which can't distinguish them
|
||||||
;; either, however, when GUIs came about Emacs greated separate input events
|
;; either, however, when GUIs came about Emacs created separate input events
|
||||||
;; for more contentious keys like TAB and RET. Therefore [return] != RET,
|
;; for more contentious keys like TAB and RET. Therefore [return] != RET,
|
||||||
;; [tab] != TAB, and [backspace] != DEL.
|
;; [tab] != TAB, and [backspace] != DEL.
|
||||||
;;
|
;;
|
||||||
;; In the same vein, this keybind adds a [C-i] event, so users can bind to it.
|
;; In the same vein, this keybind adds a [C-i] event, so users can bind to it
|
||||||
;; Otherwise, it falls back to regular C-i keybinds.
|
;; independently of TAB. Otherwise, it falls back to keys bound to C-i.
|
||||||
(define-key key-translation-map [?\C-i]
|
(define-key key-translation-map [?\C-i]
|
||||||
(cmd! (if (let ((keys (this-single-command-raw-keys)))
|
(cmd! (if (let ((keys (this-single-command-raw-keys)))
|
||||||
(and keys
|
(and keys
|
||||||
|
|
|
@ -303,9 +303,9 @@ TRIGGER-HOOK is a list of quoted hooks and/or sharp-quoted functions."
|
||||||
(error "file!: cannot deduce the current file path")))
|
(error "file!: cannot deduce the current file path")))
|
||||||
|
|
||||||
(defmacro dir! ()
|
(defmacro dir! ()
|
||||||
"Return the directory of the file this macro was called."
|
"Return the directory of the file in which this macro was called."
|
||||||
(let (file-name-handler-alist)
|
(let (file-name-handler-alist)
|
||||||
(file-name-directory (macroexpand '(file!)))))
|
(file-name-directory (macroexpand '(file!)))))
|
||||||
|
|
||||||
;; REVIEW Should I deprecate this? The macro's name is so long...
|
;; REVIEW Should I deprecate this? The macro's name is so long...
|
||||||
(defalias 'letenv! 'with-environment-variables)
|
(defalias 'letenv! 'with-environment-variables)
|
||||||
|
@ -883,16 +883,16 @@ testing advice (when combined with `rotate-text').
|
||||||
(dolist (target (cdr targets))
|
(dolist (target (cdr targets))
|
||||||
(advice-remove target #',symbol)))))
|
(advice-remove target #',symbol)))))
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;;; Backports
|
||||||
|
|
||||||
(defmacro defbackport! (type symbol &rest body)
|
(defmacro defbackport! (type symbol &rest body)
|
||||||
"Backport a function/macro/alias from later versions of Emacs."
|
"Backport a function/macro/alias from later versions of Emacs."
|
||||||
(declare (indent defun) (doc-string 4))
|
(declare (indent defun) (doc-string 4))
|
||||||
(unless (fboundp (doom-unquote symbol))
|
(unless (fboundp (doom-unquote symbol))
|
||||||
`(,type ,symbol ,@body)))
|
`(,type ,symbol ,@body)))
|
||||||
|
|
||||||
|
|
||||||
;;
|
|
||||||
;;; Backports
|
|
||||||
|
|
||||||
;; `format-spec' wasn't autoloaded until 28.1
|
;; `format-spec' wasn't autoloaded until 28.1
|
||||||
(defbackport! autoload 'format-spec "format-spec")
|
(defbackport! autoload 'format-spec "format-spec")
|
||||||
|
|
||||||
|
|
|
@ -100,13 +100,15 @@
|
||||||
|
|
||||||
;;; Disable UI elements early
|
;;; Disable UI elements early
|
||||||
;; PERF,UI: Doom strives to be keyboard-centric, so I consider these UI elements
|
;; PERF,UI: Doom strives to be keyboard-centric, so I consider these UI elements
|
||||||
;; clutter. Initializing them also costs a morsel of startup time. Whats more,
|
;; clutter. Initializing them also costs a morsel of startup time. What's
|
||||||
;; the menu bar exposes functionality that Doom doesn't endorse. Perhaps one
|
;; more, the menu bar exposes functionality that Doom doesn't endorse. Perhaps
|
||||||
;; day Doom will support these, but today is not that day.
|
;; one day Doom will support these, but today is not that day. By disabling
|
||||||
;;
|
;; them early, we save Emacs some time.
|
||||||
|
|
||||||
;; HACK: I intentionally avoid calling `menu-bar-mode', `tool-bar-mode', and
|
;; HACK: I intentionally avoid calling `menu-bar-mode', `tool-bar-mode', and
|
||||||
;; `scroll-bar-mode' because they do extra work to manipulate frame variables
|
;; `scroll-bar-mode' because their manipulation of frame parameters can
|
||||||
;; that isn't necessary this early in the startup process.
|
;; trigger/queue a superfluous (and expensive, depending on the window system)
|
||||||
|
;; frame redraw at startup.
|
||||||
(push '(menu-bar-lines . 0) default-frame-alist)
|
(push '(menu-bar-lines . 0) default-frame-alist)
|
||||||
(push '(tool-bar-lines . 0) default-frame-alist)
|
(push '(tool-bar-lines . 0) default-frame-alist)
|
||||||
(push '(vertical-scroll-bars) default-frame-alist)
|
(push '(vertical-scroll-bars) default-frame-alist)
|
||||||
|
@ -119,7 +121,7 @@
|
||||||
;; non-application window -- which means it doesn't automatically capture
|
;; non-application window -- which means it doesn't automatically capture
|
||||||
;; focus when it is started, among other things, so enable the menu-bar for
|
;; focus when it is started, among other things, so enable the menu-bar for
|
||||||
;; GUI frames, but keep it disabled in terminal frames because there it
|
;; GUI frames, but keep it disabled in terminal frames because there it
|
||||||
;; activates an ugly, in-frame menu bar.
|
;; unavoidably activates an ugly, in-frame menu bar.
|
||||||
(eval-when! doom--system-macos-p
|
(eval-when! doom--system-macos-p
|
||||||
(add-hook! '(window-setup-hook after-make-frame-functions)
|
(add-hook! '(window-setup-hook after-make-frame-functions)
|
||||||
(defun doom-restore-menu-bar-in-gui-frames-h (&optional frame)
|
(defun doom-restore-menu-bar-in-gui-frames-h (&optional frame)
|
||||||
|
@ -136,7 +138,7 @@
|
||||||
;; a step too opinionated.
|
;; a step too opinionated.
|
||||||
(setq default-input-method nil)
|
(setq default-input-method nil)
|
||||||
;; ...And the clipboard on Windows could be in a wider encoding (UTF-16), so
|
;; ...And the clipboard on Windows could be in a wider encoding (UTF-16), so
|
||||||
;; leave Emacs to its own devices.
|
;; leave Emacs to its own devices there.
|
||||||
(eval-when! (not doom--system-windows-p)
|
(eval-when! (not doom--system-windows-p)
|
||||||
(setq selection-coding-system 'utf-8))
|
(setq selection-coding-system 'utf-8))
|
||||||
|
|
||||||
|
@ -180,7 +182,7 @@
|
||||||
(defvar doom-incremental-packages '(t)
|
(defvar doom-incremental-packages '(t)
|
||||||
"A list of packages to load incrementally after startup. Any large packages
|
"A list of packages to load incrementally after startup. Any large packages
|
||||||
here may cause noticeable pauses, so it's recommended you break them up into
|
here may cause noticeable pauses, so it's recommended you break them up into
|
||||||
sub-packages. For example, `org' is comprised of many packages, and can be
|
sub-packages. For example, `org' is comprised of many packages, and might be
|
||||||
broken up into:
|
broken up into:
|
||||||
|
|
||||||
(doom-load-packages-incrementally
|
(doom-load-packages-incrementally
|
||||||
|
@ -192,16 +194,16 @@ broken up into:
|
||||||
This is already done by the lang/org module, however.
|
This is already done by the lang/org module, however.
|
||||||
|
|
||||||
If you want to disable incremental loading altogether, either remove
|
If you want to disable incremental loading altogether, either remove
|
||||||
`doom-load-packages-incrementally-h' from `emacs-startup-hook' or set
|
`doom-load-packages-incrementally-h' from `doom-after-init-hook' or set
|
||||||
`doom-incremental-first-idle-timer' to nil. Incremental loading does not occur
|
`doom-incremental-first-idle-timer' to nil. Incremental loading does not occur
|
||||||
in daemon sessions (they are loaded immediately at startup).")
|
in daemon sessions (they are loaded immediately at startup).")
|
||||||
|
|
||||||
(defvar doom-incremental-first-idle-timer (if (daemonp) 0 2.0)
|
(defvar doom-incremental-first-idle-timer (if (daemonp) 0 2.0)
|
||||||
"How long (in idle seconds) until incremental loading starts.
|
"How long (in idle seconds) until incremental loading starts.
|
||||||
|
|
||||||
Set this to nil to disable incremental loading.
|
Set this to nil to disable incremental loading at startup.
|
||||||
Set this to 0 to load all incrementally deferred packages immediately at
|
Set this to 0 to load all incrementally deferred packages immediately at
|
||||||
`emacs-startup-hook'.")
|
`doom-after-init-hook'.")
|
||||||
|
|
||||||
(defvar doom-incremental-idle-timer 0.75
|
(defvar doom-incremental-idle-timer 0.75
|
||||||
"How long (in idle seconds) in between incrementally loading packages.")
|
"How long (in idle seconds) in between incrementally loading packages.")
|
||||||
|
@ -209,9 +211,13 @@ Set this to 0 to load all incrementally deferred packages immediately at
|
||||||
(defun doom-load-packages-incrementally (packages &optional now)
|
(defun doom-load-packages-incrementally (packages &optional now)
|
||||||
"Registers PACKAGES to be loaded incrementally.
|
"Registers PACKAGES to be loaded incrementally.
|
||||||
|
|
||||||
If NOW is non-nil, load PACKAGES incrementally, in `doom-incremental-idle-timer'
|
If NOW is non-nil, PACKAGES will be marked for incremental loading next time
|
||||||
intervals."
|
Emacs is idle for `doom-incremental-first-idle-timer' seconds (falls back to
|
||||||
(let ((gc-cons-threshold most-positive-fixnum))
|
`doom-incremental-idle-timer'), then in `doom-incremental-idle-timer' intervals
|
||||||
|
afterwards."
|
||||||
|
(let* ((gc-cons-threshold most-positive-fixnum)
|
||||||
|
(first-idle-timer (or doom-incremental-first-idle-timer
|
||||||
|
doom-incremental-idle-timer)))
|
||||||
(if (not now)
|
(if (not now)
|
||||||
(cl-callf append doom-incremental-packages packages)
|
(cl-callf append doom-incremental-packages packages)
|
||||||
(while packages
|
(while packages
|
||||||
|
@ -222,7 +228,7 @@ intervals."
|
||||||
(condition-case-unless-debug e
|
(condition-case-unless-debug e
|
||||||
(and
|
(and
|
||||||
(or (null (setq idle-time (current-idle-time)))
|
(or (null (setq idle-time (current-idle-time)))
|
||||||
(< (float-time idle-time) doom-incremental-first-idle-timer)
|
(< (float-time idle-time) first-idle-timer)
|
||||||
(not
|
(not
|
||||||
(while-no-input
|
(while-no-input
|
||||||
(doom-log "start:iloader: Loading %s (%d left)" req (length packages))
|
(doom-log "start:iloader: Loading %s (%d left)" req (length packages))
|
||||||
|
@ -242,7 +248,7 @@ intervals."
|
||||||
(doom-log "start:iloader: Finished!")
|
(doom-log "start:iloader: Finished!")
|
||||||
(run-at-time (if idle-time
|
(run-at-time (if idle-time
|
||||||
doom-incremental-idle-timer
|
doom-incremental-idle-timer
|
||||||
doom-incremental-first-idle-timer)
|
first-idle-timer)
|
||||||
nil #'doom-load-packages-incrementally
|
nil #'doom-load-packages-incrementally
|
||||||
packages t)
|
packages t)
|
||||||
(setq packages nil))))))))
|
(setq packages nil))))))))
|
||||||
|
|
20
lisp/doom.el
20
lisp/doom.el
|
@ -59,9 +59,13 @@
|
||||||
;; - On first switched-to buffer: `doom-first-buffer-hook'
|
;; - On first switched-to buffer: `doom-first-buffer-hook'
|
||||||
;; - On first opened file: `doom-first-file-hook'
|
;; - On first opened file: `doom-first-file-hook'
|
||||||
;;
|
;;
|
||||||
;; This is Doom's heart, where I define all its major constants and variables,
|
;; This file is Doom's heart, where I define all its major constants and
|
||||||
;; set only its sanest global defaults, employ its hackiest (and least
|
;; variables, set only its sanest global defaults, employ its hackiest (and
|
||||||
;; offensive) optimizations, and load the minimum for all Doom sessions.
|
;; least offensive) optimizations, and load the minimum needed for all Doom
|
||||||
|
;; sessions, interactive or otherwise.
|
||||||
|
;;
|
||||||
|
;; See doom-start.el for initialization intended solely for interactive
|
||||||
|
;; sessions, and doom-cli.el for non-interactive sessions.
|
||||||
;;
|
;;
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
@ -110,7 +114,8 @@
|
||||||
;;; Custom features & global constants
|
;;; Custom features & global constants
|
||||||
;; Doom has its own features that its modules, CLI, and user extensions can
|
;; Doom has its own features that its modules, CLI, and user extensions can
|
||||||
;; announce, and don't belong in `features', so they are stored here, which can
|
;; announce, and don't belong in `features', so they are stored here, which can
|
||||||
;; include information about the external system environment.
|
;; include information about the external system environment. Module-specific
|
||||||
|
;; features are kept elsewhere, however.
|
||||||
(defconst doom-features
|
(defconst doom-features
|
||||||
(pcase system-type
|
(pcase system-type
|
||||||
('darwin '(macos bsd))
|
('darwin '(macos bsd))
|
||||||
|
@ -196,7 +201,7 @@
|
||||||
"Current version of Doom Emacs core.")
|
"Current version of Doom Emacs core.")
|
||||||
|
|
||||||
;; DEPRECATED: Remove these when the modules are moved out of core.
|
;; DEPRECATED: Remove these when the modules are moved out of core.
|
||||||
(defconst doom-modules-version "24.02.0-pre"
|
(defconst doom-modules-version "24.03.0-pre"
|
||||||
"Current version of Doom Emacs.")
|
"Current version of Doom Emacs.")
|
||||||
|
|
||||||
(defvar doom-init-time nil
|
(defvar doom-init-time nil
|
||||||
|
@ -410,8 +415,9 @@ users).")
|
||||||
|
|
||||||
;; PERF: Shave seconds off startup time by starting the scratch buffer in
|
;; PERF: Shave seconds off startup time by starting the scratch buffer in
|
||||||
;; `fundamental-mode', rather than, say, `org-mode' or `text-mode', which
|
;; `fundamental-mode', rather than, say, `org-mode' or `text-mode', which
|
||||||
;; pull in a ton of packages. `doom/open-scratch-buffer' provides a better
|
;; pull in a ton of packages. This buffer is created whether or not we're
|
||||||
;; scratch buffer anyway.
|
;; in an interactive session. Plus, `doom/open-scratch-buffer' provides a
|
||||||
|
;; better scratch buffer, so keep the initial one blank.
|
||||||
(setq initial-major-mode 'fundamental-mode
|
(setq initial-major-mode 'fundamental-mode
|
||||||
initial-scratch-message nil)
|
initial-scratch-message nil)
|
||||||
|
|
||||||
|
|
|
@ -59,9 +59,6 @@ symbol and CDR is the value to set it to when `doom-debug-mode' is activated.")
|
||||||
(let ((enabled doom-debug-mode))
|
(let ((enabled doom-debug-mode))
|
||||||
(doom-log "debug: enabled!")
|
(doom-log "debug: enabled!")
|
||||||
(mapc #'doom-debug--set-var doom-debug-variables)
|
(mapc #'doom-debug--set-var doom-debug-variables)
|
||||||
(when (called-interactively-p 'any)
|
|
||||||
(when (fboundp 'explain-pause-mode)
|
|
||||||
(explain-pause-mode (if enabled +1 -1))))
|
|
||||||
;; Watch for changes in `doom-debug-variables', or when packages load (and
|
;; Watch for changes in `doom-debug-variables', or when packages load (and
|
||||||
;; potentially define one of `doom-debug-variables'), in case some of them
|
;; potentially define one of `doom-debug-variables'), in case some of them
|
||||||
;; aren't defined when `doom-debug-mode' is first loaded.
|
;; aren't defined when `doom-debug-mode' is first loaded.
|
||||||
|
|
|
@ -527,5 +527,77 @@ If FORCE-P, overwrite the destination file if it exists, without confirmation."
|
||||||
(recentf-save-list)
|
(recentf-save-list)
|
||||||
(message "Removed %S from `recentf-list'" (abbreviate-file-name file)))
|
(message "Removed %S from `recentf-list'" (abbreviate-file-name file)))
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;;; Backports
|
||||||
|
|
||||||
|
;; Introduced in Emacs 29.
|
||||||
|
;;;###autoload
|
||||||
|
(eval-when! (not (fboundp 'find-sibling-file))
|
||||||
|
(defvar find-sibling-rules nil)
|
||||||
|
|
||||||
|
(defun find-sibling-file (file)
|
||||||
|
"Visit a \"sibling\" file of FILE.
|
||||||
|
When called interactively, FILE is the currently visited file.
|
||||||
|
|
||||||
|
The \"sibling\" file is defined by the `find-sibling-rules' variable."
|
||||||
|
(interactive (progn
|
||||||
|
(unless buffer-file-name
|
||||||
|
(user-error "Not visiting a file"))
|
||||||
|
(list buffer-file-name)))
|
||||||
|
(unless find-sibling-rules
|
||||||
|
(user-error "The `find-sibling-rules' variable has not been configured"))
|
||||||
|
(let ((siblings (find-sibling-file-search (expand-file-name file)
|
||||||
|
find-sibling-rules)))
|
||||||
|
(cond
|
||||||
|
((null siblings)
|
||||||
|
(user-error "Couldn't find any sibling files"))
|
||||||
|
((length= siblings 1)
|
||||||
|
(find-file (car siblings)))
|
||||||
|
(t
|
||||||
|
(let ((relatives (mapcar (lambda (sibling)
|
||||||
|
(file-relative-name
|
||||||
|
sibling (file-name-directory file)))
|
||||||
|
siblings)))
|
||||||
|
(find-file
|
||||||
|
(completing-read (format-prompt "Find file" (car relatives))
|
||||||
|
relatives nil t nil nil (car relatives))))))))
|
||||||
|
|
||||||
|
(defun find-sibling-file-search (file &optional rules)
|
||||||
|
"Return a list of FILE's \"siblings\".
|
||||||
|
RULES should be a list on the form defined by `find-sibling-rules' (which
|
||||||
|
see), and if nil, defaults to `find-sibling-rules'."
|
||||||
|
(let ((results nil))
|
||||||
|
(pcase-dolist (`(,match . ,expansions) (or rules find-sibling-rules))
|
||||||
|
;; Go through the list and find matches.
|
||||||
|
(when (string-match match file)
|
||||||
|
(let ((match-data (match-data)))
|
||||||
|
(dolist (expansion expansions)
|
||||||
|
(let ((start 0))
|
||||||
|
;; Expand \\1 forms in the expansions.
|
||||||
|
(while (string-match "\\\\\\([&0-9]+\\)" expansion start)
|
||||||
|
(let ((index (string-to-number (match-string 1 expansion))))
|
||||||
|
(setq start (match-end 0)
|
||||||
|
expansion
|
||||||
|
(replace-match
|
||||||
|
(substring file
|
||||||
|
(elt match-data (* index 2))
|
||||||
|
(elt match-data (1+ (* index 2))))
|
||||||
|
t t expansion)))))
|
||||||
|
;; Then see which files we have that are matching. (And
|
||||||
|
;; expand from the end of the file's match, since we might
|
||||||
|
;; be doing a relative match.)
|
||||||
|
(let ((default-directory (substring file 0 (car match-data))))
|
||||||
|
;; Keep the first matches first.
|
||||||
|
(setq results
|
||||||
|
(nconc
|
||||||
|
results
|
||||||
|
(mapcar #'expand-file-name
|
||||||
|
(file-expand-wildcards expansion nil t)))))))))
|
||||||
|
;; Delete the file itself (in case it matched), and remove
|
||||||
|
;; duplicates, in case we have several expansions and some match
|
||||||
|
;; the same subsets of files.
|
||||||
|
(delete file (delete-dups results)))))
|
||||||
|
|
||||||
(provide 'doom-lib '(files))
|
(provide 'doom-lib '(files))
|
||||||
;;; files.el ends here
|
;;; files.el ends here
|
||||||
|
|
|
@ -88,10 +88,11 @@ Uses `evil-visual-beginning' if available."
|
||||||
"Return end position of selection.
|
"Return end position of selection.
|
||||||
Uses `evil-visual-end' if available."
|
Uses `evil-visual-end' if available."
|
||||||
(declare (side-effect-free t))
|
(declare (side-effect-free t))
|
||||||
(if (and (bound-and-true-p evil-local-mode)
|
(or (and (bound-and-true-p evil-local-mode)
|
||||||
(evil-visual-state-p))
|
(evil-visual-state-p)
|
||||||
evil-visual-end
|
(markerp evil-visual-end)
|
||||||
(region-end)))
|
(marker-position evil-visual-end))
|
||||||
|
(region-end)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-thing-at-point-or-region (&optional thing prompt)
|
(defun doom-thing-at-point-or-region (&optional thing prompt)
|
||||||
|
|
|
@ -175,15 +175,18 @@ Use `winner-undo' to undo this. Alternatively, use
|
||||||
"Interactively change the current frame's opacity.
|
"Interactively change the current frame's opacity.
|
||||||
|
|
||||||
OPACITY is an integer between 0 to 100, inclusive."
|
OPACITY is an integer between 0 to 100, inclusive."
|
||||||
(interactive
|
(interactive '(interactive))
|
||||||
(list (read-number "Opacity (0-100): "
|
(let* ((parameter
|
||||||
(or (frame-parameter
|
(if (eq window-system 'pgtk)
|
||||||
nil (if (> emacs-major-version 28)
|
'alpha-background
|
||||||
'alpha-background 'alpha))
|
'alpha))
|
||||||
100))))
|
(opacity
|
||||||
(set-frame-parameter nil (if (> emacs-major-version 28)
|
(if (eq opacity 'interactive)
|
||||||
'alpha-background 'alpha)
|
(read-number "Opacity (0-100): "
|
||||||
opacity))
|
(or (frame-parameter nil parameter)
|
||||||
|
100))
|
||||||
|
opacity)))
|
||||||
|
(set-frame-parameter nil parameter opacity)))
|
||||||
|
|
||||||
(defvar doom--narrowed-base-buffer nil)
|
(defvar doom--narrowed-base-buffer nil)
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
@ -195,12 +198,9 @@ narrowing doesn't affect other windows displaying the same buffer. Call
|
||||||
`doom/widen-indirectly-narrowed-buffer' to undo it (incrementally).
|
`doom/widen-indirectly-narrowed-buffer' to undo it (incrementally).
|
||||||
|
|
||||||
Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/"
|
Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/"
|
||||||
(interactive
|
(interactive (if (region-active-p)
|
||||||
(list (or (bound-and-true-p evil-visual-beginning) (region-beginning))
|
(list (doom-region-beginning) (doom-region-end))
|
||||||
(or (bound-and-true-p evil-visual-end) (region-end))))
|
(list (bol) (eol))))
|
||||||
(unless (region-active-p)
|
|
||||||
(setq beg (line-beginning-position)
|
|
||||||
end (line-end-position)))
|
|
||||||
(deactivate-mark)
|
(deactivate-mark)
|
||||||
(let ((orig-buffer (current-buffer)))
|
(let ((orig-buffer (current-buffer)))
|
||||||
(with-current-buffer (switch-to-buffer (clone-indirect-buffer nil nil))
|
(with-current-buffer (switch-to-buffer (clone-indirect-buffer nil nil))
|
||||||
|
@ -239,12 +239,9 @@ If the current buffer is not an indirect buffer, it is `widen'ed."
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/toggle-narrow-buffer (beg end)
|
(defun doom/toggle-narrow-buffer (beg end)
|
||||||
"Narrow the buffer to BEG END. If narrowed, widen it."
|
"Narrow the buffer to BEG END. If narrowed, widen it."
|
||||||
(interactive
|
(interactive (if (region-active-p)
|
||||||
(list (or (bound-and-true-p evil-visual-beginning) (region-beginning))
|
(list (doom-region-beginning) (doom-region-end))
|
||||||
(or (bound-and-true-p evil-visual-end) (region-end))))
|
(list (bol) (eol))))
|
||||||
(if (buffer-narrowed-p)
|
(if (buffer-narrowed-p)
|
||||||
(widen)
|
(widen)
|
||||||
(unless (region-active-p)
|
|
||||||
(setq beg (line-beginning-position)
|
|
||||||
end (line-end-position)))
|
|
||||||
(narrow-to-region beg end)))
|
(narrow-to-region beg end)))
|
||||||
|
|
|
@ -4,10 +4,6 @@
|
||||||
;; doom.el
|
;; doom.el
|
||||||
(package! auto-minor-mode :pin "17cfa1b54800fdef2975c0c0531dad34846a5065")
|
(package! auto-minor-mode :pin "17cfa1b54800fdef2975c0c0531dad34846a5065")
|
||||||
(package! gcmh :pin "0089f9c3a6d4e9a310d0791cf6fa8f35642ecfd9")
|
(package! gcmh :pin "0089f9c3a6d4e9a310d0791cf6fa8f35642ecfd9")
|
||||||
(package! explain-pause-mode
|
|
||||||
:recipe (:host github
|
|
||||||
:repo "lastquestion/explain-pause-mode")
|
|
||||||
:pin "2356c8c3639cbeeb9751744dbe737267849b4b51")
|
|
||||||
|
|
||||||
;; doom-packages.el
|
;; doom-packages.el
|
||||||
(package! straight
|
(package! straight
|
||||||
|
|
|
@ -58,7 +58,7 @@ Possible values are:
|
||||||
corfu-preselect 'prompt
|
corfu-preselect 'prompt
|
||||||
corfu-count 16
|
corfu-count 16
|
||||||
corfu-max-width 120
|
corfu-max-width 120
|
||||||
corfu-preview-current (if (modulep! +on-type) 'insert t)
|
corfu-preview-current 'insert
|
||||||
corfu-on-exact-match nil
|
corfu-on-exact-match nil
|
||||||
corfu-quit-at-boundary (if (modulep! +orderless) 'separator t)
|
corfu-quit-at-boundary (if (modulep! +orderless) 'separator t)
|
||||||
corfu-quit-no-match (if (modulep! +orderless) 'separator t)
|
corfu-quit-no-match (if (modulep! +orderless) 'separator t)
|
||||||
|
|
|
@ -372,7 +372,8 @@ orderless."
|
||||||
(if (or (eq sym major-mode)
|
(if (or (eq sym major-mode)
|
||||||
(and
|
(and
|
||||||
(memq sym minor-mode-list)
|
(memq sym minor-mode-list)
|
||||||
(boundp sym)))
|
(boundp sym)
|
||||||
|
(symbol-value sym)))
|
||||||
(add-face-text-property 0 (length cmd) 'font-lock-constant-face 'append cmd)))
|
(add-face-text-property 0 (length cmd) 'font-lock-constant-face 'append cmd)))
|
||||||
cmd))
|
cmd))
|
||||||
|
|
||||||
|
|
|
@ -168,13 +168,13 @@
|
||||||
:v "C-SPC" (cmd! (call-interactively #'evil-change)
|
:v "C-SPC" (cmd! (call-interactively #'evil-change)
|
||||||
(call-interactively #'completion-at-point)))
|
(call-interactively #'completion-at-point)))
|
||||||
(:map corfu-map
|
(:map corfu-map
|
||||||
"C-SPC" #'corfu-insert-separator
|
:i "C-SPC" #'corfu-insert-separator
|
||||||
"C-k" #'corfu-previous
|
"C-k" #'corfu-previous
|
||||||
"C-j" #'corfu-next
|
"C-j" #'corfu-next
|
||||||
"C-u" (cmd! (let (corfu-cycle)
|
"C-u" (cmd! (let (corfu-cycle)
|
||||||
(funcall-interactively #'corfu-next (- corfu-count))))
|
(funcall-interactively #'corfu-next (- corfu-count))))
|
||||||
"C-d" (cmd! (let (corfu-cycle)
|
"C-d" (cmd! (let (corfu-cycle)
|
||||||
(funcall-interactively #'corfu-next corfu-count)))))
|
(funcall-interactively #'corfu-next corfu-count)))))
|
||||||
(:after corfu-popupinfo
|
(:after corfu-popupinfo
|
||||||
:map corfu-popupinfo-map
|
:map corfu-popupinfo-map
|
||||||
"C-h" #'corfu-popupinfo-toggle
|
"C-h" #'corfu-popupinfo-toggle
|
||||||
|
@ -712,7 +712,7 @@
|
||||||
:desc "Configure project" "g" #'projectile-configure-project
|
:desc "Configure project" "g" #'projectile-configure-project
|
||||||
:desc "Invalidate project cache" "i" #'projectile-invalidate-cache
|
:desc "Invalidate project cache" "i" #'projectile-invalidate-cache
|
||||||
:desc "Kill project buffers" "k" #'projectile-kill-buffers
|
:desc "Kill project buffers" "k" #'projectile-kill-buffers
|
||||||
:desc "Find other file" "o" #'projectile-find-other-file
|
:desc "Find sibling file" "o" #'find-sibling-file
|
||||||
:desc "Switch project" "p" #'projectile-switch-project
|
:desc "Switch project" "p" #'projectile-switch-project
|
||||||
:desc "Find recent project files" "r" #'projectile-recentf
|
:desc "Find recent project files" "r" #'projectile-recentf
|
||||||
:desc "Run project" "R" #'projectile-run-project
|
:desc "Run project" "R" #'projectile-run-project
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
(evil-ex-define-cmd "pop[up]" #'+popup/buffer)
|
(evil-ex-define-cmd "pop[up]" #'+popup/buffer)
|
||||||
|
|
||||||
;;; Project navigation
|
;;; Project navigation
|
||||||
(evil-ex-define-cmd "a" #'projectile-find-other-file)
|
(evil-ex-define-cmd "a" #'find-sibling-file)
|
||||||
(evil-ex-define-cmd "cd" #'+evil:cd)
|
(evil-ex-define-cmd "cd" #'+evil:cd)
|
||||||
(evil-ex-define-cmd "pwd" #'+evil:pwd)
|
(evil-ex-define-cmd "pwd" #'+evil:pwd)
|
||||||
|
|
||||||
|
|
|
@ -35,9 +35,9 @@ If STRICT only accept an unset lock file."
|
||||||
(when (or strict (/= (emacs-pid) pid)) t))))
|
(when (or strict (/= (emacs-pid) pid)) t))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +mu4e-lock-file-delete-maybe ()
|
(defun +mu4e-lock-file-delete-maybe (&optional bury)
|
||||||
"Check `+mu4e-lock-file', and delete it if this process is responsible for it."
|
"Check `+mu4e-lock-file', and delete it if this process is responsible for it."
|
||||||
(when (+mu4e-lock-available)
|
(when (and (+mu4e-lock-available) (not bury))
|
||||||
(delete-file +mu4e-lock-file)
|
(delete-file +mu4e-lock-file)
|
||||||
(file-notify-rm-watch +mu4e-lock--request-watcher)))
|
(file-notify-rm-watch +mu4e-lock--request-watcher)))
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,8 @@ This is ignored by ccls.")
|
||||||
:return "return"
|
:return "return"
|
||||||
:yield "#require")
|
:yield "#require")
|
||||||
|
|
||||||
|
(add-to-list 'find-sibling-rules '("/\\([^/]+\\)\\.c\\(c\\|pp\\)\\'" "\\1.\\(h\\|hh\\|hpp\\)"))
|
||||||
|
|
||||||
(when (modulep! +tree-sitter)
|
(when (modulep! +tree-sitter)
|
||||||
(add-hook! '(c-mode-local-vars-hook
|
(add-hook! '(c-mode-local-vars-hook
|
||||||
c++-mode-local-vars-hook)
|
c++-mode-local-vars-hook)
|
||||||
|
|
|
@ -44,8 +44,9 @@ It does this by ignoring everything before the nearest package root (see
|
||||||
root)."
|
root)."
|
||||||
(cond ((doom-special-buffer-p (current-buffer))
|
(cond ((doom-special-buffer-p (current-buffer))
|
||||||
"{PackageName}")
|
"{PackageName}")
|
||||||
((not (eq major-mode 'java-mode))
|
((and (not (eq major-mode 'java-mode))
|
||||||
(user-error "Not in java-mode"))
|
(not (eq major-mode 'java-ts-mode))
|
||||||
|
(user-error "Not in java-mode or java-ts-mode")))
|
||||||
((when-let (project-root (doom-project-root))
|
((when-let (project-root (doom-project-root))
|
||||||
(let* ((project-root (file-truename project-root))
|
(let* ((project-root (file-truename project-root))
|
||||||
(file-path
|
(file-path
|
||||||
|
@ -73,8 +74,9 @@ root)."
|
||||||
"Get the class name for the current file."
|
"Get the class name for the current file."
|
||||||
(cond ((doom-special-buffer-p (current-buffer))
|
(cond ((doom-special-buffer-p (current-buffer))
|
||||||
"{ClassName}")
|
"{ClassName}")
|
||||||
((not (eq major-mode 'java-mode))
|
((and (not (eq major-mode 'java-mode))
|
||||||
(user-error "Not in java-mode"))
|
(not (eq major-mode 'java-ts-mode))
|
||||||
|
(user-error "Not in java-mode or java-ts-mode")))
|
||||||
(buffer-file-name
|
(buffer-file-name
|
||||||
(file-name-sans-extension (file-name-base (buffer-file-name))))
|
(file-name-sans-extension (file-name-base (buffer-file-name))))
|
||||||
((user-error "Can't deduce the class name"))))
|
((user-error "Can't deduce the class name"))))
|
||||||
|
|
|
@ -18,9 +18,7 @@ capture, the end position, and the output buffer.")
|
||||||
(use-package! markdown-mode
|
(use-package! markdown-mode
|
||||||
:mode ("/README\\(?:\\.md\\)?\\'" . gfm-mode)
|
:mode ("/README\\(?:\\.md\\)?\\'" . gfm-mode)
|
||||||
:init
|
:init
|
||||||
(setq markdown-enable-math t ; syntax highlighting for latex fragments
|
(setq markdown-italic-underscore t
|
||||||
markdown-enable-wiki-links t
|
|
||||||
markdown-italic-underscore t
|
|
||||||
markdown-asymmetric-header t
|
markdown-asymmetric-header t
|
||||||
markdown-gfm-additional-languages '("sh")
|
markdown-gfm-additional-languages '("sh")
|
||||||
markdown-make-gfm-checkboxes-buttons t
|
markdown-make-gfm-checkboxes-buttons t
|
||||||
|
|
|
@ -52,8 +52,8 @@ Alternatively, nim is usually available through your OS's package manager:
|
||||||
- openSUSE: ~$ zypper install nim~
|
- openSUSE: ~$ zypper install nim~
|
||||||
|
|
||||||
** Formatter
|
** Formatter
|
||||||
|
Formatting is handled using the [[doom-module::editor format]] module via nimpretty
|
||||||
Formatting is handled using the [[doom-module::editor format]] module via [[https://github.com/FedericoCeratto/nimfmt#installation][nimfmt]].
|
(included with Nim).
|
||||||
|
|
||||||
* TODO Usage
|
* TODO Usage
|
||||||
#+begin_quote
|
#+begin_quote
|
||||||
|
|
|
@ -12,7 +12,7 @@ nimsuggest isn't installed."
|
||||||
(when (and nimsuggest-path (file-executable-p nimsuggest-path))
|
(when (and nimsuggest-path (file-executable-p nimsuggest-path))
|
||||||
(nimsuggest-mode))))
|
(nimsuggest-mode))))
|
||||||
|
|
||||||
(set-formatter! 'nmfmt '("nimfmt" filepath) :modes '(nim-mode))
|
(set-formatter! 'nmfmt '("nimpretty" filepath) :modes '(nim-mode))
|
||||||
|
|
||||||
(when (featurep :system 'windows)
|
(when (featurep :system 'windows)
|
||||||
;; TODO File PR/report upstream (https://github.com/nim-lang/nim-mode)
|
;; TODO File PR/report upstream (https://github.com/nim-lang/nim-mode)
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
;;; lang/nim/doctor.el
|
;;; lang/nim/doctor.el
|
||||||
|
|
||||||
(unless (executable-find "nimsuggest")
|
(unless (executable-find "nimsuggest")
|
||||||
|
@ -8,5 +7,5 @@
|
||||||
(warn! "Could not find nim executable; build commands will be disabled."))
|
(warn! "Could not find nim executable; build commands will be disabled."))
|
||||||
|
|
||||||
(when (modulep! :editor format)
|
(when (modulep! :editor format)
|
||||||
(unless (executable-find "nimfmt")
|
(unless (executable-find "nimpretty")
|
||||||
(warn! "Could not find nimfmt. Formatting will be disabled.")))
|
(warn! "Could not find nimpretty. Formatting will be disabled.")))
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
;;; requires nim nimsuggest nimble
|
;;; requires nim nimsuggest nimble
|
||||||
|
|
||||||
(package! nim-mode :pin "1338e5b0d5e111ad932efb77d3cad680cc3b86c9")
|
(package! nim-mode :pin "625cc023bd75a741b7d4e629e5bec3a52f45b4be")
|
||||||
|
|
||||||
(when (and (modulep! :checkers syntax)
|
(when (and (modulep! :checkers syntax)
|
||||||
(not (modulep! :checkers syntax +flymake)))
|
(not (modulep! :checkers syntax +flymake)))
|
||||||
|
|
|
@ -1438,7 +1438,12 @@ between the two."
|
||||||
;; HACK: Somehow, users/packages still find a way to modify tab-width in
|
;; HACK: Somehow, users/packages still find a way to modify tab-width in
|
||||||
;; org-mode. Since org-mode treats a non-standerd tab-width as an error
|
;; org-mode. Since org-mode treats a non-standerd tab-width as an error
|
||||||
;; state, I use this hook to makes it much harder to change by accident.
|
;; state, I use this hook to makes it much harder to change by accident.
|
||||||
(add-hook! 'org-mode-hook :depth 110 (setq-local tab-width 8))
|
(add-hook! 'org-mode-hook
|
||||||
|
(add-hook! 'after-change-major-mode-hook :local
|
||||||
|
;; The second check is necessary, in case of `org-edit-src-code' which
|
||||||
|
;; clones a buffer and changes its major-mode.
|
||||||
|
(when (derived-mode-p 'org-mode)
|
||||||
|
(setq tab-width 8))))
|
||||||
|
|
||||||
;; Save target buffer after archiving a node.
|
;; Save target buffer after archiving a node.
|
||||||
(setq org-archive-subtree-save-file-p t)
|
(setq org-archive-subtree-save-file-p t)
|
||||||
|
|
|
@ -13,3 +13,9 @@ open."
|
||||||
(when (processp process)
|
(when (processp process)
|
||||||
(kill-process (get-buffer-process inf-buffer))
|
(kill-process (get-buffer-process inf-buffer))
|
||||||
(kill-buffer inf-buffer)))))))
|
(kill-buffer inf-buffer)))))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +ruby-robe-repl-handler ()
|
||||||
|
"Start Robe and open a REPL (for `set-repl-handler!')."
|
||||||
|
(robe-start)
|
||||||
|
(robe-inf-buffer))
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
(bound-and-true-p lsp--buffer-deferred)
|
(bound-and-true-p lsp--buffer-deferred)
|
||||||
(robe-mode +1))))
|
(robe-mode +1))))
|
||||||
:config
|
:config
|
||||||
(set-repl-handler! 'ruby-mode #'robe-start)
|
(set-repl-handler! 'ruby-mode #'+ruby-robe-repl-handler)
|
||||||
(set-company-backend! 'ruby-mode 'company-robe 'company-dabbrev-code)
|
(set-company-backend! 'ruby-mode 'company-robe 'company-dabbrev-code)
|
||||||
(set-lookup-handlers! 'ruby-mode
|
(set-lookup-handlers! 'ruby-mode
|
||||||
:definition #'robe-jump
|
:definition #'robe-jump
|
||||||
|
|
|
@ -8,13 +8,7 @@ be aligned.
|
||||||
|
|
||||||
If set to `nil', disable all the above behaviors.")
|
If set to `nil', disable all the above behaviors.")
|
||||||
|
|
||||||
(after! projectile
|
(add-to-list 'find-sibling-rules '("/\\([^/]+\\)\\.\\(\\(s[ac]\\|le\\)ss\\|styl\\)\\'" "\\1\\.css"))
|
||||||
(pushnew! projectile-other-file-alist
|
|
||||||
'("css" "scss" "sass" "less" "styl")
|
|
||||||
'("scss" "css")
|
|
||||||
'("sass" "css")
|
|
||||||
'("less" "css")
|
|
||||||
'("styl" "css")))
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Description :unfold:
|
* Description :unfold:
|
||||||
This module adds support for various web languages, including HTML5, CSS,
|
This module adds support for various web languages, including HTML5, CSS,
|
||||||
SASS/SCSS, Pug/Jade/Slim, and HAML, as well as various web frameworks, like
|
SASS/SCSS, Pug/Jade/Slim, and HAML, as well as various web frameworks, like
|
||||||
ReactJS, Wordpress, Jekyll, Phaser, AngularJS, Djano, and more.
|
ReactJS, Wordpress, Jekyll, Phaser, AngularJS, Django, and more.
|
||||||
|
|
||||||
** Maintainers
|
** Maintainers
|
||||||
- @hlissner
|
- @hlissner
|
||||||
|
@ -41,6 +41,9 @@ ReactJS, Wordpress, Jekyll, Phaser, AngularJS, Djano, and more.
|
||||||
This module's hacks haven't been documented yet. [[doom-contrib-module:][Document them?]]
|
This module's hacks haven't been documented yet. [[doom-contrib-module:][Document them?]]
|
||||||
#+end_quote
|
#+end_quote
|
||||||
|
|
||||||
|
- Fixes ~//~ line commenting in JSX and Javascript files (if you aren't using
|
||||||
|
:lang javascript for some reason)
|
||||||
|
|
||||||
** TODO Changelog
|
** TODO Changelog
|
||||||
# This section will be machine generated. Don't edit it by hand.
|
# This section will be machine generated. Don't edit it by hand.
|
||||||
/This module does not have a changelog yet./
|
/This module does not have a changelog yet./
|
||||||
|
@ -49,13 +52,8 @@ ReactJS, Wordpress, Jekyll, Phaser, AngularJS, Djano, and more.
|
||||||
[[id:01cffea4-3329-45e2-a892-95a384ab2338][Enable this module in your ~doom!~ block.]]
|
[[id:01cffea4-3329-45e2-a892-95a384ab2338][Enable this module in your ~doom!~ block.]]
|
||||||
|
|
||||||
** Formatter
|
** Formatter
|
||||||
|
|
||||||
Formatting is handled using the [[doom-module::editor format]] module via [[https://prettier.io/docs/en/install.html][prettier]].
|
Formatting is handled using the [[doom-module::editor format]] module via [[https://prettier.io/docs/en/install.html][prettier]].
|
||||||
|
|
||||||
#+begin_quote
|
|
||||||
/No installation steps have been documented./ [[doom-contrib-module:][Document them?]]
|
|
||||||
#+end_quote
|
|
||||||
|
|
||||||
* TODO Usage
|
* TODO Usage
|
||||||
#+begin_quote
|
#+begin_quote
|
||||||
This module has no usage documentation yet. [[doom-contrib-module:][Write some?]]
|
This module has no usage documentation yet. [[doom-contrib-module:][Write some?]]
|
||||||
|
|
|
@ -29,12 +29,6 @@
|
||||||
org-cite-activate-processor 'citar)
|
org-cite-activate-processor 'citar)
|
||||||
|
|
||||||
:config
|
:config
|
||||||
(after! embark
|
|
||||||
(citar-embark-mode))
|
|
||||||
|
|
||||||
(after! org-roam
|
|
||||||
(citar-org-roam-mode))
|
|
||||||
|
|
||||||
(when (modulep! :completion vertico +icons)
|
(when (modulep! :completion vertico +icons)
|
||||||
(defvar citar-indicator-files-icons
|
(defvar citar-indicator-files-icons
|
||||||
(citar-indicator-create
|
(citar-indicator-create
|
||||||
|
@ -81,6 +75,20 @@
|
||||||
;;
|
;;
|
||||||
;;; Third-party
|
;;; Third-party
|
||||||
|
|
||||||
|
(use-package! citar-embark
|
||||||
|
:defer t
|
||||||
|
:init
|
||||||
|
(after! (citar embark)
|
||||||
|
(citar-embark-mode)))
|
||||||
|
|
||||||
|
|
||||||
|
(use-package! citar-org-roam
|
||||||
|
:defer t
|
||||||
|
:init
|
||||||
|
(after! (citar org-roam)
|
||||||
|
(citar-org-roam-mode)))
|
||||||
|
|
||||||
|
|
||||||
(use-package! bibtex-completion
|
(use-package! bibtex-completion
|
||||||
:when (or (modulep! :completion ivy)
|
:when (or (modulep! :completion ivy)
|
||||||
(modulep! :completion helm))
|
(modulep! :completion helm))
|
||||||
|
|
|
@ -1,21 +1,5 @@
|
||||||
;;; tools/editorconfig/config.el -*- lexical-binding: t; -*-
|
;;; tools/editorconfig/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; editorconfig cannot procure the correct settings for extension-less files.
|
|
||||||
;; Executable scripts with a shebang line, for example. So why not use Emacs'
|
|
||||||
;; major mode to drop editorconfig a hint? This is accomplished by temporarily
|
|
||||||
;; appending an extension to `buffer-file-name' when we talk to editorconfig.
|
|
||||||
(defvar +editorconfig-mode-alist
|
|
||||||
'((emacs-lisp-mode . "el")
|
|
||||||
(js2-mode . "js")
|
|
||||||
(perl-mode . "pl")
|
|
||||||
(php-mode . "php")
|
|
||||||
(python-mode . "py")
|
|
||||||
(ruby-mode . "rb")
|
|
||||||
(sh-mode . "sh"))
|
|
||||||
"An alist mapping major modes to extensions. Used by
|
|
||||||
`doom--editorconfig-smart-detection-a' to give editorconfig filetype hints.")
|
|
||||||
|
|
||||||
|
|
||||||
;; 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
|
||||||
|
@ -30,24 +14,20 @@
|
||||||
(add-to-list 'editorconfig-exclude-regexps
|
(add-to-list 'editorconfig-exclude-regexps
|
||||||
"\\.\\(zip\\|\\(doc\\|xls\\|ppt\\)x\\)\\'")
|
"\\.\\(zip\\|\\(doc\\|xls\\|ppt\\)x\\)\\'")
|
||||||
|
|
||||||
(defadvice! +editorconfig--smart-detection-a (fn)
|
|
||||||
"Retrieve the properties for the current file. If it doesn't have an
|
|
||||||
extension, try to guess one."
|
|
||||||
:around #'editorconfig-call-editorconfig-exec
|
|
||||||
(let ((buffer-file-name
|
|
||||||
(if (and (not (bound-and-true-p org-src-mode))
|
|
||||||
(file-name-extension buffer-file-name))
|
|
||||||
buffer-file-name
|
|
||||||
(format "%s%s" (buffer-file-name (buffer-base-buffer))
|
|
||||||
(if-let (ext (alist-get major-mode +editorconfig-mode-alist))
|
|
||||||
(concat "." ext)
|
|
||||||
"")))))
|
|
||||||
(funcall fn)))
|
|
||||||
|
|
||||||
(add-hook! 'editorconfig-after-apply-functions
|
(add-hook! 'editorconfig-after-apply-functions
|
||||||
(defun +editorconfig-disable-indent-detection-h (props)
|
(defun +editorconfig-disable-indent-detection-h (props)
|
||||||
"Inhibit `dtrt-indent' if an explicit indent_style and indent_size is
|
"Inhibit `dtrt-indent' if an explicit indent_style and indent_size is
|
||||||
specified by editorconfig."
|
specified by editorconfig."
|
||||||
(when (or (gethash 'indent_style props)
|
(when (and (not doom-inhibit-indent-detection)
|
||||||
(gethash 'indent_size props))
|
(or (gethash 'indent_style props)
|
||||||
(setq doom-inhibit-indent-detection 'editorconfig)))))
|
(gethash 'indent_size props)))
|
||||||
|
(setq doom-inhibit-indent-detection 'editorconfig)))
|
||||||
|
;; I use a hook over `editorconfig-exclude-modes' because the option
|
||||||
|
;; inhibits all settings, and I only want to inhibit indent_size. Plus modes
|
||||||
|
;; in that option won't apply to derived modes, so we'd have to add *all*
|
||||||
|
;; possible org-mode derivatives to it.
|
||||||
|
(defun +editorconfig-unset-tab-width-in-org-mode-h (props)
|
||||||
|
"A tab-width != 8 is an error state in org-mode, so prevent changing it."
|
||||||
|
(when (and (gethash 'indent_size props)
|
||||||
|
(derived-mode-p 'org-mode))
|
||||||
|
(setq tab-width 8)))))
|
||||||
|
|
|
@ -3,4 +3,4 @@
|
||||||
|
|
||||||
(package! editorconfig
|
(package! editorconfig
|
||||||
:recipe (:nonrecursive t)
|
:recipe (:nonrecursive t)
|
||||||
:pin "4b81a5992858cbf03bcd7ed6ef31e4be0b55a7c1")
|
:pin "c3666c093f3a2a80fb42e513bf0a10d597497c18")
|
||||||
|
|
|
@ -44,7 +44,12 @@ This must be set before `treemacs' has loaded.")
|
||||||
|
|
||||||
|
|
||||||
(use-package! treemacs-nerd-icons
|
(use-package! treemacs-nerd-icons
|
||||||
:after ( treemacs lsp-treemacs nerd-icons)
|
:defer t
|
||||||
|
;; HACK: Because `lsp-treemacs' mutates Treemacs' default theme, and
|
||||||
|
;; `treemacs-nerd-icons' reads from it to populate its nerd-icons theme,
|
||||||
|
;; load order is important to ensure they don't step on each other's toes.
|
||||||
|
:init (with-eval-after-load (if (modulep! +lsp) 'lsp-treemacs 'treemacs)
|
||||||
|
(require 'treemacs-nerd-icons))
|
||||||
:config (treemacs-load-theme "nerd-icons"))
|
:config (treemacs-load-theme "nerd-icons"))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue