summaryrefslogtreecommitdiff
path: root/lisp/allout.el
diff options
context:
space:
mode:
authorKen Manheimer <ken.manheimer@gmail.com>2011-09-24 16:58:23 -0400
committerKen Manheimer <ken.manheimer@gmail.com>2011-09-24 16:58:23 -0400
commit3f2b07f8b2a1d166e611cd9c774e351eba70d23d (patch)
tree42f192f5e16393dd73883b0499e823b1cc81784b /lisp/allout.el
parent0538fab0dd00a11b5dbe47a67ea0bf710733dc73 (diff)
downloademacs-3f2b07f8b2a1d166e611cd9c774e351eba70d23d.tar.gz
* allout.el (allout-this-command-hid-stuff): Buffer-local variable that's
true if the current command involved collapsing of text. It's reset to false at the beginning of the next command. (allout-post-command-business): Move the cursor to the beginning of entry if the cursor is hidden and collapsing activity just happened.
Diffstat (limited to 'lisp/allout.el')
-rw-r--r--lisp/allout.el17
1 files changed, 13 insertions, 4 deletions
diff --git a/lisp/allout.el b/lisp/allout.el
index 592a64c647a..4002f12e264 100644
--- a/lisp/allout.el
+++ b/lisp/allout.el
@@ -3304,6 +3304,10 @@ are mapped to the command of the corresponding control-key on the
Set by `allout-pre-command-business', to support allout addons in
coordinating with allout activity.")
(make-variable-buffer-local 'allout-command-counter)
+;;;_ = allout-this-command-hid-text
+(defvar allout-this-command-hid-text nil
+ "True if the most recent allout-mode command hid any text.")
+(make-variable-buffer-local 'allout-this-command-hid-text)
;;;_ > allout-post-command-business ()
(defun allout-post-command-business ()
"Outline `post-command-hook' function.
@@ -3311,6 +3315,9 @@ coordinating with allout activity.")
- Implement (and clear) `allout-post-goto-bullet', for hot-spot
outline commands.
+- Move the cursor to the beginning of the entry if it is hidden
+ and collapsing activity just happened.
+
- If the command we're following was an undo, check for change in
the status of encrypted items and adjust auto-save inhibitions
accordingly.
@@ -3343,8 +3350,9 @@ coordinating with allout activity.")
(if (and allout-post-goto-bullet
(allout-current-bullet-pos))
(progn (goto-char (allout-current-bullet-pos))
- (setq allout-post-goto-bullet nil)))
- ))
+ (setq allout-post-goto-bullet nil))
+ (when (and (allout-hidden-p) allout-this-command-hid-text)
+ (allout-beginning-of-current-entry)))))
;;;_ > allout-pre-command-business ()
(defun allout-pre-command-business ()
"Outline `pre-command-hook' function for outline buffers.
@@ -3367,8 +3375,8 @@ return to regular interpretation of self-insert characters."
(if (not (allout-mode-p))
nil
- ;; Increment allout-command-counter
(setq allout-command-counter (1+ allout-command-counter))
+ (setq allout-this-command-hid-text nil)
;; Do hot-spot navigation.
(if (and (eq this-command 'self-insert-command)
(eq (point)(allout-current-bullet-pos)))
@@ -4767,7 +4775,8 @@ arguments as this function, after the exposure changes are made."
(condition-case nil
;; as of 2008-02-27, xemacs lacks modification-hooks
(overlay-put o (pop props) (pop props))
- (error nil)))))))
+ (error nil))))))
+ (setq allout-this-command-hid-text t))
(run-hook-with-args 'allout-exposure-change-hook from to flag))
;;;_ > allout-flag-current-subtree (flag)
(defun allout-flag-current-subtree (flag)