Hi Arash and Vangelis,

>>>>> Vangelis Evangelou <evange...@gmail.com> writes:
> There is a typo: "When this option is non-@code{nil}, some editing
> comments are aware of". "comments" -> "commands"

Thanks 😊

I attach the current patches.

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

>From 4df96b72085a31d5c3c7901ecd122b6d2439ea2c Mon Sep 17 00:00:00 2001
From: Ikumi Keita <ik...@ikumi.que.jp>
Date: Fri, 1 Nov 2024 15:27:09 +0900
Subject: [PATCH 1/2] Change default of `LaTeX-insert-into-comments'
 (bug#74056)

* latex.el (LaTeX-insert-into-comments): Change default value to nil.
Add :safe and :package-version entries.
Refill the doc string.
* NEWS.org (Changed): Announce the change.
* doc/auctex.texi (Commenting): Add explanation of
`LaTeX-insert-into-comments' (at last).
* doc/todo.texi (Mid-term Goals): Adjust accordingly.
---
 NEWS.org        |  5 +++++
 doc/auctex.texi | 16 ++++++++++++++++
 doc/todo.texi   |  2 +-
 latex.el        | 10 ++++++----
 4 files changed, 28 insertions(+), 5 deletions(-)

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..fb20c817 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 an accompanying space) 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 commands 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 sometimes
+caused unintuitive behaviors in normal @LaTeX{} mode.  Now it defaults to
+@code{nil} and is 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..5e1c628c 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."
-- 
2.46.2

>From a15a2f013e6f4d3bafd699bf88df6883862d61fa Mon Sep 17 00:00:00 2001
From: Ikumi Keita <ik...@ikumi.que.jp>
Date: Fri, 1 Nov 2024 15:41:58 +0900
Subject: [PATCH 2/2] Improve insertion of \item (bug#74056)

* latex.el (LaTeX-insert-item): On empty line, use that line to put
\item and don't create a new line after it.
---
 latex.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/latex.el b/latex.el
index 5e1c628c..91aa16b5 100644
--- a/latex.el
+++ b/latex.el
@@ -1535,7 +1535,18 @@ 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))
+          (if LaTeX-insert-into-comments
+              (re-search-forward
+               (concat "\\=" TeX-comment-start-regexp "+")
+               (line-end-position) t))
+          (looking-at "[ \t]*$"))
+        (delete-region (match-beginning 0) (match-end 0))
+      (LaTeX-newline))
     (if (assoc environment LaTeX-item-list)
         (funcall (cdr (assoc environment LaTeX-item-list)))
       (TeX-insert-macro "item"))
-- 
2.46.2

_______________________________________________
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex

Reply via email to