bug-auctex
[Top][All Lists]
Advanced

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

bug#74056: `LaTeX-insert-item' inserts comment characters if called from


From: Ikumi Keita
Subject: bug#74056: `LaTeX-insert-item' inserts comment characters if called from inside comment
Date: Thu, 31 Oct 2024 18:49:11 +0900

Hi Arash,

>>>>> Arash Esbati <arash@gnu.org> writes:
> Thanks, :package-version '(auctex . "14.0.8") is missing, and also an
> entry in NEWS.org.  And while we're at it, should we document the
> variable in the manual and take this from the ToDo-list[1], WDYT?

I added updates to documentation as well. How about this? (I'm thinking
to install `LaTeX-insert-item' change as a separate commit.)

diff --git a/NEWS.org b/NEWS.org
index b5a4bb91..28371831 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -30,6 +30,11 @@
 - Add preliminary support for parsing =\graphicspath= in
   =style/graphicx.el=.
 
+** Changed
+
+- Change the default value of ~LaTeX-insert-into-comments~ from ~t~ to
+  ~nil~.
+
 * [14.0.7] - 2024-10-05
 
 ** Added
diff --git a/doc/auctex.texi b/doc/auctex.texi
index 718d4c2a..86913ef4 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -1616,6 +1616,22 @@ paragraph is considered to consist of all preceding and 
succeeding
 lines starting with a @samp{%}, until the first non-comment line.
 @end deffn
 
+In doc@TeX{} document, all documentations are commented out.  @AUCTeX{}
+inserts @samp{%} (with a space after it) at the beginning of line when
+you issue some commands including sectioning (@kbd{C-c C-s}) and inserting
+environments (@kbd{C-c C-e}), on a commented line.  This behavior is
+controlled by @code{LaTeX-insert-into-comments}.
+
+@defopt LaTeX-insert-into-comments
+When this option is non-@code{nil}, some editing comments are aware of
+comment prefix at the beginning of line and insert it in the line created
+anew.
+
+The default value of this option used to be @code{t}, which caused several
+unintuitive behavior in normal @LaTeX{} mode.  Now it defaults to
+@code{nil} and set to @code{t} in doc@TeX{} mode.
+@end defopt
+
 @node Indenting
 @section Indenting
 @cindex Formatting
diff --git a/doc/todo.texi b/doc/todo.texi
index d144ba72..825e21aa 100644
--- a/doc/todo.texi
+++ b/doc/todo.texi
@@ -78,7 +78,7 @@ texinfo mode.)
 Following entries should be included in the document:
 @itemize @minus
 @item
-Variables @code{LaTeX-insert-into-comments}, @code{TeX-translate-location-hook}
+Variable @code{TeX-translate-location-hook}
 
 @item
 How to use @code{TeX-auto-add-type}, as well as functions and variables
diff --git a/latex.el b/latex.el
index 02fd1e33..554865ab 100644
--- a/latex.el
+++ b/latex.el
@@ -66,12 +66,14 @@ A comma-seperated list of strings."
 
 (make-variable-buffer-local 'LaTeX-default-options)
 
-(defcustom LaTeX-insert-into-comments t
+(defcustom LaTeX-insert-into-comments nil
   "Whether insertion commands stay in comments.
-This allows using the insertion commands even when
-the lines are outcommented, like in dtx files."
+This allows using the insertion commands even when the lines are
+outcommented, like in dtx files."
   :group 'LaTeX-environment
-  :type 'boolean)
+  :type 'boolean
+  :safe #'booleanp
+  :package-version '(auctex . "14.0.8"))
 
 (defcustom docTeX-indent-across-comments nil
   "If non-nil, indentation in docTeX is done across comments."
@@ -1533,7 +1535,14 @@ You may use `LaTeX-item-list' to change the routines 
used to insert the item."
     (when (and (TeX-active-mark)
                (> (point) (mark)))
       (exchange-point-and-mark))
-    (unless (bolp) (LaTeX-newline))
+    (if (save-excursion
+          ;; If the current line has only whitespace characters, put
+          ;; the new \item on this line, not creating a new line
+          ;; below.
+          (goto-char (line-beginning-position))
+          (looking-at "\\s-*$"))
+        (delete-region (point) (match-end 0))
+      (LaTeX-newline))
     (if (assoc environment LaTeX-item-list)
         (funcall (cdr (assoc environment LaTeX-item-list)))
       (TeX-insert-macro "item"))

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine
#Gaza #StopMassiveKilling #CeasefireNOW





reply via email to

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