68 |
(defgroup allout nil |
(defgroup allout nil |
69 |
"Extensive outline mode for use alone and with other modes." |
"Extensive outline mode for use alone and with other modes." |
70 |
:prefix "allout-" |
:prefix "allout-" |
71 |
:group 'editing) |
:group 'editing |
72 |
|
:version "21.4") |
73 |
|
|
74 |
;;;_ + Layout, Mode, and Topic Header Configuration |
;;;_ + Layout, Mode, and Topic Header Configuration |
75 |
|
|
955 |
\(require 'allout) |
\(require 'allout) |
956 |
\(allout-init t)" |
\(allout-init t)" |
957 |
|
|
958 |
(interactive) |
(interactive |
959 |
(if (interactive-p) |
(let ((m (completing-read |
960 |
(progn |
(concat "Select outline auto setup mode " |
961 |
(setq mode |
"(empty for report, ? for options) ") |
962 |
(completing-read |
'(("nil")("full")("activate")("deactivate") |
963 |
(concat "Select outline auto setup mode " |
("ask") ("report") ("")) |
964 |
"(empty for report, ? for options) ") |
nil |
965 |
'(("nil")("full")("activate")("deactivate") |
t))) |
966 |
("ask") ("report") ("")) |
(if (string= m "") 'report |
967 |
nil |
(intern-soft m)))) |
|
t)) |
|
|
(if (string= mode "") |
|
|
(setq mode 'report) |
|
|
(setq mode (intern-soft mode))))) |
|
968 |
(let |
(let |
969 |
;; convenience aliases, for consistent ref to respective vars: |
;; convenience aliases, for consistent ref to respective vars: |
970 |
((hook 'allout-find-file-hook) |
((hook 'allout-find-file-hook) |
1899 |
(if (= (allout-recent-depth) depth) |
(if (= (allout-recent-depth) depth) |
1900 |
(progn (goto-char allout-recent-prefix-beginning) |
(progn (goto-char allout-recent-prefix-beginning) |
1901 |
depth) |
depth) |
1902 |
(goto-char last-good) |
(goto-char last-good))))) |
|
nil)) |
|
|
(if (interactive-p) (allout-end-of-prefix)))) |
|
1903 |
;;;_ > allout-ascend () |
;;;_ > allout-ascend () |
1904 |
(defun allout-ascend () |
(defun allout-ascend () |
1905 |
"Ascend one level, returning t if successful, nil if not." |
"Ascend one level, returning t if successful, nil if not." |
1906 |
(prog1 |
(if (allout-beginning-of-level) |
1907 |
(if (allout-beginning-of-level) |
(allout-previous-heading))) |
|
(allout-previous-heading)) |
|
|
(if (interactive-p) (allout-end-of-prefix)))) |
|
1908 |
;;;_ > allout-descend-to-depth (depth) |
;;;_ > allout-descend-to-depth (depth) |
1909 |
(defun allout-descend-to-depth (depth) |
(defun allout-descend-to-depth (depth) |
1910 |
"Descend to depth DEPTH within current topic. |
"Descend to depth DEPTH within current topic. |
1924 |
nil)) |
nil)) |
1925 |
) |
) |
1926 |
;;;_ > allout-up-current-level (arg &optional dont-complain) |
;;;_ > allout-up-current-level (arg &optional dont-complain) |
1927 |
(defun allout-up-current-level (arg &optional dont-complain) |
(defun allout-up-current-level (arg &optional dont-complain interactive) |
1928 |
"Move out ARG levels from current visible topic. |
"Move out ARG levels from current visible topic. |
1929 |
|
|
1930 |
Positions on heading line of containing topic. Error if unable to |
Positions on heading line of containing topic. Error if unable to |
1931 |
ascend that far, or nil if unable to ascend but optional arg |
ascend that far, or nil if unable to ascend but optional arg |
1932 |
DONT-COMPLAIN is non-nil." |
DONT-COMPLAIN is non-nil." |
1933 |
(interactive "p") |
(interactive "p\np") |
1934 |
(allout-back-to-current-heading) |
(allout-back-to-current-heading) |
1935 |
(let ((present-level (allout-recent-depth)) |
(let ((present-level (allout-recent-depth)) |
1936 |
(last-good (point)) |
(last-good (point)) |
1951 |
(if (or failed |
(if (or failed |
1952 |
(> arg 0)) |
(> arg 0)) |
1953 |
(progn (goto-char last-good) |
(progn (goto-char last-good) |
1954 |
(if (interactive-p) (allout-end-of-prefix)) |
(if interactive (allout-end-of-prefix)) |
1955 |
(if (not dont-complain) |
(if (not dont-complain) |
1956 |
(error "Can't ascend past outermost level") |
(error "Can't ascend past outermost level") |
1957 |
(if (interactive-p) (allout-end-of-prefix)) |
(if interactive (allout-end-of-prefix)) |
1958 |
nil)) |
nil)) |
1959 |
(if (interactive-p) (allout-end-of-prefix)) |
(if interactive (allout-end-of-prefix)) |
1960 |
allout-recent-prefix-beginning))) |
allout-recent-prefix-beginning))) |
1961 |
|
|
1962 |
;;;_ - Linear |
;;;_ - Linear |
2022 |
(let ((depth (allout-depth))) |
(let ((depth (allout-depth))) |
2023 |
(while (allout-previous-sibling depth nil)) |
(while (allout-previous-sibling depth nil)) |
2024 |
(prog1 (allout-recent-depth) |
(prog1 (allout-recent-depth) |
2025 |
(if (interactive-p) (allout-end-of-prefix))))) |
(allout-end-of-prefix)))) |
2026 |
;;;_ > allout-next-visible-heading (arg) |
;;;_ > allout-next-visible-heading (arg) |
2027 |
(defun allout-next-visible-heading (arg) |
(defun allout-next-visible-heading (arg) |
2028 |
"Move to the next ARG'th visible heading line, backward if arg is negative. |
"Move to the next ARG'th visible heading line, backward if arg is negative. |
2060 |
(interactive "p") |
(interactive "p") |
2061 |
(allout-next-visible-heading (- arg))) |
(allout-next-visible-heading (- arg))) |
2062 |
;;;_ > allout-forward-current-level (arg) |
;;;_ > allout-forward-current-level (arg) |
2063 |
(defun allout-forward-current-level (arg) |
(defun allout-forward-current-level (arg &optional interactive) |
2064 |
"Position point at the next heading of the same level. |
"Position point at the next heading of the same level. |
2065 |
|
|
2066 |
Takes optional repeat-count, goes backward if count is negative. |
Takes optional repeat-count, goes backward if count is negative. |
2067 |
|
|
2068 |
Returns resulting position, else nil if none found." |
Returns resulting position, else nil if none found." |
2069 |
(interactive "p") |
(interactive "p\np") |
2070 |
(let ((start-depth (allout-current-depth)) |
(let ((start-depth (allout-current-depth)) |
2071 |
(start-point (point)) |
(start-point (point)) |
2072 |
(start-arg arg) |
(start-arg arg) |
2094 |
(= (allout-recent-depth) start-depth))) |
(= (allout-recent-depth) start-depth))) |
2095 |
allout-recent-prefix-beginning |
allout-recent-prefix-beginning |
2096 |
(goto-char last-good) |
(goto-char last-good) |
2097 |
(if (not (interactive-p)) |
(if (not interactive) |
2098 |
nil |
nil |
2099 |
(allout-end-of-prefix) |
(allout-end-of-prefix) |
2100 |
(error "Hit %s level %d topic, traversed %d of %d requested" |
(error "Hit %s level %d topic, traversed %d of %d requested" |
2103 |
(- (abs start-arg) arg) |
(- (abs start-arg) arg) |
2104 |
(abs start-arg)))))) |
(abs start-arg)))))) |
2105 |
;;;_ > allout-backward-current-level (arg) |
;;;_ > allout-backward-current-level (arg) |
2106 |
(defun allout-backward-current-level (arg) |
(defun allout-backward-current-level (arg &optional interactive) |
2107 |
"Inverse of `allout-forward-current-level'." |
"Inverse of `allout-forward-current-level'." |
2108 |
(interactive "p") |
(interactive "p\np") |
2109 |
(if (interactive-p) |
(if interactive |
2110 |
(let ((current-prefix-arg (* -1 arg))) |
(let ((current-prefix-arg (* -1 arg))) |
2111 |
(call-interactively 'allout-forward-current-level)) |
(call-interactively 'allout-forward-current-level)) |
2112 |
(allout-forward-current-level (* -1 arg)))) |
(allout-forward-current-level (* -1 arg)))) |