Created
August 30, 2011 15:11
-
-
Save bmc/1181122 to your computer and use it in GitHub Desktop.
Making my Scaladoc tombstones conform
This file contains 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
; I've been trying to convert my Scaladoc comments from Java style to Scala style. | |
; i.e., from: | |
; /** | |
; * This amazing method washes your hair, trims your beard, and | |
; * and brushes your teeth. | |
; */ | |
; | |
; to: | |
; | |
; /** This amazing method washes your hair, trims your beard, and | |
; * and brushes your teeth. | |
; */ | |
; | |
; This Emacs LISP function helps. | |
(defun scedit () | |
(interactive) | |
(save-excursion | |
(beginning-of-buffer) | |
(replace-regexp "/\\*\\* | |
+\\*" "/**" nil (if (and transient-mark-mode mark-active) (region-beginning)) (if (and transient-mark-mode mark-active) (region-end))) | |
(beginning-of-buffer) | |
(replace-regexp "^\\( *\\)\\*" "\\1 *" nil (if (and transient-mark-mode mark-active) (region-beginning)) (if (and transient-mark-mode mark-active) (region-end))) | |
(beginning-of-buffer) | |
(replace-regexp "\\* +<li>" "* - " nil (if (and transient-mark-mode mark-active) (region-beginning)) (if (and transient-mark-mode mark-active) (region-end))) | |
(beginning-of-buffer) | |
(replace-regexp "</?tt>" "`" nil (if (and transient-mark-mode mark-active) (region-beginning)) (if (and transient-mark-mode mark-active) (region-end))) | |
(beginning-of-buffer) | |
(replace-regexp "</?p>" "" nil (if (and transient-mark-mode mark-active) (region-beginning)) (if (and transient-mark-mode mark-active) (region-end))) | |
(beginning-of-buffer) | |
(replace-regexp "</?i>" "''" nil (if (and transient-mark-mode mark-active) (region-beginning)) (if (and transient-mark-mode mark-active) (region-end))) | |
(beginning-of-buffer) | |
(replace-regexp "</?b>" "'''" nil (if (and transient-mark-mode mark-active) (region-beginning)) (if (and transient-mark-mode mark-active) (region-end))) | |
(beginning-of-buffer) | |
(replace-regexp "</?u>" "__" nil (if (and transient-mark-mode mark-active) (region-beginning)) (if (and transient-mark-mode mark-active) (region-end))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment