Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix error during indentation of first non-empty line
Fixes #13 The package was throwing an error (or hanging, rather) when starting a new file with a blank line at the very begining. To reproduce: - Create a new hamlet file and open it - Hit "o" (newline-and-indent) - Emacs hangs until C-g is pressed The error is caused by trying to count the indentation level on a line that doesn't have any characters on it. There's a two part fix here, mostly for posterity: 1. Prematurely check if we're on the first non-empty line and use 'noindent. 2. When calcuating indentation of previous lines, make sure that a character exists on the line before calculating the number of empty spaces. There still seems to be a couple of corner cases around auto-indenting and just various setups, but this should fix the immediate issue.
- Loading branch information