From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Nikolay Kudryavtsev Newsgroups: gmane.emacs.bugs Subject: bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode Date: Sun, 1 Dec 2024 13:25:35 +0300 Message-ID: References: <86v7wwn4lz.fsf@gnu.org> <6eb1f1cd-80dd-4fec-bebc-9d361321000d@gmail.com> <865xoem96o.fsf@gnu.org> <8e331068-57e1-4375-8ccb-10eb83648986@gmail.com> <86frn981ix.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33398"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 73688@debbugs.gnu.org, marc@soda.fm, monnier@iro.umontreal.ca To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 01 11:27:23 2024 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 1tHhAh-0008YV-5E for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 Dec 2024 11:27:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tHhAP-0005jV-4W; Sun, 01 Dec 2024 05:27:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tHhAN-0005jD-4j for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 05:27:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tHhAM-0001jJ-S8 for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 05:27:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:References:MIME-Version:Date:From:To:Subject; bh=0m23CcTZHagcXVRKwR5TCSEATmLkqMBycLYBZUY5xtM=; b=ZpOsNenf63en2g4riwcurVzHQc7AUyIcO5RgRq6CtZOjkDWW5gld6XchD2bY5XT0z6OhvL0/FbUBITtzPPzbF0ZxVIRPVDpUlHKZsvt8m6nbl00psp/X0QJxs+fltdHG1/PC3O2FwSU7L5uamvnawAsYig5/S75+VOm+E+GnwyZ12vNo1KYwLxdKzgrekM+moTR7fnPb7BQSeyo0t79q7mT1vPrhYNrqafseMKzYtDyWA6o1anjzwmfyLZa6oQ69WQQ2vrcofPF/M7VfoOTMfF46DRNGSKjpFpiqyx7ZhaXh8+0YGDVtXHbOdNgQhvcnBjrOBSCDglFCl1jOWz9fMw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tHhAL-000085-O9 for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 05:27:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Nikolay Kudryavtsev Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Dec 2024 10:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73688 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 73688-submit@debbugs.gnu.org id=B73688.1733048804460 (code B ref 73688); Sun, 01 Dec 2024 10:27:01 +0000 Original-Received: (at 73688) by debbugs.gnu.org; 1 Dec 2024 10:26:44 +0000 Original-Received: from localhost ([127.0.0.1]:50365 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHhA4-00007L-46 for submit@debbugs.gnu.org; Sun, 01 Dec 2024 05:26:44 -0500 Original-Received: from mail-lj1-f181.google.com ([209.85.208.181]:51700) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHhA1-00007C-V4 for 73688@debbugs.gnu.org; Sun, 01 Dec 2024 05:26:42 -0500 Original-Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2ffa974b2b0so32176691fa.3 for <73688@debbugs.gnu.org>; Sun, 01 Dec 2024 02:26:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733048741; x=1733653541; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:from:to :cc:subject:date:message-id:reply-to; bh=0m23CcTZHagcXVRKwR5TCSEATmLkqMBycLYBZUY5xtM=; b=YNi3imbC/TdfwlyXlGVl3h35YD7HN5fHOFyZZU+cFsceVQv22MMOnYU/UzDMJPcJg+ GDLzsvbZo7Xeo8Jv2o997cDsKDCtNbvZ6UG35pVT/fm1xAYyt8nFcUWUvjZiBKSUM6bl NPi5GwEG4roo/C+WNqzrmsUyS6hQ9+YmZXi8K6Q32S4fDemjY5AGYcSVnRoNGOchof9m aDSiFZYbmqxeyCmEaIIKoAvRccQ0xEAMcgpFRwrsHfjhD5TeCVws3tV47OIgmUKR5bPa yc/LyNbUCFyZct4G5e8etcED3Ddr3Yjs1bJYJaLC/SoSdCs1zgIt8T3mQAIONELbptee 3JSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733048741; x=1733653541; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0m23CcTZHagcXVRKwR5TCSEATmLkqMBycLYBZUY5xtM=; b=sEJ9KYJsiNbIsc8AQrmDSxbBykVI659raw4bzBfmhQFWHo2/grtL+vsz+v31oBrecW g/qHujOVP83bMddXFdzdFBScE9D/1ecdPKaje2QGTI2dYMvGO2Vo8Bv+bzR37fGYf5cd GGseU8N98L7dM7aB4slgJRP6NFI1ETxbHjWMaWCsiBbHx2UyXYwFzTR6LV+agUta4izD gZVB5XLu+GWQtTT/RBA5XmRVoDRrSKfBTMsFJxNvZ9PPcj30dCRnN7OsHNS74jc3dXTp 3UAwQ3DECXtJLnYP3IJofsOo2YMlpX8lZL4JLAFZeDD9T1dTrD8LtZ4iwuPfqgaOV35/ OUiw== X-Forwarded-Encrypted: i=1; AJvYcCVXybj/qAB5tqNuQJNbmBenjXxDhc/1T/wWp18sPdr8QQ6G/5UBPrwAZrWYKDQJq0oWVXiNNw==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yw/CdZO1FUBtvxvSJgMz57Uo3ZQw094Ebm+AaZBuh/ktpiJvHDZ iV4B1kve0fKHbnch2ze0WxXirjXHRHm4uW1sOakn9mryobbMLbk9 X-Gm-Gg: ASbGncujvc1mWYK8GHoeo9QEy/NH1X+iMjLFVPBBLAiiSE8xUhzEC0VqfkMHEtqGmqe 2dgCNdbFba+P30LMnKEvoX0e6MDUbW5MYMLQhUsERkeZP+xcfHmAjSRHZ8AQf3L4pQwIK1xvnB0 j8Gk0kVJEs/rOp7bIatRBudkl2pdfCNtr617rHaldCFSlAhgZ8sxjjcsfkJPoXpUftdfZKTXZvg YdYLNJs7VBVDUS5mx0PmDLc2XKr8Ad/EHP9+P4acywFJzMEHq9SB/ZDXqk1GQfdOaEPIM/6Wi0U 9L+N3TG1kKD4vKFbHUaizGJAme1AvpVnkQ1p3weGgJUE X-Google-Smtp-Source: AGHT+IGtW+weeVSMjgEw2ECTQ+u/Wx9dxOGJis7XxyQFcENrnVMFiEl9fNaSLHWyzUQDxEIukwuAcQ== X-Received: by 2002:a2e:9e4b:0:b0:2ff:e1ec:e6c7 with SMTP id 38308e7fff4ca-2ffe1ece72emr46738611fa.39.1733048740644; Sun, 01 Dec 2024 02:25:40 -0800 (PST) Original-Received: from ?IPV6:2a02:2168:b20b:5100:6db3:3ad4:d38d:d23b? ([2a02:2168:b20b:5100:6db3:3ad4:d38d:d23b]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ffdfbb9068sm8876531fa.1.2024.12.01.02.25.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 Dec 2024 02:25:38 -0800 (PST) X-Google-Original-From: Nikolay Kudryavtsev Content-Language: ru, en-US In-Reply-To: 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:296234 Archived-At: Well, that's your call here. But let me try and restate why I think there's a real problem. If we go at it from the perspective of a user who has no knowledge of electric-pair-mode internals, but now has the idea that the he wants a before-word predicate. A quick look through variables would allow him to discover the existence of electric-pair-inhibit-predicate. And just by the name alone it sounds like exactly the right thing. But unfortunately if the user looks into electric-pair-default-inhibit he'd notice that it wraps around either electric-pair-inhibit-if-helps-balance or electric-pair-conservative-inhibit. So, now the user needs to know what those functions actually do and whether anything would break if he removes them and replaces them with his own. Or a more careless user(like me) would roll out his own predicate and only then notice that it broke some advanced behavior. In the end, a reasonable user who just wants to add a simple thing is now burdened by all the cognitive load of learning numerous functions and use cases. Thus electric-pair-inhibit-predicate in it's current state is not something really user-customizable, but more of an Emacs internal. As for the add-function option, I think relying on those as the first option goes against the Emacs philosophy of providing real customizability wherever possible and avoiding littering the manuals(and user inits) with dirty hacks like this as a much as possible. Also, just from the user standpoint, in the above case the same user would probably go for add-function only after he already noticed that the electric-pair-inhibit-predicate is inadequate for his purposes.