emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

outline commands do not save point


From: Juri Linkov
Subject: outline commands do not save point
Date: Tue, 23 Aug 2005 23:16:16 +0300
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

Some outline commands (hide-entry, hide-leaves, outline-toggle-children)
do not save point after their execution.  It is inconvenient when point
is moved to the beginning of the heading line even if before the command
it was somewhere in the center of the heading line.  When point was on a
body line before hiding body lines, saving it on the same position is
convenient too, because after revealing a hidden text (without moving
point between hide- and show- commands), point is preserved on its
original position.

All other hide-related commands (hide-body, hide-region-body,
hide-subtree, hide-sublevels) already save point.  So I propose
a patch that saves point for three other outline commands:

Index: lisp/outline.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/outline.el,v
retrieving revision 1.13
diff -c -r1.13 outline.el
*** lisp/outline.el     6 Aug 2005 22:13:43 -0000       1.13
--- lisp/outline.el     23 Aug 2005 19:57:11 -0000
***************
*** 739,746 ****
  (defun hide-entry ()
    "Hide the body directly following this heading."
    (interactive)
-   (outline-back-to-heading)
    (save-excursion
      (outline-end-of-heading)
      (outline-flag-region (point) (progn (outline-next-preface) (point)) t)))
  
--- 739,746 ----
  (defun hide-entry ()
    "Hide the body directly following this heading."
    (interactive)
    (save-excursion
+     (outline-back-to-heading)
      (outline-end-of-heading)
      (outline-flag-region (point) (progn (outline-next-preface) (point)) t)))
  
***************
*** 792,799 ****
  (defun hide-leaves ()
    "Hide all body after this heading at deeper levels."
    (interactive)
-   (outline-back-to-heading)
    (save-excursion
      (outline-end-of-heading)
      (hide-region-body (point) (progn (outline-end-of-subtree) (point)))))
  
--- 792,799 ----
  (defun hide-leaves ()
    "Hide all body after this heading at deeper levels."
    (interactive)
    (save-excursion
+     (outline-back-to-heading)
      (outline-end-of-heading)
      (hide-region-body (point) (progn (outline-end-of-subtree) (point)))))
  
***************
*** 850,860 ****
  (defun outline-toggle-children ()
    "Show or hide the current subtree depending on its current state."
    (interactive)
!   (outline-back-to-heading)
!   (if (not (outline-invisible-p (line-end-position)))
!       (hide-subtree)
!     (show-children)
!     (show-entry)))
  
  (defun outline-flag-subtree (flag)
    (save-excursion
--- 850,861 ----
  (defun outline-toggle-children ()
    "Show or hide the current subtree depending on its current state."
    (interactive)
!   (save-excursion
!     (outline-back-to-heading)
!     (if (not (outline-invisible-p (line-end-position)))
!       (hide-subtree)
!       (show-children)
!       (show-entry))))
  
  (defun outline-flag-subtree (flag)
    (save-excursion

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]