Changeset 4131 for trunk/lisp/allout.el
- Timestamp:
- 07/29/06 07:48:34 (2 years ago)
- Files:
-
- trunk/lisp/allout.el (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lisp/allout.el
r4111 r4131 581 581 582 582 \(If set, this makes it an even better practice to exercise changes by 583 doing byte-compilation with a repeat count, so the file is loaded a t the584 ofcompilation.)583 doing byte-compilation with a repeat count, so the file is loaded after 584 compilation.) 585 585 586 586 See `allout-run-unit-tests' to see what's run." … … 1108 1108 (defmacro allout-unprotected (expr) 1109 1109 "Enable internal outline operations to alter invisible text." 1110 `(let ((inhibit-read-only t)) 1110 `(let ((inhibit-read-only t) 1111 (inhibit-field-text-motion t)) 1111 1112 ,expr)) 1112 1113 ;;;_ = allout-mode-hook … … 1921 1922 (defun allout-e-o-prefix-p () 1922 1923 "True if point is located where current topic prefix ends, heading begins." 1923 (and (save-excursion (beginning-of-line) 1924 (and (save-excursion (let ((inhibit-field-text-motion t)) 1925 (beginning-of-line)) 1924 1926 (looking-at allout-regexp)) 1925 1927 (= (point)(save-excursion (allout-end-of-prefix)(point))))) … … 2023 2025 "Like beginning of line, but to visible text." 2024 2026 2025 ;; XXX We would use `(move-beginning-of-line 1)', but it gets 2026 ;; stuck on some hidden newlines, eg at column 80, as of GNU Emacs 22.0.50. 2027 ;; Conversely, `beginning-of-line' can make no progress in other 2028 ;; situations. Both are necessary, in the order used below. 2029 (move-beginning-of-line 1) 2030 (beginning-of-line) 2031 (while (or (not (bolp)) (allout-hidden-p)) 2027 ;; This combination of move-beginning-of-line and beginning-of-line is 2028 ;; deliberate, but the (beginning-of-line) may now be superfluous. 2029 (let ((inhibit-field-text-motion t)) 2030 (move-beginning-of-line 1) 2032 2031 (beginning-of-line) 2033 (if (or (allout-hidden-p) (not (bolp))) 2034 (forward-char -1)))) 2032 (while (and (not (bobp)) (or (not (bolp)) (allout-hidden-p))) 2033 (beginning-of-line) 2034 (if (or (allout-hidden-p) (not (bolp))) 2035 (forward-char -1))))) 2035 2036 ;;;_ > allout-end-of-current-line () 2036 2037 (defun allout-end-of-current-line () … … 2039 2040 ;; `move-end-of-line' doesn't suffer the same problem as 2040 2041 ;; `move-beginning-of-line'. 2041 (end-of-line) 2042 (while (allout-hidden-p) 2042 (let ((inhibit-field-text-motion t)) 2043 2043 (end-of-line) 2044 (if (allout-hidden-p) (forward-char 1)))) 2044 (while (allout-hidden-p) 2045 (end-of-line) 2046 (if (allout-hidden-p) (forward-char 1))))) 2045 2047 ;;;_ > allout-next-heading () 2046 2048 (defsubst allout-next-heading () … … 2580 2582 2581 2583 (interactive "p") 2582 (let* ((backward (if (< arg 0) (setq arg (* -1 arg)))) 2584 (let* ((inhibit-field-text-motion t) 2585 (backward (if (< arg 0) (setq arg (* -1 arg)))) 2583 2586 (step (if backward -1 1)) 2584 2587 prev got) … … 2758 2761 2759 2762 (if mapped-binding 2760 (setq allout-post-goto-bullet on-bullet 2761 this-command mapped-binding))))) 2763 (setq this-command mapped-binding))))) 2762 2764 2763 2765 ;;;_ > allout-find-file-hook () … … 3012 3014 3013 3015 (allout-beginning-of-current-line) 3014 (let* ((depth (+ (allout-current-depth) relative-depth)) 3016 (let* ((inhibit-field-text-motion t) 3017 (depth (+ (allout-current-depth) relative-depth)) 3015 3018 (opening-on-blank (if (looking-at "^\$") 3016 3019 (not (setq before nil)))) … … 3630 3633 3631 3634 (interactive) 3632 (let* ((collapsed (allout-current-topic-collapsed-p)) 3635 (let* ((inhibit-field-text-motion t) 3636 (collapsed (allout-current-topic-collapsed-p)) 3633 3637 (beg (prog1 (allout-back-to-current-heading) (beginning-of-line))) 3634 3638 (depth (allout-recent-depth))) … … 3680 3684 (if (< (allout-mark-marker t) (point)) 3681 3685 (exchange-point-and-mark)) 3682 (let* ((subj-beg (point)) 3686 (let* ((inhibit-field-text-motion t) 3687 (subj-beg (point)) 3683 3688 (into-bol (bolp)) 3684 3689 (subj-end (allout-mark-marker t)) … … 3849 3854 (error "Current heading lacks cross-reference bullet `%s'" 3850 3855 allout-file-xref-bullet) 3851 (let (file-name) 3856 (let ((inhibit-field-text-motion t) 3857 file-name) 3852 3858 (save-excursion 3853 3859 (let* ((text-start allout-recent-prefix-end) … … 3897 3903 (save-excursion 3898 3904 (allout-back-to-current-heading) 3899 (end-of-line) 3905 (let ((inhibit-field-text-motion t)) 3906 (end-of-line)) 3900 3907 (allout-flag-region (point) 3901 3908 ;; Exposing must not leave trailing blanks hidden, … … 3986 3993 (interactive) 3987 3994 (save-excursion 3988 (let ((orig-pt (point)) 3995 (let ((inhibit-field-text-motion t) 3996 (orig-pt (point)) 3989 3997 (orig-pref (allout-goto-prefix)) 3990 3998 (last-at (point)) … … 4018 4026 (allout-back-to-current-heading) 4019 4027 (save-excursion 4020 (end-of-line) 4028 (let ((inhibit-field-text-motion t)) 4029 (end-of-line)) 4021 4030 (allout-flag-region (point) 4022 4031 (progn (allout-end-of-entry) (point)) … … 4088 4097 (t (goto-char 0) 4089 4098 (message sibs-msg) 4099 (allout-goto-prefix) 4090 4100 (allout-expose-topic '(0 :)) 4091 4101 (message (concat sibs-msg " Done.")))) … … 4095 4105 "Show all subheadings of this heading, but not their bodies." 4096 4106 (interactive) 4097 (beginning-of-line) 4107 (let ((inhibit-field-text-motion t)) 4108 (beginning-of-line)) 4098 4109 (allout-show-children t)) 4099 4110 ;;;_ > allout-hide-current-leaves () … … 4125 4136 (narrow-to-region start end) 4126 4137 (goto-char (point-min)) 4127 (while (not (eobp)) 4128 (end-of-line) 4129 (allout-flag-region (point) (allout-end-of-entry) t) 4130 (if (not (eobp)) 4131 (forward-char 4132 (if (looking-at "\n\n") 4133 2 1))))))) 4138 (let ((inhibit-field-text-motion t)) 4139 (while (not (eobp)) 4140 (end-of-line) 4141 (allout-flag-region (point) (allout-end-of-entry) t) 4142 (if (not (eobp)) 4143 (forward-char 4144 (if (looking-at "\n\n") 4145 2 1)))))))) 4134 4146 4135 4147 ;;;_ > allout-expose-topic (spec) … … 4284 4296 4285 4297 (interactive "xExposure spec: ") 4286 (let ((depth (allout-current-depth)) 4298 (let ((inhibit-field-text-motion t) 4299 (depth (allout-current-depth)) 4287 4300 max-pos) 4288 4301 (cond ((null spec) nil) … … 4463 4476 (save-excursion 4464 4477 (let* 4465 ;; state vars: 4466 (strings prefix result depth new-depth out gone-out bullet beg 4478 ((inhibit-field-text-motion t) 4479 ;; state vars: 4480 strings prefix result depth new-depth out gone-out bullet beg 4467 4481 next done) 4468 4482 … … 4743 4757 across LaTeX processing, within the context of a `verbatim' 4744 4758 environment. Leaves point at the end of the line." 4745 (beginning-of-line) 4746 (let ((beg (point)) 4747 (end (progn (end-of-line)(point)))) 4748 (goto-char beg) 4749 (while (re-search-forward "\\\\" 4750 ;;"\\\\\\|\\{\\|\\}\\|\\_\\|\\$\\|\\\"\\|\\&\\|\\^\\|\\-\\|\\*\\|#" 4751 end ; bounded by end-of-line 4752 1) ; no matches, move to end & return nil 4753 (goto-char (match-beginning 0)) 4754 (insert "\\") 4755 (setq end (1+ end)) 4756 (goto-char (1+ (match-end 0)))))) 4759 (let ((inhibit-field-text-motion t)) 4760 (beginning-of-line) 4761 (let ((beg (point)) 4762 (end (progn (end-of-line)(point)))) 4763 (goto-char beg) 4764 (while (re-search-forward "\\\\" 4765 ;;"\\\\\\|\\{\\|\\}\\|\\_\\|\\$\\|\\\"\\|\\&\\|\\^\\|\\-\\|\\*\\|#" 4766 end ; bounded by end-of-line 4767 1) ; no matches, move to end & return nil 4768 (goto-char (match-beginning 0)) 4769 (insert "\\") 4770 (setq end (1+ end)) 4771 (goto-char (1+ (match-end 0))))))) 4757 4772 ;;;_ > allout-insert-latex-header (buffer) 4758 4773 (defun allout-insert-latex-header (buffer) … … 5602 5617 "Put the region around topic currently containing point." 5603 5618 (interactive) 5604 (beginning-of-line) 5619 (let ((inhibit-field-text-motion t)) 5620 (beginning-of-line)) 5605 5621 (allout-goto-prefix) 5606 5622 (push-mark (point)) … … 5677 5693 nil 5678 5694 (save-excursion 5679 (let ((section-data (allout-file-vars-section-data)) 5695 (let ((inhibit-field-text-motion t) 5696 (section-data (allout-file-vars-section-data)) 5680 5697 beg prefix suffix) 5681 5698 (if section-data
