-
-
Save vbuaraujo/909bb87f22e6caa1cdfbf1341427f0b7 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 "*/" last-comment-start t)))) | |
(when (and last-comment-start (not last-comment-end)) | |
(insert "* ") | |
(indent-for-tab-command))))) | |
(defun elmord-block-comment-auto-prefix-enable-in-buffer () | |
(add-hook 'post-self-insert-hook | |
'elmord-block-comment-auto-prefix | |
nil t)) | |
(add-hook 'scala-mode-hook 'elmord-block-comment-auto-prefix-enable-in-buffer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment