/[auctex]/auctex/latex.el
ViewVC logotype

Diff of /auctex/latex.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 5.355 by angeli, Tue Apr 5 08:22:40 2005 UTC revision 5.356 by angeli, Wed Apr 6 07:00:08 2005 UTC
# Line 4  Line 4 
4  ;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2000,  ;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2000,
5  ;;   2003, 2004, 2005 Free Software Foundation, Inc.  ;;   2003, 2004, 2005 Free Software Foundation, Inc.
6    
7  ;; Maintainer: auc-tex@sunsite.dk  ;; Maintainer: auctex-devel@gnu.org
8  ;; Keywords: tex  ;; Keywords: tex
9    
10  ;; This file is part of AUCTeX.  ;; This file is part of AUCTeX.
# Line 104  This depends on `LaTeX-insert-into-comme Line 104  This depends on `LaTeX-insert-into-comme
104    
105  (defun LaTeX-section (arg)  (defun LaTeX-section (arg)
106    "Insert a template for a LaTeX section.    "Insert a template for a LaTeX section.
107  Determinate the type of section to be inserted, by the argument ARG.  Determine the type of section to be inserted, by the argument ARG.
108    
109  If ARG is nil or missing, use the current level.  If ARG is nil or missing, use the current level.
110  If ARG is a list (selected by \\[universal-argument]), go downward one level.  If ARG is a list (selected by \\[universal-argument]), go downward one level.
# Line 140  The following variables can be set to cu Line 140  The following variables can be set to cu
140                                        (region-end))                                        (region-end))
141                    ""))                    ""))
142           (done-mark (make-marker)))           (done-mark (make-marker)))
     (when (zerop (length title))  
       (LaTeX-newline))  
143      (run-hooks 'LaTeX-section-hook)      (run-hooks 'LaTeX-section-hook)
144      (LaTeX-newline)      (LaTeX-newline)
145      (if (marker-position done-mark)      (if (marker-position done-mark)
# Line 359  LaTeX-section-toc: Query the user for th Line 357  LaTeX-section-toc: Query the user for th
357    
358  LaTeX-section-section: Insert LaTeX section command according to  LaTeX-section-section: Insert LaTeX section command according to
359  `name', `title', and `toc'.  If `toc' is nil, no toc entry is  `name', `title', and `toc'.  If `toc' is nil, no toc entry is
360  enserted.  If `toc' or `title' are empty strings, `done-mark' will be  inserted.  If `toc' or `title' are empty strings, `done-mark' will be
361  placed at the point they should be inserted.  placed at the point they should be inserted.
362    
363  LaTeX-section-label: Insert a label after the section command.  LaTeX-section-label: Insert a label after the section command.
# Line 450  a different entry for the section in the Line 448  a different entry for the section in the
448    
449  (defun LaTeX-section-section ()  (defun LaTeX-section-section ()
450    "Hook to insert LaTeX section command into the file.    "Hook to insert LaTeX section command into the file.
451  Insert this hook into `LaTeX-section-hook' after those hooks which sets  Insert this hook into `LaTeX-section-hook' after those hooks that set
452  the `name', `title', and `toc' variables, but before those hooks which  the `name', `title', and `toc' variables, but before those hooks that
453  assumes the section already is inserted."  assume that the section is already inserted."
454      (insert TeX-esc name)    ;; insert a new line if the current line and the previous line are
455      (cond ((null toc))    ;; not empty (except for whitespace), with one exception: do not
456            ((zerop (length toc))    ;; insert a new line if the previous (or current, sigh) line starts
457             (insert LaTeX-optop)    ;; an environment (i.e., starts with `[optional whitespace]\begin')
458             (set-marker done-mark (point))    (unless (save-excursion
459             (insert LaTeX-optcl))              (re-search-backward
460            (t               (concat "^\\s-*\n\\s-*\\=\\|^\\s-*" (regexp-quote TeX-esc)
461             (insert LaTeX-optop toc LaTeX-optcl)))                       "begin")
462      (insert TeX-grop)               (line-beginning-position 0) t))
463      (if (zerop (length title))      (LaTeX-newline))
464          (set-marker done-mark (point)))    (insert TeX-esc name)
465      (insert title TeX-grcl)    (cond ((null toc))
466      (LaTeX-newline)          ((zerop (length toc))
467      ;; If RefTeX is available, tell it that we've just made a new section           (insert LaTeX-optop)
468      (and (fboundp 'reftex-notice-new-section)           (set-marker done-mark (point))
469           (reftex-notice-new-section)))           (insert LaTeX-optcl))
470            (t
471             (insert LaTeX-optop toc LaTeX-optcl)))
472      (insert TeX-grop)
473      (if (zerop (length title))
474          (set-marker done-mark (point)))
475      (insert title TeX-grcl)
476      (LaTeX-newline)
477      ;; If RefTeX is available, tell it that we've just made a new section
478      (and (fboundp 'reftex-notice-new-section)
479           (reftex-notice-new-section)))
480    
481  (defun LaTeX-section-label ()  (defun LaTeX-section-label ()
482    "Hook to insert a label after the sectioning command.    "Hook to insert a label after the sectioning command.
# Line 793  the label inserted, or nil if no label w Line 801  the label inserted, or nil if no label w
801    
802  (defcustom LaTeX-default-position ""  (defcustom LaTeX-default-position ""
803    "Default position for array and tabular environments.    "Default position for array and tabular environments.
804  If nil, act like the empty string is given, but don't prompt."  If nil, act like the empty string is given, but do not prompt."
805    :group 'LaTeX-environment    :group 'LaTeX-environment
806    :type '(choice (const :tag "Don't prompt" nil)    :type '(choice (const :tag "Do not prompt" nil)
807                   (const :tag "Empty" "")                   (const :tag "Empty" "")
808                   string))                   string))
809  (make-variable-buffer-local 'LaTeX-default-position)  (make-variable-buffer-local 'LaTeX-default-position)
# Line 953  job to this function." Line 961  job to this function."
961            (indent-according-to-mode))))            (indent-according-to-mode))))
962      (when (and (member environment '("table" "table*"))      (when (and (member environment '("table" "table*"))
963                 ;; Suppose an existing tabular environment should just                 ;; Suppose an existing tabular environment should just
964                 ;; be wrapped into a table if there is an actice region.                 ;; be wrapped into a table if there is an active region.
965                 (not active-mark))                 (not active-mark))
966        (LaTeX-env-array "tabular"))))        (LaTeX-env-array "tabular"))))
967    
# Line 1062  Just like array and tabular." Line 1070  Just like array and tabular."
1070  ;;; Item hooks  ;;; Item hooks
1071    
1072  (defvar LaTeX-item-list nil  (defvar LaTeX-item-list nil
1073    "An list of environments where items have a special syntax.    "A list of environments where items have a special syntax.
1074  The cdr is the name of the function, used to insert this kind of items.")  The cdr is the name of the function, used to insert this kind of items.")
1075    
1076  (defun LaTeX-insert-item ()  (defun LaTeX-insert-item ()

Legend:
Removed from v.5.355  
changed lines
  Added in v.5.356

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26