emacs-format-all-the-code
emacs-format-all-the-code copied to clipboard
Latex mode issues
format-all-mode doesnt work with TeX-mode
Whenever I format the buffer, a line Please enter text to be indented: (press CTRL+D when finished) is inserted at the start of the file before saving it. This is the usual output of latexindex when called without an argument.
This migth be related to the lack of a flag?
What operating system are you using, and what package did you install latexformat from?
I can't find a special flag in my copy of latexformat to format from stdin. It seems to always do that when a filename is not given.
Do you mean that Please enter text to be indented: (press CTRL+D when finished appears at the beginning of your LaTeX document after formatting instead of showing up in the separate *format-all-errors* buffer?
I am using fedora 30 Silverblue in one machine, the catch is that everything runs from inside a toolbox container, in that case I get that line at the beginning on the document whenever I save.
On my other machine, I have fedora 31in that case it indeeds appears in another buffer.
In both cases I just install them via texlive-scheme-{medium,full} for {f31,f30}.
If things work fine without the container, then the container is probably merging the standard output stream (where the formatted LaTeX markup goes) and the standard error stream (where Please enter text to be indented and error/warning messages go) into one stream. If that is the case, there's unfortunately nothing that format-all can reasonably do to separate those streams back again. So you'd have to find some way to run the container so that the two streams are kept separate. I don't know much about how to do that. You might have luck asking on https://unix.stackexchange.com or https://superuser.com. Sorry I can't be of more help.
It would also be nice if latex-indent had some way to hide that Please enter text to be indented prompt. But if standard output and standard error are merged, and latex-indent writes its error/warning messages to standard error, then you'd still get those messages inserted into your document if the two streams are merged. So it still wouldn't completely solve that problem.
I am testing from a container and now format-all-mode is opening a separate buffer to show the message Please enter text to be indented. Doom emacs implementes the function
(defun +format/buffer (&optional arg)
"Format the source code in the current buffer."
(interactive "P")
(let ((+format-with (or (if arg (+format-completing-read)) +format-with)))
(pcase-let ((`(,formatter ,mode-result) (format-all--probe)))
(pcase
(+format-buffer
formatter mode-result
(or +format-preserve-indentation +format-region-p))
(`no-formatter
(when (called-interactively-p 'any)
(message "No formatter specified for %s" major-mode))
nil)
(`error (message "Failed to format buffer due to errors") nil)
(`noop (message "Buffer was already formatted") nil)
(_ (message "Formatted (%s)" formatter) t)))))
which does not open this secondary buffer.