Function: cperl-electric-rparen
cperl-electric-rparen is an interactive and byte-compiled function
defined in cperl-mode.el.gz.
Signature
(cperl-electric-rparen ARG)
Documentation
Insert a matching pair of parentheses if marking is active.
If not, or if we are not at the end of marking range, would self-insert.
Affected by cperl-electric-parens.
Argument ARG is the closing parenthesis.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cperl-mode.el.gz
(defun cperl-electric-rparen (arg)
"Insert a matching pair of parentheses if marking is active.
If not, or if we are not at the end of marking range, would self-insert.
Affected by `cperl-electric-parens'.
Argument ARG is the closing parenthesis."
(interactive "P")
(let ((other-end (if (and cperl-electric-parens-mark
(cperl-val 'cperl-electric-parens)
(memq last-command-event
(append cperl-electric-parens-string nil))
(region-active-p)
(< (mark) (point)))
(mark)
nil))
p)
(if (and other-end
(cperl-val 'cperl-electric-parens)
(memq last-command-event '( ?\) ?\] ?\} ?\> ))
(>= (save-excursion (cperl-to-comment-or-eol) (point)) (point))
)
(progn
(self-insert-command (prefix-numeric-value arg))
(setq p (point))
(if other-end (goto-char other-end))
(insert (make-string
(prefix-numeric-value arg)
(cdr (assoc last-command-event '((?\} . ?\{)
(?\] . ?\[)
(?\) . ?\()
(?\> . ?\<))))))
(goto-char (1+ p)))
(self-insert-command (prefix-numeric-value arg)))))