Function: prolog-electric--dash

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

Signature

(prolog-electric--dash)

Documentation

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

that is, insert space (if appropriate), --> and newline if dash is pressed at the end of a line that starts in the first column (i.e., DCG heads).

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/prolog.el.gz
(defun prolog-electric--dash ()
  "If `prolog-electric-dash-flag' is non-nil, insert the electric `-' construct.
that is, insert space (if appropriate), `-->' and newline if dash is pressed
at the end of a line that starts in the first column (i.e., DCG heads)."
  (when (and prolog-electric-dash-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)))