FeifanZ
FeifanZ

Reputation: 16316

Emacs backspace only one space

How can I configure Emacs (24.3, OS X Yosemite, Prelude installed) to backspace only one space all the time? When I'm inside code blocks it will sometimes backspace 4 spaces without warning and I end up having to insert spaces back.

All of my code is indented with 2 spaces, never tabs.

Sorry if this is a basic question, just getting started with emacs.

Upvotes: 1

Views: 250

Answers (1)

lawlist
lawlist

Reputation: 13457

The following code may be inserted into the .emacs or other similar initialization files. The effect will be to nullify the previous coffee-mode key assignment of \177, which the original poster has indicated is the backspace key.

(eval-after-load "coffee-mode"
  '(progn
    (define-key coffee-mode-map "\177" nil)))

Alternatively, line 236 of the current version of coffee-mode can be commented out -- i.e., comment out (define-key map "\177" 'coffee-dedent-line-backspace) so that it has at least one preceding semi-colon. Then, run M-x byte-compile-file RET and the path to the coffee-mode.el file and then RET. The source code may be found at the following link:

http://www.github.com/defunkt/coffee-mode/blob/master/coffee-mode.el

Upvotes: 1

Related Questions