GNU bug report logs -
#36358
Indentation of not matched braces in latex-mode
Previous Next
Full log
Message #11 received at 36358 <at> debbugs.gnu.org (full text, mbox):
> I just pushed the patch below which lets you specify commands whose
> args shouldn't be indented this way.
Hmmm... or I don't understand how "specify commands whose args
shouldn't be indented" will work in practice, or this may be wrong
path. It's not about \emph{} or \footnote{}, it's about every command
which use '{}' (braces), so in latex... most of them(?). Therefore if
you let people add them to the list it'll grow really big - just look
at font styles: \textrm{}, \textit{}, \textmd{}, \textbf{}, \textup{},
\textsl{}, \textsf{}, \textsc{}, \texttt{}, \textnormal{} - we could
probably use "\text*", but there are other commands, for example the
ones we define as new in preamble.
Unless this patch is temporary lifebuoy for those who don't want to
set 'tex-indent-basic' to 0, then well... carry on. :)
> Note that the patch is for Emacs's bundled tex-mode, whereas you
> seem to be using AUCTeX, which uses its own indentation code.
No, I'm _not_ using AUCTeX, I'm using latex-mode. I only pointed to
AUCTeX, because when I was looking for answer to this problem, I found
solution (helpful internet) in AUCTeX - 'TeX-brace-indent-level'
variable - and wanted something similar in latex-mode.
Also I found code in theirs (AUCTeX) TEX.EL, which may help a bit.
It may, but since I basically know no Elisp, I may be wrong.
(defcustom TeX-brace-indent-level 2
"*The level of indentation produced by an open brace."
:group 'TeX-indentation
:type 'integer)
(defun TeX-brace-count-line ()
"Count number of open/closed braces."
(save-excursion
(let ((count 0) (limit (line-end-position)) char)
(while (progn
(skip-chars-forward "^{}\\\\" limit)
(when (and (< (point) limit) (not (TeX-in-comment)))
(setq char (char-after))
(forward-char)
(cond ((eq char ?\{)
(setq count (+ count TeX-brace-indent-level)))
((eq char ?\})
(setq count (- count TeX-brace-indent-level)))
((eq char ?\\)
(when (< (point) limit)
(forward-char)
t))))))
count)))
This variable is also used in theirs LATEX.EL - L3366, L3503. Both
functions too big to paste, I think.
This bug report was last modified 4 years and 344 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.