View Full Version : defining the delete key in emacs

Sep 25, 2008, 11:19 PM
So I recently got myself an apple keyboard for when I'm doing programming at lab on my MBP. I usually code in emacs and compile with gnu make, etc. However, I've noticed that in emacs my delete key #2 works the same as my delete key #1. I'd like to change it such that it will delete to the right of the cursor instead of to the left. I did something like this to define the scroll wheel action by adding the following code to my .emacs file (found it on the web).

(global-set-key [wheel-down] 'up-slightly)
(global-set-key [wheel-up] 'down-slightly)
(global-set-key [double-wheel-down] 'up-slightly)
(global-set-key [double-wheel-up] 'down-slightly)
(global-set-key [triple-wheel-down] 'up-slightly)
(global-set-key [triple-wheel-up] 'down-slightly)

Anyone know what to add to make my delete #2 work as I want?

Apr 16, 2011, 03:18 AM
add this line to your .emacs file (or to your .emacs.d/init.el file)

(normal-erase-is-backspace-mode 1)