Function: LaTeX--env-item

LaTeX--env-item is a byte-compiled function defined in latex.el.

Signature

(LaTeX--env-item ENVIRONMENT)

Documentation

Helper function running inside LaTeX-env-item.

The body of this function used to be part of LaTeX-env-item.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/latex.el
(defun LaTeX--env-item (environment)
  "Helper function running inside `LaTeX-env-item'.
The body of this function used to be part of `LaTeX-env-item'."
  (if (TeX-active-mark)
      (progn
        (LaTeX-find-matching-begin)
        (end-of-line 1))
    (end-of-line 0))
  (delete-char 1)
  (when (looking-at (concat "^[ \t]+$\\|"
                            "^[ \t]*" TeX-comment-start-regexp "+[ \t]*$"))
    (delete-region (point) (line-end-position)))
  (delete-horizontal-space)
  ;; Deactivate the mark here in order to prevent `TeX-parse-macro'
  ;; from swapping point and mark and the \item ending up right after
  ;; \begin{...}.
  (deactivate-mark)
  (LaTeX-insert-item)
  ;; The inserted \item may have outdented the first line to the
  ;; right.  Fill it, if appropriate and `auto-fill-mode' is active.
  (when (and auto-fill-function
             (not (looking-at "$"))
             (not (assoc environment LaTeX-indent-environment-list))
             (> (- (line-end-position) (line-beginning-position))
                (current-fill-column)))
    (LaTeX-fill-paragraph nil)))