Skip to content

Instantly share code, notes, and snippets.

@mklymyshyn
Created May 21, 2015 12:31
Show Gist options
  • Save mklymyshyn/39af8b7b8651872fcdba to your computer and use it in GitHub Desktop.
Save mklymyshyn/39af8b7b8651872fcdba to your computer and use it in GitHub Desktop.
; change js3 indentation based on comment
(add-hook
'js3-mode-hook
(lambda()
(interactive)
(lexical-let
((buff (buffer-substring 1 512)))
(if
(string-match "\*\*[Ee][Mm][Aa][Cc][Ss]\*\.*\*\/" buff)
(mapcar
(lambda (e)
(if
(string-match "[A-Za-z0-9\-]+\:[A-Za-z0-9]+" e)
(lexical-let
((pair (split-string e ":")))
(if (>= (length pair) 2)
(setq
(nth 0 pair)
'8)
;(string-to-number (nth 1 pair))
;)
; (message (concat (nth 0 pair) "=" (nth 1 pair)))
nil
)
(message "DYNAMIC CONFIGS LOADED")
)
nil))
(split-string buff))
"No custom EMACS configuration found")
)))
; setq js3-indent-level 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment