mirror of
https://github.com/abo-abo/avy.git
synced 2025-10-13 13:33:03 +00:00
parent
3980c03f6c
commit
54bce2cfb0
18
avy.el
18
avy.el
@ -1481,21 +1481,23 @@ The window scope is determined by `avy-all-windows' or
|
||||
|
||||
;;;###autoload
|
||||
(defun avy-move-region ()
|
||||
"Select two lines and move the text between them here."
|
||||
"Select two lines and move the text between them above the current line."
|
||||
(interactive)
|
||||
(avy-with avy-move-region
|
||||
(let* ((initial-window (selected-window))
|
||||
(beg (avy--line))
|
||||
(end (save-excursion
|
||||
(goto-char (avy--line))
|
||||
(forward-line)
|
||||
(point)))
|
||||
(text (buffer-substring beg end))
|
||||
(pad (if (bolp) "" "\n")))
|
||||
(end (avy--line))
|
||||
text)
|
||||
(when (> beg end)
|
||||
(cl-rotatef beg end))
|
||||
(setq end (save-excursion
|
||||
(goto-char end)
|
||||
(1+ (line-end-position))))
|
||||
(setq text (buffer-substring beg end))
|
||||
(move-beginning-of-line nil)
|
||||
(delete-region beg end)
|
||||
(select-window initial-window)
|
||||
(insert text pad))))
|
||||
(insert text))))
|
||||
|
||||
;;;###autoload
|
||||
(defun avy-kill-region (arg)
|
||||
|
Loading…
x
Reference in New Issue
Block a user