Mercurial > emacs
annotate lisp/obsolete/ooutline.el @ 94462:dcf2bdbd062c
*** empty log message ***
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Tue, 29 Apr 2008 03:40:45 +0000 |
parents | ee22366f2a68 |
children | 43d30a1ea764 |
rev | line source |
---|---|
38412
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
34456
diff
changeset
|
1 ;;; ooutline.el --- outline mode commands for Emacs |
34456
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2 |
74509 | 3 ;; Copyright (C) 1986, 1993, 1994, 1997, 2001, 2002, 2003, 2004, |
79715 | 4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
34456
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
5 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
6 ;; Maintainer: FSF |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
7 ;; Keywords: outlines |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
8 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
10 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
11 ;; GNU Emacs is free software; you can redistribute it and/or modify |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
78228
1e016d63f292
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
13 ;; the Free Software Foundation; either version 3, or (at your option) |
34456
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
14 ;; any later version. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
15 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
20 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
24 ;; Boston, MA 02110-1301, USA. | |
34456
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
25 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
26 ;;; Commentary: |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
27 |
94000
ee22366f2a68
Add a comment giving version of obsolescence.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
28 ;; This file has been obsolete since Emacs 21.1. |
ee22366f2a68
Add a comment giving version of obsolescence.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
29 |
34456
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
30 ;; This package is a major mode for editing outline-format documents. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
31 ;; An outline can be `abstracted' to show headers at any given level, |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
32 ;; with all stuff below hidden. See the Emacs manual for details. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
33 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
34 ;;; Code: |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
35 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
36 ;; Jan '86, Some new features added by Peter Desnoyers and rewritten by RMS. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
37 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
38 (defgroup outlines nil |
64040
44cf3ecee23f
(outlines): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents:
62769
diff
changeset
|
39 "Support for hierarchical outlining." |
34456
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
40 :prefix "outline-" |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
41 :group 'editing) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
42 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
43 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
44 (defcustom outline-regexp nil |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
45 "*Regular expression to match the beginning of a heading. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
46 Any line whose beginning matches this regexp is considered to start a heading. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
47 The recommended way to set this is with a Local Variables: list |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
48 in the file it applies to. See also outline-heading-end-regexp." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
49 :type '(choice regexp (const nil)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
50 :group 'outlines) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
51 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
52 ;; Can't initialize this in the defvar above -- some major modes have |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
53 ;; already assigned a local value to it. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
54 (or (default-value 'outline-regexp) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
55 (setq-default outline-regexp "[*\^L]+")) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38412
diff
changeset
|
56 |
34456
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
57 (defcustom outline-heading-end-regexp "[\n\^M]" |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
58 "*Regular expression to match the end of a heading line. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
59 You can assume that point is at the beginning of a heading when this |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
60 regexp is searched for. The heading ends at the end of the match. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
61 The recommended way to set this is with a \"Local Variables:\" list |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
62 in the file it applies to." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
63 :type 'regexp |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
64 :group 'outlines) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
65 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
66 (defvar outline-mode-prefix-map nil) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
67 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
68 (if outline-mode-prefix-map |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
69 nil |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
70 (setq outline-mode-prefix-map (make-sparse-keymap)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
71 (define-key outline-mode-prefix-map "\C-n" 'outline-next-visible-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
72 (define-key outline-mode-prefix-map "\C-p" 'outline-previous-visible-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
73 (define-key outline-mode-prefix-map "\C-i" 'show-children) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
74 (define-key outline-mode-prefix-map "\C-s" 'show-subtree) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
75 (define-key outline-mode-prefix-map "\C-d" 'hide-subtree) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
76 (define-key outline-mode-prefix-map "\C-u" 'outline-up-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
77 (define-key outline-mode-prefix-map "\C-f" 'outline-forward-same-level) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
78 (define-key outline-mode-prefix-map "\C-b" 'outline-backward-same-level) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
79 (define-key outline-mode-prefix-map "\C-t" 'hide-body) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
80 (define-key outline-mode-prefix-map "\C-a" 'show-all) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
81 (define-key outline-mode-prefix-map "\C-c" 'hide-entry) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
82 (define-key outline-mode-prefix-map "\C-e" 'show-entry) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
83 (define-key outline-mode-prefix-map "\C-l" 'hide-leaves) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
84 (define-key outline-mode-prefix-map "\C-k" 'show-branches) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
85 (define-key outline-mode-prefix-map "\C-q" 'hide-sublevels) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
86 (define-key outline-mode-prefix-map "\C-o" 'hide-other)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
87 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
88 (defvar outline-mode-menu-bar-map nil) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
89 (if outline-mode-menu-bar-map |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
90 nil |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
91 (setq outline-mode-menu-bar-map (make-sparse-keymap)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
92 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
93 (define-key outline-mode-menu-bar-map [hide] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
94 (cons "Hide" (make-sparse-keymap "Hide"))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
95 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
96 (define-key outline-mode-menu-bar-map [hide hide-other] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
97 '("Hide Other" . hide-other)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
98 (define-key outline-mode-menu-bar-map [hide hide-sublevels] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
99 '("Hide Sublevels" . hide-sublevels)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
100 (define-key outline-mode-menu-bar-map [hide hide-subtree] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
101 '("Hide Subtree" . hide-subtree)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
102 (define-key outline-mode-menu-bar-map [hide hide-entry] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
103 '("Hide Entry" . hide-entry)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
104 (define-key outline-mode-menu-bar-map [hide hide-body] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
105 '("Hide Body" . hide-body)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
106 (define-key outline-mode-menu-bar-map [hide hide-leaves] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
107 '("Hide Leaves" . hide-leaves)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
108 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
109 (define-key outline-mode-menu-bar-map [show] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
110 (cons "Show" (make-sparse-keymap "Show"))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
111 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
112 (define-key outline-mode-menu-bar-map [show show-subtree] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
113 '("Show Subtree" . show-subtree)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
114 (define-key outline-mode-menu-bar-map [show show-children] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
115 '("Show Children" . show-children)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
116 (define-key outline-mode-menu-bar-map [show show-branches] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
117 '("Show Branches" . show-branches)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
118 (define-key outline-mode-menu-bar-map [show show-entry] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
119 '("Show Entry" . show-entry)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
120 (define-key outline-mode-menu-bar-map [show show-all] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
121 '("Show All" . show-all)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
122 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
123 (define-key outline-mode-menu-bar-map [headings] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
124 (cons "Headings" (make-sparse-keymap "Headings"))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
125 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
126 (define-key outline-mode-menu-bar-map [headings outline-backward-same-level] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
127 '("Previous Same Level" . outline-backward-same-level)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
128 (define-key outline-mode-menu-bar-map [headings outline-forward-same-level] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
129 '("Next Same Level" . outline-forward-same-level)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
130 (define-key outline-mode-menu-bar-map [headings outline-previous-visible-heading] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
131 '("Previous" . outline-previous-visible-heading)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
132 (define-key outline-mode-menu-bar-map [headings outline-next-visible-heading] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
133 '("Next" . outline-next-visible-heading)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
134 (define-key outline-mode-menu-bar-map [headings outline-up-heading] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
135 '("Up" . outline-up-heading))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
136 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
137 (defvar outline-mode-map nil "") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
138 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
139 (if outline-mode-map |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
140 nil |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
141 (setq outline-mode-map (nconc (make-sparse-keymap) text-mode-map)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
142 (define-key outline-mode-map "\C-c" outline-mode-prefix-map) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
143 (define-key outline-mode-map [menu-bar] outline-mode-menu-bar-map)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
144 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
145 (defcustom outline-minor-mode nil |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
146 "Non-nil if using Outline mode as a minor mode of some other mode." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
147 :type 'boolean |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
148 :group 'outlines) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
149 (make-variable-buffer-local 'outline-minor-mode) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
150 (put 'outline-minor-mode 'permanent-local t) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
151 (or (assq 'outline-minor-mode minor-mode-alist) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
152 (setq minor-mode-alist (append minor-mode-alist |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
153 (list '(outline-minor-mode " Outl"))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
154 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
155 (defvar outline-font-lock-keywords |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
156 '(;; Highlight headings according to the level. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
157 ("^\\([*]+\\)[ \t]*\\([^\n\r]+\\)?[ \t]*[\n\r]" |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
158 (1 font-lock-string-face) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
159 (2 (let ((len (- (match-end 1) (match-beginning 1)))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
160 (or (cdr (assq len '((1 . font-lock-function-name-face) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
161 (2 . font-lock-keyword-face) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
162 (3 . font-lock-comment-face)))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
163 font-lock-variable-name-face)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
164 nil t)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
165 ;; Highlight citations of the form [1] and [Mar94]. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
166 ("\\[\\([[:upper:]][[:alpha:]]+\\)*[0-9]+\\]" . font-lock-type-face)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
167 "Additional expressions to highlight in Outline mode.") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
168 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
169 (defun outline-mode () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
170 "Set major mode for editing outlines with selective display. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
171 Headings are lines which start with asterisks: one for major headings, |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38412
diff
changeset
|
172 two for subheadings, etc. Lines not starting with asterisks are body lines. |
34456
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
173 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
174 Body text or subheadings under a heading can be made temporarily |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38412
diff
changeset
|
175 invisible, or visible again. Invisible lines are attached to the end |
34456
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
176 of the heading, so they move with it, if the line is killed and yanked |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
177 back. A heading with text hidden under it is marked with an ellipsis (...). |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
178 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
179 Commands:\\<outline-mode-map> |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
180 \\[outline-next-visible-heading] outline-next-visible-heading move by visible headings |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
181 \\[outline-previous-visible-heading] outline-previous-visible-heading |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
182 \\[outline-forward-same-level] outline-forward-same-level similar but skip subheadings |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
183 \\[outline-backward-same-level] outline-backward-same-level |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
184 \\[outline-up-heading] outline-up-heading move from subheading to heading |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
185 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
186 \\[hide-body] make all text invisible (not headings). |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
187 \\[show-all] make everything in buffer visible. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
188 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
189 The remaining commands are used when point is on a heading line. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
190 They apply to some of the body or subheadings of that heading. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
191 \\[hide-subtree] hide-subtree make body and subheadings invisible. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
192 \\[show-subtree] show-subtree make body and subheadings visible. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
193 \\[show-children] show-children make direct subheadings visible. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
194 No effect on body, or subheadings 2 or more levels down. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
195 With arg N, affects subheadings N levels down. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
196 \\[hide-entry] make immediately following body invisible. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
197 \\[show-entry] make it visible. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
198 \\[hide-leaves] make body under heading and under its subheadings invisible. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
199 The subheadings remain visible. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
200 \\[show-branches] make all subheadings at all levels visible. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
201 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
202 The variable `outline-regexp' can be changed to control what is a heading. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
203 A line is a heading if `outline-regexp' matches something at the |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
204 beginning of the line. The longer the match, the deeper the level. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
205 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
206 Turning on outline mode calls the value of `text-mode-hook' and then of |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
207 `outline-mode-hook', if they are non-nil." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
208 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
209 (kill-all-local-variables) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
210 (setq selective-display t) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
211 (use-local-map outline-mode-map) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
212 (setq mode-name "Outline") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
213 (setq major-mode 'outline-mode) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
214 (define-abbrev-table 'text-mode-abbrev-table ()) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
215 (setq local-abbrev-table text-mode-abbrev-table) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
216 (set-syntax-table text-mode-syntax-table) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
217 (make-local-variable 'paragraph-start) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
218 (setq paragraph-start (concat paragraph-start "\\|\\(" |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
219 outline-regexp "\\)")) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
220 ;; Inhibit auto-filling of header lines. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
221 (make-local-variable 'auto-fill-inhibit-regexp) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
222 (setq auto-fill-inhibit-regexp outline-regexp) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
223 (make-local-variable 'paragraph-separate) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
224 (setq paragraph-separate (concat paragraph-separate "\\|\\(" |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
225 outline-regexp "\\)")) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
226 (make-local-variable 'font-lock-defaults) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
227 (setq font-lock-defaults '(outline-font-lock-keywords t)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
228 (make-local-variable 'change-major-mode-hook) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
229 (add-hook 'change-major-mode-hook 'show-all) |
62769
a1fa16a75bde
* obsolete/ooutline.el (outline-mode):
Lute Kamstra <lute@gnu.org>
parents:
52401
diff
changeset
|
230 (run-mode-hooks 'text-mode-hook 'outline-mode-hook)) |
34456
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
231 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
232 (defcustom outline-minor-mode-prefix "\C-c@" |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
233 "*Prefix key to use for Outline commands in Outline minor mode. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
234 The value of this variable is checked as part of loading Outline mode. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
235 After that, changing the prefix key requires manipulating keymaps." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
236 :type 'string |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
237 :group 'outlines) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
238 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
239 (defvar outline-minor-mode-map nil) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
240 (if outline-minor-mode-map |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
241 nil |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
242 (setq outline-minor-mode-map (make-sparse-keymap)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
243 (define-key outline-minor-mode-map [menu-bar] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
244 outline-mode-menu-bar-map) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
245 (define-key outline-minor-mode-map outline-minor-mode-prefix |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
246 outline-mode-prefix-map)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
247 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
248 (or (assq 'outline-minor-mode minor-mode-map-alist) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
249 (setq minor-mode-map-alist |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
250 (cons (cons 'outline-minor-mode outline-minor-mode-map) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
251 minor-mode-map-alist))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
252 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
253 (defun outline-minor-mode (&optional arg) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
254 "Toggle Outline minor mode. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
255 With arg, turn Outline minor mode on if arg is positive, off otherwise. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
256 See the command `outline-mode' for more information on this mode." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
257 (interactive "P") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
258 (setq outline-minor-mode |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
259 (if (null arg) (not outline-minor-mode) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
260 (> (prefix-numeric-value arg) 0))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
261 (if outline-minor-mode |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
262 (progn |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
263 (setq selective-display t) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
264 (run-hooks 'outline-minor-mode-hook)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
265 (setq selective-display nil)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
266 ;; When turning off outline mode, get rid of any ^M's. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
267 (or outline-minor-mode |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
268 (outline-flag-region (point-min) (point-max) ?\n)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
269 (force-mode-line-update)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
270 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
271 (defvar outline-level 'outline-level |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
272 "Function of no args to compute a header's nesting level in an outline. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
273 It can assume point is at the beginning of a header line.") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
274 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
275 ;; This used to count columns rather than characters, but that made ^L |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
276 ;; appear to be at level 2 instead of 1. Columns would be better for |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
277 ;; tab handling, but the default regexp doesn't use tabs, and anyone |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
278 ;; who changes the regexp can also redefine the outline-level variable |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
279 ;; as appropriate. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
280 (defun outline-level () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
281 "Return the depth to which a statement is nested in the outline. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
282 Point must be at the beginning of a header line. This is actually |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
283 the number of characters that `outline-regexp' matches." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
284 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
285 (looking-at outline-regexp) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
286 (- (match-end 0) (match-beginning 0)))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
287 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
288 (defun outline-next-preface () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
289 "Skip forward to just before the next heading line. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
290 If there's no following heading line, stop before the newline |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
291 at the end of the buffer." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
292 (if (re-search-forward (concat "[\n\^M]\\(" outline-regexp "\\)") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
293 nil 'move) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
294 (goto-char (match-beginning 0))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
295 (if (memq (preceding-char) '(?\n ?\^M)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
296 (forward-char -1))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
297 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
298 (defun outline-next-heading () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
299 "Move to the next (possibly invisible) heading line." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
300 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
301 (if (re-search-forward (concat "[\n\^M]\\(" outline-regexp "\\)") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
302 nil 'move) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
303 (goto-char (1+ (match-beginning 0))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
304 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
305 (defun outline-back-to-heading () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
306 "Move to previous heading line, or beg of this line if it's a heading. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
307 Only visible heading lines are considered." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
308 (beginning-of-line) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
309 (or (outline-on-heading-p) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
310 (re-search-backward (concat "^\\(" outline-regexp "\\)") nil t) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
311 (error "before first heading"))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
312 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
313 (defun outline-on-heading-p () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
314 "Return t if point is on a (visible) heading line." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
315 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
316 (beginning-of-line) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
317 (and (bolp) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
318 (looking-at outline-regexp)))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
319 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
320 (defun outline-end-of-heading () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
321 (if (re-search-forward outline-heading-end-regexp nil 'move) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
322 (forward-char -1))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
323 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
324 (defun outline-next-visible-heading (arg) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
325 "Move to the next visible heading line. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
326 With argument, repeats or can move backward if negative. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
327 A heading line is one that starts with a `*' (or that |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
328 `outline-regexp' matches)." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
329 (interactive "p") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
330 (if (< arg 0) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
331 (beginning-of-line) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
332 (end-of-line)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
333 (or (re-search-forward (concat "^\\(" outline-regexp "\\)") nil t arg) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
334 (error "")) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
335 (beginning-of-line)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
336 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
337 (defun outline-previous-visible-heading (arg) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
338 "Move to the previous heading line. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
339 With argument, repeats or can move forward if negative. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
340 A heading line is one that starts with a `*' (or that |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
341 `outline-regexp' matches)." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
342 (interactive "p") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
343 (outline-next-visible-heading (- arg))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
344 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
345 (defun outline-flag-region (from to flag) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
346 "Hides or shows lines from FROM to TO, according to FLAG. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
347 If FLAG is `\\n' (newline character) then text is shown, |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
348 while if FLAG is `\\^M' (control-M) the text is hidden." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
349 (let (buffer-read-only) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
350 (subst-char-in-region from to |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
351 (if (= flag ?\n) ?\^M ?\n) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
352 flag t))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
353 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
354 (defun hide-entry () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
355 "Hide the body directly following this heading." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
356 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
357 (outline-back-to-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
358 (outline-end-of-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
359 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
360 (outline-flag-region (point) (progn (outline-next-preface) (point)) ?\^M))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
361 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
362 (defun show-entry () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
363 "Show the body directly following this heading." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
364 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
365 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
366 (outline-flag-region (point) (progn (outline-next-preface) (point)) ?\n))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
367 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
368 (defun hide-body () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
369 "Hide all of buffer except headings." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
370 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
371 (hide-region-body (point-min) (point-max))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
372 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
373 (defun hide-region-body (start end) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
374 "Hide all body lines in the region, but not headings." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
375 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
376 (save-restriction |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
377 (narrow-to-region start end) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
378 (goto-char (point-min)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
379 (if (outline-on-heading-p) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
380 (outline-end-of-heading)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
381 (while (not (eobp)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
382 (outline-flag-region (point) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
383 (progn (outline-next-preface) (point)) ?\^M) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
384 (if (not (eobp)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
385 (progn |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
386 (forward-char |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
387 (if (looking-at "[\n\^M][\n\^M]") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
388 2 1)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
389 (outline-end-of-heading))))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
390 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
391 (defun show-all () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
392 "Show all of the text in the buffer." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
393 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
394 (outline-flag-region (point-min) (point-max) ?\n)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
395 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
396 (defun hide-subtree () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
397 "Hide everything after this heading at deeper levels." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
398 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
399 (outline-flag-subtree ?\^M)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
400 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
401 (defun hide-leaves () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
402 "Hide all body after this heading at deeper levels." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
403 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
404 (outline-back-to-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
405 (outline-end-of-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
406 (hide-region-body (point) (progn (outline-end-of-subtree) (point)))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
407 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
408 (defun show-subtree () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
409 "Show everything after this heading at deeper levels." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
410 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
411 (outline-flag-subtree ?\n)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
412 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
413 (defun hide-sublevels (levels) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
414 "Hide everything but the top LEVELS levels of headers, in whole buffer." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
415 (interactive "p") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
416 (if (< levels 1) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
417 (error "Must keep at least one level of headers")) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
418 (setq levels (1- levels)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
419 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
420 (goto-char (point-min)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
421 ;; Keep advancing to the next top-level heading. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
422 (while (or (and (bobp) (outline-on-heading-p)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
423 (outline-next-heading)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
424 (let ((end (save-excursion (outline-end-of-subtree) (point)))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
425 ;; Hide everything under that. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
426 (outline-flag-region (point) end ?\^M) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
427 ;; Show the first LEVELS levels under that. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
428 (if (> levels 0) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
429 (show-children levels)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
430 ;; Move to the next, since we already found it. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
431 (goto-char end))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
432 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
433 (defun hide-other () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
434 "Hide everything except for the current body and the parent headings." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
435 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
436 (hide-sublevels 1) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
437 (let ((last (point)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
438 (pos (point))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
439 (while (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
440 (and (re-search-backward "[\n\r]" nil t) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
441 (eq (following-char) ?\r))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
442 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
443 (beginning-of-line) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
444 (if (eq last (point)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
445 (progn |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
446 (outline-next-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
447 (outline-flag-region last (point) ?\n)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
448 (show-children) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
449 (setq last (point))))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
450 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
451 (defun outline-flag-subtree (flag) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
452 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
453 (outline-back-to-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
454 (outline-end-of-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
455 (outline-flag-region (point) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
456 (progn (outline-end-of-subtree) (point)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
457 flag))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
458 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
459 (defun outline-end-of-subtree () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
460 (outline-back-to-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
461 (let ((opoint (point)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
462 (first t) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
463 (level (funcall outline-level))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
464 (while (and (not (eobp)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
465 (or first (> (funcall outline-level) level))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
466 (setq first nil) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
467 (outline-next-heading)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
468 (if (memq (preceding-char) '(?\n ?\^M)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
469 (progn |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
470 ;; Go to end of line before heading |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
471 (forward-char -1) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
472 (if (memq (preceding-char) '(?\n ?\^M)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
473 ;; leave blank line before heading |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
474 (forward-char -1)))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
475 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
476 (defun show-branches () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
477 "Show all subheadings of this heading, but not their bodies." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
478 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
479 (show-children 1000)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
480 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
481 (defun show-children (&optional level) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
482 "Show all direct subheadings of this heading. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
483 Prefix arg LEVEL is how many levels below the current level should be shown. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
484 Default is enough to cause the following heading to appear." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
485 (interactive "P") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
486 (setq level |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
487 (if level (prefix-numeric-value level) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
488 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
489 (outline-back-to-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
490 (let ((start-level (funcall outline-level))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
491 (outline-next-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
492 (if (eobp) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
493 1 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
494 (max 1 (- (funcall outline-level) start-level))))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
495 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
496 (save-restriction |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
497 (outline-back-to-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
498 (setq level (+ level (funcall outline-level))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
499 (narrow-to-region (point) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
500 (progn (outline-end-of-subtree) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
501 (if (eobp) (point-max) (1+ (point))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
502 (goto-char (point-min)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
503 (while (and (not (eobp)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
504 (progn |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
505 (outline-next-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
506 (not (eobp)))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
507 (if (<= (funcall outline-level) level) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
508 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
509 (outline-flag-region (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
510 (forward-char -1) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
511 (if (memq (preceding-char) '(?\n ?\^M)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
512 (forward-char -1)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
513 (point)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
514 (progn (outline-end-of-heading) (point)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
515 ?\n))))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
516 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
517 (defun outline-up-heading (arg) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
518 "Move to the heading line of which the present line is a subheading. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
519 With argument, move up ARG levels." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
520 (interactive "p") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
521 (outline-back-to-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
522 (if (eq (funcall outline-level) 1) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
523 (error "")) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
524 (while (and (> (funcall outline-level) 1) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
525 (> arg 0) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
526 (not (bobp))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
527 (let ((present-level (funcall outline-level))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
528 (while (not (< (funcall outline-level) present-level)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
529 (outline-previous-visible-heading 1)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
530 (setq arg (- arg 1))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
531 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
532 (defun outline-forward-same-level (arg) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
533 "Move forward to the ARG'th subheading at same level as this one. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
534 Stop at the first and last subheadings of a superior heading." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
535 (interactive "p") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
536 (outline-back-to-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
537 (while (> arg 0) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
538 (let ((point-to-move-to (save-excursion |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38412
diff
changeset
|
539 (outline-get-next-sibling)))) |
34456
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
540 (if point-to-move-to |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
541 (progn |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
542 (goto-char point-to-move-to) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
543 (setq arg (1- arg))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
544 (progn |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
545 (setq arg 0) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
546 (error "")))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
547 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
548 (defun outline-get-next-sibling () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
549 "Move to next heading of the same level, and return point or nil if none." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
550 (let ((level (funcall outline-level))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
551 (outline-next-visible-heading 1) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
552 (while (and (> (funcall outline-level) level) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
553 (not (eobp))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
554 (outline-next-visible-heading 1)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
555 (if (< (funcall outline-level) level) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
556 nil |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
557 (point)))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38412
diff
changeset
|
558 |
34456
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
559 (defun outline-backward-same-level (arg) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
560 "Move backward to the ARG'th subheading at same level as this one. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
561 Stop at the first and last subheadings of a superior heading." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
562 (interactive "p") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
563 (outline-back-to-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
564 (while (> arg 0) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
565 (let ((point-to-move-to (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
566 (outline-get-last-sibling)))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
567 (if point-to-move-to |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
568 (progn |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
569 (goto-char point-to-move-to) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
570 (setq arg (1- arg))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
571 (progn |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
572 (setq arg 0) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
573 (error "")))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
574 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
575 (defun outline-get-last-sibling () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
576 "Move to next heading of the same level, and return point or nil if none." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
577 (let ((level (funcall outline-level))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
578 (outline-previous-visible-heading 1) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
579 (while (and (> (funcall outline-level) level) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
580 (not (bobp))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
581 (outline-previous-visible-heading 1)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
582 (if (< (funcall outline-level) level) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
583 nil |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
584 (point)))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
585 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
586 (provide 'outline) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
587 |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
79715
diff
changeset
|
588 ;; arch-tag: 14ed00e1-bd40-4db8-86e5-3b82ce326e45 |
38412
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
34456
diff
changeset
|
589 ;;; ooutline.el ends here |