Lines Matching defs:line

27 (defsubst casl-indent-get-beg-of-line (&optional arg)
29 (beginning-of-line arg)
32 (defsubst casl-indent-get-end-of-line (&optional arg)
34 (end-of-line arg)
48 of a line.")
104 (defun casl-indent-empty-line-p ()
105 "Checks if the current line is empty."
107 (beginning-of-line)
126 (defun casl-indent-forward-line (&optional n)
127 "`forward-line' function."
128 (forward-line n)
131 (defun casl-indent-line-to (n)
132 "`indent-line-to' function."
133 (indent-line-to n)
152 preceding non-empty line."
158 ;; go backward until the first preceding empty line
159 (casl-indent-forward-line -1)
160 (while (and (not (casl-indent-empty-line-p))
162 (= 0 (casl-indent-forward-line -1))))
163 ;; go forward after the empty line
164 (if (casl-indent-empty-line-p)
165 (casl-indent-forward-line 1))
166 ;; find the first line of code which is not a comment
168 (= 0 (casl-indent-forward-line 1))))
204 (casl-indent-get-beg-of-line) t))))
213 "Returns the type of the line (also puts information in `match-data')."
215 ((casl-indent-empty-line-p) 'empty)
230 (defvar casl-indent-current-line-first-ident ""
231 "Global variable that keeps track of the first ident of the line to indent.")
233 (defun casl-indent-contour-line (start end)
238 (fl 0) ; number of lines that forward-line could not advance
249 (setq fl (casl-indent-forward-line -1))
312 "Finds indentation information for a line starting with a guard."
329 "Finds indentation information for a line starting with a rhs."
346 "Finds indentation information for a comment line.
347 If the previous line (between START and END) is also a comment line
351 indent at the same indentation as the previous line."
362 ;; no previous comment indent with previous line
391 "Finds indentation points for an empty line."
402 (last-line (= end end-visible))
456 "Finds indentation points for a line starting with an identifier."
467 (last-line (= end end-visible))
482 casl-indent-current-line-first-ident))
516 "Finds indentation points for a non-empty line starting with something other
528 (last-line (= end end-visible))
530 ; (string-match "where[ \t]*" casl-indent-current-line-first-ident))
564 (defun casl-indent-valdef-indentation (start end end-visible curr-line-type
568 (case curr-line-type
577 (defun casl-indent-line-indentation (line-start line-end end-visible
578 curr-line-type indent-info)
579 "Separate a line of program into valdefs between offside keywords
583 ;; point is (already) at line-start
584 (setq start-comment (casl-indent-in-comment line-start line-end))
586 (setq line-end (- start-comment 1))) ; end line before it
588 (while (re-search-forward casl-indent-off-side-keywords-re line-end t)
591 (if (casl-indent-in-comment line-start (point)) ; keyword in a {- comment
595 line-start ; end line before comment
596 (- (search-backward "%\{" line-start) 1)
597 end-visible curr-line-type indent-info))
599 (re-search-forward "\}%[ \t]*" line-end 'move)
600 (setq line-start (point)))
602 (if (< line-start beg-match) ; if off-side-keyword at the start
604 (casl-indent-valdef-indentation line-start beg-match
606 curr-line-type indent-info))
607 ;; but keep the start of the line if keyword alone on the line
608 (if (= line-end end-match)
610 (setq line-start end-match)
611 (goto-char line-start)))
613 (casl-indent-valdef-indentation line-start line-end end-visible
614 curr-line-type indent-info))))
618 "Returns a list of possible indentations for the current line that
622 indent-info open follow contour-line pt)
639 (end-of-line 0) ; put point at the end of preceding line before
641 (casl-indent-comment (casl-indent-get-beg-of-line)
644 (setq contour-line (casl-indent-contour-line start end))
645 (if contour-line
646 (let* ((curr-line-type (casl-indent-type-at-point))
647 line-start line-end end-visible)
649 (if (eq curr-line-type 'ident)
650 (progn ; guess the type of line
653 (casl-indent-get-end-of-line)))
657 (setq casl-indent-current-line-first-ident
659 (setq casl-indent-current-line-first-ident ""))))
660 (while contour-line ; explore the contour points
661 (setq line-start (pop contour-line))
662 (goto-char line-start)
663 (setq line-end (casl-indent-get-end-of-line))
665 (if contour-line ; next contour point
668 (casl-indent-point-to-col (car contour-line)))
670 line-end))
671 (if (and (not (casl-indent-open-structure start line-start))
672 (not (casl-indent-in-comment start line-start)))
674 (casl-indent-line-indentation line-start line-end
675 end-visible curr-line-type
704 (casl-indent-line-to (car indent-info)) ; insert indentation
713 (casl-indent-line-to (car indent-info)) ; insert indentation
741 (end-of-line 2) ; should be (forward-line 1)
742 (if (eobp) ; but it adds line at the end...
757 (make-local-variable 'indent-line-function)
758 (setq indent-line-function 'casl-indent-cycle)
768 (setq indent-line-function 'indent-to-left-margin)