Permalink
Browse files

backspace now de-indents instead of just going back a space.

  • Loading branch information...
1 parent aaeac9d commit 67e8727621b6b76b2ac27d0404ddd4ed1b2199e6 Shawn Krisman committed Sep 29, 2012
Showing with 11 additions and 0 deletions.
  1. +11 −0 coffee-mode.el
View
@@ -132,6 +132,7 @@ with CoffeeScript."
(define-key map [remap newline-and-indent] 'coffee-newline-and-indent)
(define-key map "\C-m" 'coffee-newline-and-indent)
(define-key map "\C-c\C-o\C-s" 'coffee-cos-mode)
+ (define-key map "\177" 'coffee-dedent-line-backspace)
map)
"Keymap for CoffeeScript major mode.")
@@ -500,6 +501,16 @@ output in a compilation buffer."
(when (coffee-previous-line-is-comment)
(insert "# ")))
+(defun coffee-dedent-line-backspace ()
+ "We want to be backspacing full tabs not just single characters."
+ (interactive)
+ (if (and (<= (point-marker) (save-excursion
+ (back-to-indentation)
+ (point-marker)))
+ (> (current-column) 0))
+ (backward-delete-char-untabify coffee-tab-width)
+ (backward-delete-char-untabify 1)))
+
;; Indenters help determine whether the current line should be
;; indented further based on the content of the previous line. If a
;; line starts with `class', for instance, you're probably going to

0 comments on commit 67e8727

Please sign in to comment.