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

Lines Matching defs:indent

215   (make-local-variable 'indent-line-function)
216 (setq indent-line-function 'lisp-indent-line)
217 (make-local-variable 'indent-region-function)
218 (setq indent-region-function 'lisp-indent-region)
262 (define-key map "\t" 'lisp-indent-line)
263 (define-key map "\e\C-q" 'indent-sexp)
283 (define-key emacs-lisp-mode-map "\e\C-q" 'indent-pp-sexp)
301 (define-key map [indent-region] '("Indent Region" . indent-region))
302 (define-key map [indent-line] '("Indent Line" . lisp-indent-line))
305 (put 'indent-region 'menu-enable 'mark-active)))
422 (define-key map "\e\C-q" 'indent-pp-sexp)
764 (define-obsolete-function-alias 'lisp-comment-indent 'comment-indent-default)
781 (defvar lisp-indent-offset nil
782 "If non-nil, indent second line of expressions that many more columns.")
783 (defvar lisp-indent-function 'lisp-indent-function)
785 (defun lisp-indent-line (&optional whole-exp)
787 With argument, indent any additional lines of the same expression
790 (let ((indent (calculate-lisp-indent)) shift-amt end
794 (if (or (null indent) (looking-at "\\s<\\s<\\s<"))
801 (progn (indent-for-comment) (forward-char -1))
802 (if (listp indent) (setq indent (car indent)))
803 (setq shift-amt (- indent (current-column)))
807 (indent-to indent)))
822 (indent-code-rigidly beg end shift-amt)))))
824 (defvar calculate-lisp-indent-last-sexp)
826 (defun calculate-lisp-indent (&optional parse-start)
828 In usual case returns an integer: the column to indent to.
835 Then COLUMN is the column to indent to, and CONTAINING-SEXP-START
839 (let ((indent-point (point))
842 (desired-indent nil)
844 calculate-lisp-indent-last-sexp containing-sexp)
849 (while (< (point) indent-point)
850 (setq state (parse-partial-sexp (point) indent-point 0)))
856 (setq calculate-lisp-indent-last-sexp (elt state 2))
861 (if (and calculate-lisp-indent-last-sexp
862 (> calculate-lisp-indent-last-sexp (point)))
864 (let ((peek (parse-partial-sexp calculate-lisp-indent-last-sexp
865 indent-point 0)))
871 (if (not calculate-lisp-indent-last-sexp)
872 ;; indent-point immediately follows open paren.
874 (setq desired-indent (current-column))
876 (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
882 calculate-lisp-indent-last-sexp)
885 (if (= (point) calculate-lisp-indent-last-sexp)
890 ;; argument of the function call) and indent under.
893 calculate-lisp-indent-last-sexp
898 ;; `calculate-lisp-indent-last-sexp'. Again, it's
900 (goto-char calculate-lisp-indent-last-sexp)
902 (parse-partial-sexp (point) calculate-lisp-indent-last-sexp
905 ;; Point is at the point to indent under unless we are inside a string.
906 ;; Call indentation hook except when overridden by lisp-indent-offset
908 (let ((normal-indent (current-column)))
912 ((and (integerp lisp-indent-offset) containing-sexp)
915 (+ (current-column) lisp-indent-offset))
916 ;; in this case calculate-lisp-indent-last-sexp is not nil
917 (calculate-lisp-indent-last-sexp
920 (and lisp-indent-function
922 (funcall lisp-indent-function indent-point state))
930 (goto-char indent-point)
933 (> calculate-lisp-indent-last-sexp
936 (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
939 indent)
940 (goto-char calculate-lisp-indent-last-sexp)
942 (setq indent (current-column)))
946 (setq indent (current-column))))
947 indent))
950 normal-indent))
951 ;; in this case calculate-lisp-indent-last-sexp is nil
952 (desired-indent)
954 normal-indent))))))
956 (defun lisp-indent-function (indent-point state)
957 "This function is the normal value of the variable `lisp-indent-function'.
959 called function says anything special about how to indent the line.
962 Point is located at the point to indent under (for default indentation);
966 which has a non-nil property `lisp-indent-function',
968 * `defun', meaning indent `defun'-style;
969 * an integer N, meaning indent the first N arguments specially
970 like ordinary function arguments and then indent any further
977 (let ((normal-indent (current-column)))
979 (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
985 calculate-lisp-indent-last-sexp))
986 (progn (goto-char calculate-lisp-indent-last-sexp)
989 calculate-lisp-indent-last-sexp 0 t)))
991 ;; line as calculate-lisp-indent-last-sexp. Note that first
999 (setq method (or (get (intern-soft function) 'lisp-indent-function)
1000 (get (intern-soft function) 'lisp-indent-hook)))
1005 (lisp-indent-defform state indent-point))
1007 (lisp-indent-specform method state
1008 indent-point normal-indent))
1010 (funcall method indent-point state)))))))
1012 (defvar lisp-body-indent 2
1013 "Number of columns to indent the second line of a `(def...)' form.")
1015 (defun lisp-indent-specform (count state indent-point normal-indent)
1018 body-indent containing-form-column)
1021 ;; function symbol. lisp-indent-function guarantees that there is at
1026 (setq body-indent (+ lisp-body-indent containing-form-column))
1030 (parse-partial-sexp (point) indent-point 1 t)
1031 (while (and (< (point) indent-point)
1036 (parse-partial-sexp (point) indent-point 1 t))
1041 ;; lisp-body-indent, else normal indent. With lisp-body-indent bound
1046 ;; (list normal-indent containing-form-start).
1048 (list (+ containing-form-column (* 2 lisp-body-indent))
1050 (list normal-indent containing-form-start))
1051 ;; A non-distinguished form. Use body-indent if there are no
1054 ;; distinguished form has indentation at least as great as body-indent.
1056 (and (= count 0) (<= body-indent normal-indent)))
1057 body-indent
1058 normal-indent))))
1060 (defun lisp-indent-defform (state indent-point)
1066 (+ lisp-body-indent (current-column)))))
1069 ;; (put 'progn 'lisp-indent-function 0), say, causes progn to be indented
1073 (put 'lambda 'lisp-indent-function 'defun)
1074 (put 'autoload 'lisp-indent-function 'defun)
1075 (put 'progn 'lisp-indent-function 0)
1076 (put 'prog1 'lisp-indent-function 1)
1077 (put 'prog2 'lisp-indent-function 2)
1078 (put 'save-excursion 'lisp-indent-function 0)
1079 (put 'save-window-excursion 'lisp-indent-function 0)
1080 (put 'save-selected-window 'lisp-indent-function 0)
1081 (put 'save-restriction 'lisp-indent-function 0)
1082 (put 'save-match-data 'lisp-indent-function 0)
1083 (put 'save-current-buffer 'lisp-indent-function 0)
1084 (put 'with-current-buffer 'lisp-indent-function 1)
1085 (put 'combine-after-change-calls 'lisp-indent-function 0)
1086 (put 'with-output-to-string 'lisp-indent-function 0)
1087 (put 'with-temp-file 'lisp-indent-function 1)
1088 (put 'with-temp-buffer 'lisp-indent-function 0)
1089 (put 'with-temp-message 'lisp-indent-function 1)
1090 (put 'with-syntax-table 'lisp-indent-function 1)
1091 (put 'let 'lisp-indent-function 1)
1092 (put 'let* 'lisp-indent-function 1)
1093 (put 'while 'lisp-indent-function 1)
1094 (put 'if 'lisp-indent-function 2)
1095 (put 'read-if 'lisp-indent-function 2)
1096 (put 'catch 'lisp-indent-function 1)
1097 (put 'condition-case 'lisp-indent-function 2)
1098 (put 'unwind-protect 'lisp-indent-function 1)
1099 (put 'with-output-to-temp-buffer 'lisp-indent-function 1)
1100 (put 'eval-after-load 'lisp-indent-function 1)
1101 (put 'dolist 'lisp-indent-function 1)
1102 (put 'dotimes 'lisp-indent-function 1)
1103 (put 'when 'lisp-indent-function 1)
1104 (put 'unless 'lisp-indent-function 1)
1106 (defun indent-sexp (&optional endpos)
1108 If optional arg ENDPOS is given, indent each line, stopping when
1111 (let ((indent-stack (list nil))
1114 ;; so that calculate-lisp-indent will find the beginning of
1117 ;; since every line we indent is more deeply nested than point is.
1120 last-depth bol outer-loop-done inner-loop-done state this-indent)
1131 ;; to indent the next line.
1141 ;; indent it now with indent-for-comment.
1146 (progn (indent-for-comment)
1160 (setq indent-stack (nconc indent-stack
1176 (setq indent-stack (cdr indent-stack)
1179 (setq indent-stack (cons nil indent-stack)
1181 ;; Now indent the next line according
1186 ;; (except for double-semi comments; indent them as usual).
1189 (if (and (car indent-stack)
1190 (>= (car indent-stack) 0))
1191 (setq this-indent (car indent-stack))
1192 (let ((val (calculate-lisp-indent
1193 (if (car indent-stack) (- (car indent-stack))
1196 (setq this-indent val)
1198 (setcar indent-stack
1199 (setq this-indent val))
1200 (setcar indent-stack (- (car (cdr val))))
1201 (setq this-indent (car val))))))
1202 (if (and this-indent (/= (current-column) this-indent))
1204 (indent-to this-indent)))))
1209 (defun lisp-indent-region (start end)
1215 (lisp-indent-line))
1216 (indent-sexp endmark)
1219 (defun indent-pp-sexp (&optional arg)
1231 (indent-sexp))
1291 (defun indent-code-rigidly (start end arg &optional nochange-regexp)
1298 means don't indent that line."
1314 ;; If line does not start in string, indent it
1315 (let ((indent (current-indentation)))
1318 (indent-to (max 0 (+ indent arg)) 0))))