Created
February 15, 2012 05:52
-
-
Save mahmoud/1833619 to your computer and use it in GitHub Desktop.
less major mode indentation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun less-css-calculate-indentation () | |
"Return the column to which the current line should be indented." | |
(save-excursion | |
(end-of-line) | |
(let ((indent-level 0)) | |
(while (not (bobp)) | |
;; TODO search backwards | |
(backward-char) | |
(cond ((looking-at "{") (setq indent-level (+ 1 indent-level))) | |
((looking-at "}") (setq indent-level (- indent-level 1))))) | |
indent-level))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment