How can I tweak this elisp function to distinguish between C-d & DEL?

Posted by Fletcher Moore on Stack Overflow See other posts from Stack Overflow or by Fletcher Moore
Published on 2010-05-20T14:22:22Z Indexed on 2010/05/20 22:50 UTC
Read the original article Hit count: 268

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about emacs

Related posts about elisp