Function: avy-move-region

avy-move-region is an interactive and natively compiled function defined in avy.el.

Signature

(avy-move-region)

Documentation

Select two lines and move the text between them above the current line.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/015952xhg9b72ira1qyjvb30bn11jiv3-emacs-packages-deps/share/emacs/site-lisp/elpa/avy-20241101.1357/avy.el
;;;###autoload
(defun avy-move-region ()
  "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 (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))))