Mercurial > emacs
annotate lisp/obsolete/ooutline.el @ 68279:fae5d0cc2b1d
Comment change.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 20 Jan 2006 01:21:18 +0000 |
parents | 5b1a238fcbb4 |
children | e8a3fb527b77 2d92f5c9d6ae |
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 |
64751
5b1a238fcbb4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64085
diff
changeset
|
3 ;; Copyright (C) 1986, 1993, 1994, 1997, 2002, 2003, 2004, |
5b1a238fcbb4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64085
diff
changeset
|
4 ;; 2005 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 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
13 ;; the Free Software Foundation; either version 2, or (at your option) |
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 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
28 ;; 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
|
29 ;; 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
|
30 ;; 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
|
31 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
32 ;;; Code: |
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 ;; 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
|
35 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
36 (defgroup outlines nil |
64040
44cf3ecee23f
(outlines): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents:
62769
diff
changeset
|
37 "Support for hierarchical outlining." |
34456
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
38 :prefix "outline-" |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
39 :group 'editing) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
40 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
41 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
42 (defcustom outline-regexp nil |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
43 "*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
|
44 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
|
45 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
|
46 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
|
47 :type '(choice regexp (const nil)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
48 :group 'outlines) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
49 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
50 ;; 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
|
51 ;; 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
|
52 (or (default-value 'outline-regexp) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
53 (setq-default outline-regexp "[*\^L]+")) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38412
diff
changeset
|
54 |
34456
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
55 (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
|
56 "*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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 :type 'regexp |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
62 :group 'outlines) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
63 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
64 (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
|
65 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
66 (if outline-mode-prefix-map |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
67 nil |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
68 (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
|
69 (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
|
70 (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
|
71 (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
|
72 (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
|
73 (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
|
74 (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
|
75 (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
|
76 (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
|
77 (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
|
78 (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
|
79 (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
|
80 (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
|
81 (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
|
82 (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
|
83 (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
|
84 (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
|
85 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
86 (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
|
87 (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
|
88 nil |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
89 (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
|
90 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
91 (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
|
92 (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
|
93 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
94 (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
|
95 '("Hide Other" . hide-other)) |
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-sublevels] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
97 '("Hide Sublevels" . hide-sublevels)) |
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-subtree] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
99 '("Hide Subtree" . hide-subtree)) |
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-entry] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
101 '("Hide Entry" . hide-entry)) |
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-body] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
103 '("Hide Body" . hide-body)) |
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-leaves] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
105 '("Hide Leaves" . hide-leaves)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
106 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
107 (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
|
108 (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
|
109 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
110 (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
|
111 '("Show Subtree" . show-subtree)) |
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-children] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
113 '("Show Children" . show-children)) |
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-branches] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
115 '("Show Branches" . show-branches)) |
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-entry] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
117 '("Show Entry" . show-entry)) |
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-all] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
119 '("Show All" . show-all)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
120 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
121 (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
|
122 (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
|
123 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
124 (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
|
125 '("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
|
126 (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
|
127 '("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
|
128 (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
|
129 '("Previous" . outline-previous-visible-heading)) |
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-next-visible-heading] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
131 '("Next" . outline-next-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-up-heading] |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
133 '("Up" . outline-up-heading))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
134 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
135 (defvar outline-mode-map nil "") |
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 (if outline-mode-map |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
138 nil |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
139 (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
|
140 (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
|
141 (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
|
142 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
143 (defcustom outline-minor-mode nil |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
144 "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
|
145 :type 'boolean |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
146 :group 'outlines) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
147 (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
|
148 (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
|
149 (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
|
150 (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
|
151 (list '(outline-minor-mode " Outl"))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
152 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
153 (defvar outline-font-lock-keywords |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
154 '(;; 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
|
155 ("^\\([*]+\\)[ \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
|
156 (1 font-lock-string-face) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
157 (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
|
158 (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
|
159 (2 . font-lock-keyword-face) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
160 (3 . font-lock-comment-face)))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
161 font-lock-variable-name-face)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
162 nil t)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
163 ;; 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
|
164 ("\\[\\([[: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
|
165 "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
|
166 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
167 (defun outline-mode () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
168 "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
|
169 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
|
170 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
|
171 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
172 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
|
173 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
|
174 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
|
175 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
|
176 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
177 Commands:\\<outline-mode-map> |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
178 \\[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
|
179 \\[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
|
180 \\[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
|
181 \\[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
|
182 \\[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
|
183 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
184 \\[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
|
185 \\[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
|
186 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
187 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
|
188 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
|
189 \\[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
|
190 \\[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
|
191 \\[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
|
192 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
|
193 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
|
194 \\[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
|
195 \\[show-entry] make it visible. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
196 \\[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
|
197 The subheadings remain visible. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
198 \\[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
|
199 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
200 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
|
201 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
|
202 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
|
203 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
204 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
|
205 `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
|
206 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
207 (kill-all-local-variables) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
208 (setq selective-display t) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
209 (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
|
210 (setq mode-name "Outline") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
211 (setq major-mode 'outline-mode) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
212 (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
|
213 (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
|
214 (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
|
215 (make-local-variable 'paragraph-start) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
216 (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
|
217 outline-regexp "\\)")) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
218 ;; 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
|
219 (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
|
220 (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
|
221 (make-local-variable 'paragraph-separate) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
222 (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
|
223 outline-regexp "\\)")) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
224 (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
|
225 (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
|
226 (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
|
227 (add-hook 'change-major-mode-hook 'show-all) |
62769
a1fa16a75bde
* obsolete/ooutline.el (outline-mode):
Lute Kamstra <lute@gnu.org>
parents:
52401
diff
changeset
|
228 (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
|
229 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
230 (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
|
231 "*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
|
232 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
|
233 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
|
234 :type 'string |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
235 :group 'outlines) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
236 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
237 (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
|
238 (if outline-minor-mode-map |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
239 nil |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
240 (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
|
241 (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
|
242 outline-mode-menu-bar-map) |
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 outline-minor-mode-prefix |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
244 outline-mode-prefix-map)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
245 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
246 (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
|
247 (setq minor-mode-map-alist |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
248 (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
|
249 minor-mode-map-alist))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
250 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
251 (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
|
252 "Toggle Outline minor mode. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
253 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
|
254 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
|
255 (interactive "P") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
256 (setq outline-minor-mode |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
257 (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
|
258 (> (prefix-numeric-value arg) 0))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
259 (if outline-minor-mode |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
260 (progn |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
261 (setq selective-display t) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
262 (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
|
263 (setq selective-display nil)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
264 ;; 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
|
265 (or outline-minor-mode |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
266 (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
|
267 (force-mode-line-update)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
268 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
269 (defvar outline-level 'outline-level |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
270 "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
|
271 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
|
272 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
273 ;; 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
|
274 ;; 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
|
275 ;; 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
|
276 ;; 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
|
277 ;; as appropriate. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
278 (defun outline-level () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
279 "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
|
280 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
|
281 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
|
282 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
283 (looking-at outline-regexp) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
284 (- (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
|
285 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
286 (defun outline-next-preface () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
287 "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
|
288 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
|
289 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
|
290 (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
|
291 nil 'move) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
292 (goto-char (match-beginning 0))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
293 (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
|
294 (forward-char -1))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
295 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
296 (defun outline-next-heading () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
297 "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
|
298 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
299 (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
|
300 nil 'move) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
301 (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
|
302 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
303 (defun outline-back-to-heading () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
304 "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
|
305 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
|
306 (beginning-of-line) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
307 (or (outline-on-heading-p) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
308 (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
|
309 (error "before first heading"))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
310 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
311 (defun outline-on-heading-p () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
312 "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
|
313 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
314 (beginning-of-line) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
315 (and (bolp) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
316 (looking-at outline-regexp)))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
317 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
318 (defun outline-end-of-heading () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
319 (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
|
320 (forward-char -1))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
321 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
322 (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
|
323 "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
|
324 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
|
325 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
|
326 `outline-regexp' matches)." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
327 (interactive "p") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
328 (if (< arg 0) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
329 (beginning-of-line) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
330 (end-of-line)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
331 (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
|
332 (error "")) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
333 (beginning-of-line)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
334 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
335 (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
|
336 "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
|
337 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
|
338 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
|
339 `outline-regexp' matches)." |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
340 (interactive "p") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
341 (outline-next-visible-heading (- arg))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
342 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
343 (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
|
344 "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
|
345 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
|
346 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
|
347 (let (buffer-read-only) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
348 (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
|
349 (if (= flag ?\n) ?\^M ?\n) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
350 flag t))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
351 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
352 (defun hide-entry () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
353 "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
|
354 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
355 (outline-back-to-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
356 (outline-end-of-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
357 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
358 (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
|
359 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
360 (defun show-entry () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
361 "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
|
362 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
363 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
364 (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
|
365 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
366 (defun hide-body () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
367 "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
|
368 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
369 (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
|
370 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
371 (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
|
372 "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
|
373 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
374 (save-restriction |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
375 (narrow-to-region start end) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
376 (goto-char (point-min)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
377 (if (outline-on-heading-p) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
378 (outline-end-of-heading)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
379 (while (not (eobp)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
380 (outline-flag-region (point) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
381 (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
|
382 (if (not (eobp)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
383 (progn |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
384 (forward-char |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
385 (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
|
386 2 1)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
387 (outline-end-of-heading))))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
388 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
389 (defun show-all () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
390 "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
|
391 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
392 (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
|
393 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
394 (defun hide-subtree () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
395 "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
|
396 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
397 (outline-flag-subtree ?\^M)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
398 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
399 (defun hide-leaves () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
400 "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
|
401 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
402 (outline-back-to-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
403 (outline-end-of-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
404 (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
|
405 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
406 (defun show-subtree () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
407 "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
|
408 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
409 (outline-flag-subtree ?\n)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
410 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
411 (defun hide-sublevels (levels) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
412 "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
|
413 (interactive "p") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
414 (if (< levels 1) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
415 (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
|
416 (setq levels (1- levels)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
417 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
418 (goto-char (point-min)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
419 ;; 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
|
420 (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
|
421 (outline-next-heading)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
422 (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
|
423 ;; Hide everything under that. |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
424 (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
|
425 ;; 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
|
426 (if (> levels 0) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
427 (show-children levels)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
428 ;; 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
|
429 (goto-char end))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
430 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
431 (defun hide-other () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
432 "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
|
433 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
434 (hide-sublevels 1) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
435 (let ((last (point)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
436 (pos (point))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
437 (while (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
438 (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
|
439 (eq (following-char) ?\r))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
440 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
441 (beginning-of-line) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
442 (if (eq last (point)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
443 (progn |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
444 (outline-next-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
445 (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
|
446 (show-children) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
447 (setq last (point))))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
448 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
449 (defun outline-flag-subtree (flag) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
450 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
451 (outline-back-to-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
452 (outline-end-of-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
453 (outline-flag-region (point) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
454 (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
|
455 flag))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
456 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
457 (defun outline-end-of-subtree () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
458 (outline-back-to-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
459 (let ((opoint (point)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
460 (first t) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
461 (level (funcall outline-level))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
462 (while (and (not (eobp)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
463 (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
|
464 (setq first nil) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
465 (outline-next-heading)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
466 (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
|
467 (progn |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
468 ;; 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
|
469 (forward-char -1) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
470 (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
|
471 ;; leave blank line before heading |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
472 (forward-char -1)))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
473 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
474 (defun show-branches () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
475 "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
|
476 (interactive) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
477 (show-children 1000)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
478 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
479 (defun show-children (&optional level) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
480 "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
|
481 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
|
482 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
|
483 (interactive "P") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
484 (setq level |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
485 (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
|
486 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
487 (outline-back-to-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
488 (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
|
489 (outline-next-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
490 (if (eobp) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
491 1 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
492 (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
|
493 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
494 (save-restriction |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
495 (outline-back-to-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
496 (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
|
497 (narrow-to-region (point) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
498 (progn (outline-end-of-subtree) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
499 (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
|
500 (goto-char (point-min)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
501 (while (and (not (eobp)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
502 (progn |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
503 (outline-next-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
504 (not (eobp)))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
505 (if (<= (funcall outline-level) level) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
506 (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
507 (outline-flag-region (save-excursion |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
508 (forward-char -1) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
509 (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
|
510 (forward-char -1)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
511 (point)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
512 (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
|
513 ?\n))))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
514 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
515 (defun outline-up-heading (arg) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
516 "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
|
517 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
|
518 (interactive "p") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
519 (outline-back-to-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
520 (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
|
521 (error "")) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
522 (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
|
523 (> arg 0) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
524 (not (bobp))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
525 (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
|
526 (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
|
527 (outline-previous-visible-heading 1)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
528 (setq arg (- arg 1))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
529 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
530 (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
|
531 "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
|
532 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
|
533 (interactive "p") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
534 (outline-back-to-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
535 (while (> arg 0) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
536 (let ((point-to-move-to (save-excursion |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38412
diff
changeset
|
537 (outline-get-next-sibling)))) |
34456
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
538 (if point-to-move-to |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
539 (progn |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
540 (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
|
541 (setq arg (1- arg))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
542 (progn |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
543 (setq arg 0) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
544 (error "")))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
545 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
546 (defun outline-get-next-sibling () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
547 "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
|
548 (let ((level (funcall outline-level))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
549 (outline-next-visible-heading 1) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
550 (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
|
551 (not (eobp))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
552 (outline-next-visible-heading 1)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
553 (if (< (funcall outline-level) level) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
554 nil |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
555 (point)))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38412
diff
changeset
|
556 |
34456
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
557 (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
|
558 "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
|
559 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
|
560 (interactive "p") |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
561 (outline-back-to-heading) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
562 (while (> arg 0) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
563 (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
|
564 (outline-get-last-sibling)))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
565 (if point-to-move-to |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
566 (progn |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
567 (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
|
568 (setq arg (1- arg))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
569 (progn |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
570 (setq arg 0) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
571 (error "")))))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
572 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
573 (defun outline-get-last-sibling () |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
574 "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
|
575 (let ((level (funcall outline-level))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
576 (outline-previous-visible-heading 1) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
577 (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
|
578 (not (bobp))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
579 (outline-previous-visible-heading 1)) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
580 (if (< (funcall outline-level) level) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
581 nil |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
582 (point)))) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
583 |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
584 (provide 'outline) |
6ab25b51ae25
Moved from textmodes/ooutline.el to obsolete/ooutline.el
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
585 |
52401 | 586 ;;; 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
|
587 ;;; ooutline.el ends here |