um-transpose-section : fix for trailing section case
This commit is contained in:
parent
80e68edc54
commit
29d16bb0dc
1 changed files with 23 additions and 7 deletions
30
um.el
30
um.el
|
|
@ -469,13 +469,29 @@ A tag with a value of \"+\" is rendered as the descriptor portion of the filenam
|
||||||
A negative prefix argument moves it backward.
|
A negative prefix argument moves it backward.
|
||||||
"
|
"
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(let ((direction (if (< arg 0)
|
(let* ((direction (if (< arg 0)
|
||||||
-1 1
|
-1 1
|
||||||
)))
|
))
|
||||||
(um-mark-section)
|
(origpos (point))
|
||||||
(kill-region nil nil t)
|
(last (save-excursion
|
||||||
(um--goto-section direction)
|
(not (search-forward um--section nil t))))
|
||||||
(yank)
|
(secondlast (save-excursion
|
||||||
|
(not (search-forward um--section nil t 2)))))
|
||||||
|
(cond ((and last (= -1 direction))
|
||||||
|
(um--goto-section -1)
|
||||||
|
(um-transpose-section 1))
|
||||||
|
((and secondlast (= 1 direction))
|
||||||
|
(um-mark-section)
|
||||||
|
(kill-region nil nil t)
|
||||||
|
(goto-char (point-max))
|
||||||
|
(um-section)
|
||||||
|
(yank)
|
||||||
|
(um--delete-section))
|
||||||
|
(t
|
||||||
|
(um-mark-section)
|
||||||
|
(kill-region nil nil t)
|
||||||
|
(um--goto-section direction)
|
||||||
|
(yank)))
|
||||||
;; to get us back to the top of the section region
|
;; to get us back to the top of the section region
|
||||||
(set-mark-command 1)
|
(set-mark-command 1)
|
||||||
))
|
))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue