Function: dcl-electric-character

dcl-electric-character is an interactive and byte-compiled function defined in dcl-mode.el.gz.

Signature

(dcl-electric-character ARG)

Documentation

Insert a character and indent if necessary.

Insert a character if the user gave a numeric argument or the flag dcl-electric-characters is not set. If an argument was given, insert that many characters.

The line is only reindented if the word just typed matches any of the regexps in dcl-electric-reindent-regexps.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/dcl-mode.el.gz
;;;-------------------------------------------------------------------------
(defun dcl-electric-character (arg)
  "Insert a character and indent if necessary.
Insert a character if the user gave a numeric argument or the flag
`dcl-electric-characters' is not set.  If an argument was given,
insert that many characters.

The line is only reindented if the word just typed matches any of the
regexps in `dcl-electric-reindent-regexps'."
  (interactive "*P")
  (if (or arg (not dcl-electric-characters))
      (if arg
          (self-insert-command (prefix-numeric-value arg))
        (self-insert-command 1))
    ;; Insert the character and indent
    (self-insert-command 1)
    (let ((case-fold-search t))
      ;; There must be a better way than (memq t ...).
      ;; (apply 'or ...) didn't work
      (if (memq t (mapcar #'dcl-was-looking-at dcl-electric-reindent-regexps))
          (dcl-indent-line)))))