Last active
January 2, 2016 11:59
-
-
Save MichaelPaulukonis/8300194 to your computer and use it in GitHub Desktop.
Setting Emacs' js2-mode indent level on the fly. See refs @ http://www.xradiograph.com/JavaScript/Emacs
This file contains hidden or 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
| ;;; do I even need to say how preliminary all of this is? | |
| ;;; in-progress variant to use universal-argument or param | |
| (defun js2-cust-idnt (&optional indt) | |
| "set indentation in this buffer" | |
| (interactive) | |
| ;; TODO if no prefix-arg and no idnt, prompt for indent? | |
| (let ((indent-level (if indt indt | |
| current-prefix-arg))) | |
| (setq js2-basic-offset indent-level))) | |
| ;; sample | |
| (defun js2-idnt-3 () | |
| (interactive) | |
| (js2-cust-idnt 3)) | |
| ;;; older functions | |
| (defun js2-indent-custom (position) | |
| "set indentation in this buffer" | |
| (interactive) | |
| (setq js2-basic-offset position)) | |
| (defun js2-indent-2 () | |
| "set indentation to 2 in this buffer" | |
| (interactive) | |
| (js2-indent-custom 2)) | |
| (defun js2-indent-4 () | |
| "set indentation to 2 in this buffer" | |
| (interactive) | |
| (js2-indent-custom 4)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment