Function: avy-move-region

avy-move-region is an autoloaded, interactive and byte-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

Source Code

;; Defined in ~/.emacs.d/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))))