Here's my current function (blindly copy-pasted from a website)
(defun tweakemacs-delete-one-line ()
"Delete current line."
(interactive)
(beginning-of-line)
(kill-line)
(kill-line))
(global-set-key (kbd "C-d") 'tweakemacs-delete-one-line)
There are two quirks here that I want to get rid of. 1) This actually rebinds DEL to the same function. I want my DEL to remain "delete one character". 2) There needs to be a condition where it will not double-kill if the line is only a newline character.
I read part of the manual on keybindings, and it said that
C-d
and<DEL>
, like other special keys, are bound. To unbind them you have to explicitly set both of them.Ultimately, I used this solution:
To distinguish those two, use the preferred vector syntax for keys:
As for the second thing, it sounds as if you either want
or just want to use the function
kill-entire-line
instead.