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

Lines Matching +defs:indent +defs:string

37 ;; it more correct with arbitrary string and comment contents.
118 ;; string delimiters. Fixme: Is there a better way?
123 (group (syntax string-quote)) ; maybe gets property
142 ;; should be treated as part of the string.
149 ;; Fixme: """""" goes wrong (due to syntax-ppss not getting the string
154 ;; Consider property for the last char if in a fenced string.
162 (eval-when-compile (string-to-syntax "|"))))))
169 (eval-when-compile (string-to-syntax "|"))))
170 ;; Otherwise (we're in a non-matching string) the property is
179 ;; Returns the string or comment face as usual, with side effect of putting
180 ;; a `syntax-table' property on the inside of the string or comment which is
190 ;; 'font-lock-string-face)
212 (define-key map "\C-c\C-s" 'python-send-string)
280 ;; eric has items including: (un)indent, (un)comment, restart script,
287 (let ((symbol (string-to-syntax "_"))
305 (defsubst python-in-string/comment ()
306 "Return non-nil if point is in a Python literal (a comment or string)."
368 (defun python-beginning-of-string ()
369 "Go to beginning of string around point.
370 Do nothing if not in string."
372 (when (eq 'string (syntax-ppss-context state))
387 The criteria are that the line isn't a comment or in string and
401 (not (python-in-string/comment))
411 (defcustom python-indent 4
413 See also `\\[python-guess-indent]'"
416 (put 'python-indent 'safe-local-variable 'integerp)
418 (defcustom python-guess-indent t
419 "Non-nil means Python mode guesses `python-indent' for the buffer."
423 (defcustom python-indent-string-contents t
424 "Non-nil means indent contents of multi-line strings together.
425 This means indent them the same as the preceding non-blank line.
435 "Non-nil means indent relative to preceding comment line.
449 (defun python-guess-indent ()
451 Set `python-indent' locally to the value guessed."
457 (let (done indent)
468 (setq indent (- (current-indentation) initial)))
469 (if (and indent (>= indent 2) (<= indent 8)) ; sanity check
472 (when (/= indent (default-value 'python-indent))
473 (set (make-local-variable 'python-indent) indent)
474 (unless (= tab-width python-indent)
475 (setq indent-tabs-mode nil)))
476 indent)))))
480 (defvar python-indent-list nil
483 (defvar python-indent-list-length nil
486 (defvar python-indent-index nil
491 (setq python-indent-list nil
492 python-indent-list-length 1)
498 ((eq 'string (syntax-ppss-context syntax)) ; multi-line string
499 (if (not python-indent-string-contents)
501 ;; Only respect `python-indent-string-contents' in doc
505 (looking-at (rx (or (syntax string-delimiter)
506 (syntax string-quote))))))
508 ;; Find indentation of preceding non-blank line within string.
535 (+ python-indent (current-column))
537 ;; Otherwise indent relative to statement start, one
541 (+ (current-indentation) (* (car syntax) python-indent))))
553 python-indent
579 ;; Prefer to indent comments with an immediately-following
584 (when (and (> python-indent-list-length 1)
588 (let ((elt (assq (current-indentation) python-indent-list)))
589 (setq python-indent-list
590 (nconc (delete elt python-indent-list)
592 (caar (last python-indent-list)))))))
627 It is assumed not to be a continuation line or in a multi-line string.
634 levels indent)
640 (setq indent (current-indentation))
646 (setq indent (+ python-indent indent)))))
647 (push (cons indent initial) levels))
669 ;; Not sensible to indent to the same level as
681 (setq python-indent-list levels
682 python-indent-list-length (length python-indent-list))))))
684 ;; This is basically what `python-indent-line' would be if we didn't
686 (defun python-indent-line-1 (&optional leave)
687 "Subroutine of `python-indent-line'.
695 (and leave python-indent-list
696 (assq (current-indentation) python-indent-list)))
701 (indent-to target)
705 (defun python-indent-line ()
707 When invoked via `indent-for-tab-command', cycle through possible
709 different from `indent-for-tab-command', i.e. successive TABs do
712 (if (and (eq this-command 'indent-for-tab-command)
714 (if (= 1 python-indent-list-length)
716 (progn (setq python-indent-index
717 (% (1+ python-indent-index) python-indent-list-length))
720 (indent-to (car (nth python-indent-index python-indent-list)))
722 (let ((text (cdr (nth python-indent-index
723 python-indent-list))))
726 (python-indent-line-1)
727 (setq python-indent-index (1- python-indent-list-length))))
729 (defun python-indent-region (start end)
730 "`indent-region-function' for Python.
731 Leaves validly-indented lines alone, i.e. doesn't indent to
740 (python-indent-line-1 t))
789 (not (python-in-string/comment)))
808 (python-in-string/comment))) ; just loop
819 (python-in-string/comment)))) ; just loop
843 (python-beginning-of-string)
851 (python-beginning-of-string)
890 ((eq 'string (syntax-ppss-context s))
891 ;; Go to start of string and skip it.
967 ;; this is in string.
1037 (unless (python-in-string/comment)
1039 (name (match-string-no-properties 3)))
1057 (unless (python-in-string/comment)
1058 (push (cons (match-string 1) (match-beginning 1))
1079 (not (python-in-string/comment))
1081 (python-indent-line))) ; OK, do it
1096 (let ((indent 0)
1102 (setq indent (max indent (car x)))))
1103 (setq initial (cdr (assq indent indents)))
1107 (indent-to indent))))
1115 :type 'string
1127 (list (read-string "Checker command: "
1152 :type 'string)
1158 :type 'string)
1264 (not (string-match inferior-python-filter-regexp str)))
1267 (defun python-args-to-list (string)
1268 (let ((where (string-match "[ \t]" string)))
1269 (cond ((null where) (list string))
1271 (cons (substring string 0 where)
1272 (python-args-to-list (substring string (+ 1 where)))))
1273 (t (let ((pos (string-match "[^ \t]" string)))
1274 (if pos (python-args-to-list (substring string pos))))))))
1292 (while (string-match "\n" s start)
1296 (string-match comint-prompt-regexp line))
1300 (if (and (string-match "\\`_emacs_out \\(.*\\)\n\\'" line)
1303 (setq python-preoutput-result (match-string 1 line))
1308 (cond ((and (string-match comint-prompt-regexp s)
1315 (string-match ".\\'" res))))
1324 ;; The leftover string is a prefix of _emacs_out so we don't know
1351 (list (read-string "Run Python: " python-command) nil t)
1398 "Like `python-send-string' but resets `compilation-shell-minor-mode'.
1400 ;; (assert (not (string-match "\n" command)))
1405 (python-send-string command)
1451 (defun python-send-string (string)
1454 (comint-send-string (python-proc) string)
1455 (unless (string-match "\n\\'" string)
1457 (comint-send-string (python-proc) "\n"))
1458 (when (string-match "\n[ \t].*\n?\\'" string)
1459 ;; If the string contains a final indented line, add a second newline so
1461 (comint-send-string (python-proc) "\n")))
1521 (if (string-match "\\.py\\'" file-name)
1587 (list (read-string (if symbol
1612 (defun python-send-receive (string)
1615 (python-send-string string)
1660 (let* ((version (let ((s (shell-command-to-string (concat python-command
1662 (string-match "^Python \\([0-9]+\\.[0-9]+\\>\\)" s)
1663 (match-string 1 s)))
1714 :type '(repeat string)
1730 (match-string 2))))
1742 (if (member (match-string 1) python-jython-packages)
1751 of the current line is in or at the end of a multi-line string.
1757 ;; string properly, so narrow to the string and then fill around
1765 (cond ((eq t (nth 3 syntax)) ; in fenced string
1766 (goto-char (nth 8 syntax)) ; string start
1771 ; string
1783 ;; Make sure that fenced-string delimiters that stand
1791 COUNT defaults to `python-indent'. If region isn't active, just shift
1800 (setq count python-indent))
1809 (indent-rigidly start end (- count)))))
1815 COUNT defaults to `python-indent'. If region isn't active, just shift
1823 (setq count python-indent))
1824 (indent-rigidly start end count))
1828 The level is the number of `python-indent' steps of indentation
1830 (1+ (/ (current-indentation) python-indent)))
1847 (push (match-string 1) accum)))
1904 ;; The output ends up in the wrong place if the string we
1907 (replace-regexp-in-string "\n" "\\n"
1913 "Return a list of completions of the string SYMBOL from Python process.
1919 (car (read-from-string
1926 #'string<))))
1964 ((not (string= symbol completion))
1978 (he-init-string (- (point) (length symbol)) (point))
1979 (if (not (he-string-member he-search-string he-tried-table))
1980 (push he-search-string he-tried-table))
1984 (he-string-member (car he-expand-list) he-tried-table))
1988 (he-substitute-string (pop he-expand-list))
1990 (if old (he-reset-string))
2035 (put 'def-python-skeleton 'lisp-indent-function 2)
2254 (set (make-local-variable 'indent-line-function) #'python-indent-line)
2255 (set (make-local-variable 'indent-region-function) #'python-indent-region)
2288 '((< '(backward-delete-char-untabify (min python-indent
2297 (when python-guess-indent (python-guess-indent))
2299 (unless (= tab-width python-indent)
2300 (setq indent-tabs-mode nil))
2311 (set (make-local-variable 'indent-tabs-mode) nil)))