]> git.eshelyaron.com Git - emacs.git/commitdiff
* allout.el (allout-this-command-hid-stuff): Buffer-local variable that's
authorKen Manheimer <ken.manheimer@gmail.com>
Sat, 24 Sep 2011 20:58:23 +0000 (16:58 -0400)
committerKen Manheimer <ken.manheimer@gmail.com>
Sat, 24 Sep 2011 20:58:23 +0000 (16:58 -0400)
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.

lisp/ChangeLog
lisp/allout.el

index 8b7e5f1525bcb2216401b984a8dd249dd49c29a8..662dd7a7f99e7f62db9262926b40f1cc9c4ffe1d 100644 (file)
@@ -1,3 +1,12 @@
+2011-09-22  Ken Manheimer  <ken.manheimer@gmail.com>
+
+       * 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.
+
 2011-09-24  Chong Yidong  <cyd@stupidchicken.com>
 
        * mouse.el (mouse-drag-track): Set scroll-margin to 0 while
index 592a64c647a40c26abd2faaa2c02a98347fe550c..4002f12e264ea6c8e01dc9f58fe6804f79119a24 100644 (file)
@@ -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)