;;; nxml-outln.el --- outline support for nXML mode
-;; Copyright (C) 2004, 2007 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2007-2011 Free Software Foundation, Inc.
;; Author: James Clark
;; Keywords: XML
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
(defcustom nxml-section-element-name-regexp
"article\\|\\(sub\\)*section\\|chapter\\|div\\|appendix\\|part\\|preface\\|reference\\|simplesect\\|bibliography\\|bibliodiv\\|glossary\\|glossdiv"
- "*Regular expression matching the name of elements used as sections.
+ "Regular expression matching the name of elements used as sections.
An XML element is treated as a section if:
- its local name (that is, the name without the prefix) matches
:type 'regexp)
(defcustom nxml-heading-element-name-regexp "title\\|head"
- "*Regular expression matching the name of elements used as headings.
+ "Regular expression matching the name of elements used as headings.
An XML element is only recognized as a heading if it occurs as or
within the first child of an element that is recognized as a section.
See the variable `nxml-section-element-name-regexp' for more details."
:type 'regexp)
(defcustom nxml-outline-child-indent 2
- "*Indentation in an outline for child element relative to parent element."
+ "Indentation in an outline for child element relative to parent element."
:group 'nxml
:type 'integer)
(defun nxml-hide-all-text-content ()
"Hide all text content in the buffer.
Anything that is in a section but is not a heading will be hidden.
-The visibility of headings at any level will not be changed. See the
+The visibility of headings at any level will not be changed. See the
variable `nxml-section-element-name-regexp' for more details on how to
customize which elements are recognized as sections and headings."
(interactive)
(defun nxml-show-direct-text-content ()
"Show the text content that is directly part of the section containing point.
Each subsection will be shown according to its individual state, which
-will not be changed. The section containing point is the innermost
-section that contains the character following point. See the variable
+will not be changed. The section containing point is the innermost
+section that contains the character following point. See the variable
`nxml-section-element-name-regexp' for more details on how to
customize which elements are recognized as sections and headings."
(interactive)
(defun nxml-show-direct-subheadings ()
"Show the immediate subheadings of the section containing point.
The section containing point is the innermost section that contains
-the character following point. See the variable
+the character following point. See the variable
`nxml-section-element-name-regexp' for more details on how to
customize which elements are recognized as sections and headings."
(interactive)
"Hide the text content that is directly part of the section containing point.
The heading of the section will remain visible. The state of
subsections will not be changed. The section containing point is the
-innermost section that contains the character following point. See the
+innermost section that contains the character following point. See the
variable `nxml-section-element-name-regexp' for more details on how to
customize which elements are recognized as sections and headings."
(interactive)
The text content will also be hidden, leaving only the heading of the
section itself visible. The state of the subsections will also be
changed to hide their headings, so that \\[nxml-show-direct-text-content]
-would show only the heading of the subsections. The section containing
+would show only the heading of the subsections. The section containing
point is the innermost section that contains the character following
point. See the variable `nxml-section-element-name-regexp' for more
details on how to customize which elements are recognized as sections
(defun nxml-hide-text-content ()
"Hide text content at all levels in the section containing point.
The section containing point is the innermost section that contains
-the character following point. See the variable
+the character following point. See the variable
`nxml-section-element-name-regexp' for more details on how to
customize which elements are recognized as sections and headings."
(interactive)
"Show the subheadings at all levels of the section containing point.
The visibility of the text content at all levels in the section is not
changed. The section containing point is the innermost section that
-contains the character following point. See the variable
+contains the character following point. See the variable
`nxml-section-element-name-regexp' for more details on how to
customize which elements are recognized as sections and headings."
(interactive)
"Hide text content other than that directly in the section containing point.
Hide headings other than those of ancestors of that section and their
immediate subheadings. The section containing point is the innermost
-section that contains the character following point. See the variable
+section that contains the character following point. See the variable
`nxml-section-element-name-regexp' for more details on how to
customize which elements are recognized as sections and headings."
(interactive)
(when change
(nxml-set-outline-state section-start-pos
(cdr change)))))
-
+
(defun nxml-section-tag-transform-outline-state (startp
section-start-pos
&optional
(or (eq xmltok-type 'end-tag)
(eq xmltok-type 'partial-end-tag)))
-(defun nxml-refresh-outline ()
+(defun nxml-refresh-outline ()
"Refresh the outline to correspond to the current XML element structure."
(interactive)
(save-excursion
indent of the start-tag of the current element, or nil if no
containing element has a non-nil OUTLINE-STATE. TAG-QNAMES is a list
of the qnames of the open elements. Point is after the title content.
-Leave point after the closing end-tag Return t if we had a
+Leave point after the closing end-tag. Return t if we had a
non-transparent child section."
(let ((last-pos (point))
(transparent-depth 0)
t)
'display
nxml-highlighted-empty-end-tag))
-
+
(defun nxml-outline-display-multi-line-end-tag (last-pos start-tag-indent)
(let ((indentp (save-excursion
(goto-char last-pos)
&optional
front-advance
rear-advance)
- "Replace any nxml-outline-display overlays between START and END.
+ "Replace any `nxml-outline-display' overlays between START and END.
Overlays are removed if they overlay the region between START and END,
-and have a non-nil nxml-outline-display property (typically via their
-category). If CATEGORY is non-nil, they will be replaced with a new overlay
-with that category from START to END. If CATEGORY is nil, no new
-overlay will be created."
+and have a non-nil `nxml-outline-display' property (typically via their
+category). If CATEGORY is non-nil, they will be replaced with a new
+overlay with that category from START to END. If CATEGORY is nil,
+no new overlay will be created."
(when (< start end)
(let ((overlays (overlays-in start end))
overlay)
(let ((pos (condition-case err
(and (nxml-scan-element-forward (point) t)
xmltok-start)
- nil)))
+ (nxml-scan-error nil))))
(end-of-line)
(skip-chars-backward " \t")
(cond ((not pos)
(defun nxml-section-tag-forward ()
"Move forward past the first tag that is a section start- or end-tag.
-Return xmltok-type for tag.
+Return `xmltok-type' for tag.
If no tag found, return nil and move to the end of the buffer."
(let ((case-fold-search nil)
(tag-regexp (nxml-make-section-tag-regexp))
nil)
(t))))
xmltok-type)
-
+
(defun nxml-section-tag-backward ()
"Move backward to the end of a tag that is a section start- or end-tag.
-The position of the end of the tag must be <= point
+The position of the end of the tag must be <= point.
Point is at the end of the tag. `xmltok-start' is the start."
(let ((case-fold-search nil)
(start (point))
"Try to move back to the start of the section containing point.
The start of the section must be <= point.
Only visible sections are included unless INVISIBLE-OK is non-nil.
-If found, return t. Otherwise move to point-min and return nil.
+If found, return t. Otherwise move to `point-min' and return nil.
If unbalanced section tags are found, signal an `nxml-outline-error'."
(when (or (nxml-after-section-start-tag)
(nxml-section-tag-backward))
(heading-regexp (concat "\\`\\("
nxml-heading-element-name-regexp
"\\)\\'"))
-
+
(section-regexp (concat "\\`\\("
nxml-section-element-name-regexp
"\\)\\'"))
(provide 'nxml-outln)
-;; arch-tag: 1f1b7454-e573-4cd7-a505-d9dc64eef828
;;; nxml-outln.el ends here