diff options
author | lutter <lutter@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-01-06 01:18:17 +0000 |
---|---|---|
committer | lutter <lutter@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-01-06 01:18:17 +0000 |
commit | 965a82dd16f5479c505f12867fed1c88e2e8ae91 (patch) | |
tree | 2a21ec7ddb53828dba11bf6a138d956fcb17a4ba | |
parent | c35b44120684356bacc6d1e1c19cb202ad12bbc0 (diff) | |
download | puppet-965a82dd16f5479c505f12867fed1c88e2e8ae91.tar.gz puppet-965a82dd16f5479c505f12867fed1c88e2e8ae91.tar.xz puppet-965a82dd16f5479c505f12867fed1c88e2e8ae91.zip |
Minor cleanup, leave cursor at beginning of indented line, not its end
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2065 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r-- | ext/emacs/puppet-mode.el | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/ext/emacs/puppet-mode.el b/ext/emacs/puppet-mode.el index 472c386c0..2cf5dcfe9 100644 --- a/ext/emacs/puppet-mode.el +++ b/ext/emacs/puppet-mode.el @@ -94,41 +94,41 @@ (interactive) (beginning-of-line) (if (bobp) - (indent-line-to 0) ; First line is always non-indented + (indent-line-to 0) ; First line is always non-indented (let ((not-indented t) cur-indent) - (if (looking-at "^.*}") ; If the line we are looking at is the end of a block, then decrease the indentation - (progn - (save-excursion - (forward-line -1) - - (if (looking-at "^.*}") + (if (looking-at "^.*}") ; If the line we are looking at is the end of + ; a block, then decrease the indentation + (progn + (save-excursion + (forward-line -1) + + (if (looking-at "^.*}") (progn -;; (setq cur-indent (current-indentation)) - (setq cur-indent (- (current-indentation) 2)) + (setq cur-indent (- (current-indentation) 2)) (setq not-indented nil)) (setq cur-indent (- (current-indentation) 2)))) - (if (< cur-indent 0) ; We can't indent past the left margin + (if (< cur-indent 0) ; We can't indent past the left margin (setq cur-indent 0))) (save-excursion - (while not-indented ; Iterate backwards until we find an indentation hint + (while not-indented ; Iterate backwards until we find an + ; indentation hint (forward-line -1) - (if (looking-at "^.*}") ; This hint indicates that we need to indent at the level of the END_ token + (if (looking-at "^.*}") ; This hint indicates that we need to + ; indent at the level of the END_ token (progn (setq cur-indent (current-indentation)) (setq not-indented nil)) - (if (looking-at "^.*{") ; This hint indicates that we need to indent an extra level + (if (looking-at "^.*{") ; This hint indicates that we need to + ; indent an extra level (progn - (setq cur-indent (+ (current-indentation) 2)) ; Do the actual indenting + ; Do the actual indenting + (setq cur-indent (+ (current-indentation) 2)) (setq not-indented nil)) (if (bobp) (setq not-indented nil))))))) (if cur-indent (indent-line-to cur-indent) - (indent-line-to 0)))) - (end-of-line) -) ; If we didn't see an indentation hint, then allow no indentation - - + (indent-line-to 0))))) ;;;###autoload |