auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Flycheck warnings with sections and labels


From: Jan Braun
Subject: Flycheck warnings with sections and labels
Date: Sat, 12 Mar 2022 12:37:38 +0100

Hi everyone,

I am using flycheck minor mode for my LaTeX buffers.  
Flycheck uses lacheck in the background.  One thing, 
which regularly gets warnings or notices is, when 
you use AUCTeX to insert a section via C-c C-s.  
AUCTeX asks for the section title and suggests also a 
label text, which I usually gladly accept.  AUCTeX 
inserts one line for the section command and one line 
for the label, which lacheck considers as bad style.  
Lacheck asks you, to either insert a percent after the 
section command or write section and label in one line.

Funny, if you know, that AUCTeX and lacheck where 
originally coded by the same person :-)

Personally I never had any problem (of which I am aware 
of), resulting of this additional spaces between section 
command and next line label.  But when lacheck suggests to 
avoid this constellation, I usually do.  

This is my quick hack:

--- latex.el    2022-02-26 10:12:17.000000000 +0100
+++ jb-latex.el 2022-03-12 12:23:26.000000000 +0100
@@ -533,7 +533,12 @@
   (if (zerop (length LaTeX-title))
       (set-marker LaTeX-done-mark (point)))
   (insert LaTeX-title TeX-grcl)
-  (LaTeX-newline)
+  ;; 2022-03-12 12:05:01 +0100 jan: modified.
+  (if (eq major-mode 'latex-mode)
+      (insert TeX-comment-start-regexp))
+  (if (eq major-mode 'latex-mode)
+      (newline)
+    (LaTeX-newline))
   ;; If RefTeX is available, tell it that we've just made a new section
   (and (fboundp 'reftex-notice-new-section)
        (reftex-notice-new-section)))

Using LaTeX-newline results in funny effects: the following 
\label command will be printed the in a new line, behind a 
percent sign and indented as far, as the \section-ing command 
is long.  But in docTeX-mode buffers, you’ll have to use the 
previous behaviour. 

Is there a trick, that you can combine the two following 
ifs into one?

What do you think about this?

-- 
Jan Braun (er/ihm)
Jan.Braun@klein-gallien.org


=== ypchsh /usr/local/bin/emacs === go FORTH now … ===




reply via email to

[Prev in Thread] Current Thread [Next in Thread]