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

Lines Matching +defs:fill +defs:context +defs:prefix

52 (cc-bytecomp-defvar filladapt-mode)	; c-fill-paragraph contains a kludge
62 "Indent the current line according to the syntactic context,
103 (c-syntactic-context
105 (and (boundp 'c-syntactic-context)
106 c-syntactic-context))))
108 (unless c-syntactic-context
109 (setq c-syntactic-context (c-guess-basic-syntax)))
111 c-syntactic-context))
115 c-syntactic-context indent))
186 ;; has been moved anyway and is now in a different context.
192 (let ((c-syntactic-context (c-save-buffer-state nil
219 (syntax (if (boundp 'c-syntactic-context)
220 ;; Use `c-syntactic-context' in the same way as
222 c-syntactic-context
294 context keys, when applicable.
374 line) then all preceding whitespace is consumed. If however a prefix
383 (funcall c-backspace-function (prefix-numeric-value arg))
402 line) then all following whitespace is consumed. If however a prefix
411 (funcall c-delete-function (prefix-numeric-value arg))
478 (self-insert-command (prefix-numeric-value arg))
490 ;; Return the syntactic context of the construct at point. (This is NOT
492 ;; between the `#' of a cpp thing and what follows (see c-opt-cpp-prefix).
521 ;; A brace stands at point. SYNTAX is the syntactic context of this brace
579 (let ((c-syntactic-context syntax))
692 (self-insert-command (prefix-numeric-value arg))
702 ln-syntax br-syntax syntax) ; Syntactic context of the original line,
726 ;; `syntax' is the syntactic context of the line which ends up
827 If the slash is inserted immediately after the comment prefix in a c-style
861 (looking-at (concat c-current-comment-prefix "[ \t]*$")))))
871 (self-insert-command (prefix-numeric-value arg))
884 (self-insert-command (prefix-numeric-value arg))
922 (let* (lim literal c-syntactic-context
931 (self-insert-command (prefix-numeric-value arg))
958 (setq c-syntactic-context (c-guess-basic-syntax))
959 (c-indent-line c-syntactic-context))
1000 (self-insert-command (prefix-numeric-value arg))
1093 (self-insert-command (prefix-numeric-value arg))
1206 (self-insert-command (prefix-numeric-value arg))
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.
1826 (and (looking-at c-current-comment-prefix)
1881 (concat "\\=\\(^[ \t]*\\(" c-current-comment-prefix "\\)"
1883 (prefix-at-bol-here ; matches WS and prefix at BOL, just before point
1884 (concat "^[ \t]*\\(" c-current-comment-prefix "\\)[ \t\n\r\f]*\\="))
1886 (par-beg ; point where non-WS/non-prefix text of paragraph starts.
1905 (and (not (bolp)) ; Found a non-blank comment-prefix?
1907 (if (re-search-backward prefix-at-bol-here nil t)
1910 (if (c-in-comment-line-prefix-p)
1960 (prefix-at-bol-here
1961 (concat "^[ \t]*\\(" c-current-comment-prefix "\\)\\=")))
1962 ;; Go forward one "comment-prefix which looks like sentence-end"
1969 (re-search-backward prefix-at-bol-here nil t)
1978 (and (re-search-backward prefix-at-bol-here nil t)
2290 ;; seems unavoidable. Depending on the context this function is called
2417 With prefix arg, go back N - 1 statements. If already at the
2425 to search for the syntactic context, and a flag saying whether to do
2432 (interactive (list (prefix-numeric-value current-prefix-arg)
2518 With prefix arg, go forward N - 1 statements. Move forward to the end
2525 to search for the syntactic context, and a flag saying whether to do
2527 (interactive (list (prefix-numeric-value current-prefix-arg)
2694 (let ((c-syntactic-context (c-guess-basic-syntax)))
2709 (c-get-syntactic-indentation c-syntactic-context)))
2728 A prefix argument acts as a repeat count. With a negative argument,
2748 A prefix argument acts as a repeat count. With a negative argument,
2768 A prefix argument acts as a repeat count. With a negative argument,
2776 A prefix argument acts as a repeat count. With a negative argument,
2879 the syntactic context. A numeric argument, regardless of its value,
2887 prefix argument is equivalent to -1.
2903 (prefix-numeric-value arg))))
3097 (defun c-progress-init (start end context)
3107 ;; [start end lastsec context]
3114 context))
3134 (defun c-progress-fini (context)
3137 (if (or (eq context (aref c-progress-info 3))
3138 (eq context t))
3388 (defvar c-auto-fill-prefix t)
3394 ;; (e.g. adaptive-fill-mode or filladapt-mode) and do as little as
3399 ;; with any well-written text filling package that preserves a fill
3400 ;; prefix.
3404 ;; We do _not_ mask the fill prefix, so it's up to the filling code to
3406 ;; line comments). By default, we set up and use adaptive-fill-mode,
3409 (defun c-guess-fill-prefix (lit-limits lit-type)
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
3412 ;; it ends. If fill-prefix is set, it'll override. Note that this
3418 (prefix-regexp (concat "[ \t]*\\("
3419 c-current-comment-prefix
3422 prefix-regexp
3424 prefix-line comment-prefix res comment-text-end)
3427 (fill-prefix
3428 (setq res (cons fill-prefix
3429 ;; Ugly way of getting the column after the fill
3430 ;; prefix; it'd be nice with a current-column
3435 (insert-and-inherit "\n" fill-prefix)
3441 ;; Set fallback for comment-prefix if none is found.
3442 (setq comment-prefix "// "
3449 ;; used to find the comment fill prefix.
3450 (setq prefix-line (point))
3457 (setq prefix-line (point))
3459 ;; The comment is only one line. Take the comment prefix
3462 (if (looking-at prefix-regexp)
3470 ;; starter; take the prefix straight from this line.
3478 (let ((prefix-len (- (point) (car lit-limits)))
3486 (forward-char prefix-len)
3495 ;; The prefix ends the line with no whitespace
3513 ;; to be used for the comment fill prefix.
3514 (setq prefix-line (point))
3521 (and (looking-at prefix-regexp)
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 "")))
3535 ;; Above `prefix-regexp' matched a nonempty prefix on the
3537 ;; to set `prefix-line' and let the code below pick up
3538 ;; the whole prefix, but if there's no text after the
3539 ;; match then it will probably fall back to no prefix at
3541 ;; it's better to force use of the prefix matched now.
3543 (setq comment-prefix (match-string 1))
3544 (setq prefix-line (point)))
3546 ;; There's no nonempty prefix on the line after the
3551 ;; `c-block-comment-prefix' should be used.
3553 ;; the prefix really is the empty string.
3573 (setq comment-prefix (or c-block-comment-prefix ""))
3574 (setq prefix-line (point)))))
3578 ;; enough to find the prefix in.
3579 (setq prefix-line (point))))
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
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")
3632 (or res ; Found a good prefix above.
3635 ;; prefix-line is the bol of a line on which we should try
3636 ;; to find the prefix.
3637 (let* (fb-string fb-endpos ; Contains any fallback prefix found.
3640 (when (and (looking-at prefix-regexp)
3658 ;; Search for a line which has text after the prefix
3663 (goto-char prefix-line)
3667 ;; first [ \t]* glob if the prefix is empty.
3671 ;; have whitespace after the prefix, we'll use it.
3688 (goto-char prefix-line)
3693 (goto-char prefix-line)
3698 ;; fallback that matches the comment prefix regexp.
3703 ;; There are ws or text after the prefix, so
3710 ;; use after the prefix.
3741 ;; the prefix.
3746 ;; The line doesn't match the comment prefix regexp.
3747 (if comment-prefix
3750 prefix-line (c-point 'boi))
3751 comment-prefix)
3753 (+ (current-column) (length comment-prefix))))
3757 ;; prefix at all and we should just fill it as
3762 (defun c-mask-paragraph (fill-paragraph apply-outside-literal fun &rest args)
3777 (let (fill
3790 ;; auto-fill-spaces is the exact sequence of whitespace between a
3793 auto-fill-spaces
3812 (setq c-lit-limits (c-literal-limits nil fill-paragraph)))
3881 (concat "\\=[ \t]*\\(" c-current-comment-prefix "\\)")
3916 c-current-comment-prefix
3920 ;; comment line prefix. IS THIS POSSIBLE? (ACM,
3939 (setq auto-fill-spaces (c-delete-and-extract-region
3942 ;; single or double spaces. auto-fill doesn't.
3943 (if fill-paragraph
3971 ;; Fake the fill prefix in the first line.
4011 ;; avoid that the adaptive fill mode gets the prefix from
4025 ;; Temporarily insert the fill prefix after the comment
4028 (setq fill (c-save-buffer-state nil
4029 (c-guess-fill-prefix c-lit-limits c-lit-type)))
4031 c-current-comment-prefix
4033 (car fill))
4034 ;; Oops, the prefix doesn't match the comment prefix
4036 ;; results with adaptive fill packages together with
4037 ;; the insert prefix magic below, since the prefix
4041 Warning: Regexp from `c-comment-prefix-regexp' doesn't match the comment prefix %S"
4042 (car fill)))
4044 ;; the fill prefix and make sure we're back in the
4050 c-current-comment-prefix
4055 (while (and (< (current-column) (cdr fill))
4063 (insert-and-inherit "\n" (car fill))
4071 (let ((fill-prefix
4072 (or fill-prefix
4073 ;; Kludge: If the function that adapts the fill prefix
4075 ;; line comments, then force it by setting fill-prefix.
4079 ;; doesn't override fill-context-prefix
4085 (or (fill-context-prefix beg end)
4088 (car (or fill (c-guess-fill-prefix
4124 (if (or fill-paragraph (not auto-fill-spaces))
4126 (insert auto-fill-spaces)
4127 (setq here (- here (- hang-ender-stuck (length auto-fill-spaces)))))
4134 (defun c-fill-paragraph (&optional arg)
4135 "Like \\[fill-paragraph] but handles C and C++ style comments.
4136 If any of the current line is a comment or within a comment, fill the
4139 `c-comment-prefix-regexp' and `c-block-comment-prefix' variables for
4142 If point is inside multiline string literal, fill it. This currently
4148 A very long description of something that you want to fill to make
4153 Optional prefix ARG means justify paragraph as well."
4155 (let ((fill-paragraph-function
4157 (if (not (eq fill-paragraph-function 'c-fill-paragraph))
4158 fill-paragraph-function)))
4159 (c-mask-paragraph t nil 'fill-paragraph arg))
4165 (defun c-do-auto-fill ()
4166 ;; Do automatic filling if not inside a context where it should be
4168 (let ((c-auto-fill-prefix
4170 ;; done in c-indent-new-comment-line, which do-auto-fill
4173 ;; also used to detect whether fill-prefix is user set or
4174 ;; generated automatically by do-auto-fill.
4175 fill-prefix))
4176 (c-mask-paragraph nil t 'do-auto-fill)))
4178 (defun c-indent-new-comment-line (&optional soft allow-auto-fill)
4181 indentation and line prefix are preserved (see the
4182 `c-comment-prefix-regexp' and `c-block-comment-prefix' variables for
4189 If a fill prefix is specified, it overrides all the above."
4190 ;; allow-auto-fill is used from c-context-line-break to allow auto
4192 ;; used from auto-fill itself, that's normally disabled to avoid
4195 (let ((fill-prefix fill-prefix)
4201 (newline (if allow-auto-fill nil 1)))))
4203 ;; c-context-line-break.
4209 (when (not (eq c-auto-fill-prefix t))
4210 ;; Called from do-auto-fill.
4218 c-ignore-auto-fill)
4219 (setq fill-prefix t) ; Used as flag in the cond.
4220 (if (and (null c-auto-fill-prefix)
4223 ;; The adaptive fill function has generated a prefix, but
4226 (setq fill-prefix nil)
4230 (or fill-prefix ""))))
4231 ;; Kludge: If the function that adapted the fill prefix
4234 (setq fill-prefix nil)))
4237 (cond ((eq fill-prefix t)
4238 ;; A call from do-auto-fill which should be ignored.
4240 (fill-prefix
4241 ;; A fill-prefix overrides anything.
4243 (insert-and-inherit fill-prefix))
4257 (let ((fill (c-save-buffer-state nil
4258 (c-guess-fill-prefix
4270 ;; Skip forward past the fill prefix in case
4285 (while (and (< (current-column) (cdr fill))
4292 ;; comment; insert the fill prefix at bol
4296 (insert-and-inherit (car fill))
4307 (insert-and-inherit (car fill))
4344 (c-newline-and-indent (if allow-auto-fill nil 1)))
4370 (defun c-context-line-break ()
4371 "Do a line break suitable to the context.
4374 according to the syntactic context, unless `c-syntactic-indentation'
4384 comment prefix (see the `c-comment-prefix-regexp' and
4385 `c-block-comment-prefix' variables for details). The end of a
4422 (fill-prefix nil))
4444 (defun c-context-open-line ()
4445 "Insert a line break suitable to the context and leave point before it.
4446 This is the `c-context-line-break' equivalent to `open-line', which is
4447 normally bound to C-o. See `c-context-line-break' for the details."
4455 (c-context-line-break))