A workaround for formatting org mode
If point is in a source block, format that source block. Else don't try to format the buffer. format-all-buffer does not support org mode.
This commit is contained in:
parent
2e61fbbf08
commit
99a83ca18f
1 changed files with 3 additions and 3 deletions
|
@ -225,9 +225,9 @@ If nil, BEG and/or END will default to the boundaries of the src block at point.
|
||||||
(defun +format/buffer ()
|
(defun +format/buffer ()
|
||||||
"Reformat the current buffer using LSP or `format-all-buffer'."
|
"Reformat the current buffer using LSP or `format-all-buffer'."
|
||||||
(interactive)
|
(interactive)
|
||||||
(if (and (eq major-mode 'org-mode)
|
(if (eq major-mode 'org-mode)
|
||||||
(org-in-src-block-p t))
|
(when (org-in-src-block-p t)
|
||||||
(+format--org-region nil nil)
|
(+format--org-region nil nil))
|
||||||
(call-interactively
|
(call-interactively
|
||||||
(cond ((and +format-with-lsp
|
(cond ((and +format-with-lsp
|
||||||
(bound-and-true-p lsp-mode)
|
(bound-and-true-p lsp-mode)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue