brianc / jade-mode

Emacs major mode for jade template highlighting
MIT License
157 stars 42 forks source link

fix unbound variable reference in let binding #33

Closed mgalgs closed 9 years ago

mgalgs commented 9 years ago

In 40efeb499a8, the let binding in (sws-move-region) was changed such that the first-indent variable is bound to the value of the indent-diff variable, rather than just creating two empty bindings for two separate variables. Since the indent-diff variable doesn't exist we take a void variable exception:

Debugger entered--Lisp error: (void-variable indent-diff)
  (let ((first-indent indent-diff) (num-lines-indented (count-lines-region begin end))) (goto-char begin) (setq first-indent (current-indentation)) (sws-indent-to (funcall prog first-indent sws-tab-width)) (setq indent-diff (- (current-indentation) first-indent)) (forward-line 1) (let ((--dotimes-limit-- (- num-lines-indented 1)) (i 0)) (while (< i --dotimes-limit--) (sws-indent-to (+ (current-indentation) indent-diff)) (forward-line 1) (setq i (1+ i)))))
  (save-excursion (let ((first-indent indent-diff) (num-lines-indented (count-lines-region begin end))) (goto-char begin) (setq first-indent (current-indentation)) (sws-indent-to (funcall prog first-indent sws-tab-width)) (setq indent-diff (- (current-indentation) first-indent)) (forward-line 1) (let ((--dotimes-limit-- (- num-lines-indented 1)) (i 0)) (while (< i --dotimes-limit--) (sws-indent-to (+ (current-indentation) indent-diff)) (forward-line 1) (setq i (1+ i))))))
  sws-move-region(1 55 +)
  sws-indent-region(1 55)
  indent-region(1 55 nil)
  call-interactively(indent-region nil nil)
  command-execute(indent-region)

Fix this by going back to binding indent-diff to a new variable.