From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.bugs Subject: bug#50236: 27.2; electric-pair-mode is inconvenient in comint Date: Mon, 22 Aug 2022 18:07:54 +0200 Message-ID: <87v8qk5kit.fsf@gmail.com> References: <87bl5heuva.fsf@gmail.com> <87zgn4nxv7.fsf@gmail.com> <87tu642sso.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26015"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 50236@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 22 21:09:25 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oQCnc-0006aH-Oc for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Aug 2022 21:09:24 +0200 Original-Received: from localhost ([::1]:50134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQCnb-000783-OP for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Aug 2022 15:09:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQ9z5-0006jT-A6 for bug-gnu-emacs@gnu.org; Mon, 22 Aug 2022 12:09:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51827) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQ9z4-0007pI-Ue for bug-gnu-emacs@gnu.org; Mon, 22 Aug 2022 12:09:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oQ9z3-0000v5-Qs for bug-gnu-emacs@gnu.org; Mon, 22 Aug 2022 12:09:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Aug 2022 16:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50236 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 50236-submit@debbugs.gnu.org id=B50236.16611844893464 (code B ref 50236); Mon, 22 Aug 2022 16:09:01 +0000 Original-Received: (at 50236) by debbugs.gnu.org; 22 Aug 2022 16:08:09 +0000 Original-Received: from localhost ([127.0.0.1]:41572 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQ9yD-0000to-2L for submit@debbugs.gnu.org; Mon, 22 Aug 2022 12:08:09 -0400 Original-Received: from mail-ej1-f53.google.com ([209.85.218.53]:42895) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQ9y9-0000tJ-5G for 50236@debbugs.gnu.org; Mon, 22 Aug 2022 12:08:07 -0400 Original-Received: by mail-ej1-f53.google.com with SMTP id ca13so10897456ejb.9 for <50236@debbugs.gnu.org>; Mon, 22 Aug 2022 09:08:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc; bh=Z/wwgsRl8UdoJkwKXheko/goIyjQzxAk8YmAWUGVZgY=; b=HEe60dCxdBso6ULb/9hAjvrfhU3G4UR3HvAR29LzZsNegGUsvZMxBLShm8UDAkHTnQ znxWPTC2pSeAHdhcqg3TuJfjVSd5xaqOnUELNzg/p0KABHHtAOY/oSksqvaJ9d5wtsFd QdQ/rvJivfUsYc0brFepsP2XQilHB5SXCGModza0GvIt/7gZCed8eQtAtMWd4VneQFC0 E187Eml9aEInPXYGW9be0BZL7RMDoHrraF7hccDVSf7v5rbFD/oXHt5ENmANAvYGTNMQ t3oBwqPitnKY2hWZ7yR2IjeKQrgtoUBBuXEXYSKvx+vZ81bYJorgnxLoNSAwvW1OP3O9 da4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc; bh=Z/wwgsRl8UdoJkwKXheko/goIyjQzxAk8YmAWUGVZgY=; b=wI7cm70enGKzVzhoPd48Sbpsj4G4XI5WMB/eDy6t2wSHdCt5WjFJ3IdhQI+7T1ySVF wwkATQp8ar+mtQk43M75SmpQ7DrOoHMCmQjLl+jeOVJtjtQmJnGDs5VUxiNnhPzwKnkW qLfFGLLYxtKokHdRuU9EWAOSy0gf5KCcIRDIGX8XHO4wwOYySrFjABxvgZ2Jp4q6yyvE DmejBH07K17gRpy/QotR+oZxl77fF29WWh0GoX/cseYXPMRnb9/rxqo08EbPqThc1u40 JJbB06UGix7wx911OuwE+FY/6hAHvl2Wkp2x+9r65XT2Ug9CoVBNWMHrpwJNTjq/Shej oFrg== X-Gm-Message-State: ACgBeo2MaOYmTKD09h1XT8dORrijL9zIIyo5gHfx8moVVhRp9cDZ94hH A23ZovLdwCGVVq9ZlkaOsnK7AlqD5Sk= X-Google-Smtp-Source: AA6agR4ugMdsFEQ6JLeUY52clhmEZYthrgfCYZXbKWI4bTGaj/xPTkphAR4f0YjMA1mNrKEhu1yIQg== X-Received: by 2002:a17:907:75e8:b0:73d:53dc:661d with SMTP id jz8-20020a17090775e800b0073d53dc661dmr9547497ejc.738.1661184478034; Mon, 22 Aug 2022 09:07:58 -0700 (PDT) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::157b]) by smtp.gmail.com with ESMTPSA id o21-20020a170906769500b0073d685a2985sm3370063ejm.108.2022.08.22.09.07.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 09:07:56 -0700 (PDT) In-Reply-To: <87tu642sso.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 22 Aug 2022 17:37:27 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:240455 Archived-At: On Mon, 22 Aug 2022 at 17:37, Lars Ingebrigtsen wrote: > > Augusto Stoffel writes: > >> The following quick fix works for me: >> >> (defun electric-pair-skip-in-field (char) >> (save-restriction >> (narrow-to-region (field-beginning) (field-end)) >> (electric-pair-default-skip-self char))) >> >> (add-hook 'comint-mode-hook (lambda () (setq-local electric-pair-skip-self >> 'electric-pair-skip-in-field))) >> >> Perhaps `electric-pair-default-skip-self' should always narrow to the >> current field? > > That would make sense in this case... I'm trying to think of instances > where it wouldn't make sense, and I can't think of any. There's a second question of relevance here: would this change help solving similar bugs in other modes? Consider for instance an Org file like this ( #+begin_src f() #+end_src or a Markdown file like this ( ``` f() ``` Of course each of these modes could define their own electric-pair-skip-self, but ideally a general mechanism to deal with this situation should we provided. So I guess my question here is: does it make sense for a major mode with a notion of "code blocks" set field properties as part of the font-locking? Or is there any reason not to mix up fields with font-locking?