diff options
| author | Stefan Monnier | 2007-01-07 20:11:47 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-01-07 20:11:47 +0000 |
| commit | af5debda9205ed0fe0c0d7cf523b503675afa261 (patch) | |
| tree | e6440d6005f31d75c314fe4a368711b93384c76f | |
| parent | 107173cf00a507edfe0738b54a857f20eb83d717 (diff) | |
| download | emacs-af5debda9205ed0fe0c0d7cf523b503675afa261.tar.gz emacs-af5debda9205ed0fe0c0d7cf523b503675afa261.zip | |
(fill-comment-paragraph): Improve comment.
| -rw-r--r-- | lisp/textmodes/fill.el | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index 21ee585ec11..94f29043d5d 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el | |||
| @@ -838,18 +838,22 @@ can take care of filling. JUSTIFY is used as in `fill-paragraph'." | |||
| 838 | (commark | 838 | (commark |
| 839 | (comment-string-strip (buffer-substring comstart comin) nil t)) | 839 | (comment-string-strip (buffer-substring comstart comin) nil t)) |
| 840 | (comment-re | 840 | (comment-re |
| 841 | ;; `commark' is surrounded with arbitrary text (`\0' and `a') | 841 | ;; A regexp more specialized than comment-start-skip, that only |
| 842 | ;; to make sure it can be used as an optimization of | 842 | ;; matches the current commark rather than any valid commark. |
| 843 | ;; `comment-start-skip' in the middle of a line. For example, | 843 | ;; |
| 844 | ;; `commark' can't be used with the "@c" in TeXinfo (hence | 844 | ;; The specialized regexp only works for "normal" comment |
| 845 | ;; the `a') or with the "C" at BOL in Fortran (hence the `\0'). | 845 | ;; syntax, not for Texinfo's "@c" (which can't be immediately |
| 846 | (if (string-match comment-start-skip (concat "\0" commark "a")) | 846 | ;; followed by word-chars) or Fortran's "C" (which needs to be |
| 847 | (concat "[ \t]*" (regexp-quote commark) | 847 | ;; at bol), so check that comment-start-skip indeed allows the |
| 848 | ;; Make sure we only match comments that use | 848 | ;; commark to appear in the middle of the line and followed by |
| 849 | ;; the exact same comment marker. | 849 | ;; word chars. The choice of "\0" and "a" is mostly arbitrary. |
| 850 | "[^" (substring commark -1) "]") | 850 | (if (string-match comment-start-skip (concat "\0" commark "a")) |
| 851 | (concat "[ \t]*\\(?:" comment-start-skip "\\)"))) | 851 | (concat "[ \t]*" (regexp-quote commark) |
| 852 | (comment-fill-prefix ; Compute a fill prefix. | 852 | ;; Make sure we only match comments that |
| 853 | ;; use the exact same comment marker. | ||
| 854 | "[^" (substring commark -1) "]") | ||
| 855 | (concat "[ \t]*\\(?:" comment-start-skip "\\)"))) | ||
| 856 | (comment-fill-prefix ; Compute a fill prefix. | ||
| 853 | (save-excursion | 857 | (save-excursion |
| 854 | (goto-char comstart) | 858 | (goto-char comstart) |
| 855 | (if has-code-and-comment | 859 | (if has-code-and-comment |