Function: prolog-electric--colon

prolog-electric--colon is a byte-compiled function defined in prolog.el.gz.

Signature

(prolog-electric--colon)

Documentation

If prolog-electric-colon-flag is non-nil, insert the electric : construct.

That is, insert space (if appropriate), :- and newline if colon is pressed at the end of a line that starts in the first column (i.e., clause heads).

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/prolog.el.gz
(defun prolog-electric--colon ()
  "If `prolog-electric-colon-flag' is non-nil, insert the electric `:' construct.
That is, insert space (if appropriate), `:-' and newline if colon is pressed
at the end of a line that starts in the first column (i.e., clause heads)."
  (when (and prolog-electric-colon-flag
             (eq (char-before) ?:)
             (not current-prefix-arg)
             (eolp)
             (not (memq (char-after (line-beginning-position))
                        '(?\s ?\t ?\%))))
    (unless (memq (char-before (1- (point))) '(?\s ?\t))
      (save-excursion (forward-char -1) (insert " ")))
    (insert "-\n")
    (indent-according-to-mode)))