* lisp/elec-pair.el (electric-pair--insert): New arg TIMES.
(electric-pair-inhibit-if-helps-balance)
(electric-pair-post-self-insert-function)
(electric-pair-open-newline-between-pairs-psif)
(electric-pair-skip-if-helps-balance): Respect prefix arg.
(electric-pair-delete-pair): Delete ARG chars, not just 1.
* test/lisp/electric-tests.el (autowrapping-multi-1)
(autowrapping-multi-2): New tests.
* doc/emacs/programs.texi (Matching): Mention prefix arg
support in Electric Pair mode documentation.
* etc/NEWS: Announce it. (Bug#72437)
(cherry picked from commit
a7192fd7b7355f13ff3002dba14c6acdabad5b5e)
over. If the region is active (@pxref{Mark}), insertion of a
delimiter operates on the region: the characters in the region are
enclosed in a pair of matching delimiters, leaving point after the
-delimiter you typed.
+delimiter you typed. If you provide a prefix argument when inserting
+a delimiter, the numeric value of that prefix argument specifies the
+number of pairs to insert.
These variables control additional features of Electric Pair mode:
the region enclosed by the deleted delimiters. This makes it easy to
act on that region. For example, we can highlight it using 'C-x C-x'.
++++
+** Electric Pair mode can now pair multiple delimiters at once.
+You can now insert or wrap text with multiple sets of parentheses and
+other matching delimiters at once with Electric Pair mode, by providing
+a prefix argument when inserting one of the delimiters.
+
\f
* Changes in Specialized Modes and Packages in Emacs 31.1
(skip-chars-backward "\"")
(mark-sexp -1)))
+(define-electric-pair-test autowrapping-multi-1
+ "foo" "(" :expected-string "(((((foo)))))" :expected-point 6
+ :bindings '((current-prefix-arg . 5))
+ :fixture-fn (lambda ()
+ (electric-pair-mode 1)
+ (mark-sexp 1)))
+
+(define-electric-pair-test autowrapping-multi-2
+ "foo" ")" :expected-string "(((((foo)))))" :expected-point 14
+ :bindings '((current-prefix-arg . 5))
+ :fixture-fn (lambda ()
+ (electric-pair-mode 1)
+ (goto-char (point-max))
+ (skip-chars-backward "\"")
+ (mark-sexp -1)))
+
\f
;;; Electric quotes
(define-electric-pair-test electric-quote-string