Skip to content

Instantly share code, notes, and snippets.

@jordonbiondo
Created August 15, 2014 16:51
Show Gist options
  • Select an option

  • Save jordonbiondo/7056fc628cef048cd793 to your computer and use it in GitHub Desktop.

Select an option

Save jordonbiondo/7056fc628cef048cd793 to your computer and use it in GitHub Desktop.
indent
(save-excursion
(back-to-indentation)
(let* ((syntax (syntax-ppss (point))))
(unless (io-in-string-p (line-beginning-position))
(delete-region (point) (line-beginning-position))
(insert-tab (- (length (remove-duplicates (mapcar 'line-number-at-pos (tenth syntax))))
(if (save-excursion (> (first syntax) (first (syntax-ppss (1+ (point)))))) 1 0))))))
(when (> (save-excursion (back-to-indentation) (point)) (point))
(back-to-indentation)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment