avy.el (avy-action-copy): Adjust for avy-goto-line

Re #191
This commit is contained in:
Oleh Krehel 2017-12-10 19:47:07 +01:00
parent 4af1993290
commit 56f6590c20

12
avy.el
View File

@ -627,20 +627,24 @@ Set `avy-style' according to COMMMAND as well."
(raise-frame frame)
(goto-char pt)))
(defun avy-forward-item ()
(if (eq avy-command 'avy-goto-line)
(end-of-line)
(forward-sexp))
(point))
(defun avy-action-mark (pt)
"Mark sexp at PT."
(goto-char pt)
(set-mark (point))
(forward-sexp))
(avy-forward-item))
(defun avy-action-copy (pt)
"Copy sexp starting on PT."
(save-excursion
(let (str)
(goto-char pt)
(if (eq avy-command 'avy-goto-line)
(end-of-line)
(forward-sexp))
(avy-forward-item)
(setq str (buffer-substring pt (point)))
(kill-new str)
(message "Copied: %s" str)))