(bind-keys* ("C-" . (lambda () (interactive) (back-to-indentation) (kill-line 1))))
Or maybe this is what you really want:
(bind-keys* ("C-" . (lambda ()
(interactive)
(back-to-indentation)
(delete-region (point) (line-end-position)))))
There are several possibilities, depending on whether you want to remove whitespace, newline at the line end, etc., and whether you want to kill or just delete.
(I don't use bind-key*
, so I'd use global-set-key
or define-key
. And I'd define a named command and bind that.)
UPDATE after your comment that says what really you want is to delete only the text from indentation up to the original cursor position:
(bind-keys* ("C-" . (lambda ()
(interactive)
(let ((opoint (point)))
(back-to-indentation)
(delete-region (point) opoint)))))
I don't use bind-keys*
. But this is it with normal binding (and naming the command):
(defun my-delete-back-to-indent ()
(interactive)
(let ((opoint (point)))
(back-to-indentation)
(delete-region (point) opoint)))
(global-set-key (kbd "C-<backspace>") 'my-delete-back-to-indent)