Mercurial > emacs
comparison lisp/simple.el @ 20265:37a6af24de93
(comment-padding): New var.
(comment-region): Use it.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Sat, 15 Nov 1997 21:14:21 +0000 |
parents | 1b8324e38772 |
children | 69a6030e443a |
comparison
equal
deleted
inserted
replaced
20264:3b9b07f3eab5 | 20265:37a6af24de93 |
---|---|
2486 ;; to catch comments a line beginnings | 2486 ;; to catch comments a line beginnings |
2487 (indent-according-to-mode)))) | 2487 (indent-according-to-mode)))) |
2488 (if arg (forward-line 1)) | 2488 (if arg (forward-line 1)) |
2489 (setq count (1- count))))) | 2489 (setq count (1- count))))) |
2490 | 2490 |
2491 (defvar comment-padding 1 | |
2492 "Number of spaces `comment-region' puts between comment chars and text. | |
2493 | |
2494 Extra spacing between the comment characters and the comment text | |
2495 makes the comment easier to read. Default is 1. Nil means 0 and is | |
2496 more efficient.") | |
2497 | |
2491 (defun comment-region (beg end &optional arg) | 2498 (defun comment-region (beg end &optional arg) |
2492 "Comment or uncomment each line in the region. | 2499 "Comment or uncomment each line in the region. |
2493 With just C-u prefix arg, uncomment each line in region. | 2500 With just C-u prefix arg, uncomment each line in region. |
2494 Numeric prefix arg ARG means use ARG comment characters. | 2501 Numeric prefix arg ARG means use ARG comment characters. |
2495 If ARG is negative, delete that many comment characters instead. | 2502 If ARG is negative, delete that many comment characters instead. |
2512 ;; then insert the replicated strings just once. | 2519 ;; then insert the replicated strings just once. |
2513 (while (> numarg 1) | 2520 (while (> numarg 1) |
2514 (setq cs (concat cs comment-start) | 2521 (setq cs (concat cs comment-start) |
2515 ce (concat ce comment-end)) | 2522 ce (concat ce comment-end)) |
2516 (setq numarg (1- numarg)))) | 2523 (setq numarg (1- numarg)))) |
2524 (when comment-padding | |
2525 (setq cs (concat cs (make-string comment-padding ? )))) | |
2517 ;; Loop over all lines from BEG to END. | 2526 ;; Loop over all lines from BEG to END. |
2518 (narrow-to-region beg end) | 2527 (narrow-to-region beg end) |
2519 (goto-char beg) | 2528 (goto-char beg) |
2520 (while (not (eobp)) | 2529 (while (not (eobp)) |
2521 (if (or (eq numarg t) (< numarg 0)) | 2530 (if (or (eq numarg t) (< numarg 0)) |