Commit graph

178 commits

Author SHA1 Message Date
Henrik Lissner
037b018cdd
feat: add .doommodule files
These optional dotfiles indicate the root of a module or module
group (:lang), and will later contain module metadata. They will also
serve as an alternative to packages.el and doctor.el, and will aide the
parts of the v3.0 module API concerned with resolving the current module
from a path (`doom-module-from-path`), which currently rely too heavily
on parsing path strings.

For now, however, they're simply placeholders.
2024-09-14 20:47:39 -04:00
Henrik Lissner
7ec570fdf5
fix(format): clang-format: respect c-basic-offset
In the absence of a .clang-format file, imposing the value of
`c-basic-offset` onto clang-format seems like reasonable, default
behavior. Like all other cases, this can be disabled by unsetting
`apheleia-formatters-respect-indent-level` globally or mode-locally with
`setq-hook!` or similar.
2024-09-14 20:46:49 -04:00
Henrik Lissner
804da58540
fix(format): disable on-save for LaTeX-mode
Since latex-mode != LaTeX-mode.
2024-08-22 12:32:14 -04:00
Henrik Lissner
a0c901cca7
fix(format): lsp-mode/eglot formatters
There seems to be context that eglot needs that isn't available in
Apheleia's scratch buffer.

Fix: #7962
2024-08-22 12:32:14 -04:00
Henrik Lissner
abf19aa63e
tweak(format): +format/region: emit message on success 2024-08-20 16:36:22 -04:00
Henrik Lissner
67e5dda526
fix(format): void-function +javascript-npm-conf error
Amend: c0a1b9efc9
Close: #8005
2024-08-20 16:27:34 -04:00
Henrik Lissner
50adaa9e48
fix(format): prettier-*: 'void-variable unless' error
Also short-circuits the condition with
apheleia-formatters-respect-indent-level, if it's been disabled.

Amend: c0a1b9efc9
Ref: #7998
2024-08-19 16:21:08 -04:00
Henrik Lissner
c0a1b9efc9
fix(format): prettier: don't override prettier indent config
Apheleia's default config for prettier adds --use-tabs/--tab-width to
force prettier to match Emacs' indent settings, which is fine until a
prettier config file tries to overwrite it and is ignored. As a
compromise (and stopgap solution), I omit these flags if any prettier
settings are set in the current project.

Fix: #7998
2024-08-18 03:59:18 -04:00
Henrik Lissner
f6040832e5
nit(format): move formatter configs to bottom
There will likely be more of these later, so I move them to the bottom
of the :config block.
2024-08-16 14:58:33 -04:00
Henrik Lissner
5e2e886b35
nit: comment revision & reformatting 2024-08-15 23:18:47 -04:00
Henrik Lissner
0bac5fe132
fix(format): register shfmt for sh-mode
Apheleia already has a (and better) definition for shfmt.

Fix: #5268
2024-07-30 02:54:25 -04:00
Henrik Lissner
13ed89f235
fix(format): disengage selection after +format-region
Fix: #7951
2024-07-16 11:34:14 -04:00
Henrik Lissner
1eaa1aef2c
refactor(format): rename to +format/org-blocks-in-region
To better reflect that it operates on multiple blocks.

Ref: #7936
2024-07-14 02:00:24 -04:00
Henrik Lissner
7543b04e15
feat(format): add +format/org-block-in-region
Also updates `+org/reformat-at-point` to call
`+format/org-block-in-region` if selection is active.

Fix: #7936
2024-07-14 01:57:20 -04:00
Eloise Christian
081231b73f fix(format): apheleia doesn't invoke lsp formatter
change `+format--lsp-fn` to run `+format--lsp-fn` in context of main
buffer rather than apheleia's scratch buffer so that the lsp mode can
be discovered
2024-07-08 21:41:39 -04:00
Henrik Lissner
dfe9d572a7
docs(format): hacks: mention save-buffer advice 2024-07-08 13:59:16 -04:00
Henrik Lissner
7d25ba3f6c
fix(format): void function +format-with-lsp-maybe-h error
Regression introduced in fd1941b.

Amend: fd1941b95f
2024-07-08 13:59:06 -04:00
Henrik Lissner
6b526b1b47
refactor(format): +format/org-block: make arg optional 2024-07-07 21:48:17 -04:00
Henrik Lissner
f104f10c5b
docs(format): revise README.org
To reflect recent changes and for clarity.
2024-07-07 21:48:17 -04:00
Henrik Lissner
fd1941b95f
refactor!(format): simplify & gate lsp/eglot impl behind +lsp
BREAKING CHANGE: This commit introduces two changes, a breaking, one
not.

The breaking change: `+format-with-lsp` used to control lsp-mode/eglot
integration for this module, but it is now gated behind a new +lsp flag.
Users will need to add it to their `doom!` blocks (in $DOOMDIR/init.el)
to restore the integration.

The other change: I've merged the former `lsp` and `eglot` formatters
into a single `lsp` formatter that dispatches to the appropriate
backend, as well as wrapping this integration in a
`+format-with-lsp-mode` minor mode, so it can be toggled at will; mainly
to assist in debugging formatter behavior.

A unified formatter makes it easier for folks to configure
`+format-with` on a per-project/directory/file basis, without needing to
know what backend this module uses, and opens us up to integrating other
LSP backends in the future (like lsp-bridge).
2024-07-07 21:43:27 -04:00
Henrik Lissner
cca40c0277
tweak(format): doom-debug-variables: add apheleia-log-debug-info 2024-07-07 21:43:27 -04:00
Henrik Lissner
d648bfda40
docs(format): revise docstrings and comments 2024-07-07 20:41:03 -04:00
Henrik Lissner
c5c7f0bc99
feat(format): add +format-inhibit alias
I want both `apheleia-formatter` and `apheleia-inhibit` exposed for easy
setting from directory/file-local variables (like .dir-locals.el), but
I'd like to abstract away the implementation (Apheleia) a little, hence
these aliases. This way, whether or not we're still using Apheleia in a
year or three, `+format-with` and `+format-inhibit` should always work.
2024-07-07 16:31:24 -04:00
Henrik Lissner
5e78ed0911
refactor(format): use eglot-server-capable
eglot--server-capable was deprecated.
2024-07-07 14:39:50 -04:00
Henrik Lissner
deb59ca4ad
fix(format): LSP formatters before Apheleia is loaded 2024-07-07 14:39:27 -04:00
Henrik Lissner
21a427c33b
fix(format): eglot-managed{,-mode}-hook hook 2024-07-06 21:18:34 -04:00
Henrik Lissner
17d4aaace3
fix(format): add lsp functions
Forgot to include these functions in 8072762. Oops.

Amend: 8072762de8
2024-07-06 21:03:12 -04:00
Henrik Lissner
8072762de8
refactor(format): redesign module
Rather than wrap Apheleia in custom formatting logic, I now use
Apheleia's own machinary to integrate into LSP and Eglot, which is less
complexity to maintain. It also makes settings +format-with a more
reliable option for per-project or per-file configuration.

This also adds a +format/org-src-block command, which I'll incorporate
into the org module in a follow-up commit.

Ref: #7685
2024-07-06 19:54:55 -04:00
Henrik Lissner
a3a0629e03
bump: :editor
doomemacs/snippets@c1384cc797 -> doomemacs/snippets@3a0b029c5d
emacs-evil/evil-collection@ca977acb83 -> emacs-evil/evil-collection@acb056b1d0
emacs-evil/evil@0251080640 -> emacs-evil/evil@0ad84c5216
emacs-straight/adaptive-wrap@70005d2012 -> emacs-straight/adaptive-wrap@a3b179ea21
emacs-tree-sitter/ts-fold@0627723e5f -> emacs-tree-sitter/ts-fold@6ce584d1ac
emacsmirror/visual-fill-column@5e74afe39d -> emacsmirror/visual-fill-column@e04d3521b6
joaotavora/yasnippet@297546f085 -> joaotavora/yasnippet@eb5ba2664c
juliapath/evil-numbers@7a1b62afc1 -> juliapath/evil-numbers@c789989451
justinbarclay/parinfer-rust-mode@e9a23e136b -> justinbarclay/parinfer-rust-mode@a96c768e9d
magnars/multiple-cursors.el@234806c832 -> magnars/multiple-cursors.el@c870c18462
radian-software/apheleia@96a9805ecb -> radian-software/apheleia@61766b50b2
2024-06-22 18:14:05 -04:00
Henrik Lissner
b405225b90
refactor!(vc-gutter): drop git-gutter for diff-hl
BREAKING CHANGE: This removes git-gutter as an implementation for the
`:ui vc-gutter` module, leaving only the diff-hl implementation. There
are no longer any +git-gutter or +diff-hl flags for this module. Users
don't have to do anything to keep the vc gutter, unless they prefer
git-gutter for any reason (in which case they'll need to install and set
it up themselves).

This has been planned for some time, because of a roadmap goal for Doom
to lean into native/built-in functionality where it's equal or better
than the third party alternatives. diff-hl relies on the built-in vc.el
library instead of talking to git directly (thus expanding support to
whatever VCS's vc.el supports, and not git alone), which also means it
can take advantage of its caching and other user configuration for
vc.el. Overall, it is faster and lighter.

What I've also been waiting for was a stage-hunk command, similar to
git-gutter:stage-hunk, which arrived in dgutov/diff-hl@a0560551cd and
dgutov/diff-hl@133538973b, and have evolved since.

Ref: dgutov/diff-hl@a0560551cd
Ref: dgutov/diff-hl@133538973b
Ref: https://github.com/orgs/doomemacs/projects/5/views/1?pane=issue&itemId=58747789
2024-06-22 18:14:04 -04:00
Henrik Lissner
5cc4056abf
fix(format): +format-with-eglot-fn: eglot detection 2024-03-13 01:00:38 -04:00
Henrik Lissner
5c7149da67
docs(format): +format-in-org-src-blocks-fn: add docstring 2024-02-17 07:13:39 -05:00
Henrik Lissner
1e8fd09120
fix(format): +format-in-org-src-blocks-fn
Didn't return non-nil, so whether or not it worked, Apheleia would
attempt to (ineffectually) format the org buffer afterwards.

Also remove unneeded beg/end checks (the functions always receive a
value).
2024-02-17 07:13:39 -05:00
Henrik Lissner
9ba6d7191c
refactor(format): improve lsp/eglot formatter dispatchers 2024-02-14 18:12:22 -05:00
Henrik Lissner
e9ea3cc591
feat(format): add eglot support
Fix: #7673
2024-02-14 18:12:22 -05:00
Henrik Lissner
20de3d0f29
refactor(format): introduce +format-functions 2024-02-14 18:12:22 -05:00
Henrik Lissner
e701522d68
bump: :editor
doomemacs/snippets@d490cba6d7 -> doomemacs/snippets@f022984ee1
emacs-straight/adaptive-wrap@fc9f0306f1 -> emacs-straight/adaptive-wrap@70005d2012
emacs-tree-sitter/ts-fold@75e72c658a -> emacs-tree-sitter/ts-fold@0627723e5f
joaotavora/yasnippet@5cbdbf0d20 -> joaotavora/yasnippet@297546f085
joostkremers/visual-fill-column@695a597892 -> joostkremers/visual-fill-column@db7c7c2365
justinbarclay/parinfer-rust-mode@6e6bdeeba3 -> justinbarclay/parinfer-rust-mode@8df117a3b5
raxod502/apheleia@56651724ad -> raxod502/apheleia@96a9805ecb
2024-02-04 19:18:24 -05:00
Henrik Lissner
659f7bfc71
refactor!: deprecate IS-* OS constants
BREAKING CHANGE: This deprecates the IS-(MAC|WINDOWS|LINUX|BSD) family
of global constants in favor of a native `featurep` check:

  IS-MAC      ->  (featurep :system 'macos)
  IS-WINDOWS  ->  (featurep :system 'windows)
  IS-LINUX    ->  (featurep :system 'linux)
  IS-BSD      ->  (featurep :system 'bsd)

The constants will stick around until the v3 release so folks can still
use it -- and there are still some modules that use it, but I'll phase
those uses out gradually.

Fix: #7479
2024-02-04 17:54:29 -05:00
Peter Hoeg
9a1022ef08
bump: :editor format
radian-software/apheleia@c222927f70 -> radian-software/apheleia@56651724ad

fbd00b6 changes aphelia-core to aphelia, but only in 1 out of 2 places
and this is not the correct name in the version pinned in doom.

Fix: #7568
Amend: fbd00b6a08
2023-11-29 11:27:06 -05:00
John Goff
fbd00b6a08 fix(format): correct name of feature 2023-11-27 09:37:11 -05:00
John Goff
c076b1237f docs(format): reasoning for using +format/buffer 2023-11-27 09:37:11 -05:00
John Goff
9da33cf9e7 docs(format): describe interaction between +onsave and LSP 2023-11-27 09:37:11 -05:00
John Goff
9d8f657b37 refactor(format): describe what hook does 2023-11-27 09:36:58 -05:00
John Goff
85d20f71ca docs(format): fix name of doom-package 2023-11-27 09:36:58 -05:00
John Goff
9b718f8a5a docs(format): document +format-on-save-disabled-modes in README 2023-11-27 09:36:58 -05:00
John Goff
cdbf97b4e9 fix(format): align behaviour and documentation
`+format-on-save-disabled-modes` documentation was referencing behaviour
that no longer exists, as well as documenting behaviour that was not
implemented.
2023-11-27 09:36:58 -05:00
Henrik Lissner
a4d95674ec
tweak(format): doom-debug-variables: add apheleia-log-only-errors 2023-09-20 20:23:59 +02:00
Henrik Lissner
cdbf58a871
refactor(format): swap to string-blank-p & memq 2023-09-20 20:23:59 +02:00
Henrik Lissner
88bb045388
docs(*): replace all-the-icons with nerd-icons
Also colorizes the leading icon in notices.
2023-09-16 20:19:11 +02:00
LemonBreezes
aab5215951 fix(format): use +vc-gutter-update-h instead
+vc-gutter-init-maybe-h is not defined when using +diff-hl so instead
let's use +vc-gutter-update-h to refresh the VC gutter.
2023-09-16 05:00:25 +02:00