Re: [AUCTeX-devel] TeX-header-start

2013-01-29 Thread Tassilo Horn
Mads Jensen m...@inducks.org writes:

Hi Mads,

 I noticed in the wishlist that it might be nice to have this.

I don't see a reason to have these new variables when they are not used
at all.  And as you've mentioned already, coming up with some good
default values is hard.  I prefer not having a feature over having a
feature that's likely not to work in some cases.

Reading the TODOs, it seems the author of this wishlist item had
outlining of preamble/header and trailer in mind.  But that already does
work just fine.  Toggling visibility of \documentclass shows/ hides
everything up to the \begin{document}, and toggling visibility of
\end{document} shows/hides everything after it.

Some other comments:

  - Why is LaTeX-header-start global but TeX-header-start buffer-local?

  - The \documentclass may be preceeded with other stuff like
filecontents, which also belong to the header.

  - In a plain TeX file, there's no such thing as \documentclass, so
initializing TeX-header-start with LaTeX-header-start doesn't make
sense.  Basically, the header starts at the first position in a
document's master file, no matter if TeX or LaTeX are used...

  - Although not done directly in its defvar form, TeX-trailer-start is
already initialized depending on if it's a TeX, LaTeX, or ConTeXt
document.

I've removed the sbox-thingy from the todo list, though, and kept you in
the ChangeLog for this.

Bye,
Tassilo

___
auctex-devel mailing list
auctex-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex-devel


[AUCTeX-devel] TeX-header-start

2013-01-28 Thread Mads Jensen
Hi,

I noticed in the wishlist that it might be nice to have this.  The other
one, TeX-trailer-end should be (eobp), if the trailer is everything that
is not parsed at the end of the file?  But this is impossible to put in
a regular expression, unfortunately.

ChangeLog entries for all patches:

2013-01-28  Mads Jensen  m...@inducks.org

* doc/todo.texi (Wishlist): Remove Completion for sboxes, and
`TeX-header-start'.

* latex.el (LaTeX-common-initialization): Initialize
`TeX-header-start' to `LaTeX-header-start'.
(LaTeX-header-start): New variable.

* tex.el (TeX-header-start): New variable.
(TeX-trailer-start): Set this to a value.

Please keep me in CC.
-- 
Med Venlig Hilsen / Kind Regards,
Mads Jensen
Rubinsteinsvej 31,st.th
DK-2450 Kbh. SV
Denmark
+45 6168 8518
My brain is my second favorite organ.
  -- Woody Allen
Index: latex.el
===
RCS file: /sources/auctex/auctex/latex.el,v
retrieving revision 5.482
diff -u -r5.482 latex.el
--- latex.el	28 Jan 2013 08:35:44 -	5.482
+++ latex.el	28 Jan 2013 12:36:40 -
@@ -5178,6 +5178,11 @@
   :type '(repeat regexp)
   :group 'TeX-command)
 
+(defvar LaTeX-header-start 
+  (concat ^[^%\n]* (regexp-quote TeX-esc) document\\(class\\|style\\)\\([[^]+]\\)?
+  \\({[^}]+}\\))
+  Default start of header marker for LaTeX documents.)
+
 (defvar LaTeX-header-end
   (concat ^[^%\n]* (regexp-quote TeX-esc) begin *
 	  TeX-grop document TeX-grcl)
@@ -5224,6 +5229,7 @@
   (setq LaTeX-largest-level (LaTeX-section-level section)))
 
   (setq TeX-header-end LaTeX-header-end
+TeX-header-start LaTeX-header-start
 	TeX-trailer-start LaTeX-trailer-start)
 
   (require 'outline)
Index: tex.el
===
RCS file: /sources/auctex/auctex/tex.el,v
retrieving revision 5.705
diff -u -r5.705 tex.el
--- tex.el	13 Jan 2013 11:05:48 -	5.705
+++ tex.el	28 Jan 2013 12:27:54 -
@@ -700,7 +700,7 @@
 
   (defun TeX-read-string (prompt optional initial-input history default-value)
 (read-string prompt initial-input history default-value t))
-  
+
   (defun TeX-mark-active ()
 ;; In FSF 19 mark-active indicates if mark is active.
 mark-active)
@@ -1754,7 +1754,7 @@
 (unless (local-variable-p 'TeX-PDF-mode (current-buffer))
   (TeX-PDF-mode (if arg 1 0))
   (setq TeX-PDF-mode-parsed t
-  
+
 (defun TeX-PDF-mode-on ()
   Use only from parsing routines.
   (TeX-PDF-mode-parsed t))
@@ -1811,7 +1811,8 @@
   :group 'TeX-command-name
   :type 'string)
 
-(defvar TeX-trailer-start nil
+(defvar TeX-trailer-start
+  ^[^%\n]* (regexp-quote TeX-esc) \\(endinput\\|bye\\))
   Regular expression delimiting start of trailer in a TeX file.)
 
  (make-variable-buffer-local 'TeX-trailer-start)
@@ -1821,6 +1822,11 @@
 
  (make-variable-buffer-local 'TeX-header-end)
 
+(defvar TeX-header-start nil
+  Regular expression delimiting start of header in a TeX file.)
+
+ (make-variable-buffer-local 'TeX-header-start)
+
 (defvar TeX-command-default nil
   The default command for `TeX-command' in the current major mode.)
 
@@ -1878,7 +1884,7 @@
 	(when (or (not TeX-clean-confirm)
 		  (condition-case nil
 		  (dired-mark-pop-up  *Deletions* 'delete
-	 (if ( (length files) 1) 
+	 (if ( (length files) 1)
 	 files
 	   (cons t files))
 	 'y-or-n-p Delete files? )
@@ -2990,7 +2996,7 @@
   (setq ispell-parser 'tex)
   (make-local-variable 'ispell-tex-p)
   (setq ispell-tex-p t)
-  
+
   ;; Redefine some standard variables
   (make-local-variable 'paragraph-start)
   (make-local-variable 'paragraph-separate)
@@ -4142,7 +4148,7 @@
 (define-key map \C-c?'TeX-doc)
 (define-key map \C-c\C-i 'TeX-goto-info-page)
 (define-key map \r   'TeX-newline)
-
+
 ;; From tex.el
 (define-key map \   'TeX-insert-quote)
 (define-key map $'TeX-insert-dollar)
@@ -4156,14 +4162,14 @@
 (define-key map ^'TeX-insert-sub-or-superscript)
 (define-key map _'TeX-insert-sub-or-superscript)
 (define-key map \e\t 'TeX-complete-symbol) ;*** Emacs 19 way
-
+
 (define-key map \C-c''TeX-comment-or-uncomment-paragraph) ;*** Old way
 (define-key map \C-c:'TeX-comment-or-uncomment-region) ;*** Old way
 (define-key map \C-c\   'TeX-uncomment) ;*** Old way
-
+
 (define-key map \C-c;'TeX-comment-or-uncomment-region)
 (define-key map \C-c%'TeX-comment-or-uncomment-paragraph)
-
+
 (define-key map \C-c\C-t\C-p   'TeX-PDF-mode)
 (define-key map \C-c\C-t\C-i   'TeX-interactive-mode)
 (define-key map \C-c\C-t\C-s   'TeX-source-correlate-mode)
@@ -5572,7 +5578,7 @@
 	(regexp (concat \\`\\(
 			(mapconcat (lambda (dir)
  (regexp-quote
-  (expand-file-name 
+  (expand-file-name
    (file-name-as-directory dir
    (append (when