auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] Changes to auctex/style/doc.el,v


From: Ralf Angeli
Subject: [AUCTeX-diffs] Changes to auctex/style/doc.el,v
Date: Sun, 25 May 2008 07:33:12 +0000

CVSROOT:        /cvsroot/auctex
Module name:    auctex
Changes by:     Ralf Angeli <angeli>    08/05/25 07:33:11

Index: doc.el
===================================================================
RCS file: /cvsroot/auctex/auctex/style/doc.el,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- doc.el      3 Feb 2008 14:53:30 -0000       1.8
+++ doc.el      25 May 2008 07:33:11 -0000      1.9
@@ -1,6 +1,6 @@
 ;;; doc.el --- AUCTeX style for `doc.sty'
 
-;; Copyright (C) 2004 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2008 Free Software Foundation, Inc.
 
 ;; Author: Frank Küster <address@hidden>
 ;; Maintainer: address@hidden
@@ -40,6 +40,21 @@
       (delete-region (line-beginning-position) (line-end-position))
       (indent-according-to-mode))))
 
+(defun LaTeX-doc-after-insert-macrocode (env start end)
+  "Make sure the macrocode environment is properly formatted after insertion."
+  (when (TeX-member env '("macrocode" "macrocode*") 'string-equal)
+    (save-excursion
+      (goto-char end)
+      (skip-chars-backward " \t")
+      (when (bolp)
+       (insert "%")
+       (indent-according-to-mode))
+      (goto-char start)
+      (skip-chars-backward " \t")
+      (when (bolp)
+       (insert "%")
+       (indent-according-to-mode)))))
+
 (TeX-add-style-hook
  "doc"
  (function
@@ -48,6 +63,8 @@
                 '("macrocode" current-indentation))
     (add-to-list 'LaTeX-indent-environment-list
                 '("macrocode*" current-indentation))
+    (add-hook 'LaTeX-after-insert-env-hooks 'LaTeX-doc-after-insert-macrocode
+             nil t)
     (LaTeX-add-environments
      "theglossary"
      '("macrocode" LaTeX-env-no-comment)




reply via email to

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