Mercurial > emacs
comparison lisp/allout.el @ 83353:532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Patches applied:
* lorentey@elte.hu--2004/emacs--cvs-trunk--0--base-0
tag of miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-474
* lorentey@elte.hu--2004/emacs--cvs-trunk--0--patch-1
Add CVS metadata files.
* lorentey@elte.hu--2004/emacs--cvs-trunk--0--patch-2
Update from CVS.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-393
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Sun, 04 Sep 2005 03:48:17 +0000 |
parents | 6c13700d1c13 41bb365f41c4 |
children | 732c5740ca8f |
comparison
equal
deleted
inserted
replaced
83352:b258b3492423 | 83353:532e0a9335a9 |
---|---|
1 ;;; allout.el --- extensive outline mode for use alone and with other modes | 1 ;;; allout.el --- extensive outline mode for use alone and with other modes |
2 | 2 |
3 ;; Copyright (C) 1992, 93, 94, 2001, 02, 2004 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1992, 1993, 1994, 2001, 2002, 2003, 2004, |
4 ;; 2005 Free Software Foundation, Inc. | |
4 | 5 |
5 ;; Author: Ken Manheimer <klm@zope.com> | 6 ;; Author: Ken Manheimer <klm@zope.com> |
6 ;; Maintainer: Ken Manheimer <klm@zope.com> | 7 ;; Maintainer: Ken Manheimer <klm@zope.com> |
7 ;; Created: Dec 1991 - first release to usenet | 8 ;; Created: Dec 1991 - first release to usenet |
8 ;; Keywords: outlines mode wp languages | 9 ;; Keywords: outlines mode wp languages |
866 "Cue for isearch-dynamic-exposure mechanism, implemented in | 867 "Cue for isearch-dynamic-exposure mechanism, implemented in |
867 allout-pre- and -post-command-hooks.") | 868 allout-pre- and -post-command-hooks.") |
868 (make-variable-buffer-local 'allout-pre-was-isearching) | 869 (make-variable-buffer-local 'allout-pre-was-isearching) |
869 ;;;_ = allout-isearch-prior-pos nil | 870 ;;;_ = allout-isearch-prior-pos nil |
870 (defvar allout-isearch-prior-pos nil | 871 (defvar allout-isearch-prior-pos nil |
871 "Cue for isearch-dynamic-exposure tracking, used by allout-isearch-expose.") | 872 "Cue for isearch-dynamic-exposure tracking, used by `allout-isearch-expose'.") |
872 (make-variable-buffer-local 'allout-isearch-prior-pos) | 873 (make-variable-buffer-local 'allout-isearch-prior-pos) |
873 ;;;_ = allout-isearch-did-quit | |
874 (defvar allout-isearch-did-quit nil | |
875 "Distinguishes isearch conclusion and cancellation. | |
876 | |
877 Maintained by `allout-isearch-abort' \(which is wrapped around the real | |
878 isearch-abort), and monitored by `allout-isearch-expose' for action.") | |
879 (make-variable-buffer-local 'allout-isearch-did-quit) | |
880 ;;;_ = allout-override-protect nil | 874 ;;;_ = allout-override-protect nil |
881 (defvar allout-override-protect nil | 875 (defvar allout-override-protect nil |
882 "Used in `allout-mode' for regulate of concealed-text protection mechanism. | 876 "Used in `allout-mode' for regulate of concealed-text protection mechanism. |
883 | 877 |
884 Allout outline mode regulates alteration of concealed text to protect | 878 Allout outline mode regulates alteration of concealed text to protect |
885 against inadvertent, unnoticed changes. This is for use by specific, | 879 against inadvertent, unnoticed changes. This is for use by specific, |
886 native outline functions to temporarily override that protection. | 880 native outline functions to temporarily override that protection. |
887 It's automatically reset to nil after every buffer modification.") | 881 It's automatically reset to nil after every buffer modification.") |
888 (make-variable-buffer-local 'allout-override-protect) | 882 (make-variable-buffer-local 'allout-override-protect) |
889 ;;;_ > allout-unprotected (expr) | 883 ;;;_ > allout-unprotected (expr) |
890 (defmacro allout-unprotected (expr) | 884 (defmacro allout-unprotected (expression) |
891 "Evaluate EXPRESSION with `allout-override-protect' let-bound t." | 885 "Evaluate EXPRESSION with `allout-override-protect' let-bound to t." |
892 `(let ((allout-override-protect t)) | 886 `(let ((allout-override-protect t)) |
893 ,expr)) | 887 ,expression)) |
894 ;;;_ = allout-undo-aggregation | 888 ;;;_ = allout-undo-aggregation |
895 (defvar allout-undo-aggregation 30 | 889 (defvar allout-undo-aggregation 30 |
896 "Amount of successive self-insert actions to bunch together per undo. | 890 "Amount of successive self-insert actions to bunch together per undo. |
897 | 891 |
898 This is purely a kludge variable, regulating the compensation for a bug in | 892 This is purely a kludge variable, regulating the compensation for a bug in |
899 the way that before-change-functions and undo interact.") | 893 the way that `before-change-functions' and undo interact.") |
900 (make-variable-buffer-local 'allout-undo-aggregation) | 894 (make-variable-buffer-local 'allout-undo-aggregation) |
901 ;;;_ = file-var-bug hack | 895 ;;;_ = file-var-bug hack |
902 (defvar allout-v18/19-file-var-hack nil | 896 (defvar allout-v18/19-file-var-hack nil |
903 "Horrible hack used to prevent invalid multiple triggering of outline | 897 "Horrible hack used to prevent invalid multiple triggering of outline |
904 mode from prop-line file-var activation. Used by `allout-mode' function | 898 mode from prop-line file-var activation. Used by `allout-mode' function |
1152 | 1146 |
1153 Topic text constituents: | 1147 Topic text constituents: |
1154 | 1148 |
1155 HEADER: The first line of a topic, include the topic PREFIX and header | 1149 HEADER: The first line of a topic, include the topic PREFIX and header |
1156 text. | 1150 text. |
1157 PREFIX: The leading text of a topic which which distinguishes it from | 1151 PREFIX: The leading text of a topic which distinguishes it from |
1158 normal text. It has a strict form, which consists of a | 1152 normal text. It has a strict form, which consists of a |
1159 prefix-lead string, padding, and a bullet. The bullet may be | 1153 prefix-lead string, padding, and a bullet. The bullet may be |
1160 followed by a number, indicating the ordinal number of the | 1154 followed by a number, indicating the ordinal number of the |
1161 topic among its siblings, a space, and then the header text. | 1155 topic among its siblings, a space, and then the header text. |
1162 | 1156 |
1341 (allout-setup-menubar) | 1335 (allout-setup-menubar) |
1342 | 1336 |
1343 (if allout-layout | 1337 (if allout-layout |
1344 (setq do-layout t)) | 1338 (setq do-layout t)) |
1345 | 1339 |
1346 (if (and allout-isearch-dynamic-expose | 1340 (if allout-isearch-dynamic-expose |
1347 (not (fboundp 'allout-real-isearch-abort))) | |
1348 (allout-enwrap-isearch)) | 1341 (allout-enwrap-isearch)) |
1349 | 1342 |
1350 (run-hooks 'allout-mode-hook) | 1343 (run-hooks 'allout-mode-hook) |
1351 (setq allout-mode t)) | 1344 (setq allout-mode t)) |
1352 | 1345 |
1405 ;;;_ = allout-recent-end-of-subtree | 1398 ;;;_ = allout-recent-end-of-subtree |
1406 (defvar allout-recent-end-of-subtree 0 | 1399 (defvar allout-recent-end-of-subtree 0 |
1407 "Buffer point last returned by `allout-end-of-current-subtree'.") | 1400 "Buffer point last returned by `allout-end-of-current-subtree'.") |
1408 (make-variable-buffer-local 'allout-recent-end-of-subtree) | 1401 (make-variable-buffer-local 'allout-recent-end-of-subtree) |
1409 ;;;_ > allout-prefix-data (beg end) | 1402 ;;;_ > allout-prefix-data (beg end) |
1410 (defmacro allout-prefix-data (beg end) | 1403 (defmacro allout-prefix-data (beginning end) |
1411 "Register allout-prefix state data - BEGINNING and END of prefix. | 1404 "Register allout-prefix state data - BEGINNING and END of prefix. |
1412 | 1405 |
1413 For reference by `allout-recent' funcs. Returns BEGINNING." | 1406 For reference by `allout-recent' funcs. Returns BEGINNING." |
1414 `(setq allout-recent-prefix-end ,end | 1407 `(setq allout-recent-prefix-end ,end |
1415 allout-recent-prefix-beginning ,beg)) | 1408 allout-recent-prefix-beginning ,beginning)) |
1416 ;;;_ > allout-recent-depth () | 1409 ;;;_ > allout-recent-depth () |
1417 (defmacro allout-recent-depth () | 1410 (defmacro allout-recent-depth () |
1418 "Return depth of last heading encountered by an outline maneuvering function. | 1411 "Return depth of last heading encountered by an outline maneuvering function. |
1419 | 1412 |
1420 All outline functions which directly do string matches to assess | 1413 All outline functions which directly do string matches to assess |
1630 at the beginning of the topic. Charts for offspring consists of a | 1623 at the beginning of the topic. Charts for offspring consists of a |
1631 list containing, recursively, the charts for the respective subtopics. | 1624 list containing, recursively, the charts for the respective subtopics. |
1632 The chart for a topics' offspring precedes the entry for the topic | 1625 The chart for a topics' offspring precedes the entry for the topic |
1633 itself. | 1626 itself. |
1634 | 1627 |
1635 \(fn &optional levels)" | 1628 \(fn &optional LEVELS)" |
1636 | 1629 |
1637 ;; The other function parameters are for internal recursion, and should | 1630 ;; The other function parameters are for internal recursion, and should |
1638 ;; not be specified by external callers. ORIG-DEPTH is depth of topic at | 1631 ;; not be specified by external callers. ORIG-DEPTH is depth of topic at |
1639 ;; starting point, and PREV-DEPTH is depth of prior topic." | 1632 ;; starting point, and PREV-DEPTH is depth of prior topic." |
1640 | 1633 |
1997 Return depth if successful, nil otherwise." | 1990 Return depth if successful, nil otherwise." |
1998 (allout-next-sibling depth (not backward)) | 1991 (allout-next-sibling depth (not backward)) |
1999 ) | 1992 ) |
2000 ;;;_ > allout-snug-back () | 1993 ;;;_ > allout-snug-back () |
2001 (defun allout-snug-back () | 1994 (defun allout-snug-back () |
2002 "Position cursor at end of previous topic | 1995 "Position cursor at end of previous topic. |
2003 | 1996 |
2004 Presumes point is at the start of a topic prefix." | 1997 Presumes point is at the start of a topic prefix." |
2005 (if (or (bobp) (eobp)) | 1998 (if (or (bobp) (eobp)) |
2006 nil | 1999 nil |
2007 (forward-char -1)) | 2000 (forward-char -1)) |
2224 (if rehide-completely | 2217 (if rehide-completely |
2225 (save-excursion | 2218 (save-excursion |
2226 (if rehide-place (goto-char rehide-place)) | 2219 (if rehide-place (goto-char rehide-place)) |
2227 (allout-hide-current-entry-completely)) | 2220 (allout-hide-current-entry-completely)) |
2228 (allout-hide-current-entry)) | 2221 (allout-hide-current-entry)) |
2229 (error (concat | 2222 (error "Change within concealed region prevented")))))) |
2230 "Change within concealed region prevented."))))))) | |
2231 ) ; if | 2223 ) ; if |
2232 ) ; defun | 2224 ) ; defun |
2233 ;;;_ = allout-post-goto-bullet | 2225 ;;;_ = allout-post-goto-bullet |
2234 (defvar allout-post-goto-bullet nil | 2226 (defvar allout-post-goto-bullet nil |
2235 "Outline internal var, for `allout-pre-command-business' hot-spot operation. | 2227 "Outline internal var, for `allout-pre-command-business' hot-spot operation. |
2247 - Null `allout-override-protect', so it's not left open. | 2239 - Null `allout-override-protect', so it's not left open. |
2248 | 2240 |
2249 - Implement (and clear) `allout-post-goto-bullet', for hot-spot | 2241 - Implement (and clear) `allout-post-goto-bullet', for hot-spot |
2250 outline commands. | 2242 outline commands. |
2251 | 2243 |
2252 - Massages buffer-undo-list so successive, standard character self-inserts are | 2244 - Massages `buffer-undo-list' so successive, standard character self-inserts |
2253 aggregated. This kludge compensates for lack of undo bunching when | 2245 are aggregated. This kludge compensates for lack of undo bunching when |
2254 `before-change-functions' is used." | 2246 `before-change-functions' is used." |
2255 | 2247 |
2256 ; Apply any external change func: | 2248 ; Apply any external change func: |
2257 (if (not (allout-mode-p)) ; In allout-mode. | 2249 (if (not (allout-mode-p)) ; In allout-mode. |
2258 nil | 2250 nil |
2323 (if (and (eq this-command 'self-insert-command) | 2315 (if (and (eq this-command 'self-insert-command) |
2324 (eq (point)(allout-current-bullet-pos))) | 2316 (eq (point)(allout-current-bullet-pos))) |
2325 (let* ((this-key-num (cond | 2317 (let* ((this-key-num (cond |
2326 ((numberp last-command-char) | 2318 ((numberp last-command-char) |
2327 last-command-char) | 2319 last-command-char) |
2328 ;; XXX Only XEmacs has characterp. | 2320 ((fboundp 'char-to-int) |
2329 ((and (fboundp 'characterp) | |
2330 (characterp last-command-char)) | |
2331 (char-to-int last-command-char)) | 2321 (char-to-int last-command-char)) |
2332 (t 0))) | 2322 (t 0))) |
2333 mapped-binding) | 2323 mapped-binding) |
2334 (if (zerop this-key-num) | 2324 (if (zerop this-key-num) |
2335 nil | 2325 nil |
2361 (defun allout-isearch-rectification () | 2351 (defun allout-isearch-rectification () |
2362 "Rectify outline exposure before, during, or after isearch. | 2352 "Rectify outline exposure before, during, or after isearch. |
2363 | 2353 |
2364 Called as part of `allout-post-command-business'." | 2354 Called as part of `allout-post-command-business'." |
2365 | 2355 |
2366 (let ((isearching (and (boundp 'isearch-mode) isearch-mode))) | 2356 (let ((isearching isearch-mode)) |
2367 (cond ((and isearching (not allout-pre-was-isearching)) | 2357 (cond ((and isearching (not allout-pre-was-isearching)) |
2368 (allout-isearch-expose 'start)) | 2358 (allout-isearch-expose 'start)) |
2369 ((and isearching allout-pre-was-isearching) | 2359 ((and isearching allout-pre-was-isearching) |
2370 (allout-isearch-expose 'continue)) | 2360 (allout-isearch-expose 'continue)) |
2371 ((and (not isearching) allout-pre-was-isearching) | 2361 ((and (not isearching) allout-pre-was-isearching) |
2372 (allout-isearch-expose 'final)) | 2362 (allout-isearch-expose 'final)) |
2373 ;; Not and wasn't isearching: | 2363 ;; Not and wasn't isearching: |
2374 (t (setq allout-isearch-prior-pos nil) | 2364 (t (setq allout-isearch-prior-pos nil))))) |
2375 (setq allout-isearch-did-quit nil))))) | |
2376 ;;;_ = allout-isearch-was-font-lock | 2365 ;;;_ = allout-isearch-was-font-lock |
2377 (defvar allout-isearch-was-font-lock | 2366 (defvar allout-isearch-was-font-lock |
2378 (and (boundp 'font-lock-mode) font-lock-mode)) | 2367 (and (boundp 'font-lock-mode) font-lock-mode)) |
2379 | 2368 |
2380 ;;;_ > allout-flag-region (from to flag) | 2369 ;;;_ > allout-flag-region (from to flag) |
2381 (defmacro allout-flag-region (from to flag) | 2370 (defmacro allout-flag-region (from to flag) |
2382 "Hide or show lines from FROM to TO, via Emacs selective-display FLAG char. | 2371 "Hide or show lines from FROM to TO, via Emacs `selective-display' FLAG char. |
2383 Ie, text following flag C-m \(carriage-return) is hidden until the | 2372 Ie, text following flag C-m \(carriage-return) is hidden until the |
2384 next C-j (newline) char. | 2373 next C-j (newline) char. |
2385 | 2374 |
2386 Returns the endpoint of the region." | 2375 Returns the endpoint of the region." |
2387 `(let ((buffer-read-only nil) | 2376 `(let ((buffer-read-only nil) |
2412 ?\r))) | 2401 ?\r))) |
2413 (if (allout-visible-p) | 2402 (if (allout-visible-p) |
2414 (setq allout-isearch-prior-pos nil) | 2403 (setq allout-isearch-prior-pos nil) |
2415 (if (not (eq mode 'final)) | 2404 (if (not (eq mode 'final)) |
2416 (setq allout-isearch-prior-pos (cons (point) (allout-show-entry))) | 2405 (setq allout-isearch-prior-pos (cons (point) (allout-show-entry))) |
2417 (if allout-isearch-did-quit | 2406 (if isearch-mode-end-hook-quit |
2418 nil | 2407 nil |
2419 (setq allout-isearch-prior-pos nil) | 2408 (setq allout-isearch-prior-pos nil) |
2420 (allout-show-children)))) | 2409 (allout-show-children))))) |
2421 (setq allout-isearch-did-quit nil)) | |
2422 ;;;_ > allout-enwrap-isearch () | 2410 ;;;_ > allout-enwrap-isearch () |
2423 (defun allout-enwrap-isearch () | 2411 (defun allout-enwrap-isearch () |
2424 "Impose `allout-mode' isearch-abort wrapper for dynamic exposure in isearch. | 2412 "Impose `isearch-abort' wrapper for dynamic exposure in isearch. |
2425 | 2413 |
2426 The function checks to ensure that the rebinding is done only once." | 2414 The function checks to ensure that the rebinding is done only once." |
2427 | 2415 (add-hook 'isearch-mode-end-hook 'allout-isearch-rectification)) |
2428 (add-hook 'isearch-mode-end-hook 'allout-isearch-rectification) | |
2429 (if (fboundp 'allout-real-isearch-abort) | |
2430 ;; | |
2431 nil | |
2432 ; Ensure load of isearch-mode: | |
2433 (if (or (and (fboundp 'isearch-mode) | |
2434 (fboundp 'isearch-abort)) | |
2435 (condition-case error | |
2436 (load-library "isearch-mode") | |
2437 ('file-error (message | |
2438 "Skipping isearch-mode provisions - %s '%s'" | |
2439 (car (cdr error)) | |
2440 (car (cdr (cdr error)))) | |
2441 (sit-for 1) | |
2442 ;; Inhibit subsequent tries and return nil: | |
2443 (setq allout-isearch-dynamic-expose nil)))) | |
2444 ;; Isearch-mode loaded, encapsulate specific entry points for | |
2445 ;; outline dynamic-exposure business: | |
2446 (progn | |
2447 ;; stash crucial isearch-mode funcs under known, private | |
2448 ;; names, then register wrapper functions under the old | |
2449 ;; names, in their stead: | |
2450 (fset 'allout-real-isearch-abort (symbol-function 'isearch-abort)) | |
2451 (fset 'isearch-abort 'allout-isearch-abort))))) | |
2452 ;;;_ > allout-isearch-abort () | |
2453 (defun allout-isearch-abort () | |
2454 "Wrapper for `allout-real-isearch-abort' \(which see), to register | |
2455 actual quits." | |
2456 (interactive) | |
2457 (setq allout-isearch-did-quit nil) | |
2458 (condition-case what | |
2459 (allout-real-isearch-abort) | |
2460 ('quit (setq allout-isearch-did-quit t) | |
2461 (signal 'quit nil)))) | |
2462 | 2416 |
2463 ;;; Prevent unnecessary font-lock while isearching! | 2417 ;;; Prevent unnecessary font-lock while isearching! |
2464 (defvar isearch-was-font-locking nil) | 2418 (defvar isearch-was-font-locking nil) |
2465 (defun isearch-inhibit-font-lock () | 2419 (defun isearch-inhibit-font-lock () |
2466 "Inhibit `font-lock-mode' while isearching - for use on `isearch-mode-hook'." | 2420 "Inhibit `font-lock-mode' while isearching - for use on `isearch-mode-hook'." |
2467 (if (and (allout-mode-p) (boundp 'font-lock-mode) font-lock-mode) | 2421 (if (and (allout-mode-p) (boundp 'font-lock-mode) font-lock-mode) |
2468 (setq isearch-was-font-locking t | 2422 (setq isearch-was-font-locking t |
2469 font-lock-mode nil))) | 2423 font-lock-mode nil))) |
2470 (add-hook 'isearch-mode-hook 'isearch-inhibit-font-lock) | 2424 (add-hook 'isearch-mode-hook 'isearch-inhibit-font-lock) |
2471 (defun isearch-reenable-font-lock () | 2425 (defun isearch-reenable-font-lock () |
2472 "Reenable font-lock after isearching - for use on isearch-mode-end-hook." | 2426 "Reenable font-lock after isearching - for use on `isearch-mode-end-hook'." |
2473 (if (and (boundp 'font-lock-mode) font-lock-mode) | 2427 (if (and (boundp 'font-lock-mode) font-lock-mode) |
2474 (if (and (allout-mode-p) isearch-was-font-locking) | 2428 (if (and (allout-mode-p) isearch-was-font-locking) |
2475 (setq isearch-was-font-locking nil | 2429 (setq isearch-was-font-locking nil |
2476 font-lock-mode t)))) | 2430 font-lock-mode t)))) |
2477 (add-hook 'isearch-mode-end-hook 'isearch-reenable-font-lock) | 2431 (add-hook 'isearch-mode-end-hook 'isearch-reenable-font-lock) |
2669 (format "%d" (cond ((and index (numberp index)) index) | 2623 (format "%d" (cond ((and index (numberp index)) index) |
2670 (new (1+ (allout-sibling-index depth))) | 2624 (new (1+ (allout-sibling-index depth))) |
2671 ((allout-sibling-index)))))) | 2625 ((allout-sibling-index)))))) |
2672 ) | 2626 ) |
2673 ) | 2627 ) |
2674 ;;;_ > allout-open-topic (relative-depth &optional before use_sib_bullet) | 2628 ;;;_ > allout-open-topic (relative-depth &optional before use-sib-bullet) |
2675 (defun allout-open-topic (relative-depth &optional before use_sib_bullet) | 2629 (defun allout-open-topic (relative-depth &optional before use-sib-bullet) |
2676 "Open a new topic at depth RELATIVE-DEPTH. | 2630 "Open a new topic at depth RELATIVE-DEPTH. |
2677 | 2631 |
2678 New topic is situated after current one, unless optional flag BEFORE | 2632 New topic is situated after current one, unless optional flag BEFORE |
2679 is non-nil, or unless current line is complete empty (not even | 2633 is non-nil, or unless current line is complete empty (not even |
2680 whitespace), in which case open is done on current line. | 2634 whitespace), in which case open is done on current line. |
2681 | 2635 |
2682 If USE_SIB_BULLET is true, use the bullet of the prior sibling. | 2636 If USE-SIB-BULLET is true, use the bullet of the prior sibling. |
2683 | 2637 |
2684 Nuances: | 2638 Nuances: |
2685 | 2639 |
2686 - Creation of new topics is with respect to the visible topic | 2640 - Creation of new topics is with respect to the visible topic |
2687 containing the cursor, regardless of intervening concealed ones. | 2641 containing the cursor, regardless of intervening concealed ones. |
2819 " ")) | 2773 " ")) |
2820 | 2774 |
2821 ;;(if doing-beginning (save-excursion (newline (if dbl-space 2 1)))) | 2775 ;;(if doing-beginning (save-excursion (newline (if dbl-space 2 1)))) |
2822 | 2776 |
2823 | 2777 |
2824 (allout-rebullet-heading (and use_sib_bullet ref-bullet);;; solicit | 2778 (allout-rebullet-heading (and use-sib-bullet ref-bullet);;; solicit |
2825 depth ;;; depth | 2779 depth ;;; depth |
2826 nil ;;; number-control | 2780 nil ;;; number-control |
2827 nil ;;; index | 2781 nil ;;; index |
2828 t) (end-of-line) | 2782 t) (end-of-line) |
2829 ) | 2783 ) |
3437 exactly like normal yanks. | 3391 exactly like normal yanks. |
3438 | 3392 |
3439 Numbering of yanked topics, and the successive siblings at the depth | 3393 Numbering of yanked topics, and the successive siblings at the depth |
3440 into which they're being yanked, is adjusted. | 3394 into which they're being yanked, is adjusted. |
3441 | 3395 |
3442 `allout-yank-pop' works with `allout-yank' just like normal yank-pop | 3396 `allout-yank-pop' works with `allout-yank' just like normal `yank-pop' |
3443 works with normal yank in non-outline buffers." | 3397 works with normal `yank' in non-outline buffers." |
3444 | 3398 |
3445 (interactive "*P") | 3399 (interactive "*P") |
3446 (setq this-command 'yank) | 3400 (setq this-command 'yank) |
3447 (yank arg) | 3401 (yank arg) |
3448 (if (allout-mode-p) | 3402 (if (allout-mode-p) |
3470 | 3424 |
3471 \(Works according to setting of `allout-file-xref-bullet')." | 3425 \(Works according to setting of `allout-file-xref-bullet')." |
3472 (interactive) | 3426 (interactive) |
3473 (if (not allout-file-xref-bullet) | 3427 (if (not allout-file-xref-bullet) |
3474 (error | 3428 (error |
3475 "outline cross references disabled - no `allout-file-xref-bullet'") | 3429 "Outline cross references disabled - no `allout-file-xref-bullet'") |
3476 (if (not (string= (allout-current-bullet) allout-file-xref-bullet)) | 3430 (if (not (string= (allout-current-bullet) allout-file-xref-bullet)) |
3477 (error "current heading lacks cross-reference bullet `%s'" | 3431 (error "Current heading lacks cross-reference bullet `%s'" |
3478 allout-file-xref-bullet) | 3432 allout-file-xref-bullet) |
3479 (let (file-name) | 3433 (let (file-name) |
3480 (save-excursion | 3434 (save-excursion |
3481 (let* ((text-start allout-recent-prefix-end) | 3435 (let* ((text-start allout-recent-prefix-end) |
3482 (heading-end (progn (end-of-line) (point)))) | 3436 (heading-end (progn (end-of-line) (point)))) |
4363 (allout-copy-exposed-to-buffer arg tobuf 'indent)) | 4317 (allout-copy-exposed-to-buffer arg tobuf 'indent)) |
4364 | 4318 |
4365 ;;;_ - LaTeX formatting | 4319 ;;;_ - LaTeX formatting |
4366 ;;;_ > allout-latex-verb-quote (string &optional flow) | 4320 ;;;_ > allout-latex-verb-quote (string &optional flow) |
4367 (defun allout-latex-verb-quote (string &optional flow) | 4321 (defun allout-latex-verb-quote (string &optional flow) |
4368 "Return copy of STRING for literal reproduction across latex processing. | 4322 "Return copy of STRING for literal reproduction across LaTeX processing. |
4369 Expresses the original characters \(including carriage returns) of the | 4323 Expresses the original characters \(including carriage returns) of the |
4370 string across latex processing." | 4324 string across LaTeX processing." |
4371 (mapconcat (function | 4325 (mapconcat (function |
4372 (lambda (char) | 4326 (lambda (char) |
4373 (cond ((memq char '(?\\ ?$ ?% ?# ?& ?{ ?} ?_ ?^ ?- ?*)) | 4327 (cond ((memq char '(?\\ ?$ ?% ?# ?& ?{ ?} ?_ ?^ ?- ?*)) |
4374 (concat "\\char" (number-to-string char) "{}")) | 4328 (concat "\\char" (number-to-string char) "{}")) |
4375 ((= char ?\n) "\\\\") | 4329 ((= char ?\n) "\\\\") |
4376 (t (char-to-string char))))) | 4330 (t (char-to-string char))))) |
4377 string | 4331 string |
4378 "")) | 4332 "")) |
4379 ;;;_ > allout-latex-verbatim-quote-curr-line () | 4333 ;;;_ > allout-latex-verbatim-quote-curr-line () |
4380 (defun allout-latex-verbatim-quote-curr-line () | 4334 (defun allout-latex-verbatim-quote-curr-line () |
4381 "Express line for exact \(literal) representation across latex processing. | 4335 "Express line for exact \(literal) representation across LaTeX processing. |
4382 | 4336 |
4383 Adjust line contents so it is unaltered \(from the original line) | 4337 Adjust line contents so it is unaltered \(from the original line) |
4384 across latex processing, within the context of a `verbatim' | 4338 across LaTeX processing, within the context of a `verbatim' |
4385 environment. Leaves point at the end of the line." | 4339 environment. Leaves point at the end of the line." |
4386 (beginning-of-line) | 4340 (beginning-of-line) |
4387 (let ((beg (point)) | 4341 (let ((beg (point)) |
4388 (end (progn (end-of-line)(point)))) | 4342 (end (progn (end-of-line)(point)))) |
4389 (goto-char beg) | 4343 (goto-char beg) |
4395 (insert "\\") | 4349 (insert "\\") |
4396 (setq end (1+ end)) | 4350 (setq end (1+ end)) |
4397 (goto-char (1+ (match-end 0)))))) | 4351 (goto-char (1+ (match-end 0)))))) |
4398 ;;;_ > allout-insert-latex-header (buffer) | 4352 ;;;_ > allout-insert-latex-header (buffer) |
4399 (defun allout-insert-latex-header (buffer) | 4353 (defun allout-insert-latex-header (buffer) |
4400 "Insert initial latex commands at point in BUFFER." | 4354 "Insert initial LaTeX commands at point in BUFFER." |
4401 ;; Much of this is being derived from the stuff in appendix of E in | 4355 ;; Much of this is being derived from the stuff in appendix of E in |
4402 ;; the TeXBook, pg 421. | 4356 ;; the TeXBook, pg 421. |
4403 (set-buffer buffer) | 4357 (set-buffer buffer) |
4404 (let ((doc-style (format "\n\\documentstyle{%s}\n" | 4358 (let ((doc-style (format "\n\\documentstyle{%s}\n" |
4405 "report")) | 4359 "report")) |
4469 hoffset | 4423 hoffset |
4470 vspace) | 4424 vspace) |
4471 ))) | 4425 ))) |
4472 ;;;_ > allout-insert-latex-trailer (buffer) | 4426 ;;;_ > allout-insert-latex-trailer (buffer) |
4473 (defun allout-insert-latex-trailer (buffer) | 4427 (defun allout-insert-latex-trailer (buffer) |
4474 "Insert concluding latex commands at point in BUFFER." | 4428 "Insert concluding LaTeX commands at point in BUFFER." |
4475 (set-buffer buffer) | 4429 (set-buffer buffer) |
4476 (insert "\n\\end{document}\n")) | 4430 (insert "\n\\end{document}\n")) |
4477 ;;;_ > allout-latexify-one-item (depth prefix bullet text) | 4431 ;;;_ > allout-latexify-one-item (depth prefix bullet text) |
4478 (defun allout-latexify-one-item (depth prefix bullet text) | 4432 (defun allout-latexify-one-item (depth prefix bullet text) |
4479 "Insert LaTeX commands for formatting one outline item. | 4433 "Insert LaTeX commands for formatting one outline item. |
4524 ;;(insert "\\endlines\n") | 4478 ;;(insert "\\endlines\n") |
4525 (insert "\\end{verbatim}\n") | 4479 (insert "\\end{verbatim}\n") |
4526 ))) | 4480 ))) |
4527 ;;;_ > allout-latexify-exposed (arg &optional tobuf) | 4481 ;;;_ > allout-latexify-exposed (arg &optional tobuf) |
4528 (defun allout-latexify-exposed (arg &optional tobuf) | 4482 (defun allout-latexify-exposed (arg &optional tobuf) |
4529 "Format current topics exposed portions to TOBUF for latex processing. | 4483 "Format current topics exposed portions to TOBUF for LaTeX processing. |
4530 TOBUF defaults to a buffer named the same as the current buffer, but | 4484 TOBUF defaults to a buffer named the same as the current buffer, but |
4531 with \"*\" prepended and \" latex-formed*\" appended. | 4485 with \"*\" prepended and \" latex-formed*\" appended. |
4532 | 4486 |
4533 With repeat count, copy the exposed portions of entire buffer." | 4487 With repeat count, copy the exposed portions of entire buffer." |
4534 | 4488 |
4638 "Return a copy of REGEXP with all character escapes stripped out. | 4592 "Return a copy of REGEXP with all character escapes stripped out. |
4639 | 4593 |
4640 Representations of actual backslashes - '\\\\\\\\' - are left as a | 4594 Representations of actual backslashes - '\\\\\\\\' - are left as a |
4641 single backslash. | 4595 single backslash. |
4642 | 4596 |
4643 Optional arg SUCCESSIVE-BACKSLASHES is used internally for recursion." | 4597 \(fn REGEXP)" |
4598 ;; Optional arg SUCCESSIVE-BACKSLASHES is used internally for recursion. | |
4644 | 4599 |
4645 (if (string= regexp "") | 4600 (if (string= regexp "") |
4646 "" | 4601 "" |
4647 ;; Set successive-backslashes to number if current char is | 4602 ;; Set successive-backslashes to number if current char is |
4648 ;; backslash, or else to nil: | 4603 ;; backslash, or else to nil: |
4681 (if append | 4636 (if append |
4682 (nconc (symbol-value hook) (list function)) | 4637 (nconc (symbol-value hook) (list function)) |
4683 (cons function (symbol-value hook))))))) | 4638 (cons function (symbol-value hook))))))) |
4684 ;;;_ : my-mark-marker to accommodate divergent emacsen: | 4639 ;;;_ : my-mark-marker to accommodate divergent emacsen: |
4685 (defun my-mark-marker (&optional force buffer) | 4640 (defun my-mark-marker (&optional force buffer) |
4686 "Accommodate the different signature for mark-marker across Emacsen. | 4641 "Accommodate the different signature for `mark-marker' across Emacsen. |
4687 | 4642 |
4688 XEmacs takes two optional args, while GNU Emacs does not, | 4643 XEmacs takes two optional args, while GNU Emacs does not, |
4689 so pass them along when appropriate." | 4644 so pass them along when appropriate." |
4690 (if (featurep 'xemacs) | 4645 (if (featurep 'xemacs) |
4691 (mark-marker force buffer) | 4646 (mark-marker force buffer) |