Lines Matching +defs:offset +defs:indentation

40 ;; The final indentation function.
44 ;; offset
45 ;; Offset to where indentation should be added
49 (defun indent-text (indent offset &optional no-tabs
56 start (scan offset :eol :left)
57 line (read-text start (- offset start))
66 ;; Skip any spaces after offset, "paranoia check"
67 (while (member (char-after offset) indent-spaces)
68 (incf offset)
71 ;; Check if there are only spaces before `offset' and the line `start'
79 ;; Calculate `base' unmodifiable indentation, if any
90 ;; Calculate `current' indentation
100 ;; Maybe could also "optimize" the indentation even if it is already
120 (replace-text barrier offset string)
121 (and (>= offset point) (>= point barrier) (goto-char result))
127 ;; Helper function, returns indentation of a given offset
129 ;; is, use `offset' only as a line identifier
130 ;; If `resolve' is set, it means that the offset is just a hint, it
133 (defun offset-indentation (offset &key resolve align
137 (start (scan offset :eol :left))
154 ;; Increment offset to check next character
158 (setq line (read-text start (- offset start)))
173 (compile 'offset-indentation)
176 ;; A default/fallback indentation function, just copy indentation
182 (offset (scan (point) :eol :left))
194 ;; if indentation is disabled
200 (> (scan offset :eol :right) offset)
205 (setq left offset)
224 (indent-text (offset-indentation (+ left start) :align t) offset)
236 (defun indent-clear-empty-line (&aux left offset right line index)
238 offset (scan (point) :eol :left)
239 left (scan offset :eol :left :count 2)
244 (when (and (/= offset left) (/= left right))
258 ;; Macro to be called whenever an indentation rule decides that
380 ;; Create an indentation table. Basically a list of indentation tokens.
693 ;; Create an indentation table
798 ;; Returns offset of match, and it's length, if any
801 &aux start rule rulep matchp test offset length)
917 ;; Calculate offset and length of match
918 (setq offset 0 length 0)
921 offset (1+ offset)
934 (and (setq offset (search rule-pattern match-pattern :test #'eq))
939 (values offset length)
946 (defmacro indent-macro (ind-definition ind-offset &optional ind-no-tabs)
949 ;; Current indentation table
961 ;; indentation to be used
964 ;; offset to apply indentation
965 *offset*
979 ;; offset of match
980 *ind-offset*
988 (ind-from (scan ,ind-offset :eol :left))
989 (ind-to ,ind-offset)
1019 ;; Don't parse after this offset
1201 *ind-offset*
1209 (cons ind-change (cons *ind-offset* *ind-length*))
1306 *ind-offset* (cadar ind-matches)
1327 (- ind-right *ind-offset*)
1338 ;; wrong in the indentation definition...
1412 *ind-offset* (cadr item)
1422 (integerp *offset*)
1423 (indent-text *indent* *offset* ,ind-no-tabs)