Function: cperl-electric-lbrace
cperl-electric-lbrace is an interactive and byte-compiled function
defined in cperl-mode.el.gz.
Signature
(cperl-electric-lbrace ARG &optional END)
Documentation
Insert character ARG, correct line's indentation, correct quoting by space.
Do not look beyond END.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cperl-mode.el.gz
(defun cperl-electric-lbrace (arg &optional end)
"Insert character ARG, correct line's indentation, correct quoting by space.
Do not look beyond END."
(interactive "P")
(let ((cperl-brace-recursing t)
(cperl-auto-newline cperl-auto-newline)
(other-end (or end
(if (and cperl-electric-parens-mark
(region-active-p)
(> (mark) (point)))
(save-excursion
(goto-char (mark))
(point-marker))
nil)))
pos)
(and (cperl-val 'cperl-electric-lbrace-space)
(eq (preceding-char) ?$)
(save-excursion
(skip-chars-backward "$")
(looking-at "\\(\\$\\$\\)*\\$\\([^\\$]\\|$\\)"))
(insert ?\s))
;; Check whether we are in comment
(if (and
(save-excursion
(beginning-of-line)
(not (looking-at "[ \t]*#")))
(cperl-after-expr-p nil "{;)"))
nil
(setq cperl-auto-newline nil))
(cperl-electric-brace arg)
(and (cperl-val 'cperl-electric-parens)
(eq last-command-event ?{)
(memq last-command-event
(append cperl-electric-parens-string nil))
(or (if other-end (goto-char (marker-position other-end)))
t)
(setq last-command-event ?} pos (point))
(progn (cperl-electric-brace arg t)
(goto-char pos)))))