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

Lines Matching +defs:indent +defs:string

61 (defun c-indent-line (&optional syntax quiet ignore-point-pos)
107 (c-save-buffer-state (indent)
110 (setq indent (c-get-syntactic-indentation
114 (message "syntax: %s, indent: %d"
115 c-syntactic-context indent))
116 (setq shift-amt (- indent (current-indentation))))
118 (run-hooks 'c-special-indent-hook)
121 (let ((indent 0))
126 (setq indent (current-indentation))
128 (setq shift-amt (- indent (current-indentation)))
133 (indent-to bs-col)
140 (defun c-newline-and-indent (&optional newline-arg)
141 "Insert a newline and indent the new line.
144 `indent-according-to-mode', so that lineup functions like
150 ;; Avoid calling c-backslash-region from c-indent-line if it's
153 ;; want any backslash alignment from indent-according-to-mode.
169 (indent-to col)
190 ;; wasted, since c-indent-line might look at the current
204 (indent-according-to-mode))
221 ;; `c-indent-line', to be consistent.
243 (indent-for-comment)
274 (bare-mode-name (if (string-match "\\(^[^/]*\\)/" mode-name)
293 functions and the electric keys indent according to the syntactic
298 nonempty line, and \\[c-indent-command] adjusts the indentation in steps
301 e.g. `c-special-indent-hook'.
697 (indent-according-to-mode))
708 (c-indent-line ln-syntax))
723 (c-newline-and-indent)))
804 ;; very well indent differently due to them, e.g. if
805 ;; c-indent-one-line-block is used together with the
808 (c-indent-line)))
812 (c-newline-and-indent))
873 (indent-according-to-mode))))
879 comment-only-line, indent the line as a comment. If a numeric ARG is
901 (indent-according-to-mode))
938 (c-indent-line))
959 (c-indent-line c-syntactic-context))
973 (c-newline-and-indent))
1006 (indent-according-to-mode))
1026 ;; indent the current line if it's done syntactically.
1031 (indent-according-to-mode))
1070 (c-newline-and-indent)
1075 (c-newline-and-indent))
1179 (indent-according-to-mode)))
1215 (indent-according-to-mode))
1323 (indent-according-to-mode)
1478 ;; outside any comment/string or macro.
1537 ;; Move back out of any macro/comment/string we happen to be in.
1583 ;; outside any comment/string or macro.
1640 ;; Move back out of any macro/comment/string we happen to be in.
1986 (defun c-beginning-of-sentence-in-string (range)
1987 ;; Move backwards to the "beginning of a sentence" within the string defined
1989 ;; string quotes). If we find a BOS, return NIL. Otherwise, move point to
1990 ;; just before the start of the string and return T.
2010 (paragraph-start c-string-par-start)
2011 (paragraph-separate c-string-par-separate)
2044 (defun c-end-of-sentence-in-string (range)
2045 ;; Move forward to the "end of a sentence" within the string defined by
2047 ;; return NIL. Otherwise, move point to just after the end of the string
2053 ;; string will count as EOS, providing we're not already in it.
2065 (paragraph-start c-string-par-start)
2066 (paragraph-separate c-string-par-separate)
2077 ;; string. Therefore we simulate it by the following:
2091 ;; Did we move a sentence, or did we hit the end of the string?
2098 ;; Point is not in a literal (i.e. comment or string (include AWK regexp)).
2115 ;; An EOL can act as an "open string" terminator in AWK.
2116 (looking-at c-ws*-string-limit-regexp)
2119 (looking-at c-string-limit-regexp))))
2120 (goto-char (match-end 0)) ; just after the string terminator.
2122 (c-safe (c-backward-sexp 1) ; move back over the string.
2126 ;; Point is not in a literal (i.e. comment or string (include AWK regexp)).
2136 (if (looking-at c-string-limit-regexp) ; string-delimiter.
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
2272 ;; Stop at the token after a string.
2273 ((looking-at c-string-limit-regexp) ; Just gone back over a string terminator?
2283 ;; (i.e. a comment/string) or the boundary of a preprocessor statement or
2392 ;; Found a string (this subsumes AWK regexps)?
2393 ((looking-at c-string-limit-regexp)
2405 (defun c-one-line-string-p (range)
2406 ;; Is the literal defined by RANGE a string contained in a single line?
2411 (and (looking-at c-string-limit-regexp)
2421 comment or multiline string, move by sentences instead of statements.
2460 ;; Single line string or sentence-flag is null => skip the
2463 (c-one-line-string-p range))
2475 ;; Comment inside a statement or a multi-line string.
2477 (if (eq (c-literal-type range) 'string)
2478 (c-beginning-of-sentence-in-string range)
2521 comment or multiline string, move by sentences instead of statements.
2558 ;; or a Single line string.
2560 (c-one-line-string-p range))
2566 ;; Comment or multi-line string.
2568 (if (eq (c-literal-type range) 'string)
2569 (c-end-of-sentence-in-string range)
2628 (defun c-calc-comment-indent (entry)
2631 (setq entry (or (assq entry c-indent-comment-alist)
2632 (assq 'other c-indent-comment-alist)
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."
2693 c-indent-comments-syntactically-p)
2696 ;; because indent-for-comment hasn't put the comment-start
2711 (c-calc-comment-indent line-type)))))
2809 ;; whitespace, search first for a string
2819 (let (dchange (directive (match-string 1)))
2820 (cond ((string= directive "if")
2822 ((string= directive "endif")
2832 ((string= directive "elif")
2868 ;; commands to indent lines, regions, defuns, and expressions
2869 (defun c-indent-command (&optional arg)
2872 If `c-tab-always-indent' is t, always just indent the current line.
2873 If nil, indent the current line only if point is at the left margin or
2880 means indent rigidly all the lines of the expression starting after
2893 depending on the variable `indent-tabs-mode'."
2896 (let ((indent-function
2898 (symbol-function 'indent-according-to-mode)
2914 ;; If c-syntactic-indentation and got arg, always indent this
2921 (c-indent-line)
2927 (if (eq c-tab-always-indent t)
2936 (indent-code-rigidly beg end shift-amt "#")))
2937 ;; Else use c-tab-always-indent to determine behavior.
2939 ;; CASE 1: indent when at column zero or in line's indentation,
2941 ((not c-tab-always-indent)
2946 (funcall indent-function)))
2947 ;; CASE 2: just indent the line
2948 ((eq c-tab-always-indent t)
2949 (funcall indent-function))
2950 ;; CASE 3: if in a literal, insert a tab, but always indent the
2955 (funcall indent-function)
2958 (defun c-indent-exp (&optional shutup-p)
2980 (error "Cannot find start of balanced expression to indent"))
2985 (error "Cannot find end of balanced expression to indent"))
2988 (c-indent-region (point) end)))))
2992 (defun c-indent-defun ()
3008 (c-indent-region (car decl-limits)
3013 (defun c-indent-region (start end &optional quiet)
3041 (c-progress-init start end 'c-indent-region)
3050 ;; Get syntax and indent.
3060 (c-indent-line syntax t t)
3069 (c-indent-line syntax t t)
3074 (c-progress-fini 'c-indent-region))
3083 (defun c-indent-line-or-region ()
3084 "When the region is active, indent it syntactically. Otherwise
3085 indent the current line syntactically."
3089 (c-indent-region (region-beginning) (region-end))
3090 (c-indent-line)))
3182 ;; e.g. c-newline-and-indent consistent regardless whether
3203 ;; touched in c-newline-and-indent.
3248 ;; called from c-newline-and-indent).
3314 ;; Don't realign backslashes in string literals
3325 (indent-to column))
3337 (indent-to column 1)))
3395 ;; possible to make them work correctly wrt the comment and string
3411 ;; comment. Return a cons of the prefix string and the column where
3476 ;; have to temporarily insert and indent a new line to
3483 (indent-to (prog1 (current-column)
3493 (if (or (string-match "\\s \\'" str) (not (eolp)))
3543 (setq comment-prefix (match-string 1))
3553 ;; the prefix really is the empty string.
3584 ;; `comment-prefix' on a line and indent it to find the
3603 0 (string-match
3620 (indent-according-to-mode)
3637 (let* (fb-string fb-endpos ; Contains any fallback prefix found.
3648 (unless fb-string
3652 (setq fb-string (buffer-substring-no-properties
3672 (throw 'found (cons fb-string
3696 (when fb-string
3699 (cond ((or (string-match "\\s \\'" fb-string)
3705 (cons fb-string (current-column)))
3719 (setq fb-string (buffer-substring-no-properties
3732 (insert-and-inherit fb-string)
3742 (cons (concat fb-string " ")
3773 ;; only if the point turns out to be inside a comment or a string.
3782 ;; cons of the positions of the prepended string. tmp-post is
3784 ;; string.
3834 ;; For each of the possible types of text (string, C comment ...)
3932 ;; before the string we replace.
3958 ;; Point was in the middle of the string we
3976 ((eq c-lit-type 'string) ; String.
4030 (unless (string-match (concat "\\`[ \t]*\\("
4083 (not (string-match
4118 ;; Preserve point even if it's in the middle of the string
4142 If point is inside multiline string literal, fill it. This currently
4144 is the very first thing in the string. The intended use for this rule
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.
4228 (not (string-match (concat "\\`[ \t]*"
4316 (unless (string-match "[ \t]*/\\*" comment-start)
4318 (unless (string-match "[ \t]*//" comment-start)
4328 ;; c-comment-indent may look at the current
4331 (indent-to col)
4333 (indent-for-comment))))
4341 ;; doesn't indent the next line syntactically, and otoh a
4344 (c-newline-and-indent (if allow-auto-fill nil 1)))
4353 (indent-to col))))))
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
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
4388 When point is inside a string, only insert a backslash when it is also
4410 ; it, not in a string, and not in the
4412 (not (eq c-lit-type 'string))
4423 (c-indent-new-comment-line nil t)))
4425 ((eq c-lit-type 'string)
4433 ;; c-indent-line may look at the current indentation, so let's
4441 (indent-to col))
4442 (indent-according-to-mode)))))