diff options
| author | Stefan Monnier | 2010-12-03 18:14:50 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2010-12-03 18:14:50 -0500 |
| commit | ee9355dcc84ecd5ef2a012206498b7ef00d06675 (patch) | |
| tree | b4f9ccdf87bdfca8af6fc462d884725ec3f1f8fe | |
| parent | 201ef780e052dc7c37ea5829d9a9cea9c4fd568b (diff) | |
| download | emacs-ee9355dcc84ecd5ef2a012206498b7ef00d06675.tar.gz emacs-ee9355dcc84ecd5ef2a012206498b7ef00d06675.zip | |
* lisp/newcomment.el (comment-styles): Add docs to each style.
Improve docstring.
(comment-style): Use comment-styles's docs to describe values.
Fixes: debbugs:7509
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/newcomment.el | 64 |
2 files changed, 59 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4ed0393594e..23d6130f2cb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2010-12-03 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * newcomment.el (comment-styles): Add docs to each style (bug#7509). | ||
| 4 | Improve docstring. | ||
| 5 | (comment-style): Use comment-styles's docs to describe values. | ||
| 6 | |||
| 1 | 2010-12-03 Jan Djärv <jan.h.d@swipnet.se> | 7 | 2010-12-03 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 8 | ||
| 3 | * term/common-win.el (x-setup-function-keys): Restore ns-new-frame | 9 | * term/common-win.el (x-setup-function-keys): Restore ns-new-frame |
| @@ -295,7 +301,7 @@ | |||
| 295 | 301 | ||
| 296 | * shell.el (shell): Use current-buffer by default if it's already | 302 | * shell.el (shell): Use current-buffer by default if it's already |
| 297 | a shell mode buffer and its process is dead. | 303 | a shell mode buffer and its process is dead. |
| 298 | Suggested by <jemarch@gnu.org>. | 304 | Suggested by Jose E. Marchesi <jemarch@gnu.org>. |
| 299 | 305 | ||
| 300 | 2010-11-23 Tassilo Horn <tassilo@member.fsf.org> | 306 | 2010-11-23 Tassilo Horn <tassilo@member.fsf.org> |
| 301 | 307 | ||
diff --git a/lisp/newcomment.el b/lisp/newcomment.el index de6b2474e21..3227d2ac539 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el | |||
| @@ -187,21 +187,58 @@ This should generally stay 0, except for a few modes like Lisp where | |||
| 187 | it is 1 so that regions are commented with two or three semi-colons.") | 187 | it is 1 so that regions are commented with two or three semi-colons.") |
| 188 | 188 | ||
| 189 | (defconst comment-styles | 189 | (defconst comment-styles |
| 190 | '((plain . (nil nil nil nil)) | 190 | '((plain nil nil nil nil |
| 191 | (indent . (nil nil nil t)) | 191 | "Start in column 0 (do not indent), as in Emacs-20") |
| 192 | (indent-or-triple | 192 | (indent-or-triple nil nil nil multi-char |
| 193 | . (nil nil nil multi-char)) | 193 | "Start in column 0, but only for single-char starters") |
| 194 | (aligned . (nil t nil t)) | 194 | (indent nil nil nil t |
| 195 | (multi-line . (t nil nil t)) | 195 | "Full comment per line, ends not aligned") |
| 196 | (extra-line . (t nil t t)) | 196 | (aligned nil t nil t |
| 197 | (box . (nil t t t)) | 197 | "Full comment per line, ends aligned") |
| 198 | (box-multi . (t t t t))) | 198 | (box nil t t t |
| 199 | "Comment region styles of the form (STYLE . (MULTI ALIGN EXTRA INDENT)). | 199 | "Full comment per line, ends aligned, + top and bottom") |
| 200 | (extra-line t nil t t | ||
| 201 | "One comment for all lines, end on a line by itself") | ||
| 202 | (multi-line t nil nil t | ||
| 203 | "One comment for all lines, end on last commented line") | ||
| 204 | (box-multi t t t t | ||
| 205 | "One comment for all lines, + top and bottom")) | ||
| 206 | "Comment region style definitions. | ||
| 207 | Each style is defined with a form (STYLE . (MULTI ALIGN EXTRA INDENT DOC)). | ||
| 208 | DOC should succinctly describe the style. | ||
| 200 | STYLE should be a mnemonic symbol. | 209 | STYLE should be a mnemonic symbol. |
| 201 | MULTI specifies that comments are allowed to span multiple lines. | 210 | MULTI specifies that comments are allowed to span multiple lines. |
| 211 | e.g. in C it comments regions as | ||
| 212 | /* blabla | ||
| 213 | * bli */ | ||
| 214 | rather than | ||
| 215 | /* blabla */ | ||
| 216 | /* bli */ | ||
| 217 | if `comment-end' is empty, this has no effect. | ||
| 218 | |||
| 202 | ALIGN specifies that the `comment-end' markers should be aligned. | 219 | ALIGN specifies that the `comment-end' markers should be aligned. |
| 220 | e.g. in C it comments regions as | ||
| 221 | /* blabla */ | ||
| 222 | /* bli */ | ||
| 223 | rather than | ||
| 224 | /* blabla */ | ||
| 225 | /* bli */ | ||
| 226 | if `comment-end' is empty, this has no effect, unless EXTRA is also set, | ||
| 227 | in which case the comment gets wrapped in a box. | ||
| 228 | |||
| 203 | EXTRA specifies that an extra line should be used before and after the | 229 | EXTRA specifies that an extra line should be used before and after the |
| 204 | region to comment (to put the `comment-end' and `comment-start'). | 230 | region to comment (to put the `comment-end' and `comment-start'). |
| 231 | e.g. in C it comments regions as | ||
| 232 | /* | ||
| 233 | * blabla | ||
| 234 | * bli | ||
| 235 | */ | ||
| 236 | rather than | ||
| 237 | /* blabla | ||
| 238 | * bli */ | ||
| 239 | if the comment style is not multi line, this has no effect, unless ALIGN | ||
| 240 | is also set, in which case the comment gets wrapped in a box. | ||
| 241 | |||
| 205 | INDENT specifies that the `comment-start' markers should not be put at the | 242 | INDENT specifies that the `comment-start' markers should not be put at the |
| 206 | left margin but at the current indentation of the region to comment. | 243 | left margin but at the current indentation of the region to comment. |
| 207 | If INDENT is `multi-char', that means indent multi-character | 244 | If INDENT is `multi-char', that means indent multi-character |
| @@ -212,8 +249,11 @@ If INDENT is `multi-char', that means indent multi-character | |||
| 212 | "Style to be used for `comment-region'. | 249 | "Style to be used for `comment-region'. |
| 213 | See `comment-styles' for a list of available styles." | 250 | See `comment-styles' for a list of available styles." |
| 214 | :type (if (boundp 'comment-styles) | 251 | :type (if (boundp 'comment-styles) |
| 215 | `(choice ,@(mapcar (lambda (s) `(const ,(car s))) | 252 | `(choice |
| 216 | comment-styles)) | 253 | ,@(mapcar (lambda (s) |
| 254 | `(const :tag ,(format "%s: %s" (car s) (nth 5 s)) | ||
| 255 | ,(car s))) | ||
| 256 | comment-styles)) | ||
| 217 | 'symbol) | 257 | 'symbol) |
| 218 | :version "23.1" | 258 | :version "23.1" |
| 219 | :group 'comment) | 259 | :group 'comment) |