Re: Bug in insert-environment

Ralf Angeli <[email protected]> Thu, 10 Mar 2005 19:57:00 +0100
Newsgroups gmane.emacs.auc-tex
Message-ID <[email protected]>
* David Kastrup (2005-03-10) writes:

> Ralf Angeli <[email protected]> writes:
>
>> The rationale for the extra newline is that typing `M-q' in content
>> following won't include the title and thereby mess it up.  An
>> alternative could be to make \frametitle a paragraph command.
>
> I'd vote for the alternative.  Can we do that in beamer.el, or does
> this mess with customizations in some manner?

There already is an internal list of paragraph commands which could be
used.  I attached a patch showing what would have to be done.

There is quite a bit of "manual" work to do in the style file to add
such a paragraph command.  What do you think about a
`LaTeX-paragraph-command-add' function which does all this
(incl. making the respective variables buffer-local)?

-- 
Ralf
beamer.patch (text/x-patch, 2.1 KB)
Index: latex.el
===================================================================
RCS file: /cvsroot/auctex/auctex/latex.el,v
retrieving revision 5.341
diff -u -r5.341 latex.el
--- latex.el	9 Mar 2005 20:32:12 -0000	5.341
+++ latex.el	10 Mar 2005 18:49:48 -0000
@@ -3128,10 +3128,13 @@
     "subsection" "subsubsection" "tableofcontents")
   "Internal list of LaTeX macros that should have their own line.")
 
-(defvar LaTeX-paragraph-commands-regexp
+(defun LaTeX-paragraph-commands-regexp-make ()
+  "Return a regular expression matching defined paragraph commands."
   (concat (regexp-quote TeX-esc)
-	  (regexp-opt LaTeX-paragraph-commands-internal t))
-  "Regular expression matching LaTeX macros that should have their own line.")
+	  (regexp-opt LaTeX-paragraph-commands-internal t)))
+
+(defvar LaTeX-paragraph-commands-regexp (LaTeX-paragraph-commands-regexp-make)
+    "Regular expression matching LaTeX macros that should have their own line.")
 
 (defcustom LaTeX-paragraph-commands nil
   "List of LaTeX macros that should have their own line.
@@ -3141,10 +3144,7 @@
   :set (lambda (symbol value)
          (set-default symbol value)
 	 (setq LaTeX-paragraph-commands-regexp
-	       (concat
-		(regexp-quote TeX-esc)
-		(regexp-opt (append LaTeX-paragraph-commands
-				    LaTeX-paragraph-commands-internal) t)))))
+	       (LaTeX-paragraph-commands-regexp-make))))
 
 (defun LaTeX-forward-paragraph (&optional count)
   "Move forward to end of paragraph.
Index: style/beamer.el
===================================================================
RCS file: /cvsroot/auctex/auctex/style/beamer.el,v
retrieving revision 1.6
diff -u -r1.6 beamer.el
--- style/beamer.el	7 Mar 2005 18:30:55 -0000	1.6
+++ style/beamer.el	10 Mar 2005 18:49:48 -0000
@@ -28,6 +28,11 @@
 		   ("enumerate" . LaTeX-item-beamer))
 		 LaTeX-item-list))
 
+   (make-local-variable 'LaTeX-paragraph-commands-internal)
+   (make-local-variable 'LaTeX-paragraph-commands-regexp)
+   (add-to-list 'LaTeX-paragraph-commands-internal "frametitle")
+   (setq LaTeX-paragraph-commands-regexp (LaTeX-paragraph-commands-regexp-make))
+
    (TeX-add-symbols
     '("alert" 1)
     '("alt" TeX-arg-beamer-overlay-spec 2)