Function: avy-kill-region
avy-kill-region is an autoloaded, interactive and byte-compiled
function defined in avy.el.
Signature
(avy-kill-region ARG)
Documentation
Select two lines and kill the region between them.
The window scope is determined by avy-all-windows or
avy-all-windows-alt when ARG is non-nil.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/avy-20241101.1357/avy.el
;;;###autoload
(defun avy-kill-region (arg)
"Select two lines and kill the region between them.
The window scope is determined by `avy-all-windows' or
`avy-all-windows-alt' when ARG is non-nil."
(interactive "P")
(let ((initial-window (selected-window)))
(avy-with avy-kill-region
(let* ((beg (save-selected-window
(list (avy--line arg) (selected-window))))
(end (list (avy--line arg) (selected-window))))
(cond
((not (numberp (car beg)))
(user-error "Fail to select the beginning of region"))
((not (numberp (car end)))
(user-error "Fail to select the end of region"))
;; Restrict operation to same window. It's better if it can be
;; different windows but same buffer; however, then the cloned
;; buffers with different narrowed regions might cause problem.
((not (equal (cdr beg) (cdr end)))
(user-error "Selected points are not in the same window"))
((< (car beg) (car end))
(save-excursion
(kill-region
(car beg)
(progn (goto-char (car end)) (forward-visible-line 1) (point)))))
(t
(save-excursion
(kill-region
(progn (goto-char (car beg)) (forward-visible-line 1) (point))
(car end)))))))
(select-window initial-window)))