From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#35480: insert-wide-parentheses Date: Tue, 30 Apr 2019 23:15:27 +0300 Organization: LINKOV.NET Message-ID: <87y33rw9n4.fsf@mail.linkov.net> References: <87pnp5euh9.8.fsf@jidanni.org> <87lfzswpi1.fsf@mail.linkov.net> <87muk8b6ci.8.fsf@jidanni.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="55819"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 35480@debbugs.gnu.org To: =?UTF-8?Q?=E7=A9=8D=E4=B8=B9=E5=B0=BC?= Dan Jacobson Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 30 22:48:14 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hLZfh-000EM6-5B for geb-bug-gnu-emacs@m.gmane.org; Tue, 30 Apr 2019 22:48:13 +0200 Original-Received: from localhost ([127.0.0.1]:53168 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLZfd-000389-1O for geb-bug-gnu-emacs@m.gmane.org; Tue, 30 Apr 2019 16:48:09 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:52932) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLZVY-0002Jh-9O for bug-gnu-emacs@gnu.org; Tue, 30 Apr 2019 16:37:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLZIH-0004kL-UU for bug-gnu-emacs@gnu.org; Tue, 30 Apr 2019 16:24:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57168) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hLZIH-0004kF-RU for bug-gnu-emacs@gnu.org; Tue, 30 Apr 2019 16:24:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hLZIH-0003Ax-Mg for bug-gnu-emacs@gnu.org; Tue, 30 Apr 2019 16:24:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 30 Apr 2019 20:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35480 X-GNU-PR-Package: emacs Original-Received: via spool by 35480-submit@debbugs.gnu.org id=B35480.155665581612171 (code B ref 35480); Tue, 30 Apr 2019 20:24:01 +0000 Original-Received: (at 35480) by debbugs.gnu.org; 30 Apr 2019 20:23:36 +0000 Original-Received: from localhost ([127.0.0.1]:42478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hLZHs-0003AF-8F for submit@debbugs.gnu.org; Tue, 30 Apr 2019 16:23:36 -0400 Original-Received: from lavender.maple.relay.mailchannels.net ([23.83.214.99]:29041) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hLZHq-0003A5-B2 for 35480@debbugs.gnu.org; Tue, 30 Apr 2019 16:23:35 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 8C9A08C154B; Tue, 30 Apr 2019 20:23:29 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a81.g.dreamhost.com (100-96-4-152.trex.outbound.svc.cluster.local [100.96.4.152]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id E97968C26F6; Tue, 30 Apr 2019 20:23:28 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a81.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.17.2); Tue, 30 Apr 2019 20:23:29 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Hysterical-Bitter: 6b6f3277099999c4_1556655809324_2892842727 X-MC-Loop-Signature: 1556655809324:3511227710 X-MC-Ingress-Time: 1556655809324 Original-Received: from pdx1-sub0-mail-a81.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a81.g.dreamhost.com (Postfix) with ESMTP id 59C2B7F9B8; Tue, 30 Apr 2019 13:23:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=linkov.net; bh=tOpfRe uFf2f1W/BPR8dCpyv1EEg=; b=qfTUI1WE3Lpllx3QpBRjFd8KJwjXcOkyqL7fgo RMpwCGJdF14rjJU1wdBPMqYgSl3N3A1F4nxBvHSFwWIuErdwn/BUVXyAg04HWnvw Udc7r8R7xrKmLvGFUjBE+GJlRqE21O/U0adh4861nHs7dUmgkRVitJ4N8yDPj6Wg Z4Wao= Original-Received: from mail.jurta.org (m91-129-107-198.cust.tele2.ee [91.129.107.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a81.g.dreamhost.com (Postfix) with ESMTPSA id C25C07F9BC; Tue, 30 Apr 2019 13:23:21 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a81 In-Reply-To: <87muk8b6ci.8.fsf@jidanni.org> ("=?UTF-8?Q?=E7=A9=8D=E4=B8=B9=E5=B0=BC?= Dan Jacobson"'s message of "Tue, 30 Apr 2019 09:59:57 +0800") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: 0 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduuddrieehgdeklecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufhofhffjgfkfgggtgfgsehtkeertddtreejnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddtjedrudelkeenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrddutdejrdduleekpdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepjhhiuggrnhhnihesjhhiuggrnhhnihdrohhrghenucevlhhushhtvghrufhiiigvpedt X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:158534 Archived-At: >>> M-( is insert-parentheses, so >>> M-=EF=BC=88 should be insert-wide-parentheses. > > JL> (define-key esc-map "=EF=BC=88" 'insert-pair) > JL> (add-to-list 'insert-pair-alist '(?\=EF=BC=88 ?\=EF=BC=88 ?\=EF=BC=89= )) > > OK but now it looks like > perl -C -wple 's/\d+/chr $&/eg;' > ((=EF=BC=88 =EF=BC=88 =EF=BC=89) > (( )) > ([ ]) > ({ }) > (< >) > (" ") > (' ') > (` ')) > > So I bet just > > (add-to-list 'insert-pair-alist '(?\=EF=BC=88 ?\=EF=BC=89)) > > is good enough. Anyways, I'm hoping the emacs authors will add this to > the defaults. > > In fact they need to add wide versions of all those current narrow item= s there. OK, this adds all Unicode pairs to the default: diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index d10d5f0d10..f73dbb269d 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -646,7 +646,13 @@ narrow-to-defun (narrow-to-region beg end)))) =20 (defvar insert-pair-alist - '((?\( ?\)) (?\[ ?\]) (?\{ ?\}) (?\< ?\>) (?\" ?\") (?\' ?\') (?\` ?\'= )) + (append '((?\< ?\>) (?\" ?\") (?\' ?\') (?\` ?\')) + (let (alist) + (map-char-table + (lambda (open close) + (when (< open close) (push (list open close) alist))) + (unicode-property-table-internal 'paired-bracket)) + (nreverse alist))) "Alist of paired characters inserted by `insert-pair'. Each element looks like (OPEN-CHAR CLOSE-CHAR) or (COMMAND-CHAR OPEN-CHAR CLOSE-CHAR). The characters OPEN-CHAR and CLOSE-CHAR