Function: antlr-electric-character

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

Signature

(antlr-electric-character &optional ARG)

Documentation

Insert the character you type and indent the current line.

Insert the character like self-insert-command and indent the current line as antlr-indent-command does. Do not indent the line if

 * this command is called with a prefix argument ARG,
 * there are characters except whitespaces between point and the
   beginning of the line, or
 * point is not inside a normal grammar code, { and } are also OK in
   actions.

This command is useful for a character which has some special meaning in ANTLR's syntax and influences the auto indentation, see antlr-indent-item-regexp.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/antlr-mode.el.gz
(defun antlr-electric-character (&optional arg)
  "Insert the character you type and indent the current line.
Insert the character like `self-insert-command' and indent the current
line as `antlr-indent-command' does.  Do not indent the line if

 * this command is called with a prefix argument ARG,
 * there are characters except whitespaces between point and the
   beginning of the line, or
 * point is not inside a normal grammar code, { and } are also OK in
   actions.

This command is useful for a character which has some special meaning in
ANTLR's syntax and influences the auto indentation, see
`antlr-indent-item-regexp'."
  (interactive "*P")
  (if (or arg
	  (save-excursion (skip-chars-backward " \t") (not (bolp)))
	  (with-syntax-table antlr-action-syntax-table
	    (antlr-invalidate-context-cache)
	    (let ((context (antlr-syntactic-context)))
	      (not (and (numberp context)
			(or (zerop context)
			    (memq last-command-event '(?\{ ?\}))))))))
      (self-insert-command (prefix-numeric-value arg))
    (self-insert-command (prefix-numeric-value arg))
    (antlr-indent-line)))