2761 |
'("" . 0)))))) |
'("" . 0)))))) |
2762 |
)) |
)) |
2763 |
|
|
2764 |
(defun c-mask-comment (fill-include-ender apply-outside-literal fun &rest args) |
(defun c-mask-comment (fill-mode apply-outside-literal fun &rest args) |
2765 |
;; Calls FUN with ARGS ar arguments. If point is inside a comment, |
;; Calls FUN with ARGS ar arguments. If point is inside a comment, |
2766 |
;; the comment starter and ender are masked and the buffer is |
;; the comment starter and ender are masked and the buffer is |
2767 |
;; narrowed to make it look like a normal paragraph during the call. |
;; narrowed to make it look like a normal paragraph during the call. |
2790 |
;; Widen to catch comment limits correctly. |
;; Widen to catch comment limits correctly. |
2791 |
(widen) |
(widen) |
2792 |
(unless c-lit-limits |
(unless c-lit-limits |
2793 |
(setq c-lit-limits (c-literal-limits nil t))) |
(setq c-lit-limits (c-literal-limits nil fill-mode))) |
2794 |
(setq c-lit-limits (c-collect-line-comments c-lit-limits)) |
(setq c-lit-limits (c-collect-line-comments c-lit-limits)) |
2795 |
(unless c-lit-type |
(unless c-lit-type |
2796 |
(setq c-lit-type (c-literal-type c-lit-limits)))) |
(setq c-lit-type (c-literal-type c-lit-limits)))) |
2840 |
"\\)\\*/")) |
"\\)\\*/")) |
2841 |
(eq (cdr c-lit-limits) (match-end 0)) |
(eq (cdr c-lit-limits) (match-end 0)) |
2842 |
;; Leave the comment ender on its own line. |
;; Leave the comment ender on its own line. |
2843 |
(set-marker end (point)))) |
(set-marker end (max (point) here)))) |
2844 |
(when fill-include-ender |
(when fill-mode |
2845 |
;; The comment ender should hang. Replace all cruft |
;; The comment ender should hang. Replace all cruft |
2846 |
;; between it and the last word with one or two 'x' |
;; between it and the last word with one or two 'x' |
2847 |
;; and include it in the region. We'll change them |
;; and include it in the region. We'll change them |
2900 |
;; The region includes the comment starter. |
;; The region includes the comment starter. |
2901 |
(save-excursion |
(save-excursion |
2902 |
(goto-char (car c-lit-limits)) |
(goto-char (car c-lit-limits)) |
2903 |
(if (and (looking-at (concat "\\(" comment-start-skip "\\)$")) |
(when (and (looking-at comment-start-skip) |
2904 |
(> here (match-end 0))) |
(> here (match-end 0))) |
2905 |
;; Begin with the next line. |
(if (eq (match-end 0) (c-point 'eol)) |
2906 |
(setq beg (c-point 'bonl)) |
;; Begin with the next line. |
2907 |
;; Fake the fill prefix in the first line. |
(setq beg (c-point 'bonl)) |
2908 |
(setq tmp-pre t))))) |
;; Fake the fill prefix in the first line. |
2909 |
|
(setq tmp-pre t)))))) |
2910 |
((eq c-lit-type 'string) ; String. |
((eq c-lit-type 'string) ; String. |
2911 |
(save-excursion |
(save-excursion |
2912 |
(when (>= end (cdr c-lit-limits)) |
(when (>= end (cdr c-lit-limits)) |
2952 |
(goto-char (match-end 0)) |
(goto-char (match-end 0)) |
2953 |
(forward-char 2) |
(forward-char 2) |
2954 |
(skip-chars-forward " \t")) |
(skip-chars-forward " \t")) |
2955 |
(while (< (current-column) (cdr fill)) (forward-char 1)) |
(while (and (< (current-column) (cdr fill)) |
2956 |
|
(not (eolp))) |
2957 |
|
(forward-char 1)) |
2958 |
(let ((col (current-column))) |
(let ((col (current-column))) |
2959 |
(setq beg (1+ (point)) |
(setq beg (1+ (point)) |
2960 |
tmp-pre (list (point))) |
tmp-pre (list (point))) |