From 46fe49e944fea8f3e35212b10cbe53d5b5d45c84 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Mon, 17 Oct 2016 16:25:20 +0200 Subject: [PATCH] =?UTF-8?q?Add=20the=20=C3=A6-kill-or-copy-whole-line=20fu?= =?UTF-8?q?nction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I’m not sure yet if this will be useful in the future, though… --- lisp/buf-manipulation.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lisp/buf-manipulation.el b/lisp/buf-manipulation.el index 8ee923e..1333e87 100644 --- a/lisp/buf-manipulation.el +++ b/lisp/buf-manipulation.el @@ -114,3 +114,16 @@ Version 2016-02-16" (looking-back eshell-prompt-regexp)) (kill-buffer) (signal (car err) (cdr err)))))) + +(defun æ-kill-or-copy-whole-line (kill) + "Kill or copy the whole line point is on. + +If KILL is non-nil, the line gets killed. Otherwise, it gets just +copied to the kill-ring." + (interactive "P") + + (if kill + (kill-whole-line) + (let ((beginning (progn (beginning-of-line) (point))) + (end (progn (end-of-line) (point)))) + (copy-region-as-kill beginning end))))