2

I'm having trouble getting the py-electric-backspace command to execute when I hit backspace at the end of a line of only spaces in python-mode. When I hit backspace it deletes individual spaces, not 4 at a time as it should be.

What confuses me is that if I do M-x py-electric-backspace, it performs the command correctly and tells me I could have invoked the command by using backspace:

You can run the command `py-electric-backspace' with <backspace>

I'm using python-mode.el version 6.0.10, and I've tried reducing my .emacs file to only the few lines required to load python-mode.el.

I'd like backspace to work properly in python-mode, but I don't even know where to start figuring out what's wrong. Any help would be appreciated.

Update:

I've added the following to my .emacs file:

(add-hook 'python-mode-hook
     (lambda () (define-key python-mode-map (kbd "DEL") 'py-electric-backspace)))

which seems to do the trick.

1 Answer 1

3

What is the output of C-h k <backspace>? My guess is that you are running in a terminal and you can't actually type <backspace>, since it gets changed by the terminal to DEL. Running in a GUI, or binding py-electric-backspace to DEL should fix it.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .