diff options
| -rw-r--r-- | lisp/allout.el | 105 |
1 files changed, 62 insertions, 43 deletions
diff --git a/lisp/allout.el b/lisp/allout.el index 296777ee9d9..f1f262c70b7 100644 --- a/lisp/allout.el +++ b/lisp/allout.el | |||
| @@ -1107,7 +1107,8 @@ their settings before allout-mode was started." | |||
| 1107 | ;;;_ > allout-unprotected (expr) | 1107 | ;;;_ > allout-unprotected (expr) |
| 1108 | (defmacro allout-unprotected (expr) | 1108 | (defmacro allout-unprotected (expr) |
| 1109 | "Enable internal outline operations to alter invisible text." | 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 | ,expr)) | 1112 | ,expr)) |
| 1112 | ;;;_ = allout-mode-hook | 1113 | ;;;_ = allout-mode-hook |
| 1113 | (defvar allout-mode-hook nil | 1114 | (defvar allout-mode-hook nil |
| @@ -1920,7 +1921,8 @@ Actually, returns prefix beginning point." | |||
| 1920 | ;;;_ > allout-e-o-prefix-p () | 1921 | ;;;_ > allout-e-o-prefix-p () |
| 1921 | (defun allout-e-o-prefix-p () | 1922 | (defun allout-e-o-prefix-p () |
| 1922 | "True if point is located where current topic prefix ends, heading begins." | 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 | (looking-at allout-regexp)) | 1926 | (looking-at allout-regexp)) |
| 1925 | (= (point)(save-excursion (allout-end-of-prefix)(point))))) | 1927 | (= (point)(save-excursion (allout-end-of-prefix)(point))))) |
| 1926 | ;;;_ : Location attributes | 1928 | ;;;_ : Location attributes |
| @@ -2024,22 +2026,24 @@ Outermost is first." | |||
| 2024 | 2026 | ||
| 2025 | ;; This combination of move-beginning-of-line and beginning-of-line is | 2027 | ;; This combination of move-beginning-of-line and beginning-of-line is |
| 2026 | ;; deliberate, but the (beginning-of-line) may now be superfluous. | 2028 | ;; deliberate, but the (beginning-of-line) may now be superfluous. |
| 2027 | (move-beginning-of-line 1) | 2029 | (let ((inhibit-field-text-motion t)) |
| 2028 | (beginning-of-line) | 2030 | (move-beginning-of-line 1) |
| 2029 | (while (and (not (bobp)) (or (not (bolp)) (allout-hidden-p))) | ||
| 2030 | (beginning-of-line) | 2031 | (beginning-of-line) |
| 2031 | (if (or (allout-hidden-p) (not (bolp))) | 2032 | (while (and (not (bobp)) (or (not (bolp)) (allout-hidden-p))) |
| 2032 | (forward-char -1)))) | 2033 | (beginning-of-line) |
| 2034 | (if (or (allout-hidden-p) (not (bolp))) | ||
| 2035 | (forward-char -1))))) | ||
| 2033 | ;;;_ > allout-end-of-current-line () | 2036 | ;;;_ > allout-end-of-current-line () |
| 2034 | (defun allout-end-of-current-line () | 2037 | (defun allout-end-of-current-line () |
| 2035 | "Move to the end of line, past concealed text if any." | 2038 | "Move to the end of line, past concealed text if any." |
| 2036 | ;; XXX This is for symmetry with `allout-beginning-of-current-line' - | 2039 | ;; XXX This is for symmetry with `allout-beginning-of-current-line' - |
| 2037 | ;; `move-end-of-line' doesn't suffer the same problem as | 2040 | ;; `move-end-of-line' doesn't suffer the same problem as |
| 2038 | ;; `move-beginning-of-line'. | 2041 | ;; `move-beginning-of-line'. |
| 2039 | (end-of-line) | 2042 | (let ((inhibit-field-text-motion t)) |
| 2040 | (while (allout-hidden-p) | ||
| 2041 | (end-of-line) | 2043 | (end-of-line) |
| 2042 | (if (allout-hidden-p) (forward-char 1)))) | 2044 | (while (allout-hidden-p) |
| 2045 | (end-of-line) | ||
| 2046 | (if (allout-hidden-p) (forward-char 1))))) | ||
| 2043 | ;;;_ > allout-next-heading () | 2047 | ;;;_ > allout-next-heading () |
| 2044 | (defsubst allout-next-heading () | 2048 | (defsubst allout-next-heading () |
| 2045 | "Move to the heading for the topic \(possibly invisible) after this one. | 2049 | "Move to the heading for the topic \(possibly invisible) after this one. |
| @@ -2577,7 +2581,8 @@ Presumes point is at the start of a topic prefix." | |||
| 2577 | Move to buffer limit in indicated direction if headings are exhausted." | 2581 | Move to buffer limit in indicated direction if headings are exhausted." |
| 2578 | 2582 | ||
| 2579 | (interactive "p") | 2583 | (interactive "p") |
| 2580 | (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)))) | ||
| 2581 | (step (if backward -1 1)) | 2586 | (step (if backward -1 1)) |
| 2582 | prev got) | 2587 | prev got) |
| 2583 | 2588 | ||
| @@ -3008,7 +3013,8 @@ Nuances: | |||
| 3008 | from there." | 3013 | from there." |
| 3009 | 3014 | ||
| 3010 | (allout-beginning-of-current-line) | 3015 | (allout-beginning-of-current-line) |
| 3011 | (let* ((depth (+ (allout-current-depth) relative-depth)) | 3016 | (let* ((inhibit-field-text-motion t) |
| 3017 | (depth (+ (allout-current-depth) relative-depth)) | ||
| 3012 | (opening-on-blank (if (looking-at "^\$") | 3018 | (opening-on-blank (if (looking-at "^\$") |
| 3013 | (not (setq before nil)))) | 3019 | (not (setq before nil)))) |
| 3014 | ;; bunch o vars set while computing ref-topic | 3020 | ;; bunch o vars set while computing ref-topic |
| @@ -3626,7 +3632,8 @@ when yank with allout-yank into an outline as a heading." | |||
| 3626 | ;; a lag *after* a kill has been performed. | 3632 | ;; a lag *after* a kill has been performed. |
| 3627 | 3633 | ||
| 3628 | (interactive) | 3634 | (interactive) |
| 3629 | (let* ((collapsed (allout-current-topic-collapsed-p)) | 3635 | (let* ((inhibit-field-text-motion t) |
| 3636 | (collapsed (allout-current-topic-collapsed-p)) | ||
| 3630 | (beg (prog1 (allout-back-to-current-heading) (beginning-of-line))) | 3637 | (beg (prog1 (allout-back-to-current-heading) (beginning-of-line))) |
| 3631 | (depth (allout-recent-depth))) | 3638 | (depth (allout-recent-depth))) |
| 3632 | (allout-end-of-current-subtree) | 3639 | (allout-end-of-current-subtree) |
| @@ -3676,7 +3683,8 @@ however, are left exactly like normal, non-allout-specific yanks." | |||
| 3676 | ; region around subject: | 3683 | ; region around subject: |
| 3677 | (if (< (allout-mark-marker t) (point)) | 3684 | (if (< (allout-mark-marker t) (point)) |
| 3678 | (exchange-point-and-mark)) | 3685 | (exchange-point-and-mark)) |
| 3679 | (let* ((subj-beg (point)) | 3686 | (let* ((inhibit-field-text-motion t) |
| 3687 | (subj-beg (point)) | ||
| 3680 | (into-bol (bolp)) | 3688 | (into-bol (bolp)) |
| 3681 | (subj-end (allout-mark-marker t)) | 3689 | (subj-end (allout-mark-marker t)) |
| 3682 | (was-collapsed (get-text-property subj-beg 'allout-was-collapsed)) | 3690 | (was-collapsed (get-text-property subj-beg 'allout-was-collapsed)) |
| @@ -3845,7 +3853,8 @@ by pops to non-distinctive yanks. Bug..." | |||
| 3845 | (if (not (string= (allout-current-bullet) allout-file-xref-bullet)) | 3853 | (if (not (string= (allout-current-bullet) allout-file-xref-bullet)) |
| 3846 | (error "Current heading lacks cross-reference bullet `%s'" | 3854 | (error "Current heading lacks cross-reference bullet `%s'" |
| 3847 | allout-file-xref-bullet) | 3855 | allout-file-xref-bullet) |
| 3848 | (let (file-name) | 3856 | (let ((inhibit-field-text-motion t) |
| 3857 | file-name) | ||
| 3849 | (save-excursion | 3858 | (save-excursion |
| 3850 | (let* ((text-start allout-recent-prefix-end) | 3859 | (let* ((text-start allout-recent-prefix-end) |
| 3851 | (heading-end (progn (end-of-line) (point)))) | 3860 | (heading-end (progn (end-of-line) (point)))) |
| @@ -3893,7 +3902,8 @@ Text is shown if flag is nil and hidden otherwise." | |||
| 3893 | 3902 | ||
| 3894 | (save-excursion | 3903 | (save-excursion |
| 3895 | (allout-back-to-current-heading) | 3904 | (allout-back-to-current-heading) |
| 3896 | (end-of-line) | 3905 | (let ((inhibit-field-text-motion t)) |
| 3906 | (end-of-line)) | ||
| 3897 | (allout-flag-region (point) | 3907 | (allout-flag-region (point) |
| 3898 | ;; Exposing must not leave trailing blanks hidden, | 3908 | ;; Exposing must not leave trailing blanks hidden, |
| 3899 | ;; but can leave them exposed when hiding, so we | 3909 | ;; but can leave them exposed when hiding, so we |
| @@ -3982,7 +3992,8 @@ point of non-opened subtree?)" | |||
| 3982 | Useful for coherently exposing to a random point in a hidden region." | 3992 | Useful for coherently exposing to a random point in a hidden region." |
| 3983 | (interactive) | 3993 | (interactive) |
| 3984 | (save-excursion | 3994 | (save-excursion |
| 3985 | (let ((orig-pt (point)) | 3995 | (let ((inhibit-field-text-motion t) |
| 3996 | (orig-pt (point)) | ||
| 3986 | (orig-pref (allout-goto-prefix)) | 3997 | (orig-pref (allout-goto-prefix)) |
| 3987 | (last-at (point)) | 3998 | (last-at (point)) |
| 3988 | bag-it) | 3999 | bag-it) |
| @@ -4014,7 +4025,8 @@ Useful for coherently exposing to a random point in a hidden region." | |||
| 4014 | (interactive) | 4025 | (interactive) |
| 4015 | (allout-back-to-current-heading) | 4026 | (allout-back-to-current-heading) |
| 4016 | (save-excursion | 4027 | (save-excursion |
| 4017 | (end-of-line) | 4028 | (let ((inhibit-field-text-motion t)) |
| 4029 | (end-of-line)) | ||
| 4018 | (allout-flag-region (point) | 4030 | (allout-flag-region (point) |
| 4019 | (progn (allout-end-of-entry) (point)) | 4031 | (progn (allout-end-of-entry) (point)) |
| 4020 | t))) | 4032 | t))) |
| @@ -4092,7 +4104,8 @@ siblings, even if the target topic is already closed." | |||
| 4092 | (defun allout-show-current-branches () | 4104 | (defun allout-show-current-branches () |
| 4093 | "Show all subheadings of this heading, but not their bodies." | 4105 | "Show all subheadings of this heading, but not their bodies." |
| 4094 | (interactive) | 4106 | (interactive) |
| 4095 | (beginning-of-line) | 4107 | (let ((inhibit-field-text-motion t)) |
| 4108 | (beginning-of-line)) | ||
| 4096 | (allout-show-children t)) | 4109 | (allout-show-children t)) |
| 4097 | ;;;_ > allout-hide-current-leaves () | 4110 | ;;;_ > allout-hide-current-leaves () |
| 4098 | (defun allout-hide-current-leaves () | 4111 | (defun allout-hide-current-leaves () |
| @@ -4122,13 +4135,14 @@ siblings, even if the target topic is already closed." | |||
| 4122 | (save-restriction | 4135 | (save-restriction |
| 4123 | (narrow-to-region start end) | 4136 | (narrow-to-region start end) |
| 4124 | (goto-char (point-min)) | 4137 | (goto-char (point-min)) |
| 4125 | (while (not (eobp)) | 4138 | (let ((inhibit-field-text-motion t)) |
| 4126 | (end-of-line) | 4139 | (while (not (eobp)) |
| 4127 | (allout-flag-region (point) (allout-end-of-entry) t) | 4140 | (end-of-line) |
| 4128 | (if (not (eobp)) | 4141 | (allout-flag-region (point) (allout-end-of-entry) t) |
| 4129 | (forward-char | 4142 | (if (not (eobp)) |
| 4130 | (if (looking-at "\n\n") | 4143 | (forward-char |
| 4131 | 2 1))))))) | 4144 | (if (looking-at "\n\n") |
| 4145 | 2 1)))))))) | ||
| 4132 | 4146 | ||
| 4133 | ;;;_ > allout-expose-topic (spec) | 4147 | ;;;_ > allout-expose-topic (spec) |
| 4134 | (defun allout-expose-topic (spec) | 4148 | (defun allout-expose-topic (spec) |
| @@ -4281,7 +4295,8 @@ for the corresponding offspring of the topic. | |||
| 4281 | Optional FOLLOWERS arguments dictate exposure for succeeding siblings." | 4295 | Optional FOLLOWERS arguments dictate exposure for succeeding siblings." |
| 4282 | 4296 | ||
| 4283 | (interactive "xExposure spec: ") | 4297 | (interactive "xExposure spec: ") |
| 4284 | (let ((depth (allout-current-depth)) | 4298 | (let ((inhibit-field-text-motion t) |
| 4299 | (depth (allout-current-depth)) | ||
| 4285 | max-pos) | 4300 | max-pos) |
| 4286 | (cond ((null spec) nil) | 4301 | (cond ((null spec) nil) |
| 4287 | ((symbolp spec) | 4302 | ((symbolp spec) |
| @@ -4460,8 +4475,9 @@ header and body. The elements of that list are: | |||
| 4460 | (interactive "r") | 4475 | (interactive "r") |
| 4461 | (save-excursion | 4476 | (save-excursion |
| 4462 | (let* | 4477 | (let* |
| 4463 | ;; state vars: | 4478 | ((inhibit-field-text-motion t) |
| 4464 | (strings prefix result depth new-depth out gone-out bullet beg | 4479 | ;; state vars: |
| 4480 | strings prefix result depth new-depth out gone-out bullet beg | ||
| 4465 | next done) | 4481 | next done) |
| 4466 | 4482 | ||
| 4467 | (goto-char start) | 4483 | (goto-char start) |
| @@ -4740,18 +4756,19 @@ string across LaTeX processing." | |||
| 4740 | Adjust line contents so it is unaltered \(from the original line) | 4756 | Adjust line contents so it is unaltered \(from the original line) |
| 4741 | across LaTeX processing, within the context of a `verbatim' | 4757 | across LaTeX processing, within the context of a `verbatim' |
| 4742 | environment. Leaves point at the end of the line." | 4758 | environment. Leaves point at the end of the line." |
| 4743 | (beginning-of-line) | 4759 | (let ((inhibit-field-text-motion t)) |
| 4744 | (let ((beg (point)) | 4760 | (beginning-of-line) |
| 4745 | (end (progn (end-of-line)(point)))) | 4761 | (let ((beg (point)) |
| 4746 | (goto-char beg) | 4762 | (end (progn (end-of-line)(point)))) |
| 4747 | (while (re-search-forward "\\\\" | 4763 | (goto-char beg) |
| 4748 | ;;"\\\\\\|\\{\\|\\}\\|\\_\\|\\$\\|\\\"\\|\\&\\|\\^\\|\\-\\|\\*\\|#" | 4764 | (while (re-search-forward "\\\\" |
| 4749 | end ; bounded by end-of-line | 4765 | ;;"\\\\\\|\\{\\|\\}\\|\\_\\|\\$\\|\\\"\\|\\&\\|\\^\\|\\-\\|\\*\\|#" |
| 4750 | 1) ; no matches, move to end & return nil | 4766 | end ; bounded by end-of-line |
| 4751 | (goto-char (match-beginning 0)) | 4767 | 1) ; no matches, move to end & return nil |
| 4752 | (insert "\\") | 4768 | (goto-char (match-beginning 0)) |
| 4753 | (setq end (1+ end)) | 4769 | (insert "\\") |
| 4754 | (goto-char (1+ (match-end 0)))))) | 4770 | (setq end (1+ end)) |
| 4771 | (goto-char (1+ (match-end 0))))))) | ||
| 4755 | ;;;_ > allout-insert-latex-header (buffer) | 4772 | ;;;_ > allout-insert-latex-header (buffer) |
| 4756 | (defun allout-insert-latex-header (buffer) | 4773 | (defun allout-insert-latex-header (buffer) |
| 4757 | "Insert initial LaTeX commands at point in BUFFER." | 4774 | "Insert initial LaTeX commands at point in BUFFER." |
| @@ -5599,7 +5616,8 @@ save. See `allout-encrypt-unencrypted-on-saves' for more info." | |||
| 5599 | (defun allout-mark-topic () | 5616 | (defun allout-mark-topic () |
| 5600 | "Put the region around topic currently containing point." | 5617 | "Put the region around topic currently containing point." |
| 5601 | (interactive) | 5618 | (interactive) |
| 5602 | (beginning-of-line) | 5619 | (let ((inhibit-field-text-motion t)) |
| 5620 | (beginning-of-line)) | ||
| 5603 | (allout-goto-prefix) | 5621 | (allout-goto-prefix) |
| 5604 | (push-mark (point)) | 5622 | (push-mark (point)) |
| 5605 | (allout-end-of-current-subtree) | 5623 | (allout-end-of-current-subtree) |
| @@ -5674,7 +5692,8 @@ enable-local-variables must be true for any of this to happen." | |||
| 5674 | allout-enable-file-variable-adjustment)) | 5692 | allout-enable-file-variable-adjustment)) |
| 5675 | nil | 5693 | nil |
| 5676 | (save-excursion | 5694 | (save-excursion |
| 5677 | (let ((section-data (allout-file-vars-section-data)) | 5695 | (let ((inhibit-field-text-motion t) |
| 5696 | (section-data (allout-file-vars-section-data)) | ||
| 5678 | beg prefix suffix) | 5697 | beg prefix suffix) |
| 5679 | (if section-data | 5698 | (if section-data |
| 5680 | (setq beg (car section-data) | 5699 | (setq beg (car section-data) |