-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from ethereum/option_to_customize_comment_style
Option to customize comment style
- Loading branch information
Showing
3 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
;; Author: Lefteris Karapetsas <[email protected]> | ||
;; Keywords: languages | ||
;; Version: 0.1.6 | ||
;; Version: 0.1.7 | ||
|
||
;; This program is free software; you can redistribute it and/or modify | ||
;; it under the terms of the GNU General Public License as published by | ||
|
@@ -97,6 +97,25 @@ Possible values are: | |
:package-version '(solidity . "0.1.5") | ||
:safe #'symbolp) | ||
|
||
(defcustom solidity-comment-style 'star | ||
"Denotes the style of comments to use for solidity when commenting. | ||
This option will define what kind of comments will be input into the buffer by | ||
commands like `comment-region'. The default value is 'star. | ||
Possible values are: | ||
`star' | ||
Follow the same styling as C mode does by default having all comments | ||
obey the /* .. */ style. | ||
`slash' | ||
All comments will start with //." | ||
:group 'solidity | ||
:type '(choice (const :tag "Commenting starts with /* and ends with */" star) | ||
(const :tag "Commenting starts with //" slash)) | ||
:package-version '(solidity . "0.1.7") | ||
:safe #'symbolp) | ||
|
||
(defvar solidity-mode-map | ||
(let ((map (make-sparse-keymap))) | ||
(define-key map "\C-j" 'newline-and-indent) | ||
|
@@ -529,9 +548,13 @@ Cursor must be at the function's name. Does not currently work for constructors | |
(set-syntax-table solidity-mode-syntax-table) | ||
;; specify syntax highlighting | ||
(setq font-lock-defaults '(solidity-font-lock-keywords)) | ||
;; register indentation functions, basically the c-mode ones | ||
(make-local-variable 'comment-start) | ||
(make-local-variable 'comment-end) | ||
|
||
;; register indentation and other langue mode functions, basically the c-mode ones with some modifications | ||
(let ((start-value (if (eq solidity-comment-style 'star) "/* " "// ")) | ||
(end-value (if (eq solidity-comment-style 'star) " */" ""))) | ||
(set (make-local-variable 'comment-start) start-value) | ||
(set (make-local-variable 'comment-end) end-value)) | ||
|
||
(make-local-variable 'comment-start-skip) | ||
|
||
(make-local-variable 'paragraph-start) | ||
|
@@ -541,7 +564,7 @@ Cursor must be at the function's name. Does not currently work for constructors | |
(make-local-variable 'adaptive-fill-regexp) | ||
(make-local-variable 'fill-paragraph-handle-comment) | ||
|
||
;; now set their values | ||
;; set values for some other variables | ||
(set (make-local-variable 'parse-sexp-ignore-comments) t) | ||
(set (make-local-variable 'indent-line-function) 'c-indent-line) | ||
(set (make-local-variable 'indent-region-function) 'c-indent-region) | ||
|