comparison lisp/allout.el @ 64283:d57ad48e7901

(my-mark-marker, allout-isearch-prior-pos, allout-unprotected, allout-undo-aggregation, allout-snug-back, allout-post-command-business, allout-flag-region, isearch-reenable-font-lock, allout-yank, allout-insert-latex-header, allout-insert-latex-trailer, allout-latex-verbatim-quote-curr-line, allout-latexify-exposed, allout-latex-verb-quote): Fix typos in docstrings. (allout-enwrap-isearch, regexp-sans-escapes): Doc fix. (allout-unprotected, allout-prefix-data): Improve argument/docstring consistency. (allout-chart-subtree): Fix argument spec. (allout-open-topic): Rename `use_sib_bullet' argument to `use-sib-bullet'. Doc fix.
author Juanma Barranquero <lekktu@gmail.com>
date Wed, 13 Jul 2005 10:15:39 +0000
parents 6fb026ad601f
children e169c8755108 fbb2bea03df9
comparison
equal deleted inserted replaced
64282:769e8d799acf 64283:d57ad48e7901
866 "Cue for isearch-dynamic-exposure mechanism, implemented in 866 "Cue for isearch-dynamic-exposure mechanism, implemented in
867 allout-pre- and -post-command-hooks.") 867 allout-pre- and -post-command-hooks.")
868 (make-variable-buffer-local 'allout-pre-was-isearching) 868 (make-variable-buffer-local 'allout-pre-was-isearching)
869 ;;;_ = allout-isearch-prior-pos nil 869 ;;;_ = allout-isearch-prior-pos nil
870 (defvar allout-isearch-prior-pos nil 870 (defvar allout-isearch-prior-pos nil
871 "Cue for isearch-dynamic-exposure tracking, used by allout-isearch-expose.") 871 "Cue for isearch-dynamic-exposure tracking, used by `allout-isearch-expose'.")
872 (make-variable-buffer-local 'allout-isearch-prior-pos) 872 (make-variable-buffer-local 'allout-isearch-prior-pos)
873 ;;;_ = allout-isearch-did-quit 873 ;;;_ = allout-isearch-did-quit
874 (defvar allout-isearch-did-quit nil 874 (defvar allout-isearch-did-quit nil
875 "Distinguishes isearch conclusion and cancellation. 875 "Distinguishes isearch conclusion and cancellation.
876 876
885 against inadvertent, unnoticed changes. This is for use by specific, 885 against inadvertent, unnoticed changes. This is for use by specific,
886 native outline functions to temporarily override that protection. 886 native outline functions to temporarily override that protection.
887 It's automatically reset to nil after every buffer modification.") 887 It's automatically reset to nil after every buffer modification.")
888 (make-variable-buffer-local 'allout-override-protect) 888 (make-variable-buffer-local 'allout-override-protect)
889 ;;;_ > allout-unprotected (expr) 889 ;;;_ > allout-unprotected (expr)
890 (defmacro allout-unprotected (expr) 890 (defmacro allout-unprotected (expression)
891 "Evaluate EXPRESSION with `allout-override-protect' let-bound t." 891 "Evaluate EXPRESSION with `allout-override-protect' let-bound to t."
892 `(let ((allout-override-protect t)) 892 `(let ((allout-override-protect t))
893 ,expr)) 893 ,expression))
894 ;;;_ = allout-undo-aggregation 894 ;;;_ = allout-undo-aggregation
895 (defvar allout-undo-aggregation 30 895 (defvar allout-undo-aggregation 30
896 "Amount of successive self-insert actions to bunch together per undo. 896 "Amount of successive self-insert actions to bunch together per undo.
897 897
898 This is purely a kludge variable, regulating the compensation for a bug in 898 This is purely a kludge variable, regulating the compensation for a bug in
899 the way that before-change-functions and undo interact.") 899 the way that `before-change-functions' and undo interact.")
900 (make-variable-buffer-local 'allout-undo-aggregation) 900 (make-variable-buffer-local 'allout-undo-aggregation)
901 ;;;_ = file-var-bug hack 901 ;;;_ = file-var-bug hack
902 (defvar allout-v18/19-file-var-hack nil 902 (defvar allout-v18/19-file-var-hack nil
903 "Horrible hack used to prevent invalid multiple triggering of outline 903 "Horrible hack used to prevent invalid multiple triggering of outline
904 mode from prop-line file-var activation. Used by `allout-mode' function 904 mode from prop-line file-var activation. Used by `allout-mode' function
1405 ;;;_ = allout-recent-end-of-subtree 1405 ;;;_ = allout-recent-end-of-subtree
1406 (defvar allout-recent-end-of-subtree 0 1406 (defvar allout-recent-end-of-subtree 0
1407 "Buffer point last returned by `allout-end-of-current-subtree'.") 1407 "Buffer point last returned by `allout-end-of-current-subtree'.")
1408 (make-variable-buffer-local 'allout-recent-end-of-subtree) 1408 (make-variable-buffer-local 'allout-recent-end-of-subtree)
1409 ;;;_ > allout-prefix-data (beg end) 1409 ;;;_ > allout-prefix-data (beg end)
1410 (defmacro allout-prefix-data (beg end) 1410 (defmacro allout-prefix-data (beginning end)
1411 "Register allout-prefix state data - BEGINNING and END of prefix. 1411 "Register allout-prefix state data - BEGINNING and END of prefix.
1412 1412
1413 For reference by `allout-recent' funcs. Returns BEGINNING." 1413 For reference by `allout-recent' funcs. Returns BEGINNING."
1414 `(setq allout-recent-prefix-end ,end 1414 `(setq allout-recent-prefix-end ,end
1415 allout-recent-prefix-beginning ,beg)) 1415 allout-recent-prefix-beginning ,beginning))
1416 ;;;_ > allout-recent-depth () 1416 ;;;_ > allout-recent-depth ()
1417 (defmacro allout-recent-depth () 1417 (defmacro allout-recent-depth ()
1418 "Return depth of last heading encountered by an outline maneuvering function. 1418 "Return depth of last heading encountered by an outline maneuvering function.
1419 1419
1420 All outline functions which directly do string matches to assess 1420 All outline functions which directly do string matches to assess
1630 at the beginning of the topic. Charts for offspring consists of a 1630 at the beginning of the topic. Charts for offspring consists of a
1631 list containing, recursively, the charts for the respective subtopics. 1631 list containing, recursively, the charts for the respective subtopics.
1632 The chart for a topics' offspring precedes the entry for the topic 1632 The chart for a topics' offspring precedes the entry for the topic
1633 itself. 1633 itself.
1634 1634
1635 \(fn &optional levels)" 1635 \(fn &optional LEVELS)"
1636 1636
1637 ;; The other function parameters are for internal recursion, and should 1637 ;; The other function parameters are for internal recursion, and should
1638 ;; not be specified by external callers. ORIG-DEPTH is depth of topic at 1638 ;; not be specified by external callers. ORIG-DEPTH is depth of topic at
1639 ;; starting point, and PREV-DEPTH is depth of prior topic." 1639 ;; starting point, and PREV-DEPTH is depth of prior topic."
1640 1640
1997 Return depth if successful, nil otherwise." 1997 Return depth if successful, nil otherwise."
1998 (allout-next-sibling depth (not backward)) 1998 (allout-next-sibling depth (not backward))
1999 ) 1999 )
2000 ;;;_ > allout-snug-back () 2000 ;;;_ > allout-snug-back ()
2001 (defun allout-snug-back () 2001 (defun allout-snug-back ()
2002 "Position cursor at end of previous topic 2002 "Position cursor at end of previous topic.
2003 2003
2004 Presumes point is at the start of a topic prefix." 2004 Presumes point is at the start of a topic prefix."
2005 (if (or (bobp) (eobp)) 2005 (if (or (bobp) (eobp))
2006 nil 2006 nil
2007 (forward-char -1)) 2007 (forward-char -1))
2247 - Null `allout-override-protect', so it's not left open. 2247 - Null `allout-override-protect', so it's not left open.
2248 2248
2249 - Implement (and clear) `allout-post-goto-bullet', for hot-spot 2249 - Implement (and clear) `allout-post-goto-bullet', for hot-spot
2250 outline commands. 2250 outline commands.
2251 2251
2252 - Massages buffer-undo-list so successive, standard character self-inserts are 2252 - Massages `buffer-undo-list' so successive, standard character self-inserts
2253 aggregated. This kludge compensates for lack of undo bunching when 2253 are aggregated. This kludge compensates for lack of undo bunching when
2254 `before-change-functions' is used." 2254 `before-change-functions' is used."
2255 2255
2256 ; Apply any external change func: 2256 ; Apply any external change func:
2257 (if (not (allout-mode-p)) ; In allout-mode. 2257 (if (not (allout-mode-p)) ; In allout-mode.
2258 nil 2258 nil
2377 (defvar allout-isearch-was-font-lock 2377 (defvar allout-isearch-was-font-lock
2378 (and (boundp 'font-lock-mode) font-lock-mode)) 2378 (and (boundp 'font-lock-mode) font-lock-mode))
2379 2379
2380 ;;;_ > allout-flag-region (from to flag) 2380 ;;;_ > allout-flag-region (from to flag)
2381 (defmacro allout-flag-region (from to flag) 2381 (defmacro allout-flag-region (from to flag)
2382 "Hide or show lines from FROM to TO, via Emacs selective-display FLAG char. 2382 "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 2383 Ie, text following flag C-m \(carriage-return) is hidden until the
2384 next C-j (newline) char. 2384 next C-j (newline) char.
2385 2385
2386 Returns the endpoint of the region." 2386 Returns the endpoint of the region."
2387 `(let ((buffer-read-only nil) 2387 `(let ((buffer-read-only nil)
2419 (setq allout-isearch-prior-pos nil) 2419 (setq allout-isearch-prior-pos nil)
2420 (allout-show-children)))) 2420 (allout-show-children))))
2421 (setq allout-isearch-did-quit nil)) 2421 (setq allout-isearch-did-quit nil))
2422 ;;;_ > allout-enwrap-isearch () 2422 ;;;_ > allout-enwrap-isearch ()
2423 (defun allout-enwrap-isearch () 2423 (defun allout-enwrap-isearch ()
2424 "Impose `allout-mode' isearch-abort wrapper for dynamic exposure in isearch. 2424 "Impose `isearch-abort' wrapper for dynamic exposure in isearch.
2425 2425
2426 The function checks to ensure that the rebinding is done only once." 2426 The function checks to ensure that the rebinding is done only once."
2427 2427
2428 (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) 2429 (if (fboundp 'allout-real-isearch-abort)
2467 (if (and (allout-mode-p) (boundp 'font-lock-mode) font-lock-mode) 2467 (if (and (allout-mode-p) (boundp 'font-lock-mode) font-lock-mode)
2468 (setq isearch-was-font-locking t 2468 (setq isearch-was-font-locking t
2469 font-lock-mode nil))) 2469 font-lock-mode nil)))
2470 (add-hook 'isearch-mode-hook 'isearch-inhibit-font-lock) 2470 (add-hook 'isearch-mode-hook 'isearch-inhibit-font-lock)
2471 (defun isearch-reenable-font-lock () 2471 (defun isearch-reenable-font-lock ()
2472 "Reenable font-lock after isearching - for use on isearch-mode-end-hook." 2472 "Reenable font-lock after isearching - for use on `isearch-mode-end-hook'."
2473 (if (and (boundp 'font-lock-mode) font-lock-mode) 2473 (if (and (boundp 'font-lock-mode) font-lock-mode)
2474 (if (and (allout-mode-p) isearch-was-font-locking) 2474 (if (and (allout-mode-p) isearch-was-font-locking)
2475 (setq isearch-was-font-locking nil 2475 (setq isearch-was-font-locking nil
2476 font-lock-mode t)))) 2476 font-lock-mode t))))
2477 (add-hook 'isearch-mode-end-hook 'isearch-reenable-font-lock) 2477 (add-hook 'isearch-mode-end-hook 'isearch-reenable-font-lock)
2669 (format "%d" (cond ((and index (numberp index)) index) 2669 (format "%d" (cond ((and index (numberp index)) index)
2670 (new (1+ (allout-sibling-index depth))) 2670 (new (1+ (allout-sibling-index depth)))
2671 ((allout-sibling-index)))))) 2671 ((allout-sibling-index))))))
2672 ) 2672 )
2673 ) 2673 )
2674 ;;;_ > allout-open-topic (relative-depth &optional before use_sib_bullet) 2674 ;;;_ > allout-open-topic (relative-depth &optional before use-sib-bullet)
2675 (defun allout-open-topic (relative-depth &optional before use_sib_bullet) 2675 (defun allout-open-topic (relative-depth &optional before use-sib-bullet)
2676 "Open a new topic at depth RELATIVE-DEPTH. 2676 "Open a new topic at depth RELATIVE-DEPTH.
2677 2677
2678 New topic is situated after current one, unless optional flag BEFORE 2678 New topic is situated after current one, unless optional flag BEFORE
2679 is non-nil, or unless current line is complete empty (not even 2679 is non-nil, or unless current line is complete empty (not even
2680 whitespace), in which case open is done on current line. 2680 whitespace), in which case open is done on current line.
2681 2681
2682 If USE_SIB_BULLET is true, use the bullet of the prior sibling. 2682 If USE-SIB-BULLET is true, use the bullet of the prior sibling.
2683 2683
2684 Nuances: 2684 Nuances:
2685 2685
2686 - Creation of new topics is with respect to the visible topic 2686 - Creation of new topics is with respect to the visible topic
2687 containing the cursor, regardless of intervening concealed ones. 2687 containing the cursor, regardless of intervening concealed ones.
2819 " ")) 2819 " "))
2820 2820
2821 ;;(if doing-beginning (save-excursion (newline (if dbl-space 2 1)))) 2821 ;;(if doing-beginning (save-excursion (newline (if dbl-space 2 1))))
2822 2822
2823 2823
2824 (allout-rebullet-heading (and use_sib_bullet ref-bullet);;; solicit 2824 (allout-rebullet-heading (and use-sib-bullet ref-bullet);;; solicit
2825 depth ;;; depth 2825 depth ;;; depth
2826 nil ;;; number-control 2826 nil ;;; number-control
2827 nil ;;; index 2827 nil ;;; index
2828 t) (end-of-line) 2828 t) (end-of-line)
2829 ) 2829 )
3437 exactly like normal yanks. 3437 exactly like normal yanks.
3438 3438
3439 Numbering of yanked topics, and the successive siblings at the depth 3439 Numbering of yanked topics, and the successive siblings at the depth
3440 into which they're being yanked, is adjusted. 3440 into which they're being yanked, is adjusted.
3441 3441
3442 `allout-yank-pop' works with `allout-yank' just like normal yank-pop 3442 `allout-yank-pop' works with `allout-yank' just like normal `yank-pop'
3443 works with normal yank in non-outline buffers." 3443 works with normal `yank' in non-outline buffers."
3444 3444
3445 (interactive "*P") 3445 (interactive "*P")
3446 (setq this-command 'yank) 3446 (setq this-command 'yank)
3447 (yank arg) 3447 (yank arg)
3448 (if (allout-mode-p) 3448 (if (allout-mode-p)
4363 (allout-copy-exposed-to-buffer arg tobuf 'indent)) 4363 (allout-copy-exposed-to-buffer arg tobuf 'indent))
4364 4364
4365 ;;;_ - LaTeX formatting 4365 ;;;_ - LaTeX formatting
4366 ;;;_ > allout-latex-verb-quote (string &optional flow) 4366 ;;;_ > allout-latex-verb-quote (string &optional flow)
4367 (defun allout-latex-verb-quote (string &optional flow) 4367 (defun allout-latex-verb-quote (string &optional flow)
4368 "Return copy of STRING for literal reproduction across latex processing. 4368 "Return copy of STRING for literal reproduction across LaTeX processing.
4369 Expresses the original characters \(including carriage returns) of the 4369 Expresses the original characters \(including carriage returns) of the
4370 string across latex processing." 4370 string across LaTeX processing."
4371 (mapconcat (function 4371 (mapconcat (function
4372 (lambda (char) 4372 (lambda (char)
4373 (cond ((memq char '(?\\ ?$ ?% ?# ?& ?{ ?} ?_ ?^ ?- ?*)) 4373 (cond ((memq char '(?\\ ?$ ?% ?# ?& ?{ ?} ?_ ?^ ?- ?*))
4374 (concat "\\char" (number-to-string char) "{}")) 4374 (concat "\\char" (number-to-string char) "{}"))
4375 ((= char ?\n) "\\\\") 4375 ((= char ?\n) "\\\\")
4376 (t (char-to-string char))))) 4376 (t (char-to-string char)))))
4377 string 4377 string
4378 "")) 4378 ""))
4379 ;;;_ > allout-latex-verbatim-quote-curr-line () 4379 ;;;_ > allout-latex-verbatim-quote-curr-line ()
4380 (defun allout-latex-verbatim-quote-curr-line () 4380 (defun allout-latex-verbatim-quote-curr-line ()
4381 "Express line for exact \(literal) representation across latex processing. 4381 "Express line for exact \(literal) representation across LaTeX processing.
4382 4382
4383 Adjust line contents so it is unaltered \(from the original line) 4383 Adjust line contents so it is unaltered \(from the original line)
4384 across latex processing, within the context of a `verbatim' 4384 across LaTeX processing, within the context of a `verbatim'
4385 environment. Leaves point at the end of the line." 4385 environment. Leaves point at the end of the line."
4386 (beginning-of-line) 4386 (beginning-of-line)
4387 (let ((beg (point)) 4387 (let ((beg (point))
4388 (end (progn (end-of-line)(point)))) 4388 (end (progn (end-of-line)(point))))
4389 (goto-char beg) 4389 (goto-char beg)
4395 (insert "\\") 4395 (insert "\\")
4396 (setq end (1+ end)) 4396 (setq end (1+ end))
4397 (goto-char (1+ (match-end 0)))))) 4397 (goto-char (1+ (match-end 0))))))
4398 ;;;_ > allout-insert-latex-header (buffer) 4398 ;;;_ > allout-insert-latex-header (buffer)
4399 (defun allout-insert-latex-header (buffer) 4399 (defun allout-insert-latex-header (buffer)
4400 "Insert initial latex commands at point in BUFFER." 4400 "Insert initial LaTeX commands at point in BUFFER."
4401 ;; Much of this is being derived from the stuff in appendix of E in 4401 ;; Much of this is being derived from the stuff in appendix of E in
4402 ;; the TeXBook, pg 421. 4402 ;; the TeXBook, pg 421.
4403 (set-buffer buffer) 4403 (set-buffer buffer)
4404 (let ((doc-style (format "\n\\documentstyle{%s}\n" 4404 (let ((doc-style (format "\n\\documentstyle{%s}\n"
4405 "report")) 4405 "report"))
4469 hoffset 4469 hoffset
4470 vspace) 4470 vspace)
4471 ))) 4471 )))
4472 ;;;_ > allout-insert-latex-trailer (buffer) 4472 ;;;_ > allout-insert-latex-trailer (buffer)
4473 (defun allout-insert-latex-trailer (buffer) 4473 (defun allout-insert-latex-trailer (buffer)
4474 "Insert concluding latex commands at point in BUFFER." 4474 "Insert concluding LaTeX commands at point in BUFFER."
4475 (set-buffer buffer) 4475 (set-buffer buffer)
4476 (insert "\n\\end{document}\n")) 4476 (insert "\n\\end{document}\n"))
4477 ;;;_ > allout-latexify-one-item (depth prefix bullet text) 4477 ;;;_ > allout-latexify-one-item (depth prefix bullet text)
4478 (defun allout-latexify-one-item (depth prefix bullet text) 4478 (defun allout-latexify-one-item (depth prefix bullet text)
4479 "Insert LaTeX commands for formatting one outline item. 4479 "Insert LaTeX commands for formatting one outline item.
4524 ;;(insert "\\endlines\n") 4524 ;;(insert "\\endlines\n")
4525 (insert "\\end{verbatim}\n") 4525 (insert "\\end{verbatim}\n")
4526 ))) 4526 )))
4527 ;;;_ > allout-latexify-exposed (arg &optional tobuf) 4527 ;;;_ > allout-latexify-exposed (arg &optional tobuf)
4528 (defun allout-latexify-exposed (arg &optional tobuf) 4528 (defun allout-latexify-exposed (arg &optional tobuf)
4529 "Format current topics exposed portions to TOBUF for latex processing. 4529 "Format current topics exposed portions to TOBUF for LaTeX processing.
4530 TOBUF defaults to a buffer named the same as the current buffer, but 4530 TOBUF defaults to a buffer named the same as the current buffer, but
4531 with \"*\" prepended and \" latex-formed*\" appended. 4531 with \"*\" prepended and \" latex-formed*\" appended.
4532 4532
4533 With repeat count, copy the exposed portions of entire buffer." 4533 With repeat count, copy the exposed portions of entire buffer."
4534 4534
4638 "Return a copy of REGEXP with all character escapes stripped out. 4638 "Return a copy of REGEXP with all character escapes stripped out.
4639 4639
4640 Representations of actual backslashes - '\\\\\\\\' - are left as a 4640 Representations of actual backslashes - '\\\\\\\\' - are left as a
4641 single backslash. 4641 single backslash.
4642 4642
4643 Optional arg SUCCESSIVE-BACKSLASHES is used internally for recursion." 4643 \(fn REGEXP)"
4644 ;; Optional arg SUCCESSIVE-BACKSLASHES is used internally for recursion.
4644 4645
4645 (if (string= regexp "") 4646 (if (string= regexp "")
4646 "" 4647 ""
4647 ;; Set successive-backslashes to number if current char is 4648 ;; Set successive-backslashes to number if current char is
4648 ;; backslash, or else to nil: 4649 ;; backslash, or else to nil:
4681 (if append 4682 (if append
4682 (nconc (symbol-value hook) (list function)) 4683 (nconc (symbol-value hook) (list function))
4683 (cons function (symbol-value hook))))))) 4684 (cons function (symbol-value hook)))))))
4684 ;;;_ : my-mark-marker to accommodate divergent emacsen: 4685 ;;;_ : my-mark-marker to accommodate divergent emacsen:
4685 (defun my-mark-marker (&optional force buffer) 4686 (defun my-mark-marker (&optional force buffer)
4686 "Accommodate the different signature for mark-marker across Emacsen. 4687 "Accommodate the different signature for `mark-marker' across Emacsen.
4687 4688
4688 XEmacs takes two optional args, while GNU Emacs does not, 4689 XEmacs takes two optional args, while GNU Emacs does not,
4689 so pass them along when appropriate." 4690 so pass them along when appropriate."
4690 (if (featurep 'xemacs) 4691 (if (featurep 'xemacs)
4691 (mark-marker force buffer) 4692 (mark-marker force buffer)