Skip to content

Commit fcdff6b

Browse files
committed
lispy.el (lispy-kill-at-point-hook): Add
1 parent 24feac4 commit fcdff6b

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

lispy.el

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,25 +1690,29 @@ When ARG is more than 1, mark ARGth element."
16901690
(t
16911691
(lispy--mark (lispy--bounds-dwim))))))
16921692

1693+
(defvar lispy-kill-at-point-hook nil)
1694+
16931695
(defun lispy-kill-at-point ()
16941696
"Kill the quoted string or the list that includes the point."
16951697
(interactive)
1696-
(cond ((region-active-p)
1697-
(lispy--maybe-safe-kill-region (region-beginning)
1698-
(region-end)))
1699-
(t
1700-
(let ((bnd (or (lispy--bounds-comment)
1701-
(lispy--bounds-string)
1702-
(lispy--bounds-list)
1703-
(and (derived-mode-p 'text-mode)
1704-
(cons (save-excursion
1705-
(1+ (re-search-backward "[ \t\n]" nil t)))
1706-
(save-excursion
1707-
(1- (re-search-forward "[ \t\n]" nil t))))))))
1708-
(if buffer-read-only
1709-
(kill-new (buffer-substring
1710-
(car bnd) (cdr bnd)))
1711-
(kill-region (car bnd) (cdr bnd)))))))
1698+
(cond
1699+
((run-hook-with-args-until-success 'lispy-kill-at-point-hook))
1700+
((region-active-p)
1701+
(lispy--maybe-safe-kill-region (region-beginning)
1702+
(region-end)))
1703+
(t
1704+
(let ((bnd (or (lispy--bounds-comment)
1705+
(lispy--bounds-string)
1706+
(lispy--bounds-list)
1707+
(and (derived-mode-p 'text-mode)
1708+
(cons (save-excursion
1709+
(1+ (re-search-backward "[ \t\n]" nil t)))
1710+
(save-excursion
1711+
(1- (re-search-forward "[ \t\n]" nil t))))))))
1712+
(if buffer-read-only
1713+
(kill-new (buffer-substring
1714+
(car bnd) (cdr bnd)))
1715+
(kill-region (car bnd) (cdr bnd)))))))
17121716

17131717
(defun lispy-new-copy ()
17141718
"Copy marked region or sexp to kill ring."

0 commit comments

Comments
 (0)