Lines Matching defs:indent
26 (require "indent")
30 (defsynprop *prop-indent*
31 "indent"
40 ;; Boolean. Move cursor to the indent column after pressing <Enter>?
41 (:newline-indent . t)
49 (:only-newline-indent . nil)
52 ;; This should default to T when newline-indent is not NIL.
57 (:disable-indent . nil))
66 ;; Note that the indent lisp hook is only run on character additions, so
69 (defindent *python-mode-indent* :main
71 (indtoken "^\\s*" :indent
134 ((:indent :eol)
135 (:indent :expression :eol))
136 (setq *indent* (offset-indentation *offset* :resolve t))
140 (unless (/= (mod *indent* *base-indent*) 0)
142 (setq *indent* (offset-indentation *ind-offset* :resolve t)))
143 (indent-macro-reject-left))
149 ((:indent :expression :collon :eol))
150 (setq *indent* (+ *base-indent* (offset-indentation *ind-offset* :resolve t)))
151 (indent-macro-reject-left))
154 (setq *indent* (- *indent* (mod *indent* *base-indent*))))
160 (setq *indent* (+ *base-indent*
163 (setq *indent* (- (offset-indentation *ind-offset* :resolve t)
165 *base-indent* 0))))
170 (defun python-offset-indent (&aux char (point (point)))
172 (while (member (setq char (char-after point)) indent-spaces)
176 (compile 'python-offset-indent)
179 (defun python-should-indent (options &aux point start end offset)
183 (indent-clear-empty-line))
186 (and (gethash :disable-indent options)
187 (return-from python-should-indent))
194 ;; if at bol and should indent only when starting a line
195 (and (gethash :only-newline-indent options)
196 (return-from python-should-indent (= point start)))
200 (return-from python-should-indent (gethash :newline-indent options)))
204 (return-from python-should-indent t))
209 (member (char-after offset) indent-spaces))
213 (return-from python-should-indent (or (= offset end) (= offset (1- point))))
215 ;; Should not indent
218 (compile 'python-should-indent)
221 (defun python-indent (syntax syntable)
224 *base-indent*)
226 (or (python-should-indent options) (return-from python-indent))
228 *base-indent* (gethash :indentation options 4))
230 (indent-macro
231 *python-mode-indent*
232 (python-offset-indent)
235 (compile 'python-indent)
243 (defsyntax *python-mode* :main nil #'python-indent *python-mode-options*
254 (syntoken "^\\s+" :property *prop-indent*)