Closed oatmealm closed 4 years ago
This seems to be a bug in Doom Emacs which I don't know how to fix. The backtrace line:
(if (and (eq major-mode 'org-mode) (org-in-src-block-p t)) (+format--org-region nil nil) (call-interactively (cond ((and +format-with-lsp (and (boundp 'lsp-mode) lsp-mode) (lsp-feature\? "textDocument/formatting")) #'lsp-format-buffer) ((and +format-with-lsp (and (boundp 'eglot--managed-mode) eglot--managed-mode) (eglot--server-capable :documentFormattingProvider)) #'eglot-format-buffer) (#'format-all-buffer))))
shows that it tries a bunch of different alternatives for how to format the buffer, and at the end, falls back to format-all-buffer
as the default alternative if the other ones do not apply. In the case of your buffer, since you have no source code blocks, it probably should give up instead of calling format-all.
My org file contains some headlines with :crypt:
as tags. Each time I edit and save it, the information is automatically encrypted to protect some of my personal privacy. Everything was normal before, but since a commit, every time you save after editing, you can always get the error message in the title, and it no longer automatically encodes the encrypted information.
Debugger entered--Lisp error: (error "Don’t know how to format org-mode code")
signal(error ("Don’t know how to format org-mode code"))
error("Don't know how to format %S code" org-mode)
format-all-buffer()
funcall-interactively(format-all-buffer)
call-interactively(format-all-buffer)
(if (and (eq major-mode 'org-mode) (org-in-src-block-p t)) (+format--org-region nil nil) (call-interactively (cond ((and +format-with-lsp (and (boundp 'lsp-mode) lsp-mode) (lsp-feature\? "textDocument/formatting")) #'lsp-format-buffer) ((and +format-with-lsp (and (boundp 'eglot--managed-mode) eglot--managed-mode) (eglot--server-capable :documentFormattingProvider)) #'eglot-format-buffer) (#'format-all-buffer))))
+format-buffer-h()
run-hooks(before-save-hook)
basic-save-buffer(t)
save-buffer(1)
funcall-interactively(save-buffer 1)
call-interactively(save-buffer nil nil)
command-execute(save-buffer)
Please talk to the Doom Emacs people about this bug as we are not able to fix it on the format-all side. If they need some assistance from format-all to make it easier to fix, we can work it out.
Hi, there! Wanted to report that I'm seeing this error message when saving org-mode buffers... There are NO source code blocks in the buffer that's being saved, and I DO see this error when saving buffer with org file which do have some source code blocks.
I'm using Doom Emacs.