auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 1823017839b2c2bd09d3d


From: Arash Esbati
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 1823017839b2c2bd09d3d58fd08ef6dd168c10b8
Date: Wed, 6 Apr 2022 07:09:25 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  1823017839b2c2bd09d3d58fd08ef6dd168c10b8 (commit)
      from  69b78fcc2692e81a31ebdeb23aa82b1f5123e213 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1823017839b2c2bd09d3d58fd08ef6dd168c10b8
Author: Arash Esbati <arash@gnu.org>
Date:   Wed Apr 6 13:07:56 2022 +0200

    Wrap the 'function' environment better with %
    
    * style/l3doc.el (LaTeX-env-l3doc-function): Improve inserting of
    comment-char % around and in the 'function' environment.

diff --git a/style/l3doc.el b/style/l3doc.el
index 1e11bb14..e51e83a4 100644
--- a/style/l3doc.el
+++ b/style/l3doc.el
@@ -63,7 +63,7 @@ This function should be used for the environments 'function' 
and
                                          ("noTF")
                                          ("label")
                                          ("verb"))
-                                     "Flag(s)"))
+                                     "Flags (k=v)"))
          (mac (TeX-read-string
                (TeX-argument-prompt nil nil "Macro(s)")
                TeX-esc))
@@ -72,19 +72,37 @@ This function should be used for the environments 
'function' and
          (elt-count 0)
          (count 1)
          (comment-func (lambda ()
-                         (if (TeX-in-commented-line)
+                         (if (TeX-in-line-comment)
                              (indent-according-to-mode)
                            (delete-horizontal-space)
                            (beginning-of-line)
                            (insert "%")
-                           (indent-according-to-mode)))))
+                           (indent-according-to-mode))))
+         p)
     (LaTeX-insert-environment environment
                               (concat
                                (unless (zerop (length exp-flag))
                                  (format "[%s]" exp-flag))
                                TeX-grop mac TeX-grcl))
-    ;; Now make sure the current line starts with a '%':
+    ;; Remember where we start:
+    (setq p (point-marker))
+    ;; Now make sure we have '%' everywhere, start at the beginning:
+    (search-backward (concat TeX-esc "begin" TeX-grop environment TeX-grcl)
+                     (if active-mark nil (line-beginning-position 0))
+                     t)
     (funcall comment-func)
+    ;; Now at the end:
+    (goto-char p)
+    (search-forward (concat TeX-esc "end" TeX-grop environment TeX-grcl)
+                    (if active-mark nil (line-end-position 2))
+                    t)
+    (goto-char (match-beginning 0))
+    (funcall comment-func)
+    ;; Finally for where we started and clean up only when region was
+    ;; not active:
+    (goto-char p)
+    (unless active-mark (funcall comment-func))
+    (set-marker p nil)
     ;; Ask if we should insert a 'syntax' environment:
     (when (and (not active-mark)
                (y-or-n-p "Insert syntax environment? "))

-----------------------------------------------------------------------

Summary of changes:
 style/l3doc.el | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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