Function: perl-electric-terminator

perl-electric-terminator is an interactive and byte-compiled function defined in perl-mode.el.gz.

This command is obsolete since 24.4; use electric-indent-mode(var)/electric-indent-mode(fun) instead.

Signature

(perl-electric-terminator ARG)

Documentation

Insert character and maybe adjust indentation.

If at end-of-line, and not in a comment or a quote, correct the indentation.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/perl-mode.el.gz
(defun perl-electric-terminator (arg)
  "Insert character and maybe adjust indentation.
If at end-of-line, and not in a comment or a quote, correct the indentation."
  (interactive "P")
  (let ((insertpos (point)))
    (and (not arg)			; decide whether to indent
	 (eolp)
	 (save-excursion
	   (beginning-of-line)
	   (and (not			; eliminate comments quickly
		 (and comment-start-skip
		      (re-search-forward comment-start-skip insertpos t)) )
		(or (/= last-command-event ?:)
		    ;; Colon is special only after a label ....
		    (looking-at "\\s-*\\(\\w\\|\\s_\\)+$"))
		(let ((pps (parse-partial-sexp
			    (perl-beginning-of-function) insertpos)))
		  (not (or (nth 3 pps) (nth 4 pps) (nth 5 pps))))))
	 (progn				; must insert, indent, delete
	   (insert-char last-command-event 1)
	   (perl-indent-line)
	   (delete-char -1))))
  (self-insert-command (prefix-numeric-value arg)))