Function: Texinfo-mark-section

Texinfo-mark-section is an interactive and byte-compiled function defined in tex-info.el.

Signature

(Texinfo-mark-section &optional NO-SUBSECTION)

Documentation

Mark current section, with inclusion of any containing node.

The current section is detected as starting by any of the structuring commands matched by regexp in variable outline-regexp which in turn is a regexp matching any element of variable texinfo-section-list.

If optional argument NO-SUBSECTION is set to any integer or is a non nil empty argument (that is, C-u (universal-argument) M-x Texinfo-mark-section (Texinfo-mark-section)), then mark the current section with exclusion of any subsections.

Otherwise, any included subsections are also marked along with current section.

Note that when current section is starting immediatley after a node commande, then the node command is also marked as part as the section.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex-info.el
(defun Texinfo-mark-section (&optional no-subsection)
  "Mark current section, with inclusion of any containing node.

The current section is detected as starting by any of the
structuring commands matched by regexp in variable
`outline-regexp' which in turn is a regexp matching any element
of variable `texinfo-section-list'.

If optional argument NO-SUBSECTION is set to any integer or is a
non nil empty argument (that is, `\\[universal-argument] \\[Texinfo-mark-section]'),
then mark the current section with exclusion of any subsections.

Otherwise, any included subsections are also marked along with
current section.

Note that when current section is starting immediatley after a
node commande, then the node command is also marked as part as
the section."
  (interactive "P")
  (let (beg end is-beg-section is-end-section
            (section-re (concat "^\\s-*" outline-regexp)))
    (if (and (consp no-subsection) (eq (car no-subsection) 4))
        ;; section with exclusion of any subsection
        (setq beg (save-excursion
                    (unless (looking-at section-re)
                      (end-of-line))
                    (re-search-backward section-re nil t))
              is-beg-section t
              end (save-excursion
                    (beginning-of-line)
                    (when
                        (re-search-forward (concat section-re
                                                   "\\|^\\s-*@bye\\_>" )
                                           nil t)
                      (save-match-data
                        (beginning-of-line)
                        (point))))
              is-end-section (match-string 1))
      ;; full section without exclusion of any subsection
      (let (section-command-level)
        (setq beg
              (save-excursion
                (end-of-line)
                (re-search-backward section-re nil t)))
        (when beg
          (setq is-beg-section t
                section-command-level
                (cadr (assoc (match-string 1) texinfo-section-list))
                end
                (save-excursion
                  (beginning-of-line)
                  (while
                      (and (re-search-forward
                            (concat section-re "\\|^\\s-*@bye\\_>" ) nil t)
                           (or (null (setq is-end-section  (match-string 1)))
                               (> (cadr (assoc is-end-section
                                               texinfo-section-list))
                                  section-command-level))))
                  (when (match-string 0)
                    (beginning-of-line)
                    (point)))))));  (if ...)
    (when (and beg end)
      ;; now take also enclosing node of beg and end
      (let ((before-@node
             (lambda (pos)
               (save-excursion
                 (goto-char pos)
                 (while (and
                         (null (bobp))
                         (progn
                           (beginning-of-line 0)
                           (looking-at
                            "^\\s-*\\($\\|@\\(c\\|comment\\)\\_>\\)"))))
                 (when (looking-at "^\\s-*@node\\_>")
                   (point))))))
        (when is-beg-section
          (setq beg (or (funcall before-@node beg) beg)))
        (when is-end-section
          (setq end (or (funcall before-@node end) end))))

      (push-mark end)
      (goto-char beg)
      (TeX-activate-region) )))