• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/progmodes/

Lines Matching +defs:forward +defs:comment

51 (cc-bytecomp-defun delete-forward-p)	; XEmacs
54 (cc-bytecomp-defun c-forward-subword)
123 (while (and (= (forward-line -1) 0)
161 (= (forward-line -1) 0)))
216 With universal argument, inserts the analysis as a comment on that line."
243 (indent-for-comment)
249 "Insert a comment with the syntactic analysis on every line in the region."
257 (forward-line)))))
389 See also \\[c-hungry-delete-forward]."
399 (defun c-electric-delete-forward (arg)
412 (c-hungry-delete-forward)))
414 (defun c-hungry-delete-forward ()
420 (c-skip-ws-forward)
428 This function either deletes forward as `c-electric-delete-forward' or
430 the function `delete-forward-p' is defined and returns non-nil, it
431 deletes forward. Otherwise it deletes backward.
437 (if (and (fboundp 'delete-forward-p)
438 (delete-forward-p))
439 (c-electric-delete-forward arg)
446 function `delete-forward-p' is defined and returns non-nil, it deletes
447 forward using `c-hungry-delete-forward'. Otherwise it deletes
454 (if (and (fboundp 'delete-forward-p)
455 (delete-forward-p))
456 (c-hungry-delete-forward)
473 (and (= (forward-line -1) 0)
511 (forward-char))
555 (forward-char -1)
556 (c-forward-sexp -1))
605 (forward-line -2)
610 (forward-char)
628 (setq cmnt-pos (and (c-backward-single-comment)
635 ;; oriented comment to keep it syntactically significant.
639 (delete-char 1) ; the `}' has blundered into a comment
644 (insert-char ?\} 1) ; reinsert the `}' before the comment.
647 (insert-char ?\ 1) ; Put a space before a bare comment.
653 ;; Can we trim space before comment to make the line fit?
724 (forward-char)
743 (forward-char -1)
746 ;; make sure matching open brace isn't in a comment
827 If the slash is inserted immediately after the comment prefix in a c-style
828 comment, the comment might get closed by removing whitespace and possibly
831 Indent the line as a comment, if:
833 1. The slash is second of a \"//\" line oriented comment introducing
834 token and we are on a comment-only-line, or
837 comment.
848 ;; comment-close-slash cleanup? This DOESN'T need `c-electric-flag' or
852 (memq 'comment-close-slash c-cleanup-list)
855 (regexp-quote comment-end) "\\)?$"))
856 ; (eq c-block-comment-ender "*/") ; C-style comments ALWAYS end in */
861 (looking-at (concat c-current-comment-prefix "[ \t]*$")))))
862 (delete-region (progn (forward-line 0) (point))
878 the star is the second character of a C style comment starter on a
879 comment-only-line, indent the line as a comment. If a numeric ARG is
886 ;; current line, unless this star introduces a comment-only line.
894 (forward-char -1)
897 (forward-char -1))
949 (forward-char -1)
952 ;; make sure matching open brace isn't in a comment
1016 (forward-char -1)
1069 (forward-char -1)
1119 ;; Narrow to avoid that `c-forward-<>-arglist' below searches past
1158 (c-forward-<>-arglist nil))
1271 (c-forward-over-cpp-define-id)
1329 (defun c-forward-into-nomenclature (&optional arg)
1330 "Compatibility alias for `c-forward-subword'."
1333 (c-forward-subword arg))
1334 (make-obsolete 'c-forward-into-nomenclature 'c-forward-subword)
1376 (c-syntactic-re-search-forward
1383 (c-syntactic-re-search-forward "[;=\(\[{]" eo-block t t t)
1389 ;; constructs, included in the term "function" in the rest of this comment).
1436 (forward-char))
1448 (and (c-syntactic-re-search-forward "[;{]" nil t t)
1478 ;; outside any comment/string or macro.
1496 (c-syntactic-re-search-forward "{")
1522 argument -N means move forward to the Nth following beginning. Return
1537 ;; Move back out of any macro/comment/string we happen to be in.
1545 ;; Move forward to the closing brace of a function.
1550 (setq arg (c-forward-to-nth-EOF-} (- arg) where)))
1551 ;; Move forward to the next opening brace....
1553 (c-syntactic-re-search-forward "{" nil 'eob))
1569 ;; preceding boi that isn't inside a comment, but if we hit
1573 (c-backward-single-comment)))
1580 (defun c-forward-to-nth-EOF-} (n where)
1583 ;; outside any comment/string or macro.
1596 ;; What we do to go forward over the first defun depends on where we
1602 (forward-sexp)
1608 (when (c-syntactic-re-search-forward "{" nil 'eob)
1610 (forward-sexp)
1612 (t (error "c-forward-to-nth-EOF-}: `where' is %s" where)))
1614 ;; Each time round the loop, go forward to a "}" at the outermost level.
1618 (when (c-syntactic-re-search-forward "{" nil 'eob)
1620 (forward-sexp))
1625 "Move forward to the end of a top level declaration.
1640 ;; Move back out of any macro/comment/string we happen to be in.
1657 ;; Move forward to the } of a function
1659 (setq arg (c-forward-to-nth-EOF-} arg where))))
1661 ;; Do we need to move forward from the brace to the semicolon?
1664 (c-syntactic-re-search-forward ";"))
1669 ;; newline that isn't inside a comment, but if we hit the
1673 (c-forward-single-comment)))
1676 (forward-line 1))
1719 (forward-line 1)
1726 ;; one. Not using c-forward-syntactic-ws here since we
1732 (c-forward-comments)
1739 (forward-line 1)
1766 ;; isn't inside a comment, but if we hit a neighboring
1772 (c-backward-single-comment)))
1783 (c-forward-single-comment)))
1787 (forward-line 1)
1817 (defun c-in-comment-line-prefix-p ()
1818 ;; Point is within a comment. Is it also within a comment-prefix?
1819 ;; Space at BOL which precedes a comment-prefix counts as part of it.
1825 (skip-chars-forward " \t")
1826 (and (looking-at c-current-comment-prefix)
1830 (defun c-narrow-to-comment-innards (range)
1831 ;; Narrow to the "inside" of the comment (block) defined by range, as
1834 ;; A c-style block comment has its opening "/*" and its closing "*/" (if
1835 ;; present) removed. A c++-style line comment retains its opening "//" but
1840 ;; eliminates awkward things at the boundaries of the comment (block).
1859 (defun c-beginning-of-sentence-in-comment (range)
1860 ;; Move backwards to the "beginning of a sentence" within the comment
1863 ;; of the comment and return T.
1869 ;; This code was adapted from GNU Emacs's forward-sentence in paragraphs.el.
1877 (c-narrow-to-comment-innards range) ; This may move point back.
1880 (here-filler ; matches WS and comment-prefices at point.
1881 (concat "\\=\\(^[ \t]*\\(" c-current-comment-prefix "\\)"
1884 (concat "^[ \t]*\\(" c-current-comment-prefix "\\)[ \t\n\r\f]*\\="))
1888 (forward-paragraph -1) ; uses cc-mode values of
1890 (if (> (re-search-forward here-filler nil t) here)
1893 (forward-paragraph -2)
1894 (if (> (re-search-forward here-filler nil t) here)
1900 ;; HERE, or we hit PAR-BEG. Beware of comment prefices!
1905 (and (not (bolp)) ; Found a non-blank comment-prefix?
1910 (if (c-in-comment-line-prefix-p)
1912 (re-search-forward here-filler) ; always succeeds.
1915 (re-search-forward here-filler)))
1922 (defun c-end-of-sentence-in-comment (range)
1923 ;; Move forward to the "end of a sentence" within the comment defined by
1925 ;; comment delimiter and the terminating */ or newline). If we find an EOS,
1926 ;; return NIL. Otherwise, move point to just after the end of the comment
1932 ;; comment will count as EOS, providing we're not already in it.
1934 ;; This code was adapted from GNU Emacs's forward-sentence in paragraphs.el.
1944 (c-narrow-to-comment-innards range) ; This might move point forwards.
1951 (forward-paragraph 1)
1952 (if (eq (preceding-char) ?\n) (forward-char -1))
1955 (forward-paragraph 2)
1956 (if (eq (preceding-char) ?\n) (forward-char -1)))
1961 (concat "^[ \t]*\\(" c-current-comment-prefix "\\)\\=")))
1962 ;; Go forward one "comment-prefix which looks like sentence-end"
1964 (while (and (re-search-forward (c-sentence-end) par-end 'limit)
1974 ;; Take special action if we're up against the end of a comment (of
1997 ;; This code was adapted from GNU Emacs's forward-sentence in paragraphs.el.
2017 (forward-paragraph -1) ; uses above values of
2019 (if (> (re-search-forward here-filler nil t) here)
2022 (forward-paragraph -2)
2023 (if (> (re-search-forward here-filler nil t) here)
2032 (re-search-forward
2038 (re-search-forward here-filler here t)
2045 ;; Move forward to the "end of a sentence" within the string defined by
2055 ;; This code was adapted from GNU Emacs's forward-sentence in paragraphs.el.
2074 (forward-paragraph 1)
2082 (forward-paragraph 1)
2086 ;; Try to go forward a sentence.
2087 (when (re-search-forward c-sentence-end-with-esc-eol par-end 'limit)
2098 ;; Point is not in a literal (i.e. comment or string (include AWK regexp)).
2108 (if (c-backward-single-comment)
2109 (cons (point) (progn (c-forward-single-comment) (point)))
2126 ;; Point is not in a literal (i.e. comment or string (include AWK regexp)).
2135 (c-skip-ws-forward)
2137 (cons (point) (or (c-safe (progn (c-forward-sexp 1) (point)))
2140 (if (c-forward-single-comment)
2165 (c-forward-comments)
2169 ;; Move backwards over code which isn't a literal (i.e. comment or string),
2183 ;; (t . literal): No BOS found: only a comment/string. We _might_ be at
2210 ;; Stop at the token after a comment.
2211 ((c-backward-single-comment) ; Also functions as backwards-ws.
2219 (re-search-forward "\\(^\\|[^\\]\\)[\n\r]" last t))
2281 (defun c-forward-over-illiterals (macro-end allow-early-stop)
2283 ;; (i.e. a comment/string) or the boundary of a preprocessor statement or
2289 ;; forward at all, should we encounter a `{'. This is an ugly kludge, but
2296 ;; A is NIL if we moved forward to an EOS, or stay at one (when
2305 ;; As a clarification of "after the end-of-statement", if a comment or
2307 ;; as ending just after the last non-ws character before the comment.
2322 (while t ;; We go one "token" forward each time round this loop.
2325 ;; If we've moved forward to a virtual semicolon, we're done.
2330 (c-skip-ws-forward)
2337 ;; About to hit a comment?
2338 ((save-excursion (c-forward-single-comment))
2369 (forward-char)
2370 (skip-syntax-forward "w_")) ; Speedup only.
2398 (forward-char) ; Can't fail - we checked (eobp) earlier on.
2399 (skip-syntax-forward "w_") ; Speedup only.
2412 (progn (skip-chars-forward "^\n" (cdr range))
2421 comment or multiline string, move by sentences instead of statements.
2479 (c-beginning-of-sentence-in-comment range)))
2518 With prefix arg, go forward N - 1 statements. Move forward to the end
2520 \(use \\[forward-sexp] to skip over a block). If within or next to a
2521 comment or multiline string, move by sentences instead of statements.
2533 (here ; start point for going forward ONE statement. Updated each statement.
2541 ;; Go back/forward one statement at each iteration of the following loop.
2546 ;; Go forward one "chunk" each time round the following loop, stopping
2570 (c-end-of-sentence-in-comment range)))
2572 ;; If we've just come forward out of a literal, check for
2573 ;; vsemi. (N.B. AWK can't have a vsemi after a comment, but
2579 (t (setq res (c-forward-over-illiterals macro-fence
2581 ;; Are we about to move forward into or out of a
2588 (progn (c-skip-ws-forward)
2592 ;; Are we about to move forward into a literal?
2622 (put 'c-electric-delete-forward 'delete-selection 'supersede) ; delsel
2623 (put 'c-electric-delete-forward 'pending-delete 'supersede) ; pending-del
2628 (defun c-calc-comment-indent (entry)
2631 (setq entry (or (assq entry c-indent-comment-alist)
2632 (assq 'other c-indent-comment-alist)
2640 (unless value (setq value comment-column))
2654 ;; Found comment to align with.
2660 (c-calc-comment-indent (cdr entry)))))))
2662 (defun c-comment-indent ()
2663 "Used by `indent-for-comment' to create and indent comments.
2664 See `c-indent-comment-alist' for a description."
2679 'anchored-comment)
2692 (if (and (memq line-type '(anchored-comment empty-line))
2696 ;; because indent-for-comment hasn't put the comment-start
2701 ;; c-comment-only-line-offset since it doesn't apply here.
2703 (c-add-syntax 'comment-intro))
2704 (let ((c-comment-only-line-offset
2705 (if (consp c-comment-only-line-offset)
2706 c-comment-only-line-offset
2707 (cons c-comment-only-line-offset
2708 c-comment-only-line-offset))))
2711 (c-calc-comment-indent line-type)))))
2720 (skip-chars-forward "\t ")
2729 move forward to the end of the containing preprocessor conditional.
2733 forward."
2735 (c-forward-conditional (- count) -1)
2743 (c-forward-conditional (- count) -1 t)
2747 "Move forward into the next preprocessor conditional, leaving mark behind.
2752 function stops at them when going forward, but not when going
2755 (c-forward-conditional count 1)
2759 "Move forward into the next preprocessor conditional, including \"#else\".
2763 (c-forward-conditional count 1 t)
2769 move forward across a preprocessor conditional."
2771 (c-forward-conditional (- count) target-depth with-else)
2774 (defun c-forward-conditional (count &optional target-depth with-else)
2775 "Move forward across a preprocessor conditional, leaving mark behind.
2790 (let* ((forward (> count 0))
2791 (increment (if forward -1 1))
2792 (search-function (if forward 're-search-forward 're-search-backward))
2846 (error (if forward
2849 ;; When searching forward, start from next line so
2851 (if forward (forward-line 1))
2857 (if forward (forward-line 1)))))
2930 (c-forward-sexp 1)
2933 (forward-line 1)
2972 (while (and (setq beg (c-down-list-forward end))
2973 (setq end (c-up-list-forward beg))))
2986 (forward-line)
3005 (c-forward-token-2 0 nil (c-point 'eol)))
3025 (skip-chars-forward " \t\n\r\f\v")
3048 (skip-chars-forward " \t\n")
3059 (forward-line)
3065 (forward-line)
3068 (forward-line)))
3070 (forward-line)))
3190 (c-delete-backslashes-forward endmark point-pos))
3196 (= (forward-line 1) 0)
3220 (forward-line 1))
3225 (forward-char -1))
3254 (forward-line 1)))
3276 (c-append-backslashes-forward endmark column point-pos))
3285 (c-append-backslashes-forward endmark column point-pos)
3290 (c-delete-backslashes-forward endmark point-pos)))))
3295 (defun c-append-backslashes-forward (to-mark column point-pos)
3339 (zerop (forward-line 1)))
3340 (bolp))) ; forward-line has funny behavior at eob.
3365 (zerop (forward-line 1)))
3366 (bolp)))))) ; forward-line has funny behavior at eob.
3368 (defun c-delete-backslashes-forward (to-mark point-pos)
3380 (zerop (forward-line 1)))
3381 (bolp)))) ; forward-line has funny behavior at eob.
3395 ;; possible to make them work correctly wrt the comment and string
3402 ;; We temporarily mask comment starters and enders as necessary for
3410 ;; Determine the appropriate comment fill prefix for a block or line
3411 ;; comment. Return a cons of the prefix string and the column where
3419 c-current-comment-prefix
3421 (comment-start-regexp (if (eq lit-type 'c++)
3423 comment-start-skip))
3424 prefix-line comment-prefix res comment-text-end)
3441 ;; Set fallback for comment-prefix if none is found.
3442 (setq comment-prefix "// "
3443 comment-text-end (cdr lit-limits))
3447 ;; The current line is not the comment starter, so the
3448 ;; comment has more than one line, and it can therefore be
3449 ;; used to find the comment fill prefix.
3453 (if (and (= (forward-line 1) 0)
3455 ;; The line after the comment starter is inside the
3456 ;; comment, so we can use it.
3459 ;; The comment is only one line. Take the comment prefix
3464 (forward-char 2)
3465 (skip-chars-forward " \t"))
3469 ;; There is only whitespace before the comment
3475 ;; There is code before the comment starter, so we
3486 (forward-char prefix-len)
3501 (setq comment-text-end
3511 ;; The current line is not the comment starter and
3513 ;; to be used for the comment fill prefix.
3517 (cond ((or (/= (forward-line 1) 0)
3523 ;; The comment is either one line or the next line contains
3524 ;; just the comment ender. In this case we have no
3525 ;; information about a suitable comment prefix, so we resort
3526 ;; to c-block-comment-prefix.
3527 (setq comment-prefix (or c-block-comment-prefix "")))
3530 ;; The point was on the comment opener line, so we might want
3531 ;; to treat this as a not yet closed comment.
3540 ;; all if the comment isn't closed yet, so in that case
3543 (setq comment-prefix (match-string 1))
3547 ;; comment opener. If the line is empty, or if the
3549 ;; comment starter we assume it's an unclosed
3550 ;; comment starter, i.e. that
3551 ;; `c-block-comment-prefix' should be used.
3552 ;; Otherwise we assume it's a closed comment where
3554 ;; E.g. this is an unclosed comment:
3565 ;; (Looking for the presence of the comment closer
3567 ;; some comment further down when the comment
3573 (setq comment-prefix (or c-block-comment-prefix ""))
3577 ;; Otherwise the line after the comment starter is good
3581 (when comment-prefix
3582 ;; Haven't got the comment prefix on any real line that we
3584 ;; `comment-prefix' on a line and indent it to find the
3592 (if (looking-at comment-start-regexp)
3594 comment-text-end))
3595 (forward-char 2)
3596 (skip-chars-forward " \t"))
3600 ;; instead of what's ending comment-prefix.
3601 (setq comment-prefix
3602 (concat (substring comment-prefix
3605 comment-prefix))
3615 ;; before the line break and after comment-prefix in
3617 (insert-and-inherit "x\n" comment-prefix "x")
3641 (<= (match-end 0) comment-text-end))
3679 (while (and (zerop (forward-line -1))
3684 (while (and (zerop (forward-line -1))
3689 (while (and (zerop (forward-line 1))
3698 ;; fallback that matches the comment prefix regexp.
3709 ;; on the comment start line that we can
3712 (if (looking-at comment-start-regexp)
3714 (forward-char 2)
3715 (skip-chars-forward " \t"))
3746 ;; The line doesn't match the comment prefix regexp.
3747 (if comment-prefix
3751 comment-prefix)
3753 (+ (current-column) (length comment-prefix))))
3756 ;; comment where the lines doesn't have any comment
3765 ;; includes narrowing the buffer and, if point is inside a comment,
3766 ;; masking the comment starter and ender appropriately.
3773 ;; only if the point turns out to be inside a comment or a string.
3786 ;; If hang-ender-stuck isn't nil, the comment ender is
3791 ;; comment's last word and the comment ender, temporarily replaced
3809 ;; Widen to catch comment limits correctly.
3819 (forward-paragraph)
3822 (forward-paragraph))
3825 (unless (c-safe (forward-char)
3834 ;; For each of the possible types of text (string, C comment ...)
3838 ;; For some of these text types, particularly a block comment, we
3843 ((eq c-lit-type 'c++) ; Line comment.
3845 ;; Limit to the comment or paragraph end, whichever
3850 ;; The region includes the comment starter, so we must
3858 ;; comment. We must fake a line that doesn't.
3863 ((eq c-lit-type 'c) ; Block comment.
3871 ;; There is a comment ender, and the region includes it. If
3874 ;; "=====*/" counts as a comment ender here, but "===== */"
3880 (and (search-forward-regexp
3881 (concat "\\=[ \t]*\\(" c-current-comment-prefix "\\)")
3883 (not (search-forward-regexp
3886 ;; The comment ender IS on its own line. Exclude
3890 ;; The comment ender is hanging. Replace all space between it
3895 ;; afterwards. The effect of this is to glue the comment
3896 ;; ender to the last word in the comment during filling.
3914 (forward-line -1) ; last line of the comment
3916 c-current-comment-prefix
3919 ;; The comment ender is prefixed by nothing but a
3920 ;; comment line prefix. IS THIS POSSIBLE? (ACM,
3965 ;; The region includes the comment starter.
3968 (if (looking-at (concat "\\(" comment-start-skip "\\)$"))
4005 (forward-line)
4016 (c-forward-syntactic-ws end)
4021 (forward-line)
4025 ;; Temporarily insert the fill prefix after the comment
4027 ;; comment line in the narrowed region.
4031 c-current-comment-prefix
4034 ;; Oops, the prefix doesn't match the comment prefix
4041 Warning: Regexp from `c-comment-prefix-regexp' doesn't match the comment prefix %S"
4050 c-current-comment-prefix
4051 comment-start-skip))
4053 (forward-char 2)
4054 (skip-chars-forward " \t"))
4057 (forward-char 1))
4074 ;; doesn't produce the required comment starter for
4123 (forward-char (- hang-ender-stuck))
4136 If any of the current line is a comment or within a comment, fill the
4137 comment or the paragraph of it that point is in, preserving the
4138 comment indentation or line-starting decorations (see the
4139 `c-comment-prefix-regexp' and `c-block-comment-prefix' variables for
4170 ;; done in c-indent-new-comment-line, which do-auto-fill
4178 (defun c-indent-new-comment-line (&optional soft allow-auto-fill)
4179 "Break line at point and indent, continuing comment or macro if within one.
4180 If inside a comment and `comment-multi-line' is non-nil, the
4182 `c-comment-prefix-regexp' and `c-block-comment-prefix' variables for
4183 details). If inside a single line comment and `comment-multi-line' is
4184 nil, a new comment of the same type is started on the next line and
4224 ;; we're on the first line in a block comment so it'll be
4229 c-line-comment-starter)
4232 ;; doesn't produce the required comment starter for line
4250 ;; Some sort of comment.
4251 (if (or comment-multi-line
4256 ;; Inside a comment that should be continued.
4264 (comment-text-end
4270 ;; Skip forward past the fill prefix in case
4281 ;; If we have an empty comment, /* */, the next
4287 (forward-char 1))
4288 (if (and (> (point) comment-text-end)
4292 ;; comment; insert the fill prefix at bol
4300 ;; Don't break in the middle of a comment starter
4302 (cond ((> (point) comment-text-end)
4303 (goto-char comment-text-end))
4311 ;; Inside a comment that should be broken.
4312 (let ((comment-start comment-start)
4313 (comment-end comment-end)
4316 (unless (string-match "[ \t]*/\\*" comment-start)
4317 (setq comment-start "/* " comment-end " */"))
4318 (unless (string-match "[ \t]*//" comment-start)
4319 (setq comment-start "// " comment-end "")))
4324 (when (and comment-end (not (equal comment-end "")))
4325 (forward-char -1)
4326 (insert-and-inherit comment-end)
4327 (forward-char 1))
4328 ;; c-comment-indent may look at the current
4332 (insert-and-inherit comment-start)
4333 (indent-for-comment))))
4350 (= (forward-line -1) 0)))
4355 (defalias 'c-comment-line-break-function 'c-indent-new-comment-line)
4356 (make-obsolete 'c-comment-line-break-function 'c-indent-new-comment-line)
4358 ;; advice for indent-new-comment-line for older Emacsen
4359 (unless (boundp 'comment-line-break-function)
4361 (defadvice indent-new-comment-line (around c-line-break-advice
4363 "Call `c-indent-new-comment-line' if in CC Mode."
4368 (c-indent-new-comment-line (ad-get-arg 0))))))
4373 When point is outside a comment or macro, insert a newline and indent
4383 When point is inside a comment, continue it with the appropriate
4384 comment prefix (see the `c-comment-prefix-regexp' and
4385 `c-block-comment-prefix' variables for details). The end of a
4386 C++-style line comment doesn't count as inside it.
4404 (and (eq c-lit-type 'c++) ; C++ comment, but not at the very end of it.
4406 (skip-chars-forward " \t")
4421 (let ((comment-multi-line t)
4423 (c-indent-new-comment-line nil t)))
4437 (forward-line 0)
4439 (= (forward-line -1) 0)))