Created
March 15, 2018 13:42
-
-
Save anonymous/f4f2c965b1ac26ba2d89e9986f1a9bf7 to your computer and use it in GitHub Desktop.
Auto-insert " * " in block comments in 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
(defun elmord-block-comment-auto-prefix () | |
(when (eq last-command-event ?\n) | |
(let ((last-comment-start | |
(save-excursion (search-backward "/*" nil t))) | |
(last-comment-end | |
(save-excursion (search-backward "*/" nil t)))) | |
(when (and last-comment-start | |
(or (null last-comment-end) | |
(> last-comment-start last-comment-end))) | |
(insert "* ") | |
(indent-for-tab-command))))) | |
(add-hook 'scala-mode-hook | |
(defun elmord-scala-mode-hook () | |
(add-hook 'post-self-insert-hook | |
'elmord-block-comment-auto-prefix | |
nil t))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment