diff options
| author | Stephen Berman | 2014-11-27 11:03:58 +0100 |
|---|---|---|
| committer | Stephen Berman | 2014-11-27 11:03:58 +0100 |
| commit | b3910f653938fc8625f4e0c970123e826bbf427e (patch) | |
| tree | 613576b8f4f483dad7ab0014707a74a84290ec2a | |
| parent | b66511f7680a195c5f56f2275f21e1d571706fba (diff) | |
| download | emacs-b3910f653938fc8625f4e0c970123e826bbf427e.tar.gz emacs-b3910f653938fc8625f4e0c970123e826bbf427e.zip | |
outline.el: Fix subtree movement.
Fixes: debbugs:19102
Co-authored-by: Stefan Monnier <monnier@iro.umontreal.ca>
* outline.el (outline-move-subtree-down): Make sure we can move
forward to find the end of the subtree and the insertion point.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/outline.el | 17 |
2 files changed, 18 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d88ecfeb8a8..8c480190c17 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2014-11-27 Stephen Berman <stephen.berman@gmx.net> | ||
| 2 | Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 3 | |||
| 4 | * outline.el (outline-move-subtree-down): Make sure we can move | ||
| 5 | forward to find the end of the subtree and the insertion point | ||
| 6 | (bug#19102). | ||
| 7 | |||
| 1 | 2014-11-27 Leonard Randall <leonard.a.randall@gmail.com> | 8 | 2014-11-27 Leonard Randall <leonard.a.randall@gmail.com> |
| 2 | 9 | ||
| 3 | * textmodes/reftex-parse.el (reftex-using-biblatex-p): Make search | 10 | * textmodes/reftex-parse.el (reftex-using-biblatex-p): Make search |
diff --git a/lisp/outline.el b/lisp/outline.el index c7cad31f572..61ee7ff0f9f 100644 --- a/lisp/outline.el +++ b/lisp/outline.el | |||
| @@ -649,27 +649,32 @@ the match data is set appropriately." | |||
| 649 | 'outline-get-last-sibling)) | 649 | 'outline-get-last-sibling)) |
| 650 | (ins-point (make-marker)) | 650 | (ins-point (make-marker)) |
| 651 | (cnt (abs arg)) | 651 | (cnt (abs arg)) |
| 652 | ;; Make sure we can move forward to find the end of the | ||
| 653 | ;; subtree and the insertion point. | ||
| 654 | (maybe-forward-char (lambda () | ||
| 655 | (if (eq (char-after) ?\n) (forward-char 1) | ||
| 656 | (if (and (eobp) (not (bolp))) (insert "\n"))))) | ||
| 652 | beg end folded) | 657 | beg end folded) |
| 653 | ;; Select the tree | 658 | ;; Select the tree. |
| 654 | (outline-back-to-heading) | 659 | (outline-back-to-heading) |
| 655 | (setq beg (point)) | 660 | (setq beg (point)) |
| 656 | (save-match-data | 661 | (save-match-data |
| 657 | (save-excursion (outline-end-of-heading) | 662 | (save-excursion (outline-end-of-heading) |
| 658 | (setq folded (outline-invisible-p))) | 663 | (setq folded (outline-invisible-p))) |
| 659 | (outline-end-of-subtree)) | 664 | (outline-end-of-subtree)) |
| 660 | (if (= (char-after) ?\n) (forward-char 1)) | 665 | (funcall maybe-forward-char) |
| 661 | (setq end (point)) | 666 | (setq end (point)) |
| 662 | ;; Find insertion point, with error handling | 667 | ;; Find insertion point, with error handling. |
| 663 | (goto-char beg) | 668 | (goto-char beg) |
| 664 | (while (> cnt 0) | 669 | (while (> cnt 0) |
| 665 | (or (funcall movfunc) | 670 | (or (funcall movfunc) |
| 666 | (progn (goto-char beg) | 671 | (progn (goto-char beg) |
| 667 | (error "Cannot move past superior level"))) | 672 | (user-error "Cannot move past superior level"))) |
| 668 | (setq cnt (1- cnt))) | 673 | (setq cnt (1- cnt))) |
| 669 | (if (> arg 0) | 674 | (if (> arg 0) |
| 670 | ;; Moving forward - still need to move over subtree | 675 | ;; Moving forward - still need to move over subtree. |
| 671 | (progn (outline-end-of-subtree) | 676 | (progn (outline-end-of-subtree) |
| 672 | (if (= (char-after) ?\n) (forward-char 1)))) | 677 | (funcall maybe-forward-char))) |
| 673 | (move-marker ins-point (point)) | 678 | (move-marker ins-point (point)) |
| 674 | (insert (delete-and-extract-region beg end)) | 679 | (insert (delete-and-extract-region beg end)) |
| 675 | (goto-char ins-point) | 680 | (goto-char ins-point) |